isppreview.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. * isppreview.h
  3. *
  4. * TI OMAP3 ISP - Preview module
  5. *
  6. * Copyright (C) 2010 Nokia Corporation
  7. * Copyright (C) 2009 Texas Instruments, Inc.
  8. *
  9. * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
  10. * Sakari Ailus <sakari.ailus@iki.fi>
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License version 2 as
  14. * published by the Free Software Foundation.
  15. */
  16. #ifndef OMAP3_ISP_PREVIEW_H
  17. #define OMAP3_ISP_PREVIEW_H
  18. #include <linux/omap3isp.h>
  19. #include <linux/types.h>
  20. #include <media/v4l2-ctrls.h>
  21. #include "ispvideo.h"
  22. #define ISPPRV_BRIGHT_STEP 0x1
  23. #define ISPPRV_BRIGHT_DEF 0x0
  24. #define ISPPRV_BRIGHT_LOW 0x0
  25. #define ISPPRV_BRIGHT_HIGH 0xFF
  26. #define ISPPRV_BRIGHT_UNITS 0x1
  27. #define ISPPRV_CONTRAST_STEP 0x1
  28. #define ISPPRV_CONTRAST_DEF 0x10
  29. #define ISPPRV_CONTRAST_LOW 0x0
  30. #define ISPPRV_CONTRAST_HIGH 0xFF
  31. #define ISPPRV_CONTRAST_UNITS 0x1
  32. /* Additional features not listed in linux/omap3isp.h */
  33. #define OMAP3ISP_PREV_CONTRAST (1 << 17)
  34. #define OMAP3ISP_PREV_BRIGHTNESS (1 << 18)
  35. #define OMAP3ISP_PREV_FEATURES_END (1 << 19)
  36. enum preview_input_entity {
  37. PREVIEW_INPUT_NONE,
  38. PREVIEW_INPUT_CCDC,
  39. PREVIEW_INPUT_MEMORY,
  40. };
  41. #define PREVIEW_OUTPUT_RESIZER (1 << 1)
  42. #define PREVIEW_OUTPUT_MEMORY (1 << 2)
  43. /* Configure byte layout of YUV image */
  44. enum preview_ycpos_mode {
  45. YCPOS_YCrYCb = 0,
  46. YCPOS_YCbYCr = 1,
  47. YCPOS_CbYCrY = 2,
  48. YCPOS_CrYCbY = 3
  49. };
  50. /*
  51. * struct prev_params - Structure for all configuration
  52. * @busy: Bitmask of busy parameters (being updated or used)
  53. * @update: Bitmask of the parameters to be updated
  54. * @features: Set of features enabled.
  55. * @cfa: CFA coefficients.
  56. * @csup: Chroma suppression coefficients.
  57. * @luma: Luma enhancement coefficients.
  58. * @nf: Noise filter coefficients.
  59. * @dcor: Noise filter coefficients.
  60. * @gamma: Gamma coefficients.
  61. * @wbal: White Balance parameters.
  62. * @blkadj: Black adjustment parameters.
  63. * @rgb2rgb: RGB blending parameters.
  64. * @csc: Color space conversion (RGB to YCbCr) parameters.
  65. * @hmed: Horizontal median filter.
  66. * @yclimit: YC limits parameters.
  67. * @contrast: Contrast.
  68. * @brightness: Brightness.
  69. */
  70. struct prev_params {
  71. u32 busy;
  72. u32 update;
  73. u32 features;
  74. struct omap3isp_prev_cfa cfa;
  75. struct omap3isp_prev_csup csup;
  76. struct omap3isp_prev_luma luma;
  77. struct omap3isp_prev_nf nf;
  78. struct omap3isp_prev_dcor dcor;
  79. struct omap3isp_prev_gtables gamma;
  80. struct omap3isp_prev_wbal wbal;
  81. struct omap3isp_prev_blkadj blkadj;
  82. struct omap3isp_prev_rgbtorgb rgb2rgb;
  83. struct omap3isp_prev_csc csc;
  84. struct omap3isp_prev_hmed hmed;
  85. struct omap3isp_prev_yclimit yclimit;
  86. u8 contrast;
  87. u8 brightness;
  88. };
  89. /* Sink and source previewer pads */
  90. #define PREV_PAD_SINK 0
  91. #define PREV_PAD_SOURCE 1
  92. #define PREV_PADS_NUM 2
  93. /*
  94. * struct isp_prev_device - Structure for storing ISP Preview module information
  95. * @subdev: V4L2 subdevice
  96. * @pads: Media entity pads
  97. * @formats: Active formats at the subdev pad
  98. * @crop: Active crop rectangle
  99. * @input: Module currently connected to the input pad
  100. * @output: Bitmask of the active output
  101. * @video_in: Input video entity
  102. * @video_out: Output video entity
  103. * @params.params : Active and shadow parameters sets
  104. * @params.active: Bitmask of parameters active in set 0
  105. * @params.lock: Parameters lock, protects params.active and params.shadow
  106. * @underrun: Whether the preview entity has queued buffers on the output
  107. * @state: Current preview pipeline state
  108. *
  109. * This structure is used to store the OMAP ISP Preview module Information.
  110. */
  111. struct isp_prev_device {
  112. struct v4l2_subdev subdev;
  113. struct media_pad pads[PREV_PADS_NUM];
  114. struct v4l2_mbus_framefmt formats[PREV_PADS_NUM];
  115. struct v4l2_rect crop;
  116. struct v4l2_ctrl_handler ctrls;
  117. enum preview_input_entity input;
  118. unsigned int output;
  119. struct isp_video video_in;
  120. struct isp_video video_out;
  121. struct {
  122. unsigned int cfa_order;
  123. struct prev_params params[2];
  124. u32 active;
  125. spinlock_t lock;
  126. } params;
  127. enum isp_pipeline_stream_state state;
  128. wait_queue_head_t wait;
  129. atomic_t stopping;
  130. };
  131. struct isp_device;
  132. int omap3isp_preview_init(struct isp_device *isp);
  133. void omap3isp_preview_cleanup(struct isp_device *isp);
  134. int omap3isp_preview_register_entities(struct isp_prev_device *prv,
  135. struct v4l2_device *vdev);
  136. void omap3isp_preview_unregister_entities(struct isp_prev_device *prv);
  137. void omap3isp_preview_isr_frame_sync(struct isp_prev_device *prev);
  138. void omap3isp_preview_isr(struct isp_prev_device *prev);
  139. int omap3isp_preview_busy(struct isp_prev_device *isp_prev);
  140. void omap3isp_preview_restore_context(struct isp_device *isp);
  141. #endif /* OMAP3_ISP_PREVIEW_H */