Laurent Pinchart | de1135d | 2011-02-12 18:05:06 -0300 | [diff] [blame] | 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 | |
| 27 | #ifndef OMAP3_ISP_PREVIEW_H |
| 28 | #define OMAP3_ISP_PREVIEW_H |
| 29 | |
| 30 | #include <linux/omap3isp.h> |
| 31 | #include <linux/types.h> |
| 32 | #include <media/v4l2-ctrls.h> |
| 33 | |
| 34 | #include "ispvideo.h" |
| 35 | |
| 36 | #define ISPPRV_BRIGHT_STEP 0x1 |
| 37 | #define ISPPRV_BRIGHT_DEF 0x0 |
| 38 | #define ISPPRV_BRIGHT_LOW 0x0 |
| 39 | #define ISPPRV_BRIGHT_HIGH 0xFF |
| 40 | #define ISPPRV_BRIGHT_UNITS 0x1 |
| 41 | |
| 42 | #define ISPPRV_CONTRAST_STEP 0x1 |
| 43 | #define ISPPRV_CONTRAST_DEF 0x10 |
| 44 | #define ISPPRV_CONTRAST_LOW 0x0 |
| 45 | #define ISPPRV_CONTRAST_HIGH 0xFF |
| 46 | #define ISPPRV_CONTRAST_UNITS 0x1 |
| 47 | |
Laurent Pinchart | 3108e02 | 2012-04-05 12:38:23 -0300 | [diff] [blame] | 48 | /* Additional features not listed in linux/omap3isp.h */ |
| 49 | #define OMAP3ISP_PREV_CONTRAST (1 << 17) |
| 50 | #define OMAP3ISP_PREV_BRIGHTNESS (1 << 18) |
| 51 | #define OMAP3ISP_PREV_FEATURES_END (1 << 19) |
Laurent Pinchart | de1135d | 2011-02-12 18:05:06 -0300 | [diff] [blame] | 52 | |
| 53 | enum preview_input_entity { |
| 54 | PREVIEW_INPUT_NONE, |
| 55 | PREVIEW_INPUT_CCDC, |
| 56 | PREVIEW_INPUT_MEMORY, |
| 57 | }; |
| 58 | |
| 59 | #define PREVIEW_OUTPUT_RESIZER (1 << 1) |
| 60 | #define PREVIEW_OUTPUT_MEMORY (1 << 2) |
| 61 | |
| 62 | /* Configure byte layout of YUV image */ |
| 63 | enum preview_ycpos_mode { |
| 64 | YCPOS_YCrYCb = 0, |
| 65 | YCPOS_YCbYCr = 1, |
| 66 | YCPOS_CbYCrY = 2, |
| 67 | YCPOS_CrYCbY = 3 |
| 68 | }; |
| 69 | |
| 70 | /* |
| 71 | * struct prev_params - Structure for all configuration |
| 72 | * @features: Set of features enabled. |
| 73 | * @cfa: CFA coefficients. |
| 74 | * @csup: Chroma suppression coefficients. |
| 75 | * @luma: Luma enhancement coefficients. |
| 76 | * @nf: Noise filter coefficients. |
| 77 | * @dcor: Noise filter coefficients. |
| 78 | * @gamma: Gamma coefficients. |
| 79 | * @wbal: White Balance parameters. |
Laurent Pinchart | 9b00184 | 2012-04-05 13:51:17 -0300 | [diff] [blame^] | 80 | * @blkadj: Black adjustment parameters. |
Laurent Pinchart | de1135d | 2011-02-12 18:05:06 -0300 | [diff] [blame] | 81 | * @rgb2rgb: RGB blending parameters. |
Laurent Pinchart | 9b00184 | 2012-04-05 13:51:17 -0300 | [diff] [blame^] | 82 | * @csc: Color space conversion (RGB to YCbCr) parameters. |
Laurent Pinchart | de1135d | 2011-02-12 18:05:06 -0300 | [diff] [blame] | 83 | * @hmed: Horizontal median filter. |
| 84 | * @yclimit: YC limits parameters. |
Laurent Pinchart | de1135d | 2011-02-12 18:05:06 -0300 | [diff] [blame] | 85 | * @contrast: Contrast. |
| 86 | * @brightness: Brightness. |
| 87 | */ |
| 88 | struct prev_params { |
| 89 | u32 features; |
| 90 | struct omap3isp_prev_cfa cfa; |
| 91 | struct omap3isp_prev_csup csup; |
| 92 | struct omap3isp_prev_luma luma; |
| 93 | struct omap3isp_prev_nf nf; |
| 94 | struct omap3isp_prev_dcor dcor; |
| 95 | struct omap3isp_prev_gtables gamma; |
| 96 | struct omap3isp_prev_wbal wbal; |
Laurent Pinchart | 9b00184 | 2012-04-05 13:51:17 -0300 | [diff] [blame^] | 97 | struct omap3isp_prev_blkadj blkadj; |
Laurent Pinchart | de1135d | 2011-02-12 18:05:06 -0300 | [diff] [blame] | 98 | struct omap3isp_prev_rgbtorgb rgb2rgb; |
Laurent Pinchart | 9b00184 | 2012-04-05 13:51:17 -0300 | [diff] [blame^] | 99 | struct omap3isp_prev_csc csc; |
Laurent Pinchart | de1135d | 2011-02-12 18:05:06 -0300 | [diff] [blame] | 100 | struct omap3isp_prev_hmed hmed; |
| 101 | struct omap3isp_prev_yclimit yclimit; |
Laurent Pinchart | de1135d | 2011-02-12 18:05:06 -0300 | [diff] [blame] | 102 | u8 contrast; |
| 103 | u8 brightness; |
| 104 | }; |
| 105 | |
Laurent Pinchart | de1135d | 2011-02-12 18:05:06 -0300 | [diff] [blame] | 106 | /* Sink and source previewer pads */ |
| 107 | #define PREV_PAD_SINK 0 |
| 108 | #define PREV_PAD_SOURCE 1 |
| 109 | #define PREV_PADS_NUM 2 |
| 110 | |
| 111 | /* |
| 112 | * struct isp_prev_device - Structure for storing ISP Preview module information |
| 113 | * @subdev: V4L2 subdevice |
| 114 | * @pads: Media entity pads |
| 115 | * @formats: Active formats at the subdev pad |
Laurent Pinchart | 1f69fd9 | 2011-09-21 20:05:45 -0300 | [diff] [blame] | 116 | * @crop: Active crop rectangle |
Laurent Pinchart | de1135d | 2011-02-12 18:05:06 -0300 | [diff] [blame] | 117 | * @input: Module currently connected to the input pad |
| 118 | * @output: Bitmask of the active output |
| 119 | * @video_in: Input video entity |
| 120 | * @video_out: Output video entity |
Laurent Pinchart | de1135d | 2011-02-12 18:05:06 -0300 | [diff] [blame] | 121 | * @params: Module configuration data |
| 122 | * @shadow_update: If set, update the hardware configured in the next interrupt |
| 123 | * @underrun: Whether the preview entity has queued buffers on the output |
| 124 | * @state: Current preview pipeline state |
| 125 | * @lock: Shadow update lock |
| 126 | * @update: Bitmask of the parameters to be updated |
| 127 | * |
| 128 | * This structure is used to store the OMAP ISP Preview module Information. |
| 129 | */ |
| 130 | struct isp_prev_device { |
| 131 | struct v4l2_subdev subdev; |
| 132 | struct media_pad pads[PREV_PADS_NUM]; |
| 133 | struct v4l2_mbus_framefmt formats[PREV_PADS_NUM]; |
Laurent Pinchart | 1f69fd9 | 2011-09-21 20:05:45 -0300 | [diff] [blame] | 134 | struct v4l2_rect crop; |
Laurent Pinchart | de1135d | 2011-02-12 18:05:06 -0300 | [diff] [blame] | 135 | |
| 136 | struct v4l2_ctrl_handler ctrls; |
| 137 | |
| 138 | enum preview_input_entity input; |
| 139 | unsigned int output; |
| 140 | struct isp_video video_in; |
| 141 | struct isp_video video_out; |
Laurent Pinchart | de1135d | 2011-02-12 18:05:06 -0300 | [diff] [blame] | 142 | |
| 143 | struct prev_params params; |
| 144 | unsigned int shadow_update:1; |
| 145 | enum isp_pipeline_stream_state state; |
| 146 | wait_queue_head_t wait; |
| 147 | atomic_t stopping; |
| 148 | spinlock_t lock; |
| 149 | u32 update; |
| 150 | }; |
| 151 | |
| 152 | struct isp_device; |
| 153 | |
| 154 | int omap3isp_preview_init(struct isp_device *isp); |
| 155 | void omap3isp_preview_cleanup(struct isp_device *isp); |
| 156 | |
| 157 | int omap3isp_preview_register_entities(struct isp_prev_device *prv, |
| 158 | struct v4l2_device *vdev); |
| 159 | void omap3isp_preview_unregister_entities(struct isp_prev_device *prv); |
| 160 | |
| 161 | void omap3isp_preview_isr_frame_sync(struct isp_prev_device *prev); |
| 162 | void omap3isp_preview_isr(struct isp_prev_device *prev); |
| 163 | |
| 164 | int omap3isp_preview_busy(struct isp_prev_device *isp_prev); |
| 165 | |
| 166 | void omap3isp_preview_restore_context(struct isp_device *isp); |
| 167 | |
| 168 | #endif /* OMAP3_ISP_PREVIEW_H */ |