isppreview.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. * This program is distributed in the hope that it will be useful, but
  17. * WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  24. * 02110-1301 USA
  25. */
  26. #ifndef OMAP3_ISP_PREVIEW_H
  27. #define OMAP3_ISP_PREVIEW_H
  28. #include <linux/omap3isp.h>
  29. #include <linux/types.h>
  30. #include <media/v4l2-ctrls.h>
  31. #include "ispvideo.h"
  32. #define ISPPRV_BRIGHT_STEP 0x1
  33. #define ISPPRV_BRIGHT_DEF 0x0
  34. #define ISPPRV_BRIGHT_LOW 0x0
  35. #define ISPPRV_BRIGHT_HIGH 0xFF
  36. #define ISPPRV_BRIGHT_UNITS 0x1
  37. #define ISPPRV_CONTRAST_STEP 0x1
  38. #define ISPPRV_CONTRAST_DEF 0x10
  39. #define ISPPRV_CONTRAST_LOW 0x0
  40. #define ISPPRV_CONTRAST_HIGH 0xFF
  41. #define ISPPRV_CONTRAST_UNITS 0x1
  42. /* Additional features not listed in linux/omap3isp.h */
  43. #define OMAP3ISP_PREV_CONTRAST (1 << 17)
  44. #define OMAP3ISP_PREV_BRIGHTNESS (1 << 18)
  45. #define OMAP3ISP_PREV_FEATURES_END (1 << 19)
  46. enum preview_input_entity {
  47. PREVIEW_INPUT_NONE,
  48. PREVIEW_INPUT_CCDC,
  49. PREVIEW_INPUT_MEMORY,
  50. };
  51. #define PREVIEW_OUTPUT_RESIZER (1 << 1)
  52. #define PREVIEW_OUTPUT_MEMORY (1 << 2)
  53. /* Configure byte layout of YUV image */
  54. enum preview_ycpos_mode {
  55. YCPOS_YCrYCb = 0,
  56. YCPOS_YCbYCr = 1,
  57. YCPOS_CbYCrY = 2,
  58. YCPOS_CrYCbY = 3
  59. };
  60. /*
  61. * struct prev_params - Structure for all configuration
  62. * @features: Set of features enabled.
  63. * @cfa: CFA coefficients.
  64. * @csup: Chroma suppression coefficients.
  65. * @luma: Luma enhancement coefficients.
  66. * @nf: Noise filter coefficients.
  67. * @dcor: Noise filter coefficients.
  68. * @gamma: Gamma coefficients.
  69. * @wbal: White Balance parameters.
  70. * @blk_adj: Black adjustment parameters.
  71. * @rgb2rgb: RGB blending parameters.
  72. * @rgb2ycbcr: RGB to ycbcr parameters.
  73. * @hmed: Horizontal median filter.
  74. * @yclimit: YC limits parameters.
  75. * @contrast: Contrast.
  76. * @brightness: Brightness.
  77. */
  78. struct prev_params {
  79. u32 features;
  80. struct omap3isp_prev_cfa cfa;
  81. struct omap3isp_prev_csup csup;
  82. struct omap3isp_prev_luma luma;
  83. struct omap3isp_prev_nf nf;
  84. struct omap3isp_prev_dcor dcor;
  85. struct omap3isp_prev_gtables gamma;
  86. struct omap3isp_prev_wbal wbal;
  87. struct omap3isp_prev_blkadj blk_adj;
  88. struct omap3isp_prev_rgbtorgb rgb2rgb;
  89. struct omap3isp_prev_csc rgb2ycbcr;
  90. struct omap3isp_prev_hmed hmed;
  91. struct omap3isp_prev_yclimit yclimit;
  92. u8 contrast;
  93. u8 brightness;
  94. };
  95. /* Sink and source previewer pads */
  96. #define PREV_PAD_SINK 0
  97. #define PREV_PAD_SOURCE 1
  98. #define PREV_PADS_NUM 2
  99. /*
  100. * struct isp_prev_device - Structure for storing ISP Preview module information
  101. * @subdev: V4L2 subdevice
  102. * @pads: Media entity pads
  103. * @formats: Active formats at the subdev pad
  104. * @crop: Active crop rectangle
  105. * @input: Module currently connected to the input pad
  106. * @output: Bitmask of the active output
  107. * @video_in: Input video entity
  108. * @video_out: Output video entity
  109. * @params: Module configuration data
  110. * @shadow_update: If set, update the hardware configured in the next interrupt
  111. * @underrun: Whether the preview entity has queued buffers on the output
  112. * @state: Current preview pipeline state
  113. * @lock: Shadow update lock
  114. * @update: Bitmask of the parameters to be updated
  115. *
  116. * This structure is used to store the OMAP ISP Preview module Information.
  117. */
  118. struct isp_prev_device {
  119. struct v4l2_subdev subdev;
  120. struct media_pad pads[PREV_PADS_NUM];
  121. struct v4l2_mbus_framefmt formats[PREV_PADS_NUM];
  122. struct v4l2_rect crop;
  123. struct v4l2_ctrl_handler ctrls;
  124. enum preview_input_entity input;
  125. unsigned int output;
  126. struct isp_video video_in;
  127. struct isp_video video_out;
  128. struct prev_params params;
  129. unsigned int shadow_update:1;
  130. enum isp_pipeline_stream_state state;
  131. wait_queue_head_t wait;
  132. atomic_t stopping;
  133. spinlock_t lock;
  134. u32 update;
  135. };
  136. struct isp_device;
  137. int omap3isp_preview_init(struct isp_device *isp);
  138. void omap3isp_preview_cleanup(struct isp_device *isp);
  139. int omap3isp_preview_register_entities(struct isp_prev_device *prv,
  140. struct v4l2_device *vdev);
  141. void omap3isp_preview_unregister_entities(struct isp_prev_device *prv);
  142. void omap3isp_preview_isr_frame_sync(struct isp_prev_device *prev);
  143. void omap3isp_preview_isr(struct isp_prev_device *prev);
  144. int omap3isp_preview_busy(struct isp_prev_device *isp_prev);
  145. void omap3isp_preview_restore_context(struct isp_device *isp);
  146. #endif /* OMAP3_ISP_PREVIEW_H */