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