diff options
Diffstat (limited to 'include/media')
26 files changed, 1426 insertions, 82 deletions
diff --git a/include/media/adp1653.h b/include/media/adp1653.h new file mode 100644 index 000000000000..50a1af88aed0 --- /dev/null +++ b/include/media/adp1653.h | |||
@@ -0,0 +1,126 @@ | |||
1 | /* | ||
2 | * include/media/adp1653.h | ||
3 | * | ||
4 | * Copyright (C) 2008--2011 Nokia Corporation | ||
5 | * | ||
6 | * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | ||
10 | * Tuukka Toivonen <tuukkat76@gmail.com> | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * version 2 as 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 | |||
28 | #ifndef ADP1653_H | ||
29 | #define ADP1653_H | ||
30 | |||
31 | #include <linux/i2c.h> | ||
32 | #include <linux/mutex.h> | ||
33 | #include <linux/videodev2.h> | ||
34 | #include <media/v4l2-ctrls.h> | ||
35 | #include <media/v4l2-subdev.h> | ||
36 | |||
37 | #define ADP1653_NAME "adp1653" | ||
38 | #define ADP1653_I2C_ADDR (0x60 >> 1) | ||
39 | |||
40 | /* Register definitions */ | ||
41 | #define ADP1653_REG_OUT_SEL 0x00 | ||
42 | #define ADP1653_REG_OUT_SEL_HPLED_TORCH_MIN 0x01 | ||
43 | #define ADP1653_REG_OUT_SEL_HPLED_TORCH_MAX 0x0b | ||
44 | #define ADP1653_REG_OUT_SEL_HPLED_FLASH_MIN 0x0c | ||
45 | #define ADP1653_REG_OUT_SEL_HPLED_FLASH_MAX 0x1f | ||
46 | #define ADP1653_REG_OUT_SEL_HPLED_SHIFT 3 | ||
47 | #define ADP1653_REG_OUT_SEL_ILED_MAX 0x07 | ||
48 | #define ADP1653_REG_OUT_SEL_ILED_SHIFT 0 | ||
49 | |||
50 | #define ADP1653_REG_CONFIG 0x01 | ||
51 | #define ADP1653_REG_CONFIG_TMR_CFG (1 << 4) | ||
52 | #define ADP1653_REG_CONFIG_TMR_SET_MAX 0x0f | ||
53 | #define ADP1653_REG_CONFIG_TMR_SET_SHIFT 0 | ||
54 | |||
55 | #define ADP1653_REG_SW_STROBE 0x02 | ||
56 | #define ADP1653_REG_SW_STROBE_SW_STROBE (1 << 0) | ||
57 | |||
58 | #define ADP1653_REG_FAULT 0x03 | ||
59 | #define ADP1653_REG_FAULT_FLT_SCP (1 << 3) | ||
60 | #define ADP1653_REG_FAULT_FLT_OT (1 << 2) | ||
61 | #define ADP1653_REG_FAULT_FLT_TMR (1 << 1) | ||
62 | #define ADP1653_REG_FAULT_FLT_OV (1 << 0) | ||
63 | |||
64 | #define ADP1653_INDICATOR_INTENSITY_MIN 0 | ||
65 | #define ADP1653_INDICATOR_INTENSITY_STEP 2500 | ||
66 | #define ADP1653_INDICATOR_INTENSITY_MAX \ | ||
67 | (ADP1653_REG_OUT_SEL_ILED_MAX * ADP1653_INDICATOR_INTENSITY_STEP) | ||
68 | #define ADP1653_INDICATOR_INTENSITY_uA_TO_REG(a) \ | ||
69 | ((a) / ADP1653_INDICATOR_INTENSITY_STEP) | ||
70 | #define ADP1653_INDICATOR_INTENSITY_REG_TO_uA(a) \ | ||
71 | ((a) * ADP1653_INDICATOR_INTENSITY_STEP) | ||
72 | |||
73 | #define ADP1653_FLASH_INTENSITY_BASE 35 | ||
74 | #define ADP1653_FLASH_INTENSITY_STEP 15 | ||
75 | #define ADP1653_FLASH_INTENSITY_MIN \ | ||
76 | (ADP1653_FLASH_INTENSITY_BASE \ | ||
77 | + ADP1653_REG_OUT_SEL_HPLED_FLASH_MIN * ADP1653_FLASH_INTENSITY_STEP) | ||
78 | #define ADP1653_FLASH_INTENSITY_MAX \ | ||
79 | (ADP1653_FLASH_INTENSITY_MIN + \ | ||
80 | (ADP1653_REG_OUT_SEL_HPLED_FLASH_MAX - \ | ||
81 | ADP1653_REG_OUT_SEL_HPLED_FLASH_MIN + 1) * \ | ||
82 | ADP1653_FLASH_INTENSITY_STEP) | ||
83 | |||
84 | #define ADP1653_FLASH_INTENSITY_mA_TO_REG(a) \ | ||
85 | ((a) < ADP1653_FLASH_INTENSITY_BASE ? 0 : \ | ||
86 | (((a) - ADP1653_FLASH_INTENSITY_BASE) / ADP1653_FLASH_INTENSITY_STEP)) | ||
87 | #define ADP1653_FLASH_INTENSITY_REG_TO_mA(a) \ | ||
88 | ((a) * ADP1653_FLASH_INTENSITY_STEP + ADP1653_FLASH_INTENSITY_BASE) | ||
89 | |||
90 | #define ADP1653_TORCH_INTENSITY_MIN \ | ||
91 | (ADP1653_FLASH_INTENSITY_BASE \ | ||
92 | + ADP1653_REG_OUT_SEL_HPLED_TORCH_MIN * ADP1653_FLASH_INTENSITY_STEP) | ||
93 | #define ADP1653_TORCH_INTENSITY_MAX \ | ||
94 | (ADP1653_TORCH_INTENSITY_MIN + \ | ||
95 | (ADP1653_REG_OUT_SEL_HPLED_TORCH_MAX - \ | ||
96 | ADP1653_REG_OUT_SEL_HPLED_TORCH_MIN + 1) * \ | ||
97 | ADP1653_FLASH_INTENSITY_STEP) | ||
98 | |||
99 | struct adp1653_platform_data { | ||
100 | int (*power)(struct v4l2_subdev *sd, int on); | ||
101 | |||
102 | u32 max_flash_timeout; /* flash light timeout in us */ | ||
103 | u32 max_flash_intensity; /* led intensity, flash mode */ | ||
104 | u32 max_torch_intensity; /* led intensity, torch mode */ | ||
105 | u32 max_indicator_intensity; /* indicator led intensity */ | ||
106 | }; | ||
107 | |||
108 | #define to_adp1653_flash(sd) container_of(sd, struct adp1653_flash, subdev) | ||
109 | |||
110 | struct adp1653_flash { | ||
111 | struct v4l2_subdev subdev; | ||
112 | struct adp1653_platform_data *platform_data; | ||
113 | |||
114 | struct v4l2_ctrl_handler ctrls; | ||
115 | struct v4l2_ctrl *led_mode; | ||
116 | struct v4l2_ctrl *flash_timeout; | ||
117 | struct v4l2_ctrl *flash_intensity; | ||
118 | struct v4l2_ctrl *torch_intensity; | ||
119 | struct v4l2_ctrl *indicator_intensity; | ||
120 | |||
121 | struct mutex power_lock; | ||
122 | int power_count; | ||
123 | int fault; | ||
124 | }; | ||
125 | |||
126 | #endif /* ADP1653_H */ | ||
diff --git a/include/media/atmel-isi.h b/include/media/atmel-isi.h new file mode 100644 index 000000000000..26cece595121 --- /dev/null +++ b/include/media/atmel-isi.h | |||
@@ -0,0 +1,119 @@ | |||
1 | /* | ||
2 | * Register definitions for the Atmel Image Sensor Interface. | ||
3 | * | ||
4 | * Copyright (C) 2011 Atmel Corporation | ||
5 | * Josh Wu, <josh.wu@atmel.com> | ||
6 | * | ||
7 | * Based on previous work by Lars Haring, <lars.haring@atmel.com> | ||
8 | * and Sedji Gaouaou | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | #ifndef __ATMEL_ISI_H__ | ||
15 | #define __ATMEL_ISI_H__ | ||
16 | |||
17 | #include <linux/types.h> | ||
18 | |||
19 | /* ISI_V2 register offsets */ | ||
20 | #define ISI_CFG1 0x0000 | ||
21 | #define ISI_CFG2 0x0004 | ||
22 | #define ISI_PSIZE 0x0008 | ||
23 | #define ISI_PDECF 0x000c | ||
24 | #define ISI_Y2R_SET0 0x0010 | ||
25 | #define ISI_Y2R_SET1 0x0014 | ||
26 | #define ISI_R2Y_SET0 0x0018 | ||
27 | #define ISI_R2Y_SET1 0x001C | ||
28 | #define ISI_R2Y_SET2 0x0020 | ||
29 | #define ISI_CTRL 0x0024 | ||
30 | #define ISI_STATUS 0x0028 | ||
31 | #define ISI_INTEN 0x002C | ||
32 | #define ISI_INTDIS 0x0030 | ||
33 | #define ISI_INTMASK 0x0034 | ||
34 | #define ISI_DMA_CHER 0x0038 | ||
35 | #define ISI_DMA_CHDR 0x003C | ||
36 | #define ISI_DMA_CHSR 0x0040 | ||
37 | #define ISI_DMA_P_ADDR 0x0044 | ||
38 | #define ISI_DMA_P_CTRL 0x0048 | ||
39 | #define ISI_DMA_P_DSCR 0x004C | ||
40 | #define ISI_DMA_C_ADDR 0x0050 | ||
41 | #define ISI_DMA_C_CTRL 0x0054 | ||
42 | #define ISI_DMA_C_DSCR 0x0058 | ||
43 | |||
44 | /* Bitfields in CFG1 */ | ||
45 | #define ISI_CFG1_HSYNC_POL_ACTIVE_LOW (1 << 2) | ||
46 | #define ISI_CFG1_VSYNC_POL_ACTIVE_LOW (1 << 3) | ||
47 | #define ISI_CFG1_PIXCLK_POL_ACTIVE_FALLING (1 << 4) | ||
48 | #define ISI_CFG1_EMB_SYNC (1 << 6) | ||
49 | #define ISI_CFG1_CRC_SYNC (1 << 7) | ||
50 | /* Constants for FRATE(ISI_V2) */ | ||
51 | #define ISI_CFG1_FRATE_CAPTURE_ALL (0 << 8) | ||
52 | #define ISI_CFG1_FRATE_DIV_2 (1 << 8) | ||
53 | #define ISI_CFG1_FRATE_DIV_3 (2 << 8) | ||
54 | #define ISI_CFG1_FRATE_DIV_4 (3 << 8) | ||
55 | #define ISI_CFG1_FRATE_DIV_5 (4 << 8) | ||
56 | #define ISI_CFG1_FRATE_DIV_6 (5 << 8) | ||
57 | #define ISI_CFG1_FRATE_DIV_7 (6 << 8) | ||
58 | #define ISI_CFG1_FRATE_DIV_8 (7 << 8) | ||
59 | #define ISI_CFG1_DISCR (1 << 11) | ||
60 | #define ISI_CFG1_FULL_MODE (1 << 12) | ||
61 | |||
62 | /* Bitfields in CFG2 */ | ||
63 | #define ISI_CFG2_GRAYSCALE (1 << 13) | ||
64 | /* Constants for YCC_SWAP(ISI_V2) */ | ||
65 | #define ISI_CFG2_YCC_SWAP_DEFAULT (0 << 28) | ||
66 | #define ISI_CFG2_YCC_SWAP_MODE_1 (1 << 28) | ||
67 | #define ISI_CFG2_YCC_SWAP_MODE_2 (2 << 28) | ||
68 | #define ISI_CFG2_YCC_SWAP_MODE_3 (3 << 28) | ||
69 | #define ISI_CFG2_IM_VSIZE_OFFSET 0 | ||
70 | #define ISI_CFG2_IM_HSIZE_OFFSET 16 | ||
71 | #define ISI_CFG2_IM_VSIZE_MASK (0x7FF << ISI_CFG2_IM_VSIZE_OFFSET) | ||
72 | #define ISI_CFG2_IM_HSIZE_MASK (0x7FF << ISI_CFG2_IM_HSIZE_OFFSET) | ||
73 | |||
74 | /* Bitfields in CTRL */ | ||
75 | /* Also using in SR(ISI_V2) */ | ||
76 | #define ISI_CTRL_EN (1 << 0) | ||
77 | #define ISI_CTRL_CDC (1 << 8) | ||
78 | /* Also using in SR/IER/IDR/IMR(ISI_V2) */ | ||
79 | #define ISI_CTRL_DIS (1 << 1) | ||
80 | #define ISI_CTRL_SRST (1 << 2) | ||
81 | |||
82 | /* Bitfields in SR */ | ||
83 | #define ISI_SR_SIP (1 << 19) | ||
84 | /* Also using in SR/IER/IDR/IMR */ | ||
85 | #define ISI_SR_VSYNC (1 << 10) | ||
86 | #define ISI_SR_PXFR_DONE (1 << 16) | ||
87 | #define ISI_SR_CXFR_DONE (1 << 17) | ||
88 | #define ISI_SR_P_OVR (1 << 24) | ||
89 | #define ISI_SR_C_OVR (1 << 25) | ||
90 | #define ISI_SR_CRC_ERR (1 << 26) | ||
91 | #define ISI_SR_FR_OVR (1 << 27) | ||
92 | |||
93 | /* Bitfields in DMA_C_CTRL & in DMA_P_CTRL */ | ||
94 | #define ISI_DMA_CTRL_FETCH (1 << 0) | ||
95 | #define ISI_DMA_CTRL_WB (1 << 1) | ||
96 | #define ISI_DMA_CTRL_IEN (1 << 2) | ||
97 | #define ISI_DMA_CTRL_DONE (1 << 3) | ||
98 | |||
99 | /* Bitfields in DMA_CHSR/CHER/CHDR */ | ||
100 | #define ISI_DMA_CHSR_P_CH (1 << 0) | ||
101 | #define ISI_DMA_CHSR_C_CH (1 << 1) | ||
102 | |||
103 | /* Definition for isi_platform_data */ | ||
104 | #define ISI_DATAWIDTH_8 0x01 | ||
105 | #define ISI_DATAWIDTH_10 0x02 | ||
106 | |||
107 | struct isi_platform_data { | ||
108 | u8 has_emb_sync; | ||
109 | u8 emb_crc_sync; | ||
110 | u8 hsync_act_low; | ||
111 | u8 vsync_act_low; | ||
112 | u8 pclk_act_falling; | ||
113 | u8 isi_full_mode; | ||
114 | u32 data_width_flags; | ||
115 | /* Using for ISI_CFG1 */ | ||
116 | u32 frate; | ||
117 | }; | ||
118 | |||
119 | #endif /* __ATMEL_ISI_H__ */ | ||
diff --git a/include/media/davinci/vpbe.h b/include/media/davinci/vpbe.h new file mode 100644 index 000000000000..8b11fb037980 --- /dev/null +++ b/include/media/davinci/vpbe.h | |||
@@ -0,0 +1,184 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Texas Instruments Inc | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program; if not, write to the Free Software | ||
15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
16 | */ | ||
17 | #ifndef _VPBE_H | ||
18 | #define _VPBE_H | ||
19 | |||
20 | #include <linux/videodev2.h> | ||
21 | #include <linux/i2c.h> | ||
22 | |||
23 | #include <media/v4l2-dev.h> | ||
24 | #include <media/v4l2-ioctl.h> | ||
25 | #include <media/v4l2-device.h> | ||
26 | #include <media/davinci/vpbe_osd.h> | ||
27 | #include <media/davinci/vpbe_venc.h> | ||
28 | #include <media/davinci/vpbe_types.h> | ||
29 | |||
30 | /* OSD configuration info */ | ||
31 | struct osd_config_info { | ||
32 | char module_name[32]; | ||
33 | }; | ||
34 | |||
35 | struct vpbe_output { | ||
36 | struct v4l2_output output; | ||
37 | /* | ||
38 | * If output capabilities include dv_preset, list supported presets | ||
39 | * below | ||
40 | */ | ||
41 | char *subdev_name; | ||
42 | /* | ||
43 | * defualt_mode identifies the default timings set at the venc or | ||
44 | * external encoder. | ||
45 | */ | ||
46 | char *default_mode; | ||
47 | /* | ||
48 | * Fields below are used for supporting multiple modes. For example, | ||
49 | * LCD panel might support different modes and they are listed here. | ||
50 | * Similarly for supporting external encoders, lcd controller port | ||
51 | * requires a set of non-standard timing values to be listed here for | ||
52 | * each supported mode since venc is used in non-standard timing mode | ||
53 | * for interfacing with external encoder similar to configuring lcd | ||
54 | * panel timings | ||
55 | */ | ||
56 | unsigned int num_modes; | ||
57 | struct vpbe_enc_mode_info *modes; | ||
58 | /* | ||
59 | * Bus configuration goes here for external encoders. Some encoders | ||
60 | * may require multiple interface types for each of the output. For | ||
61 | * example, SD modes would use YCC8 where as HD mode would use YCC16. | ||
62 | * Not sure if this is needed on a per mode basis instead of per | ||
63 | * output basis. If per mode is needed, we may have to move this to | ||
64 | * mode_info structure | ||
65 | */ | ||
66 | }; | ||
67 | |||
68 | /* encoder configuration info */ | ||
69 | struct encoder_config_info { | ||
70 | char module_name[32]; | ||
71 | /* Is this an i2c device ? */ | ||
72 | unsigned int is_i2c:1; | ||
73 | /* i2c subdevice board info */ | ||
74 | struct i2c_board_info board_info; | ||
75 | }; | ||
76 | |||
77 | /* structure for defining vpbe display subsystem components */ | ||
78 | struct vpbe_config { | ||
79 | char module_name[32]; | ||
80 | /* i2c bus adapter no */ | ||
81 | int i2c_adapter_id; | ||
82 | struct osd_config_info osd; | ||
83 | struct encoder_config_info venc; | ||
84 | /* external encoder information goes here */ | ||
85 | int num_ext_encoders; | ||
86 | struct encoder_config_info *ext_encoders; | ||
87 | int num_outputs; | ||
88 | /* Order is venc outputs followed by LCD and then external encoders */ | ||
89 | struct vpbe_output *outputs; | ||
90 | }; | ||
91 | |||
92 | struct vpbe_device; | ||
93 | |||
94 | struct vpbe_device_ops { | ||
95 | /* crop cap for the display */ | ||
96 | int (*g_cropcap)(struct vpbe_device *vpbe_dev, | ||
97 | struct v4l2_cropcap *cropcap); | ||
98 | |||
99 | /* Enumerate the outputs */ | ||
100 | int (*enum_outputs)(struct vpbe_device *vpbe_dev, | ||
101 | struct v4l2_output *output); | ||
102 | |||
103 | /* Set output to the given index */ | ||
104 | int (*set_output)(struct vpbe_device *vpbe_dev, | ||
105 | int index); | ||
106 | |||
107 | /* Get current output */ | ||
108 | unsigned int (*get_output)(struct vpbe_device *vpbe_dev); | ||
109 | |||
110 | /* Set DV preset at current output */ | ||
111 | int (*s_dv_preset)(struct vpbe_device *vpbe_dev, | ||
112 | struct v4l2_dv_preset *dv_preset); | ||
113 | |||
114 | /* Get DV presets supported at the output */ | ||
115 | int (*g_dv_preset)(struct vpbe_device *vpbe_dev, | ||
116 | struct v4l2_dv_preset *dv_preset); | ||
117 | |||
118 | /* Enumerate the DV Presets supported at the output */ | ||
119 | int (*enum_dv_presets)(struct vpbe_device *vpbe_dev, | ||
120 | struct v4l2_dv_enum_preset *preset_info); | ||
121 | |||
122 | /* Set std at the output */ | ||
123 | int (*s_std)(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id); | ||
124 | |||
125 | /* Get the current std at the output */ | ||
126 | int (*g_std)(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id); | ||
127 | |||
128 | /* initialize the device */ | ||
129 | int (*initialize)(struct device *dev, struct vpbe_device *vpbe_dev); | ||
130 | |||
131 | /* De-initialize the device */ | ||
132 | void (*deinitialize)(struct device *dev, struct vpbe_device *vpbe_dev); | ||
133 | |||
134 | /* Get the current mode info */ | ||
135 | int (*get_mode_info)(struct vpbe_device *vpbe_dev, | ||
136 | struct vpbe_enc_mode_info*); | ||
137 | |||
138 | /* | ||
139 | * Set the current mode in the encoder. Alternate way of setting | ||
140 | * standard or DV preset or custom timings in the encoder | ||
141 | */ | ||
142 | int (*set_mode)(struct vpbe_device *vpbe_dev, | ||
143 | struct vpbe_enc_mode_info*); | ||
144 | /* Power management operations */ | ||
145 | int (*suspend)(struct vpbe_device *vpbe_dev); | ||
146 | int (*resume)(struct vpbe_device *vpbe_dev); | ||
147 | }; | ||
148 | |||
149 | /* struct for vpbe device */ | ||
150 | struct vpbe_device { | ||
151 | /* V4l2 device */ | ||
152 | struct v4l2_device v4l2_dev; | ||
153 | /* vpbe dispay controller cfg */ | ||
154 | struct vpbe_config *cfg; | ||
155 | /* parent device */ | ||
156 | struct device *pdev; | ||
157 | /* external encoder v4l2 sub devices */ | ||
158 | struct v4l2_subdev **encoders; | ||
159 | /* current encoder index */ | ||
160 | int current_sd_index; | ||
161 | struct mutex lock; | ||
162 | /* device initialized */ | ||
163 | int initialized; | ||
164 | /* vpbe dac clock */ | ||
165 | struct clk *dac_clk; | ||
166 | /* osd_device pointer */ | ||
167 | struct osd_state *osd_device; | ||
168 | /* | ||
169 | * fields below are accessed by users of vpbe_device. Not the | ||
170 | * ones above | ||
171 | */ | ||
172 | |||
173 | /* current output */ | ||
174 | int current_out_index; | ||
175 | /* lock used by caller to do atomic operation on vpbe device */ | ||
176 | /* current timings set in the controller */ | ||
177 | struct vpbe_enc_mode_info current_timings; | ||
178 | /* venc sub device */ | ||
179 | struct v4l2_subdev *venc; | ||
180 | /* device operations below */ | ||
181 | struct vpbe_device_ops ops; | ||
182 | }; | ||
183 | |||
184 | #endif | ||
diff --git a/include/media/davinci/vpbe_display.h b/include/media/davinci/vpbe_display.h new file mode 100644 index 000000000000..dbf6b37682cd --- /dev/null +++ b/include/media/davinci/vpbe_display.h | |||
@@ -0,0 +1,147 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License as | ||
6 | * published by the Free Software Foundation version 2. | ||
7 | * | ||
8 | * This program is distributed WITHOUT ANY WARRANTY of any | ||
9 | * kind, whether express or implied; without even the implied warranty | ||
10 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | */ | ||
13 | #ifndef VPBE_DISPLAY_H | ||
14 | #define VPBE_DISPLAY_H | ||
15 | |||
16 | /* Header files */ | ||
17 | #include <linux/videodev2.h> | ||
18 | #include <media/v4l2-common.h> | ||
19 | #include <media/videobuf-dma-contig.h> | ||
20 | #include <media/davinci/vpbe_types.h> | ||
21 | #include <media/davinci/vpbe_osd.h> | ||
22 | #include <media/davinci/vpbe.h> | ||
23 | |||
24 | #define VPBE_DISPLAY_MAX_DEVICES 2 | ||
25 | |||
26 | enum vpbe_display_device_id { | ||
27 | VPBE_DISPLAY_DEVICE_0, | ||
28 | VPBE_DISPLAY_DEVICE_1 | ||
29 | }; | ||
30 | |||
31 | #define VPBE_DISPLAY_DRV_NAME "vpbe-display" | ||
32 | |||
33 | #define VPBE_DISPLAY_MAJOR_RELEASE 1 | ||
34 | #define VPBE_DISPLAY_MINOR_RELEASE 0 | ||
35 | #define VPBE_DISPLAY_BUILD 1 | ||
36 | #define VPBE_DISPLAY_VERSION_CODE ((VPBE_DISPLAY_MAJOR_RELEASE << 16) | \ | ||
37 | (VPBE_DISPLAY_MINOR_RELEASE << 8) | \ | ||
38 | VPBE_DISPLAY_BUILD) | ||
39 | |||
40 | #define VPBE_DISPLAY_VALID_FIELD(field) ((V4L2_FIELD_NONE == field) || \ | ||
41 | (V4L2_FIELD_ANY == field) || (V4L2_FIELD_INTERLACED == field)) | ||
42 | |||
43 | /* Exp ratio numerator and denominator constants */ | ||
44 | #define VPBE_DISPLAY_H_EXP_RATIO_N 9 | ||
45 | #define VPBE_DISPLAY_H_EXP_RATIO_D 8 | ||
46 | #define VPBE_DISPLAY_V_EXP_RATIO_N 6 | ||
47 | #define VPBE_DISPLAY_V_EXP_RATIO_D 5 | ||
48 | |||
49 | /* Zoom multiplication factor */ | ||
50 | #define VPBE_DISPLAY_ZOOM_4X 4 | ||
51 | #define VPBE_DISPLAY_ZOOM_2X 2 | ||
52 | |||
53 | /* Structures */ | ||
54 | struct display_layer_info { | ||
55 | int enable; | ||
56 | /* Layer ID used by Display Manager */ | ||
57 | enum osd_layer id; | ||
58 | struct osd_layer_config config; | ||
59 | enum osd_zoom_factor h_zoom; | ||
60 | enum osd_zoom_factor v_zoom; | ||
61 | enum osd_h_exp_ratio h_exp; | ||
62 | enum osd_v_exp_ratio v_exp; | ||
63 | }; | ||
64 | |||
65 | /* vpbe display object structure */ | ||
66 | struct vpbe_layer { | ||
67 | /* number of buffers in fbuffers */ | ||
68 | unsigned int numbuffers; | ||
69 | /* Pointer to the vpbe_display */ | ||
70 | struct vpbe_display *disp_dev; | ||
71 | /* Pointer pointing to current v4l2_buffer */ | ||
72 | struct videobuf_buffer *cur_frm; | ||
73 | /* Pointer pointing to next v4l2_buffer */ | ||
74 | struct videobuf_buffer *next_frm; | ||
75 | /* videobuf specific parameters | ||
76 | * Buffer queue used in video-buf | ||
77 | */ | ||
78 | struct videobuf_queue buffer_queue; | ||
79 | /* Queue of filled frames */ | ||
80 | struct list_head dma_queue; | ||
81 | /* Used in video-buf */ | ||
82 | spinlock_t irqlock; | ||
83 | /* V4l2 specific parameters */ | ||
84 | /* Identifies video device for this layer */ | ||
85 | struct video_device video_dev; | ||
86 | /* This field keeps track of type of buffer exchange mechanism user | ||
87 | * has selected | ||
88 | */ | ||
89 | enum v4l2_memory memory; | ||
90 | /* Used to keep track of state of the priority */ | ||
91 | struct v4l2_prio_state prio; | ||
92 | /* Used to store pixel format */ | ||
93 | struct v4l2_pix_format pix_fmt; | ||
94 | enum v4l2_field buf_field; | ||
95 | /* Video layer configuration params */ | ||
96 | struct display_layer_info layer_info; | ||
97 | /* vpbe specific parameters | ||
98 | * enable window for display | ||
99 | */ | ||
100 | unsigned char window_enable; | ||
101 | /* number of open instances of the layer */ | ||
102 | unsigned int usrs; | ||
103 | /* number of users performing IO */ | ||
104 | unsigned int io_usrs; | ||
105 | /* Indicates id of the field which is being displayed */ | ||
106 | unsigned int field_id; | ||
107 | /* Indicates whether streaming started */ | ||
108 | unsigned char started; | ||
109 | /* Identifies device object */ | ||
110 | enum vpbe_display_device_id device_id; | ||
111 | /* facilitation of ioctl ops lock by v4l2*/ | ||
112 | struct mutex opslock; | ||
113 | u8 layer_first_int; | ||
114 | }; | ||
115 | |||
116 | /* vpbe device structure */ | ||
117 | struct vpbe_display { | ||
118 | /* layer specific parameters */ | ||
119 | /* lock for isr updates to buf layers*/ | ||
120 | spinlock_t dma_queue_lock; | ||
121 | /* C-Plane offset from start of y-plane */ | ||
122 | unsigned int cbcr_ofst; | ||
123 | struct vpbe_layer *dev[VPBE_DISPLAY_MAX_DEVICES]; | ||
124 | struct vpbe_device *vpbe_dev; | ||
125 | struct osd_state *osd_device; | ||
126 | }; | ||
127 | |||
128 | /* File handle structure */ | ||
129 | struct vpbe_fh { | ||
130 | /* vpbe device structure */ | ||
131 | struct vpbe_display *disp_dev; | ||
132 | /* pointer to layer object for opened device */ | ||
133 | struct vpbe_layer *layer; | ||
134 | /* Indicates whether this file handle is doing IO */ | ||
135 | unsigned char io_allowed; | ||
136 | /* Used to keep track priority of this instance */ | ||
137 | enum v4l2_priority prio; | ||
138 | }; | ||
139 | |||
140 | struct buf_config_params { | ||
141 | unsigned char min_numbuffers; | ||
142 | unsigned char numbuffers[VPBE_DISPLAY_MAX_DEVICES]; | ||
143 | unsigned int min_bufsize[VPBE_DISPLAY_MAX_DEVICES]; | ||
144 | unsigned int layer_bufsize[VPBE_DISPLAY_MAX_DEVICES]; | ||
145 | }; | ||
146 | |||
147 | #endif /* VPBE_DISPLAY_H */ | ||
diff --git a/include/media/davinci/vpbe_osd.h b/include/media/davinci/vpbe_osd.h new file mode 100644 index 000000000000..d7e397a444e6 --- /dev/null +++ b/include/media/davinci/vpbe_osd.h | |||
@@ -0,0 +1,394 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2009 Texas Instruments Inc | ||
3 | * Copyright (C) 2007 MontaVista Software, Inc. | ||
4 | * | ||
5 | * Andy Lowe (alowe@mvista.com), MontaVista Software | ||
6 | * - Initial version | ||
7 | * Murali Karicheri (mkaricheri@gmail.com), Texas Instruments Ltd. | ||
8 | * - ported to sub device interface | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation version 2.. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | * | ||
23 | */ | ||
24 | #ifndef _OSD_H | ||
25 | #define _OSD_H | ||
26 | |||
27 | #include <media/davinci/vpbe_types.h> | ||
28 | |||
29 | #define VPBE_OSD_SUBDEV_NAME "vpbe-osd" | ||
30 | |||
31 | /** | ||
32 | * enum osd_layer | ||
33 | * @WIN_OSD0: On-Screen Display Window 0 | ||
34 | * @WIN_VID0: Video Window 0 | ||
35 | * @WIN_OSD1: On-Screen Display Window 1 | ||
36 | * @WIN_VID1: Video Window 1 | ||
37 | * | ||
38 | * Description: | ||
39 | * An enumeration of the osd display layers. | ||
40 | */ | ||
41 | enum osd_layer { | ||
42 | WIN_OSD0, | ||
43 | WIN_VID0, | ||
44 | WIN_OSD1, | ||
45 | WIN_VID1, | ||
46 | }; | ||
47 | |||
48 | /** | ||
49 | * enum osd_win_layer | ||
50 | * @OSDWIN_OSD0: On-Screen Display Window 0 | ||
51 | * @OSDWIN_OSD1: On-Screen Display Window 1 | ||
52 | * | ||
53 | * Description: | ||
54 | * An enumeration of the OSD Window layers. | ||
55 | */ | ||
56 | enum osd_win_layer { | ||
57 | OSDWIN_OSD0, | ||
58 | OSDWIN_OSD1, | ||
59 | }; | ||
60 | |||
61 | /** | ||
62 | * enum osd_pix_format | ||
63 | * @PIXFMT_1BPP: 1-bit-per-pixel bitmap | ||
64 | * @PIXFMT_2BPP: 2-bits-per-pixel bitmap | ||
65 | * @PIXFMT_4BPP: 4-bits-per-pixel bitmap | ||
66 | * @PIXFMT_8BPP: 8-bits-per-pixel bitmap | ||
67 | * @PIXFMT_RGB565: 16-bits-per-pixel RGB565 | ||
68 | * @PIXFMT_YCbCrI: YUV 4:2:2 | ||
69 | * @PIXFMT_RGB888: 24-bits-per-pixel RGB888 | ||
70 | * @PIXFMT_YCrCbI: YUV 4:2:2 with chroma swap | ||
71 | * @PIXFMT_NV12: YUV 4:2:0 planar | ||
72 | * @PIXFMT_OSD_ATTR: OSD Attribute Window pixel format (4bpp) | ||
73 | * | ||
74 | * Description: | ||
75 | * An enumeration of the DaVinci pixel formats. | ||
76 | */ | ||
77 | enum osd_pix_format { | ||
78 | PIXFMT_1BPP = 0, | ||
79 | PIXFMT_2BPP, | ||
80 | PIXFMT_4BPP, | ||
81 | PIXFMT_8BPP, | ||
82 | PIXFMT_RGB565, | ||
83 | PIXFMT_YCbCrI, | ||
84 | PIXFMT_RGB888, | ||
85 | PIXFMT_YCrCbI, | ||
86 | PIXFMT_NV12, | ||
87 | PIXFMT_OSD_ATTR, | ||
88 | }; | ||
89 | |||
90 | /** | ||
91 | * enum osd_h_exp_ratio | ||
92 | * @H_EXP_OFF: no expansion (1/1) | ||
93 | * @H_EXP_9_OVER_8: 9/8 expansion ratio | ||
94 | * @H_EXP_3_OVER_2: 3/2 expansion ratio | ||
95 | * | ||
96 | * Description: | ||
97 | * An enumeration of the available horizontal expansion ratios. | ||
98 | */ | ||
99 | enum osd_h_exp_ratio { | ||
100 | H_EXP_OFF, | ||
101 | H_EXP_9_OVER_8, | ||
102 | H_EXP_3_OVER_2, | ||
103 | }; | ||
104 | |||
105 | /** | ||
106 | * enum osd_v_exp_ratio | ||
107 | * @V_EXP_OFF: no expansion (1/1) | ||
108 | * @V_EXP_6_OVER_5: 6/5 expansion ratio | ||
109 | * | ||
110 | * Description: | ||
111 | * An enumeration of the available vertical expansion ratios. | ||
112 | */ | ||
113 | enum osd_v_exp_ratio { | ||
114 | V_EXP_OFF, | ||
115 | V_EXP_6_OVER_5, | ||
116 | }; | ||
117 | |||
118 | /** | ||
119 | * enum osd_zoom_factor | ||
120 | * @ZOOM_X1: no zoom (x1) | ||
121 | * @ZOOM_X2: x2 zoom | ||
122 | * @ZOOM_X4: x4 zoom | ||
123 | * | ||
124 | * Description: | ||
125 | * An enumeration of the available zoom factors. | ||
126 | */ | ||
127 | enum osd_zoom_factor { | ||
128 | ZOOM_X1, | ||
129 | ZOOM_X2, | ||
130 | ZOOM_X4, | ||
131 | }; | ||
132 | |||
133 | /** | ||
134 | * enum osd_clut | ||
135 | * @ROM_CLUT: ROM CLUT | ||
136 | * @RAM_CLUT: RAM CLUT | ||
137 | * | ||
138 | * Description: | ||
139 | * An enumeration of the available Color Lookup Tables (CLUTs). | ||
140 | */ | ||
141 | enum osd_clut { | ||
142 | ROM_CLUT, | ||
143 | RAM_CLUT, | ||
144 | }; | ||
145 | |||
146 | /** | ||
147 | * enum osd_rom_clut | ||
148 | * @ROM_CLUT0: Macintosh CLUT | ||
149 | * @ROM_CLUT1: CLUT from DM270 and prior devices | ||
150 | * | ||
151 | * Description: | ||
152 | * An enumeration of the ROM Color Lookup Table (CLUT) options. | ||
153 | */ | ||
154 | enum osd_rom_clut { | ||
155 | ROM_CLUT0, | ||
156 | ROM_CLUT1, | ||
157 | }; | ||
158 | |||
159 | /** | ||
160 | * enum osd_blending_factor | ||
161 | * @OSD_0_VID_8: OSD pixels are fully transparent | ||
162 | * @OSD_1_VID_7: OSD pixels contribute 1/8, video pixels contribute 7/8 | ||
163 | * @OSD_2_VID_6: OSD pixels contribute 2/8, video pixels contribute 6/8 | ||
164 | * @OSD_3_VID_5: OSD pixels contribute 3/8, video pixels contribute 5/8 | ||
165 | * @OSD_4_VID_4: OSD pixels contribute 4/8, video pixels contribute 4/8 | ||
166 | * @OSD_5_VID_3: OSD pixels contribute 5/8, video pixels contribute 3/8 | ||
167 | * @OSD_6_VID_2: OSD pixels contribute 6/8, video pixels contribute 2/8 | ||
168 | * @OSD_8_VID_0: OSD pixels are fully opaque | ||
169 | * | ||
170 | * Description: | ||
171 | * An enumeration of the DaVinci pixel blending factor options. | ||
172 | */ | ||
173 | enum osd_blending_factor { | ||
174 | OSD_0_VID_8, | ||
175 | OSD_1_VID_7, | ||
176 | OSD_2_VID_6, | ||
177 | OSD_3_VID_5, | ||
178 | OSD_4_VID_4, | ||
179 | OSD_5_VID_3, | ||
180 | OSD_6_VID_2, | ||
181 | OSD_8_VID_0, | ||
182 | }; | ||
183 | |||
184 | /** | ||
185 | * enum osd_blink_interval | ||
186 | * @BLINK_X1: blink interval is 1 vertical refresh cycle | ||
187 | * @BLINK_X2: blink interval is 2 vertical refresh cycles | ||
188 | * @BLINK_X3: blink interval is 3 vertical refresh cycles | ||
189 | * @BLINK_X4: blink interval is 4 vertical refresh cycles | ||
190 | * | ||
191 | * Description: | ||
192 | * An enumeration of the DaVinci pixel blinking interval options. | ||
193 | */ | ||
194 | enum osd_blink_interval { | ||
195 | BLINK_X1, | ||
196 | BLINK_X2, | ||
197 | BLINK_X3, | ||
198 | BLINK_X4, | ||
199 | }; | ||
200 | |||
201 | /** | ||
202 | * enum osd_cursor_h_width | ||
203 | * @H_WIDTH_1: horizontal line width is 1 pixel | ||
204 | * @H_WIDTH_4: horizontal line width is 4 pixels | ||
205 | * @H_WIDTH_8: horizontal line width is 8 pixels | ||
206 | * @H_WIDTH_12: horizontal line width is 12 pixels | ||
207 | * @H_WIDTH_16: horizontal line width is 16 pixels | ||
208 | * @H_WIDTH_20: horizontal line width is 20 pixels | ||
209 | * @H_WIDTH_24: horizontal line width is 24 pixels | ||
210 | * @H_WIDTH_28: horizontal line width is 28 pixels | ||
211 | */ | ||
212 | enum osd_cursor_h_width { | ||
213 | H_WIDTH_1, | ||
214 | H_WIDTH_4, | ||
215 | H_WIDTH_8, | ||
216 | H_WIDTH_12, | ||
217 | H_WIDTH_16, | ||
218 | H_WIDTH_20, | ||
219 | H_WIDTH_24, | ||
220 | H_WIDTH_28, | ||
221 | }; | ||
222 | |||
223 | /** | ||
224 | * enum davinci_cursor_v_width | ||
225 | * @V_WIDTH_1: vertical line width is 1 line | ||
226 | * @V_WIDTH_2: vertical line width is 2 lines | ||
227 | * @V_WIDTH_4: vertical line width is 4 lines | ||
228 | * @V_WIDTH_6: vertical line width is 6 lines | ||
229 | * @V_WIDTH_8: vertical line width is 8 lines | ||
230 | * @V_WIDTH_10: vertical line width is 10 lines | ||
231 | * @V_WIDTH_12: vertical line width is 12 lines | ||
232 | * @V_WIDTH_14: vertical line width is 14 lines | ||
233 | */ | ||
234 | enum osd_cursor_v_width { | ||
235 | V_WIDTH_1, | ||
236 | V_WIDTH_2, | ||
237 | V_WIDTH_4, | ||
238 | V_WIDTH_6, | ||
239 | V_WIDTH_8, | ||
240 | V_WIDTH_10, | ||
241 | V_WIDTH_12, | ||
242 | V_WIDTH_14, | ||
243 | }; | ||
244 | |||
245 | /** | ||
246 | * struct osd_cursor_config | ||
247 | * @xsize: horizontal size in pixels | ||
248 | * @ysize: vertical size in lines | ||
249 | * @xpos: horizontal offset in pixels from the left edge of the display | ||
250 | * @ypos: vertical offset in lines from the top of the display | ||
251 | * @interlaced: Non-zero if the display is interlaced, or zero otherwise | ||
252 | * @h_width: horizontal line width | ||
253 | * @v_width: vertical line width | ||
254 | * @clut: the CLUT selector (ROM or RAM) for the cursor color | ||
255 | * @clut_index: an index into the CLUT for the cursor color | ||
256 | * | ||
257 | * Description: | ||
258 | * A structure describing the configuration parameters of the hardware | ||
259 | * rectangular cursor. | ||
260 | */ | ||
261 | struct osd_cursor_config { | ||
262 | unsigned xsize; | ||
263 | unsigned ysize; | ||
264 | unsigned xpos; | ||
265 | unsigned ypos; | ||
266 | int interlaced; | ||
267 | enum osd_cursor_h_width h_width; | ||
268 | enum osd_cursor_v_width v_width; | ||
269 | enum osd_clut clut; | ||
270 | unsigned char clut_index; | ||
271 | }; | ||
272 | |||
273 | /** | ||
274 | * struct osd_layer_config | ||
275 | * @pixfmt: pixel format | ||
276 | * @line_length: offset in bytes between start of each line in memory | ||
277 | * @xsize: number of horizontal pixels displayed per line | ||
278 | * @ysize: number of lines displayed | ||
279 | * @xpos: horizontal offset in pixels from the left edge of the display | ||
280 | * @ypos: vertical offset in lines from the top of the display | ||
281 | * @interlaced: Non-zero if the display is interlaced, or zero otherwise | ||
282 | * | ||
283 | * Description: | ||
284 | * A structure describing the configuration parameters of an On-Screen Display | ||
285 | * (OSD) or video layer related to how the image is stored in memory. | ||
286 | * @line_length must be a multiple of the cache line size (32 bytes). | ||
287 | */ | ||
288 | struct osd_layer_config { | ||
289 | enum osd_pix_format pixfmt; | ||
290 | unsigned line_length; | ||
291 | unsigned xsize; | ||
292 | unsigned ysize; | ||
293 | unsigned xpos; | ||
294 | unsigned ypos; | ||
295 | int interlaced; | ||
296 | }; | ||
297 | |||
298 | /* parameters that apply on a per-window (OSD or video) basis */ | ||
299 | struct osd_window_state { | ||
300 | int is_allocated; | ||
301 | int is_enabled; | ||
302 | unsigned long fb_base_phys; | ||
303 | enum osd_zoom_factor h_zoom; | ||
304 | enum osd_zoom_factor v_zoom; | ||
305 | struct osd_layer_config lconfig; | ||
306 | }; | ||
307 | |||
308 | /* parameters that apply on a per-OSD-window basis */ | ||
309 | struct osd_osdwin_state { | ||
310 | enum osd_clut clut; | ||
311 | enum osd_blending_factor blend; | ||
312 | int colorkey_blending; | ||
313 | unsigned colorkey; | ||
314 | int rec601_attenuation; | ||
315 | /* index is pixel value */ | ||
316 | unsigned char palette_map[16]; | ||
317 | }; | ||
318 | |||
319 | /* hardware rectangular cursor parameters */ | ||
320 | struct osd_cursor_state { | ||
321 | int is_enabled; | ||
322 | struct osd_cursor_config config; | ||
323 | }; | ||
324 | |||
325 | struct osd_state; | ||
326 | |||
327 | struct vpbe_osd_ops { | ||
328 | int (*initialize)(struct osd_state *sd); | ||
329 | int (*request_layer)(struct osd_state *sd, enum osd_layer layer); | ||
330 | void (*release_layer)(struct osd_state *sd, enum osd_layer layer); | ||
331 | int (*enable_layer)(struct osd_state *sd, enum osd_layer layer, | ||
332 | int otherwin); | ||
333 | void (*disable_layer)(struct osd_state *sd, enum osd_layer layer); | ||
334 | int (*set_layer_config)(struct osd_state *sd, enum osd_layer layer, | ||
335 | struct osd_layer_config *lconfig); | ||
336 | void (*get_layer_config)(struct osd_state *sd, enum osd_layer layer, | ||
337 | struct osd_layer_config *lconfig); | ||
338 | void (*start_layer)(struct osd_state *sd, enum osd_layer layer, | ||
339 | unsigned long fb_base_phys, | ||
340 | unsigned long cbcr_ofst); | ||
341 | void (*set_left_margin)(struct osd_state *sd, u32 val); | ||
342 | void (*set_top_margin)(struct osd_state *sd, u32 val); | ||
343 | void (*set_interpolation_filter)(struct osd_state *sd, int filter); | ||
344 | int (*set_vid_expansion)(struct osd_state *sd, | ||
345 | enum osd_h_exp_ratio h_exp, | ||
346 | enum osd_v_exp_ratio v_exp); | ||
347 | void (*get_vid_expansion)(struct osd_state *sd, | ||
348 | enum osd_h_exp_ratio *h_exp, | ||
349 | enum osd_v_exp_ratio *v_exp); | ||
350 | void (*set_zoom)(struct osd_state *sd, enum osd_layer layer, | ||
351 | enum osd_zoom_factor h_zoom, | ||
352 | enum osd_zoom_factor v_zoom); | ||
353 | }; | ||
354 | |||
355 | struct osd_state { | ||
356 | enum vpbe_version vpbe_type; | ||
357 | spinlock_t lock; | ||
358 | struct device *dev; | ||
359 | dma_addr_t osd_base_phys; | ||
360 | unsigned long osd_base; | ||
361 | unsigned long osd_size; | ||
362 | /* 1-->the isr will toggle the VID0 ping-pong buffer */ | ||
363 | int pingpong; | ||
364 | int interpolation_filter; | ||
365 | int field_inversion; | ||
366 | enum osd_h_exp_ratio osd_h_exp; | ||
367 | enum osd_v_exp_ratio osd_v_exp; | ||
368 | enum osd_h_exp_ratio vid_h_exp; | ||
369 | enum osd_v_exp_ratio vid_v_exp; | ||
370 | enum osd_clut backg_clut; | ||
371 | unsigned backg_clut_index; | ||
372 | enum osd_rom_clut rom_clut; | ||
373 | int is_blinking; | ||
374 | /* attribute window blinking enabled */ | ||
375 | enum osd_blink_interval blink; | ||
376 | /* YCbCrI or YCrCbI */ | ||
377 | enum osd_pix_format yc_pixfmt; | ||
378 | /* columns are Y, Cb, Cr */ | ||
379 | unsigned char clut_ram[256][3]; | ||
380 | struct osd_cursor_state cursor; | ||
381 | /* OSD0, VID0, OSD1, VID1 */ | ||
382 | struct osd_window_state win[4]; | ||
383 | /* OSD0, OSD1 */ | ||
384 | struct osd_osdwin_state osdwin[2]; | ||
385 | /* OSD device Operations */ | ||
386 | struct vpbe_osd_ops ops; | ||
387 | }; | ||
388 | |||
389 | struct osd_platform_data { | ||
390 | enum vpbe_version vpbe_type; | ||
391 | int field_inv_wa_enable; | ||
392 | }; | ||
393 | |||
394 | #endif | ||
diff --git a/include/media/davinci/vpbe_types.h b/include/media/davinci/vpbe_types.h new file mode 100644 index 000000000000..727f55170e41 --- /dev/null +++ b/include/media/davinci/vpbe_types.h | |||
@@ -0,0 +1,91 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Texas Instruments Inc | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program; if not, write to the Free Software | ||
15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
16 | */ | ||
17 | #ifndef _VPBE_TYPES_H | ||
18 | #define _VPBE_TYPES_H | ||
19 | |||
20 | enum vpbe_version { | ||
21 | VPBE_VERSION_1 = 1, | ||
22 | VPBE_VERSION_2, | ||
23 | VPBE_VERSION_3, | ||
24 | }; | ||
25 | |||
26 | /* vpbe_timing_type - Timing types used in vpbe device */ | ||
27 | enum vpbe_enc_timings_type { | ||
28 | VPBE_ENC_STD = 0x1, | ||
29 | VPBE_ENC_DV_PRESET = 0x2, | ||
30 | VPBE_ENC_CUSTOM_TIMINGS = 0x4, | ||
31 | /* Used when set timings through FB device interface */ | ||
32 | VPBE_ENC_TIMINGS_INVALID = 0x8, | ||
33 | }; | ||
34 | |||
35 | union vpbe_timings { | ||
36 | v4l2_std_id std_id; | ||
37 | unsigned int dv_preset; | ||
38 | }; | ||
39 | |||
40 | /* | ||
41 | * struct vpbe_enc_mode_info | ||
42 | * @name: ptr to name string of the standard, "NTSC", "PAL" etc | ||
43 | * @std: standard or non-standard mode. 1 - standard, 0 - nonstandard | ||
44 | * @interlaced: 1 - interlaced, 0 - non interlaced/progressive | ||
45 | * @xres: x or horizontal resolution of the display | ||
46 | * @yres: y or vertical resolution of the display | ||
47 | * @fps: frame per second | ||
48 | * @left_margin: left margin of the display | ||
49 | * @right_margin: right margin of the display | ||
50 | * @upper_margin: upper margin of the display | ||
51 | * @lower_margin: lower margin of the display | ||
52 | * @hsync_len: h-sync length | ||
53 | * @vsync_len: v-sync length | ||
54 | * @flags: bit field: bit usage is documented below | ||
55 | * | ||
56 | * Description: | ||
57 | * Structure holding timing and resolution information of a standard. | ||
58 | * Used by vpbe_device to set required non-standard timing in the | ||
59 | * venc when lcd controller output is connected to a external encoder. | ||
60 | * A table of timings is maintained in vpbe device to set this in | ||
61 | * venc when external encoder is connected to lcd controller output. | ||
62 | * Encoder may provide a g_dv_timings() API to override these values | ||
63 | * as needed. | ||
64 | * | ||
65 | * Notes | ||
66 | * ------ | ||
67 | * if_type should be used only by encoder manager and encoder. | ||
68 | * flags usage | ||
69 | * b0 (LSB) - hsync polarity, 0 - negative, 1 - positive | ||
70 | * b1 - vsync polarity, 0 - negative, 1 - positive | ||
71 | * b2 - field id polarity, 0 - negative, 1 - positive | ||
72 | */ | ||
73 | struct vpbe_enc_mode_info { | ||
74 | unsigned char *name; | ||
75 | enum vpbe_enc_timings_type timings_type; | ||
76 | union vpbe_timings timings; | ||
77 | unsigned int interlaced; | ||
78 | unsigned int xres; | ||
79 | unsigned int yres; | ||
80 | struct v4l2_fract aspect; | ||
81 | struct v4l2_fract fps; | ||
82 | unsigned int left_margin; | ||
83 | unsigned int right_margin; | ||
84 | unsigned int upper_margin; | ||
85 | unsigned int lower_margin; | ||
86 | unsigned int hsync_len; | ||
87 | unsigned int vsync_len; | ||
88 | unsigned int flags; | ||
89 | }; | ||
90 | |||
91 | #endif | ||
diff --git a/include/media/davinci/vpbe_venc.h b/include/media/davinci/vpbe_venc.h new file mode 100644 index 000000000000..426c205831a2 --- /dev/null +++ b/include/media/davinci/vpbe_venc.h | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Texas Instruments Inc | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program; if not, write to the Free Software | ||
15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
16 | */ | ||
17 | #ifndef _VPBE_VENC_H | ||
18 | #define _VPBE_VENC_H | ||
19 | |||
20 | #include <media/v4l2-subdev.h> | ||
21 | #include <media/davinci/vpbe_types.h> | ||
22 | |||
23 | #define VPBE_VENC_SUBDEV_NAME "vpbe-venc" | ||
24 | |||
25 | /* venc events */ | ||
26 | #define VENC_END_OF_FRAME BIT(0) | ||
27 | #define VENC_FIRST_FIELD BIT(1) | ||
28 | #define VENC_SECOND_FIELD BIT(2) | ||
29 | |||
30 | struct venc_platform_data { | ||
31 | enum vpbe_version venc_type; | ||
32 | int (*setup_clock)(enum vpbe_enc_timings_type type, | ||
33 | unsigned int mode); | ||
34 | /* Number of LCD outputs supported */ | ||
35 | int num_lcd_outputs; | ||
36 | }; | ||
37 | |||
38 | enum venc_ioctls { | ||
39 | VENC_GET_FLD = 1, | ||
40 | }; | ||
41 | |||
42 | /* exported functions */ | ||
43 | struct v4l2_subdev *venc_sub_dev_init(struct v4l2_device *v4l2_dev, | ||
44 | const char *venc_name); | ||
45 | #endif | ||
diff --git a/include/media/lirc_dev.h b/include/media/lirc_dev.h index 630e702c9511..168dd0b1bae2 100644 --- a/include/media/lirc_dev.h +++ b/include/media/lirc_dev.h | |||
@@ -9,7 +9,7 @@ | |||
9 | #ifndef _LINUX_LIRC_DEV_H | 9 | #ifndef _LINUX_LIRC_DEV_H |
10 | #define _LINUX_LIRC_DEV_H | 10 | #define _LINUX_LIRC_DEV_H |
11 | 11 | ||
12 | #define MAX_IRCTL_DEVICES 4 | 12 | #define MAX_IRCTL_DEVICES 8 |
13 | #define BUFLEN 16 | 13 | #define BUFLEN 16 |
14 | 14 | ||
15 | #define mod(n, div) ((n) % (div)) | 15 | #define mod(n, div) ((n) % (div)) |
diff --git a/include/media/m5mols.h b/include/media/m5mols.h index 2d7e7ca2313d..aac2c0e06d5e 100644 --- a/include/media/m5mols.h +++ b/include/media/m5mols.h | |||
@@ -2,10 +2,10 @@ | |||
2 | * Driver header for M-5MOLS 8M Pixel camera sensor with ISP | 2 | * Driver header for M-5MOLS 8M Pixel camera sensor with ISP |
3 | * | 3 | * |
4 | * Copyright (C) 2011 Samsung Electronics Co., Ltd. | 4 | * Copyright (C) 2011 Samsung Electronics Co., Ltd. |
5 | * Author: HeungJun Kim, riverful.kim@samsung.com | 5 | * Author: HeungJun Kim <riverful.kim@samsung.com> |
6 | * | 6 | * |
7 | * Copyright (C) 2009 Samsung Electronics Co., Ltd. | 7 | * Copyright (C) 2009 Samsung Electronics Co., Ltd. |
8 | * Author: Dongsoo Nathaniel Kim, dongsoo45.kim@samsung.com | 8 | * Author: Dongsoo Nathaniel Kim <dongsoo45.kim@samsung.com> |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License as published by |
diff --git a/include/media/mmp-camera.h b/include/media/mmp-camera.h new file mode 100644 index 000000000000..7611963a257f --- /dev/null +++ b/include/media/mmp-camera.h | |||
@@ -0,0 +1,9 @@ | |||
1 | /* | ||
2 | * Information for the Marvell Armada MMP camera | ||
3 | */ | ||
4 | |||
5 | struct mmp_camera_platform_data { | ||
6 | struct platform_device *i2c_device; | ||
7 | int sensor_power_gpio; | ||
8 | int sensor_reset_gpio; | ||
9 | }; | ||
diff --git a/include/media/ov7670.h b/include/media/ov7670.h new file mode 100644 index 000000000000..b133bc123031 --- /dev/null +++ b/include/media/ov7670.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /* | ||
2 | * A V4L2 driver for OmniVision OV7670 cameras. | ||
3 | * | ||
4 | * Copyright 2010 One Laptop Per Child | ||
5 | * | ||
6 | * This file may be distributed under the terms of the GNU General | ||
7 | * Public License, version 2. | ||
8 | */ | ||
9 | |||
10 | #ifndef __OV7670_H | ||
11 | #define __OV7670_H | ||
12 | |||
13 | struct ov7670_config { | ||
14 | int min_width; /* Filter out smaller sizes */ | ||
15 | int min_height; /* Filter out smaller sizes */ | ||
16 | int clock_speed; /* External clock speed (MHz) */ | ||
17 | bool use_smbus; /* Use smbus I/O instead of I2C */ | ||
18 | }; | ||
19 | |||
20 | #endif | ||
diff --git a/include/media/rc-core.h b/include/media/rc-core.h index 60536c74c1ea..b1f19b77ecd4 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h | |||
@@ -117,7 +117,7 @@ struct rc_dev { | |||
117 | int (*s_tx_carrier)(struct rc_dev *dev, u32 carrier); | 117 | int (*s_tx_carrier)(struct rc_dev *dev, u32 carrier); |
118 | int (*s_tx_duty_cycle)(struct rc_dev *dev, u32 duty_cycle); | 118 | int (*s_tx_duty_cycle)(struct rc_dev *dev, u32 duty_cycle); |
119 | int (*s_rx_carrier_range)(struct rc_dev *dev, u32 min, u32 max); | 119 | int (*s_rx_carrier_range)(struct rc_dev *dev, u32 min, u32 max); |
120 | int (*tx_ir)(struct rc_dev *dev, int *txbuf, u32 n); | 120 | int (*tx_ir)(struct rc_dev *dev, unsigned *txbuf, unsigned n); |
121 | void (*s_idle)(struct rc_dev *dev, bool enable); | 121 | void (*s_idle)(struct rc_dev *dev, bool enable); |
122 | int (*s_learning_mode)(struct rc_dev *dev, int enable); | 122 | int (*s_learning_mode)(struct rc_dev *dev, int enable); |
123 | int (*s_carrier_report) (struct rc_dev *dev, int enable); | 123 | int (*s_carrier_report) (struct rc_dev *dev, int enable); |
diff --git a/include/media/rc-map.h b/include/media/rc-map.h index 4e1409ec2613..17c9759ae77b 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h | |||
@@ -18,12 +18,13 @@ | |||
18 | #define RC_TYPE_JVC (1 << 3) /* JVC protocol */ | 18 | #define RC_TYPE_JVC (1 << 3) /* JVC protocol */ |
19 | #define RC_TYPE_SONY (1 << 4) /* Sony12/15/20 protocol */ | 19 | #define RC_TYPE_SONY (1 << 4) /* Sony12/15/20 protocol */ |
20 | #define RC_TYPE_RC5_SZ (1 << 5) /* RC5 variant used by Streamzap */ | 20 | #define RC_TYPE_RC5_SZ (1 << 5) /* RC5 variant used by Streamzap */ |
21 | #define RC_TYPE_MCE_KBD (1 << 29) /* RC6-ish MCE keyboard/mouse */ | ||
21 | #define RC_TYPE_LIRC (1 << 30) /* Pass raw IR to lirc userspace */ | 22 | #define RC_TYPE_LIRC (1 << 30) /* Pass raw IR to lirc userspace */ |
22 | #define RC_TYPE_OTHER (1u << 31) | 23 | #define RC_TYPE_OTHER (1u << 31) |
23 | 24 | ||
24 | #define RC_TYPE_ALL (RC_TYPE_RC5 | RC_TYPE_NEC | RC_TYPE_RC6 | \ | 25 | #define RC_TYPE_ALL (RC_TYPE_RC5 | RC_TYPE_NEC | RC_TYPE_RC6 | \ |
25 | RC_TYPE_JVC | RC_TYPE_SONY | RC_TYPE_LIRC | \ | 26 | RC_TYPE_JVC | RC_TYPE_SONY | RC_TYPE_LIRC | \ |
26 | RC_TYPE_RC5_SZ | RC_TYPE_OTHER) | 27 | RC_TYPE_RC5_SZ | RC_TYPE_MCE_KBD | RC_TYPE_OTHER) |
27 | 28 | ||
28 | struct rc_map_table { | 29 | struct rc_map_table { |
29 | u32 scancode; | 30 | u32 scancode; |
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h index 80346a6d28a9..48413b410f15 100644 --- a/include/media/sh_mobile_ceu.h +++ b/include/media/sh_mobile_ceu.h | |||
@@ -7,10 +7,18 @@ | |||
7 | #define SH_CEU_FLAG_VSYNC_LOW (1 << 3) /* default High if possible */ | 7 | #define SH_CEU_FLAG_VSYNC_LOW (1 << 3) /* default High if possible */ |
8 | 8 | ||
9 | struct device; | 9 | struct device; |
10 | struct resource; | ||
11 | |||
12 | struct sh_mobile_ceu_companion { | ||
13 | u32 num_resources; | ||
14 | struct resource *resource; | ||
15 | int id; | ||
16 | void *platform_data; | ||
17 | }; | ||
10 | 18 | ||
11 | struct sh_mobile_ceu_info { | 19 | struct sh_mobile_ceu_info { |
12 | unsigned long flags; | 20 | unsigned long flags; |
13 | struct device *csi2_dev; | 21 | struct sh_mobile_ceu_companion *csi2; |
14 | }; | 22 | }; |
15 | 23 | ||
16 | #endif /* __ASM_SH_MOBILE_CEU_H__ */ | 24 | #endif /* __ASM_SH_MOBILE_CEU_H__ */ |
diff --git a/include/media/sh_mobile_csi2.h b/include/media/sh_mobile_csi2.h index 4d2615174461..c586c4f7f16b 100644 --- a/include/media/sh_mobile_csi2.h +++ b/include/media/sh_mobile_csi2.h | |||
@@ -11,6 +11,8 @@ | |||
11 | #ifndef SH_MIPI_CSI | 11 | #ifndef SH_MIPI_CSI |
12 | #define SH_MIPI_CSI | 12 | #define SH_MIPI_CSI |
13 | 13 | ||
14 | #include <linux/list.h> | ||
15 | |||
14 | enum sh_csi2_phy { | 16 | enum sh_csi2_phy { |
15 | SH_CSI2_PHY_MAIN, | 17 | SH_CSI2_PHY_MAIN, |
16 | SH_CSI2_PHY_SUB, | 18 | SH_CSI2_PHY_SUB, |
@@ -33,14 +35,14 @@ struct sh_csi2_client_config { | |||
33 | struct platform_device *pdev; /* client platform device */ | 35 | struct platform_device *pdev; /* client platform device */ |
34 | }; | 36 | }; |
35 | 37 | ||
38 | struct v4l2_device; | ||
39 | |||
36 | struct sh_csi2_pdata { | 40 | struct sh_csi2_pdata { |
37 | enum sh_csi2_type type; | 41 | enum sh_csi2_type type; |
38 | unsigned int flags; | 42 | unsigned int flags; |
39 | struct sh_csi2_client_config *clients; | 43 | struct sh_csi2_client_config *clients; |
40 | int num_clients; | 44 | int num_clients; |
45 | struct v4l2_device *v4l2_dev; | ||
41 | }; | 46 | }; |
42 | 47 | ||
43 | struct device; | ||
44 | struct v4l2_device; | ||
45 | |||
46 | #endif | 48 | #endif |
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index 238bd334fd83..7582952dceae 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h | |||
@@ -20,14 +20,15 @@ | |||
20 | #include <media/videobuf2-core.h> | 20 | #include <media/videobuf2-core.h> |
21 | #include <media/v4l2-device.h> | 21 | #include <media/v4l2-device.h> |
22 | 22 | ||
23 | extern struct bus_type soc_camera_bus_type; | ||
24 | |||
25 | struct file; | 23 | struct file; |
24 | struct soc_camera_link; | ||
26 | 25 | ||
27 | struct soc_camera_device { | 26 | struct soc_camera_device { |
28 | struct list_head list; | 27 | struct list_head list; /* list of all registered devices */ |
29 | struct device dev; | 28 | struct soc_camera_link *link; |
30 | struct device *pdev; /* Platform device */ | 29 | struct device *pdev; /* Platform device */ |
30 | struct device *parent; /* Camera host device */ | ||
31 | struct device *control; /* E.g., the i2c client */ | ||
31 | s32 user_width; | 32 | s32 user_width; |
32 | s32 user_height; | 33 | s32 user_height; |
33 | u32 bytesperline; /* for padding, zero if unused */ | 34 | u32 bytesperline; /* for padding, zero if unused */ |
@@ -66,8 +67,6 @@ struct soc_camera_host_ops { | |||
66 | struct module *owner; | 67 | struct module *owner; |
67 | int (*add)(struct soc_camera_device *); | 68 | int (*add)(struct soc_camera_device *); |
68 | void (*remove)(struct soc_camera_device *); | 69 | void (*remove)(struct soc_camera_device *); |
69 | int (*suspend)(struct soc_camera_device *, pm_message_t); | ||
70 | int (*resume)(struct soc_camera_device *); | ||
71 | /* | 70 | /* |
72 | * .get_formats() is called for each client device format, but | 71 | * .get_formats() is called for each client device format, but |
73 | * .put_formats() is only called once. Further, if any of the calls to | 72 | * .put_formats() is only called once. Further, if any of the calls to |
@@ -109,12 +108,6 @@ struct soc_camera_host_ops { | |||
109 | #define SOCAM_SENSOR_INVERT_HSYNC (1 << 2) | 108 | #define SOCAM_SENSOR_INVERT_HSYNC (1 << 2) |
110 | #define SOCAM_SENSOR_INVERT_VSYNC (1 << 3) | 109 | #define SOCAM_SENSOR_INVERT_VSYNC (1 << 3) |
111 | #define SOCAM_SENSOR_INVERT_DATA (1 << 4) | 110 | #define SOCAM_SENSOR_INVERT_DATA (1 << 4) |
112 | #define SOCAM_MIPI_1LANE (1 << 5) | ||
113 | #define SOCAM_MIPI_2LANE (1 << 6) | ||
114 | #define SOCAM_MIPI_3LANE (1 << 7) | ||
115 | #define SOCAM_MIPI_4LANE (1 << 8) | ||
116 | #define SOCAM_MIPI (SOCAM_MIPI_1LANE | SOCAM_MIPI_2LANE | \ | ||
117 | SOCAM_MIPI_3LANE | SOCAM_MIPI_4LANE) | ||
118 | 111 | ||
119 | struct i2c_board_info; | 112 | struct i2c_board_info; |
120 | struct regulator_bulk_data; | 113 | struct regulator_bulk_data; |
@@ -134,11 +127,11 @@ struct soc_camera_link { | |||
134 | int num_regulators; | 127 | int num_regulators; |
135 | 128 | ||
136 | /* | 129 | /* |
137 | * For non-I2C devices platform platform has to provide methods to | 130 | * For non-I2C devices platform has to provide methods to add a device |
138 | * add a device to the system and to remove | 131 | * to the system and to remove it |
139 | */ | 132 | */ |
140 | int (*add_device)(struct soc_camera_link *, struct device *); | 133 | int (*add_device)(struct soc_camera_device *); |
141 | void (*del_device)(struct soc_camera_link *); | 134 | void (*del_device)(struct soc_camera_device *); |
142 | /* Optional callbacks to power on or off and reset the sensor */ | 135 | /* Optional callbacks to power on or off and reset the sensor */ |
143 | int (*power)(struct device *, int); | 136 | int (*power)(struct device *, int); |
144 | int (*reset)(struct device *); | 137 | int (*reset)(struct device *); |
@@ -152,12 +145,6 @@ struct soc_camera_link { | |||
152 | void (*free_bus)(struct soc_camera_link *); | 145 | void (*free_bus)(struct soc_camera_link *); |
153 | }; | 146 | }; |
154 | 147 | ||
155 | static inline struct soc_camera_device *to_soc_camera_dev( | ||
156 | const struct device *dev) | ||
157 | { | ||
158 | return container_of(dev, struct soc_camera_device, dev); | ||
159 | } | ||
160 | |||
161 | static inline struct soc_camera_host *to_soc_camera_host( | 148 | static inline struct soc_camera_host *to_soc_camera_host( |
162 | const struct device *dev) | 149 | const struct device *dev) |
163 | { | 150 | { |
@@ -169,13 +156,13 @@ static inline struct soc_camera_host *to_soc_camera_host( | |||
169 | static inline struct soc_camera_link *to_soc_camera_link( | 156 | static inline struct soc_camera_link *to_soc_camera_link( |
170 | const struct soc_camera_device *icd) | 157 | const struct soc_camera_device *icd) |
171 | { | 158 | { |
172 | return icd->dev.platform_data; | 159 | return icd->link; |
173 | } | 160 | } |
174 | 161 | ||
175 | static inline struct device *to_soc_camera_control( | 162 | static inline struct device *to_soc_camera_control( |
176 | const struct soc_camera_device *icd) | 163 | const struct soc_camera_device *icd) |
177 | { | 164 | { |
178 | return dev_get_drvdata(&icd->dev); | 165 | return icd->control; |
179 | } | 166 | } |
180 | 167 | ||
181 | static inline struct v4l2_subdev *soc_camera_to_subdev( | 168 | static inline struct v4l2_subdev *soc_camera_to_subdev( |
@@ -207,11 +194,8 @@ struct soc_camera_format_xlate { | |||
207 | }; | 194 | }; |
208 | 195 | ||
209 | struct soc_camera_ops { | 196 | struct soc_camera_ops { |
210 | int (*suspend)(struct soc_camera_device *, pm_message_t state); | ||
211 | int (*resume)(struct soc_camera_device *); | ||
212 | unsigned long (*query_bus_param)(struct soc_camera_device *); | 197 | unsigned long (*query_bus_param)(struct soc_camera_device *); |
213 | int (*set_bus_param)(struct soc_camera_device *, unsigned long); | 198 | int (*set_bus_param)(struct soc_camera_device *, unsigned long); |
214 | int (*enum_input)(struct soc_camera_device *, struct v4l2_input *); | ||
215 | const struct v4l2_queryctrl *controls; | 199 | const struct v4l2_queryctrl *controls; |
216 | int num_controls; | 200 | int num_controls; |
217 | }; | 201 | }; |
@@ -270,6 +254,12 @@ static inline struct v4l2_queryctrl const *soc_camera_find_qctrl( | |||
270 | #define SOCAM_PCLK_SAMPLE_FALLING (1 << 13) | 254 | #define SOCAM_PCLK_SAMPLE_FALLING (1 << 13) |
271 | #define SOCAM_DATA_ACTIVE_HIGH (1 << 14) | 255 | #define SOCAM_DATA_ACTIVE_HIGH (1 << 14) |
272 | #define SOCAM_DATA_ACTIVE_LOW (1 << 15) | 256 | #define SOCAM_DATA_ACTIVE_LOW (1 << 15) |
257 | #define SOCAM_MIPI_1LANE (1 << 16) | ||
258 | #define SOCAM_MIPI_2LANE (1 << 17) | ||
259 | #define SOCAM_MIPI_3LANE (1 << 18) | ||
260 | #define SOCAM_MIPI_4LANE (1 << 19) | ||
261 | #define SOCAM_MIPI (SOCAM_MIPI_1LANE | SOCAM_MIPI_2LANE | \ | ||
262 | SOCAM_MIPI_3LANE | SOCAM_MIPI_4LANE) | ||
273 | 263 | ||
274 | #define SOCAM_DATAWIDTH_MASK (SOCAM_DATAWIDTH_4 | SOCAM_DATAWIDTH_8 | \ | 264 | #define SOCAM_DATAWIDTH_MASK (SOCAM_DATAWIDTH_4 | SOCAM_DATAWIDTH_8 | \ |
275 | SOCAM_DATAWIDTH_9 | SOCAM_DATAWIDTH_10 | \ | 265 | SOCAM_DATAWIDTH_9 | SOCAM_DATAWIDTH_10 | \ |
diff --git a/include/media/soc_camera_platform.h b/include/media/soc_camera_platform.h index 6d7a4fd00fc0..74f0fa15ca47 100644 --- a/include/media/soc_camera_platform.h +++ b/include/media/soc_camera_platform.h | |||
@@ -21,7 +21,7 @@ struct soc_camera_platform_info { | |||
21 | unsigned long format_depth; | 21 | unsigned long format_depth; |
22 | struct v4l2_mbus_framefmt format; | 22 | struct v4l2_mbus_framefmt format; |
23 | unsigned long bus_param; | 23 | unsigned long bus_param; |
24 | struct device *dev; | 24 | struct soc_camera_device *icd; |
25 | int (*set_capture)(struct soc_camera_platform_info *info, int enable); | 25 | int (*set_capture)(struct soc_camera_platform_info *info, int enable); |
26 | }; | 26 | }; |
27 | 27 | ||
@@ -30,8 +30,7 @@ static inline void soc_camera_platform_release(struct platform_device **pdev) | |||
30 | *pdev = NULL; | 30 | *pdev = NULL; |
31 | } | 31 | } |
32 | 32 | ||
33 | static inline int soc_camera_platform_add(const struct soc_camera_link *icl, | 33 | static inline int soc_camera_platform_add(struct soc_camera_device *icd, |
34 | struct device *dev, | ||
35 | struct platform_device **pdev, | 34 | struct platform_device **pdev, |
36 | struct soc_camera_link *plink, | 35 | struct soc_camera_link *plink, |
37 | void (*release)(struct device *dev), | 36 | void (*release)(struct device *dev), |
@@ -40,7 +39,7 @@ static inline int soc_camera_platform_add(const struct soc_camera_link *icl, | |||
40 | struct soc_camera_platform_info *info = plink->priv; | 39 | struct soc_camera_platform_info *info = plink->priv; |
41 | int ret; | 40 | int ret; |
42 | 41 | ||
43 | if (icl != plink) | 42 | if (icd->link != plink) |
44 | return -ENODEV; | 43 | return -ENODEV; |
45 | 44 | ||
46 | if (*pdev) | 45 | if (*pdev) |
@@ -50,7 +49,7 @@ static inline int soc_camera_platform_add(const struct soc_camera_link *icl, | |||
50 | if (!*pdev) | 49 | if (!*pdev) |
51 | return -ENOMEM; | 50 | return -ENOMEM; |
52 | 51 | ||
53 | info->dev = dev; | 52 | info->icd = icd; |
54 | 53 | ||
55 | (*pdev)->dev.platform_data = info; | 54 | (*pdev)->dev.platform_data = info; |
56 | (*pdev)->dev.release = release; | 55 | (*pdev)->dev.release = release; |
@@ -59,17 +58,17 @@ static inline int soc_camera_platform_add(const struct soc_camera_link *icl, | |||
59 | if (ret < 0) { | 58 | if (ret < 0) { |
60 | platform_device_put(*pdev); | 59 | platform_device_put(*pdev); |
61 | *pdev = NULL; | 60 | *pdev = NULL; |
62 | info->dev = NULL; | 61 | info->icd = NULL; |
63 | } | 62 | } |
64 | 63 | ||
65 | return ret; | 64 | return ret; |
66 | } | 65 | } |
67 | 66 | ||
68 | static inline void soc_camera_platform_del(const struct soc_camera_link *icl, | 67 | static inline void soc_camera_platform_del(const struct soc_camera_device *icd, |
69 | struct platform_device *pdev, | 68 | struct platform_device *pdev, |
70 | const struct soc_camera_link *plink) | 69 | const struct soc_camera_link *plink) |
71 | { | 70 | { |
72 | if (icl != plink || !pdev) | 71 | if (icd->link != plink || !pdev) |
73 | return; | 72 | return; |
74 | 73 | ||
75 | platform_device_unregister(pdev); | 74 | platform_device_unregister(pdev); |
diff --git a/include/media/timb_radio.h b/include/media/timb_radio.h index a59a84854dc1..a40a6a348d21 100644 --- a/include/media/timb_radio.h +++ b/include/media/timb_radio.h | |||
@@ -23,13 +23,8 @@ | |||
23 | 23 | ||
24 | struct timb_radio_platform_data { | 24 | struct timb_radio_platform_data { |
25 | int i2c_adapter; /* I2C adapter where the tuner and dsp are attached */ | 25 | int i2c_adapter; /* I2C adapter where the tuner and dsp are attached */ |
26 | struct { | 26 | struct i2c_board_info *tuner; |
27 | struct i2c_board_info *info; | 27 | struct i2c_board_info *dsp; |
28 | } tuner; | ||
29 | struct { | ||
30 | const char *module_name; | ||
31 | struct i2c_board_info *info; | ||
32 | } dsp; | ||
33 | }; | 28 | }; |
34 | 29 | ||
35 | #endif | 30 | #endif |
diff --git a/include/media/tuner.h b/include/media/tuner.h index 963e33471835..89c290b69a5c 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h | |||
@@ -127,6 +127,8 @@ | |||
127 | #define TUNER_PHILIPS_FMD1216MEX_MK3 78 | 127 | #define TUNER_PHILIPS_FMD1216MEX_MK3 78 |
128 | #define TUNER_PHILIPS_FM1216MK5 79 | 128 | #define TUNER_PHILIPS_FM1216MK5 79 |
129 | #define TUNER_PHILIPS_FQ1216LME_MK3 80 /* Active loopthrough, no FM */ | 129 | #define TUNER_PHILIPS_FQ1216LME_MK3 80 /* Active loopthrough, no FM */ |
130 | #define TUNER_XC4000 81 /* Xceive Silicon Tuner */ | ||
131 | |||
130 | #define TUNER_PARTSNIC_PTI_5NF05 81 | 132 | #define TUNER_PARTSNIC_PTI_5NF05 81 |
131 | #define TUNER_PHILIPS_CU1216L 82 | 133 | #define TUNER_PHILIPS_CU1216L 82 |
132 | #define TUNER_NXP_TDA18271 83 | 134 | #define TUNER_NXP_TDA18271 83 |
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h index b3edb67a8311..63fd9d3db296 100644 --- a/include/media/v4l2-chip-ident.h +++ b/include/media/v4l2-chip-ident.h | |||
@@ -76,6 +76,7 @@ enum { | |||
76 | V4L2_IDENT_OV6650 = 258, | 76 | V4L2_IDENT_OV6650 = 258, |
77 | V4L2_IDENT_OV2640 = 259, | 77 | V4L2_IDENT_OV2640 = 259, |
78 | V4L2_IDENT_OV9740 = 260, | 78 | V4L2_IDENT_OV9740 = 260, |
79 | V4L2_IDENT_OV5642 = 261, | ||
79 | 80 | ||
80 | /* module saa7146: reserved range 300-309 */ | 81 | /* module saa7146: reserved range 300-309 */ |
81 | V4L2_IDENT_SAA7146 = 300, | 82 | V4L2_IDENT_SAA7146 = 300, |
@@ -185,8 +186,9 @@ enum { | |||
185 | /* module wm8775: just ident 8775 */ | 186 | /* module wm8775: just ident 8775 */ |
186 | V4L2_IDENT_WM8775 = 8775, | 187 | V4L2_IDENT_WM8775 = 8775, |
187 | 188 | ||
188 | /* module cafe_ccic, just ident 8801 */ | 189 | /* Marvell controllers starting at 8801 */ |
189 | V4L2_IDENT_CAFE = 8801, | 190 | V4L2_IDENT_CAFE = 8801, |
191 | V4L2_IDENT_ARMADA610 = 8802, | ||
190 | 192 | ||
191 | /* AKM AK8813/AK8814 */ | 193 | /* AKM AK8813/AK8814 */ |
192 | V4L2_IDENT_AK8813 = 8813, | 194 | V4L2_IDENT_AK8813 = 8813, |
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 97d063837b61..13fe4d744aba 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h | |||
@@ -27,9 +27,12 @@ | |||
27 | 27 | ||
28 | /* forward references */ | 28 | /* forward references */ |
29 | struct v4l2_ctrl_handler; | 29 | struct v4l2_ctrl_handler; |
30 | struct v4l2_ctrl_helper; | ||
30 | struct v4l2_ctrl; | 31 | struct v4l2_ctrl; |
31 | struct video_device; | 32 | struct video_device; |
32 | struct v4l2_subdev; | 33 | struct v4l2_subdev; |
34 | struct v4l2_subscribed_event; | ||
35 | struct v4l2_fh; | ||
33 | 36 | ||
34 | /** struct v4l2_ctrl_ops - The control operations that the driver has to provide. | 37 | /** struct v4l2_ctrl_ops - The control operations that the driver has to provide. |
35 | * @g_volatile_ctrl: Get a new value for this control. Generally only relevant | 38 | * @g_volatile_ctrl: Get a new value for this control. Generally only relevant |
@@ -51,6 +54,7 @@ struct v4l2_ctrl_ops { | |||
51 | 54 | ||
52 | /** struct v4l2_ctrl - The control structure. | 55 | /** struct v4l2_ctrl - The control structure. |
53 | * @node: The list node. | 56 | * @node: The list node. |
57 | * @ev_subs: The list of control event subscriptions. | ||
54 | * @handler: The handler that owns the control. | 58 | * @handler: The handler that owns the control. |
55 | * @cluster: Point to start of cluster array. | 59 | * @cluster: Point to start of cluster array. |
56 | * @ncontrols: Number of controls in cluster array. | 60 | * @ncontrols: Number of controls in cluster array. |
@@ -65,6 +69,15 @@ struct v4l2_ctrl_ops { | |||
65 | * control's current value cannot be cached and needs to be | 69 | * control's current value cannot be cached and needs to be |
66 | * retrieved through the g_volatile_ctrl op. Drivers can set | 70 | * retrieved through the g_volatile_ctrl op. Drivers can set |
67 | * this flag. | 71 | * this flag. |
72 | * @is_auto: If set, then this control selects whether the other cluster | ||
73 | * members are in 'automatic' mode or 'manual' mode. This is | ||
74 | * used for autogain/gain type clusters. Drivers should never | ||
75 | * set this flag directly. | ||
76 | * @manual_mode_value: If the is_auto flag is set, then this is the value | ||
77 | * of the auto control that determines if that control is in | ||
78 | * manual mode. So if the value of the auto control equals this | ||
79 | * value, then the whole cluster is in manual mode. Drivers should | ||
80 | * never set this flag directly. | ||
68 | * @ops: The control ops. | 81 | * @ops: The control ops. |
69 | * @id: The control ID. | 82 | * @id: The control ID. |
70 | * @name: The control name. | 83 | * @name: The control name. |
@@ -97,6 +110,7 @@ struct v4l2_ctrl_ops { | |||
97 | struct v4l2_ctrl { | 110 | struct v4l2_ctrl { |
98 | /* Administrative fields */ | 111 | /* Administrative fields */ |
99 | struct list_head node; | 112 | struct list_head node; |
113 | struct list_head ev_subs; | ||
100 | struct v4l2_ctrl_handler *handler; | 114 | struct v4l2_ctrl_handler *handler; |
101 | struct v4l2_ctrl **cluster; | 115 | struct v4l2_ctrl **cluster; |
102 | unsigned ncontrols; | 116 | unsigned ncontrols; |
@@ -105,6 +119,8 @@ struct v4l2_ctrl { | |||
105 | unsigned int is_new:1; | 119 | unsigned int is_new:1; |
106 | unsigned int is_private:1; | 120 | unsigned int is_private:1; |
107 | unsigned int is_volatile:1; | 121 | unsigned int is_volatile:1; |
122 | unsigned int is_auto:1; | ||
123 | unsigned int manual_mode_value:8; | ||
108 | 124 | ||
109 | const struct v4l2_ctrl_ops *ops; | 125 | const struct v4l2_ctrl_ops *ops; |
110 | u32 id; | 126 | u32 id; |
@@ -134,6 +150,7 @@ struct v4l2_ctrl { | |||
134 | * @node: List node for the sorted list. | 150 | * @node: List node for the sorted list. |
135 | * @next: Single-link list node for the hash. | 151 | * @next: Single-link list node for the hash. |
136 | * @ctrl: The actual control information. | 152 | * @ctrl: The actual control information. |
153 | * @helper: Pointer to helper struct. Used internally in prepare_ext_ctrls(). | ||
137 | * | 154 | * |
138 | * Each control handler has a list of these refs. The list_head is used to | 155 | * Each control handler has a list of these refs. The list_head is used to |
139 | * keep a sorted-by-control-ID list of all controls, while the next pointer | 156 | * keep a sorted-by-control-ID list of all controls, while the next pointer |
@@ -143,6 +160,7 @@ struct v4l2_ctrl_ref { | |||
143 | struct list_head node; | 160 | struct list_head node; |
144 | struct v4l2_ctrl_ref *next; | 161 | struct v4l2_ctrl_ref *next; |
145 | struct v4l2_ctrl *ctrl; | 162 | struct v4l2_ctrl *ctrl; |
163 | struct v4l2_ctrl_helper *helper; | ||
146 | }; | 164 | }; |
147 | 165 | ||
148 | /** struct v4l2_ctrl_handler - The control handler keeps track of all the | 166 | /** struct v4l2_ctrl_handler - The control handler keeps track of all the |
@@ -363,6 +381,40 @@ int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl, | |||
363 | void v4l2_ctrl_cluster(unsigned ncontrols, struct v4l2_ctrl **controls); | 381 | void v4l2_ctrl_cluster(unsigned ncontrols, struct v4l2_ctrl **controls); |
364 | 382 | ||
365 | 383 | ||
384 | /** v4l2_ctrl_auto_cluster() - Mark all controls in the cluster as belonging to | ||
385 | * that cluster and set it up for autofoo/foo-type handling. | ||
386 | * @ncontrols: The number of controls in this cluster. | ||
387 | * @controls: The cluster control array of size @ncontrols. The first control | ||
388 | * must be the 'auto' control (e.g. autogain, autoexposure, etc.) | ||
389 | * @manual_val: The value for the first control in the cluster that equals the | ||
390 | * manual setting. | ||
391 | * @set_volatile: If true, then all controls except the first auto control will | ||
392 | * have is_volatile set to true. If false, then is_volatile will not | ||
393 | * be touched. | ||
394 | * | ||
395 | * Use for control groups where one control selects some automatic feature and | ||
396 | * the other controls are only active whenever the automatic feature is turned | ||
397 | * off (manual mode). Typical examples: autogain vs gain, auto-whitebalance vs | ||
398 | * red and blue balance, etc. | ||
399 | * | ||
400 | * The behavior of such controls is as follows: | ||
401 | * | ||
402 | * When the autofoo control is set to automatic, then any manual controls | ||
403 | * are set to inactive and any reads will call g_volatile_ctrl (if the control | ||
404 | * was marked volatile). | ||
405 | * | ||
406 | * When the autofoo control is set to manual, then any manual controls will | ||
407 | * be marked active, and any reads will just return the current value without | ||
408 | * going through g_volatile_ctrl. | ||
409 | * | ||
410 | * In addition, this function will set the V4L2_CTRL_FLAG_UPDATE flag | ||
411 | * on the autofoo control and V4L2_CTRL_FLAG_INACTIVE on the foo control(s) | ||
412 | * if autofoo is in auto mode. | ||
413 | */ | ||
414 | void v4l2_ctrl_auto_cluster(unsigned ncontrols, struct v4l2_ctrl **controls, | ||
415 | u8 manual_val, bool set_volatile); | ||
416 | |||
417 | |||
366 | /** v4l2_ctrl_find() - Find a control with the given ID. | 418 | /** v4l2_ctrl_find() - Find a control with the given ID. |
367 | * @hdl: The control handler. | 419 | * @hdl: The control handler. |
368 | * @id: The control ID to find. | 420 | * @id: The control ID to find. |
@@ -379,9 +431,9 @@ struct v4l2_ctrl *v4l2_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id); | |||
379 | * This sets or clears the V4L2_CTRL_FLAG_INACTIVE flag atomically. | 431 | * This sets or clears the V4L2_CTRL_FLAG_INACTIVE flag atomically. |
380 | * Does nothing if @ctrl == NULL. | 432 | * Does nothing if @ctrl == NULL. |
381 | * This will usually be called from within the s_ctrl op. | 433 | * This will usually be called from within the s_ctrl op. |
434 | * The V4L2_EVENT_CTRL event will be generated afterwards. | ||
382 | * | 435 | * |
383 | * This function can be called regardless of whether the control handler | 436 | * This function assumes that the control handler is locked. |
384 | * is locked or not. | ||
385 | */ | 437 | */ |
386 | void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active); | 438 | void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active); |
387 | 439 | ||
@@ -391,11 +443,12 @@ void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active); | |||
391 | * | 443 | * |
392 | * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically. | 444 | * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically. |
393 | * Does nothing if @ctrl == NULL. | 445 | * Does nothing if @ctrl == NULL. |
446 | * The V4L2_EVENT_CTRL event will be generated afterwards. | ||
394 | * This will usually be called when starting or stopping streaming in the | 447 | * This will usually be called when starting or stopping streaming in the |
395 | * driver. | 448 | * driver. |
396 | * | 449 | * |
397 | * This function can be called regardless of whether the control handler | 450 | * This function assumes that the control handler is not locked and will |
398 | * is locked or not. | 451 | * take the lock itself. |
399 | */ | 452 | */ |
400 | void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed); | 453 | void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed); |
401 | 454 | ||
@@ -440,15 +493,22 @@ s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl); | |||
440 | */ | 493 | */ |
441 | int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val); | 494 | int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val); |
442 | 495 | ||
496 | /* Internal helper functions that deal with control events. */ | ||
497 | void v4l2_ctrl_add_event(struct v4l2_ctrl *ctrl, | ||
498 | struct v4l2_subscribed_event *sev); | ||
499 | void v4l2_ctrl_del_event(struct v4l2_ctrl *ctrl, | ||
500 | struct v4l2_subscribed_event *sev); | ||
443 | 501 | ||
444 | /* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */ | 502 | /* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */ |
445 | int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc); | 503 | int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc); |
446 | int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm); | 504 | int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm); |
447 | int v4l2_g_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl); | 505 | int v4l2_g_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl); |
448 | int v4l2_s_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl); | 506 | int v4l2_s_ctrl(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl, |
507 | struct v4l2_control *ctrl); | ||
449 | int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c); | 508 | int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c); |
450 | int v4l2_try_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c); | 509 | int v4l2_try_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c); |
451 | int v4l2_s_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c); | 510 | int v4l2_s_ext_ctrls(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl, |
511 | struct v4l2_ext_controls *c); | ||
452 | 512 | ||
453 | /* Helpers for subdevices. If the associated ctrl_handler == NULL then they | 513 | /* Helpers for subdevices. If the associated ctrl_handler == NULL then they |
454 | will all return -EINVAL. */ | 514 | will all return -EINVAL. */ |
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index 93e96fb93452..c7c40f1d2624 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h | |||
@@ -128,8 +128,8 @@ struct video_device | |||
128 | struct mutex *lock; | 128 | struct mutex *lock; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | #define media_entity_to_video_device(entity) \ | 131 | #define media_entity_to_video_device(__e) \ |
132 | container_of(entity, struct video_device, entity) | 132 | container_of(__e, struct video_device, entity) |
133 | /* dev to video-device */ | 133 | /* dev to video-device */ |
134 | #define to_video_device(cd) container_of(cd, struct video_device, dev) | 134 | #define to_video_device(cd) container_of(cd, struct video_device, dev) |
135 | 135 | ||
diff --git a/include/media/v4l2-event.h b/include/media/v4l2-event.h index 3b86177c8cd2..5f14e8895ce2 100644 --- a/include/media/v4l2-event.h +++ b/include/media/v4l2-event.h | |||
@@ -29,39 +29,95 @@ | |||
29 | #include <linux/videodev2.h> | 29 | #include <linux/videodev2.h> |
30 | #include <linux/wait.h> | 30 | #include <linux/wait.h> |
31 | 31 | ||
32 | /* | ||
33 | * Overview: | ||
34 | * | ||
35 | * Events are subscribed per-filehandle. An event specification consists of a | ||
36 | * type and is optionally associated with an object identified through the | ||
37 | * 'id' field. So an event is uniquely identified by the (type, id) tuple. | ||
38 | * | ||
39 | * The v4l2-fh struct has a list of subscribed events. The v4l2_subscribed_event | ||
40 | * struct is added to that list, one for every subscribed event. | ||
41 | * | ||
42 | * Each v4l2_subscribed_event struct ends with an array of v4l2_kevent structs. | ||
43 | * This array (ringbuffer, really) is used to store any events raised by the | ||
44 | * driver. The v4l2_kevent struct links into the 'available' list of the | ||
45 | * v4l2_fh struct so VIDIOC_DQEVENT will know which event to dequeue first. | ||
46 | * | ||
47 | * Finally, if the event subscription is associated with a particular object | ||
48 | * such as a V4L2 control, then that object needs to know about that as well | ||
49 | * so that an event can be raised by that object. So the 'node' field can | ||
50 | * be used to link the v4l2_subscribed_event struct into a list of that | ||
51 | * object. | ||
52 | * | ||
53 | * So to summarize: | ||
54 | * | ||
55 | * struct v4l2_fh has two lists: one of the subscribed events, and one of the | ||
56 | * pending events. | ||
57 | * | ||
58 | * struct v4l2_subscribed_event has a ringbuffer of raised (pending) events of | ||
59 | * that particular type. | ||
60 | * | ||
61 | * If struct v4l2_subscribed_event is associated with a specific object, then | ||
62 | * that object will have an internal list of struct v4l2_subscribed_event so | ||
63 | * it knows who subscribed an event to that object. | ||
64 | */ | ||
65 | |||
32 | struct v4l2_fh; | 66 | struct v4l2_fh; |
67 | struct v4l2_subscribed_event; | ||
33 | struct video_device; | 68 | struct video_device; |
34 | 69 | ||
70 | /** struct v4l2_kevent - Internal kernel event struct. | ||
71 | * @list: List node for the v4l2_fh->available list. | ||
72 | * @sev: Pointer to parent v4l2_subscribed_event. | ||
73 | * @event: The event itself. | ||
74 | */ | ||
35 | struct v4l2_kevent { | 75 | struct v4l2_kevent { |
36 | struct list_head list; | 76 | struct list_head list; |
77 | struct v4l2_subscribed_event *sev; | ||
37 | struct v4l2_event event; | 78 | struct v4l2_event event; |
38 | }; | 79 | }; |
39 | 80 | ||
81 | /** struct v4l2_subscribed_event - Internal struct representing a subscribed event. | ||
82 | * @list: List node for the v4l2_fh->subscribed list. | ||
83 | * @type: Event type. | ||
84 | * @id: Associated object ID (e.g. control ID). 0 if there isn't any. | ||
85 | * @flags: Copy of v4l2_event_subscription->flags. | ||
86 | * @fh: Filehandle that subscribed to this event. | ||
87 | * @node: List node that hooks into the object's event list (if there is one). | ||
88 | * @replace: Optional callback that can replace event 'old' with event 'new'. | ||
89 | * @merge: Optional callback that can merge event 'old' into event 'new'. | ||
90 | * @elems: The number of elements in the events array. | ||
91 | * @first: The index of the events containing the oldest available event. | ||
92 | * @in_use: The number of queued events. | ||
93 | * @events: An array of @elems events. | ||
94 | */ | ||
40 | struct v4l2_subscribed_event { | 95 | struct v4l2_subscribed_event { |
41 | struct list_head list; | 96 | struct list_head list; |
42 | u32 type; | 97 | u32 type; |
98 | u32 id; | ||
99 | u32 flags; | ||
100 | struct v4l2_fh *fh; | ||
101 | struct list_head node; | ||
102 | void (*replace)(struct v4l2_event *old, | ||
103 | const struct v4l2_event *new); | ||
104 | void (*merge)(const struct v4l2_event *old, | ||
105 | struct v4l2_event *new); | ||
106 | unsigned elems; | ||
107 | unsigned first; | ||
108 | unsigned in_use; | ||
109 | struct v4l2_kevent events[]; | ||
43 | }; | 110 | }; |
44 | 111 | ||
45 | struct v4l2_events { | ||
46 | wait_queue_head_t wait; | ||
47 | struct list_head subscribed; /* Subscribed events */ | ||
48 | struct list_head free; /* Events ready for use */ | ||
49 | struct list_head available; /* Dequeueable event */ | ||
50 | unsigned int navailable; | ||
51 | unsigned int nallocated; /* Number of allocated events */ | ||
52 | u32 sequence; | ||
53 | }; | ||
54 | |||
55 | int v4l2_event_init(struct v4l2_fh *fh); | ||
56 | int v4l2_event_alloc(struct v4l2_fh *fh, unsigned int n); | ||
57 | void v4l2_event_free(struct v4l2_fh *fh); | ||
58 | int v4l2_event_dequeue(struct v4l2_fh *fh, struct v4l2_event *event, | 112 | int v4l2_event_dequeue(struct v4l2_fh *fh, struct v4l2_event *event, |
59 | int nonblocking); | 113 | int nonblocking); |
60 | void v4l2_event_queue(struct video_device *vdev, const struct v4l2_event *ev); | 114 | void v4l2_event_queue(struct video_device *vdev, const struct v4l2_event *ev); |
115 | void v4l2_event_queue_fh(struct v4l2_fh *fh, const struct v4l2_event *ev); | ||
61 | int v4l2_event_pending(struct v4l2_fh *fh); | 116 | int v4l2_event_pending(struct v4l2_fh *fh); |
62 | int v4l2_event_subscribe(struct v4l2_fh *fh, | 117 | int v4l2_event_subscribe(struct v4l2_fh *fh, |
63 | struct v4l2_event_subscription *sub); | 118 | struct v4l2_event_subscription *sub, unsigned elems); |
64 | int v4l2_event_unsubscribe(struct v4l2_fh *fh, | 119 | int v4l2_event_unsubscribe(struct v4l2_fh *fh, |
65 | struct v4l2_event_subscription *sub); | 120 | struct v4l2_event_subscription *sub); |
121 | void v4l2_event_unsubscribe_all(struct v4l2_fh *fh); | ||
66 | 122 | ||
67 | #endif /* V4L2_EVENT_H */ | 123 | #endif /* V4L2_EVENT_H */ |
diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h index 0206aa55be24..52513c225c18 100644 --- a/include/media/v4l2-fh.h +++ b/include/media/v4l2-fh.h | |||
@@ -29,13 +29,20 @@ | |||
29 | #include <linux/list.h> | 29 | #include <linux/list.h> |
30 | 30 | ||
31 | struct video_device; | 31 | struct video_device; |
32 | struct v4l2_events; | 32 | struct v4l2_ctrl_handler; |
33 | 33 | ||
34 | struct v4l2_fh { | 34 | struct v4l2_fh { |
35 | struct list_head list; | 35 | struct list_head list; |
36 | struct video_device *vdev; | 36 | struct video_device *vdev; |
37 | struct v4l2_events *events; /* events, pending and subscribed */ | 37 | struct v4l2_ctrl_handler *ctrl_handler; |
38 | enum v4l2_priority prio; | 38 | enum v4l2_priority prio; |
39 | |||
40 | /* Events */ | ||
41 | wait_queue_head_t wait; | ||
42 | struct list_head subscribed; /* Subscribed events */ | ||
43 | struct list_head available; /* Dequeueable event */ | ||
44 | unsigned int navailable; | ||
45 | u32 sequence; | ||
39 | }; | 46 | }; |
40 | 47 | ||
41 | /* | 48 | /* |
@@ -44,7 +51,7 @@ struct v4l2_fh { | |||
44 | * from driver's v4l2_file_operations->open() handler if the driver | 51 | * from driver's v4l2_file_operations->open() handler if the driver |
45 | * uses v4l2_fh. | 52 | * uses v4l2_fh. |
46 | */ | 53 | */ |
47 | int v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev); | 54 | void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev); |
48 | /* | 55 | /* |
49 | * Add the fh to the list of file handles on a video_device. The file | 56 | * Add the fh to the list of file handles on a video_device. The file |
50 | * handle must be initialised first. | 57 | * handle must be initialised first. |
diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h index 971c7fa29614..6114007c8c74 100644 --- a/include/media/v4l2-mediabus.h +++ b/include/media/v4l2-mediabus.h | |||
@@ -13,6 +13,69 @@ | |||
13 | 13 | ||
14 | #include <linux/v4l2-mediabus.h> | 14 | #include <linux/v4l2-mediabus.h> |
15 | 15 | ||
16 | /* Parallel flags */ | ||
17 | /* | ||
18 | * Can the client run in master or in slave mode. By "Master mode" an operation | ||
19 | * mode is meant, when the client (e.g., a camera sensor) is producing | ||
20 | * horizontal and vertical synchronisation. In "Slave mode" the host is | ||
21 | * providing these signals to the slave. | ||
22 | */ | ||
23 | #define V4L2_MBUS_MASTER (1 << 0) | ||
24 | #define V4L2_MBUS_SLAVE (1 << 1) | ||
25 | /* Which signal polarities it supports */ | ||
26 | /* Note: in BT.656 mode HSYNC and VSYNC are unused */ | ||
27 | #define V4L2_MBUS_HSYNC_ACTIVE_HIGH (1 << 2) | ||
28 | #define V4L2_MBUS_HSYNC_ACTIVE_LOW (1 << 3) | ||
29 | #define V4L2_MBUS_VSYNC_ACTIVE_HIGH (1 << 4) | ||
30 | #define V4L2_MBUS_VSYNC_ACTIVE_LOW (1 << 5) | ||
31 | #define V4L2_MBUS_PCLK_SAMPLE_RISING (1 << 6) | ||
32 | #define V4L2_MBUS_PCLK_SAMPLE_FALLING (1 << 7) | ||
33 | #define V4L2_MBUS_DATA_ACTIVE_HIGH (1 << 8) | ||
34 | #define V4L2_MBUS_DATA_ACTIVE_LOW (1 << 9) | ||
35 | |||
36 | /* Serial flags */ | ||
37 | /* How many lanes the client can use */ | ||
38 | #define V4L2_MBUS_CSI2_1_LANE (1 << 0) | ||
39 | #define V4L2_MBUS_CSI2_2_LANE (1 << 1) | ||
40 | #define V4L2_MBUS_CSI2_3_LANE (1 << 2) | ||
41 | #define V4L2_MBUS_CSI2_4_LANE (1 << 3) | ||
42 | /* On which channels it can send video data */ | ||
43 | #define V4L2_MBUS_CSI2_CHANNEL_0 (1 << 4) | ||
44 | #define V4L2_MBUS_CSI2_CHANNEL_1 (1 << 5) | ||
45 | #define V4L2_MBUS_CSI2_CHANNEL_2 (1 << 6) | ||
46 | #define V4L2_MBUS_CSI2_CHANNEL_3 (1 << 7) | ||
47 | /* Does it support only continuous or also non-continuous clock mode */ | ||
48 | #define V4L2_MBUS_CSI2_CONTINUOUS_CLOCK (1 << 8) | ||
49 | #define V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK (1 << 9) | ||
50 | |||
51 | #define V4L2_MBUS_CSI2_LANES (V4L2_MBUS_CSI2_1_LANE | V4L2_MBUS_CSI2_2_LANE | \ | ||
52 | V4L2_MBUS_CSI2_3_LANE | V4L2_MBUS_CSI2_4_LANE) | ||
53 | #define V4L2_MBUS_CSI2_CHANNELS (V4L2_MBUS_CSI2_CHANNEL_0 | V4L2_MBUS_CSI2_CHANNEL_1 | \ | ||
54 | V4L2_MBUS_CSI2_CHANNEL_2 | V4L2_MBUS_CSI2_CHANNEL_3) | ||
55 | |||
56 | /** | ||
57 | * v4l2_mbus_type - media bus type | ||
58 | * @V4L2_MBUS_PARALLEL: parallel interface with hsync and vsync | ||
59 | * @V4L2_MBUS_BT656: parallel interface with embedded synchronisation, can | ||
60 | * also be used for BT.1120 | ||
61 | * @V4L2_MBUS_CSI2: MIPI CSI-2 serial interface | ||
62 | */ | ||
63 | enum v4l2_mbus_type { | ||
64 | V4L2_MBUS_PARALLEL, | ||
65 | V4L2_MBUS_BT656, | ||
66 | V4L2_MBUS_CSI2, | ||
67 | }; | ||
68 | |||
69 | /** | ||
70 | * v4l2_mbus_config - media bus configuration | ||
71 | * @type: in: interface type | ||
72 | * @flags: in / out: configuration flags, depending on @type | ||
73 | */ | ||
74 | struct v4l2_mbus_config { | ||
75 | enum v4l2_mbus_type type; | ||
76 | unsigned int flags; | ||
77 | }; | ||
78 | |||
16 | static inline void v4l2_fill_pix_format(struct v4l2_pix_format *pix_fmt, | 79 | static inline void v4l2_fill_pix_format(struct v4l2_pix_format *pix_fmt, |
17 | const struct v4l2_mbus_framefmt *mbus_fmt) | 80 | const struct v4l2_mbus_framefmt *mbus_fmt) |
18 | { | 81 | { |
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 1562c4ff3a65..257da1a30f66 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h | |||
@@ -173,16 +173,20 @@ struct v4l2_subdev_core_ops { | |||
173 | struct v4l2_event_subscription *sub); | 173 | struct v4l2_event_subscription *sub); |
174 | }; | 174 | }; |
175 | 175 | ||
176 | /* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. | 176 | /* s_radio: v4l device was opened in radio mode. |
177 | 177 | ||
178 | s_radio: v4l device was opened in Radio mode, to be replaced by s_mode. | 178 | g_frequency: freq->type must be filled in. Normally done by video_ioctl2 |
179 | or the bridge driver. | ||
180 | |||
181 | g_tuner: | ||
182 | s_tuner: vt->type must be filled in. Normally done by video_ioctl2 or the | ||
183 | bridge driver. | ||
179 | 184 | ||
180 | s_type_addr: sets tuner type and its I2C addr. | 185 | s_type_addr: sets tuner type and its I2C addr. |
181 | 186 | ||
182 | s_config: sets tda9887 specific stuff, like port1, port2 and qss | 187 | s_config: sets tda9887 specific stuff, like port1, port2 and qss |
183 | */ | 188 | */ |
184 | struct v4l2_subdev_tuner_ops { | 189 | struct v4l2_subdev_tuner_ops { |
185 | int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type); | ||
186 | int (*s_radio)(struct v4l2_subdev *sd); | 190 | int (*s_radio)(struct v4l2_subdev *sd); |
187 | int (*s_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq); | 191 | int (*s_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq); |
188 | int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq); | 192 | int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq); |
@@ -225,6 +229,12 @@ struct v4l2_subdev_audio_ops { | |||
225 | s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by | 229 | s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by |
226 | video input devices. | 230 | video input devices. |
227 | 231 | ||
232 | g_std_output: get current standard for video OUTPUT devices. This is ignored | ||
233 | by video input devices. | ||
234 | |||
235 | g_tvnorms_output: get v4l2_std_id with all standards supported by video | ||
236 | OUTPUT device. This is ignored by video input devices. | ||
237 | |||
228 | s_crystal_freq: sets the frequency of the crystal used to generate the | 238 | s_crystal_freq: sets the frequency of the crystal used to generate the |
229 | clocks in Hz. An extra flags field allows device specific configuration | 239 | clocks in Hz. An extra flags field allows device specific configuration |
230 | regarding clock frequency dividers, etc. If not used, then set flags | 240 | regarding clock frequency dividers, etc. If not used, then set flags |
@@ -239,6 +249,8 @@ struct v4l2_subdev_audio_ops { | |||
239 | s_dv_preset: set dv (Digital Video) preset in the sub device. Similar to | 249 | s_dv_preset: set dv (Digital Video) preset in the sub device. Similar to |
240 | s_std() | 250 | s_std() |
241 | 251 | ||
252 | g_dv_preset: get current dv (Digital Video) preset in the sub device. | ||
253 | |||
242 | query_dv_preset: query dv preset in the sub device. This is similar to | 254 | query_dv_preset: query dv preset in the sub device. This is similar to |
243 | querystd() | 255 | querystd() |
244 | 256 | ||
@@ -255,12 +267,20 @@ struct v4l2_subdev_audio_ops { | |||
255 | try_mbus_fmt: try to set a pixel format on a video data source | 267 | try_mbus_fmt: try to set a pixel format on a video data source |
256 | 268 | ||
257 | s_mbus_fmt: set a pixel format on a video data source | 269 | s_mbus_fmt: set a pixel format on a video data source |
270 | |||
271 | g_mbus_config: get supported mediabus configurations | ||
272 | |||
273 | s_mbus_config: set a certain mediabus configuration. This operation is added | ||
274 | for compatibility with soc-camera drivers and should not be used by new | ||
275 | software. | ||
258 | */ | 276 | */ |
259 | struct v4l2_subdev_video_ops { | 277 | struct v4l2_subdev_video_ops { |
260 | int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); | 278 | int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); |
261 | int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags); | 279 | int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags); |
262 | int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std); | 280 | int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std); |
281 | int (*g_std_output)(struct v4l2_subdev *sd, v4l2_std_id *std); | ||
263 | int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std); | 282 | int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std); |
283 | int (*g_tvnorms_output)(struct v4l2_subdev *sd, v4l2_std_id *std); | ||
264 | int (*g_input_status)(struct v4l2_subdev *sd, u32 *status); | 284 | int (*g_input_status)(struct v4l2_subdev *sd, u32 *status); |
265 | int (*s_stream)(struct v4l2_subdev *sd, int enable); | 285 | int (*s_stream)(struct v4l2_subdev *sd, int enable); |
266 | int (*cropcap)(struct v4l2_subdev *sd, struct v4l2_cropcap *cc); | 286 | int (*cropcap)(struct v4l2_subdev *sd, struct v4l2_cropcap *cc); |
@@ -278,6 +298,8 @@ struct v4l2_subdev_video_ops { | |||
278 | struct v4l2_dv_enum_preset *preset); | 298 | struct v4l2_dv_enum_preset *preset); |
279 | int (*s_dv_preset)(struct v4l2_subdev *sd, | 299 | int (*s_dv_preset)(struct v4l2_subdev *sd, |
280 | struct v4l2_dv_preset *preset); | 300 | struct v4l2_dv_preset *preset); |
301 | int (*g_dv_preset)(struct v4l2_subdev *sd, | ||
302 | struct v4l2_dv_preset *preset); | ||
281 | int (*query_dv_preset)(struct v4l2_subdev *sd, | 303 | int (*query_dv_preset)(struct v4l2_subdev *sd, |
282 | struct v4l2_dv_preset *preset); | 304 | struct v4l2_dv_preset *preset); |
283 | int (*s_dv_timings)(struct v4l2_subdev *sd, | 305 | int (*s_dv_timings)(struct v4l2_subdev *sd, |
@@ -294,6 +316,10 @@ struct v4l2_subdev_video_ops { | |||
294 | struct v4l2_mbus_framefmt *fmt); | 316 | struct v4l2_mbus_framefmt *fmt); |
295 | int (*s_mbus_fmt)(struct v4l2_subdev *sd, | 317 | int (*s_mbus_fmt)(struct v4l2_subdev *sd, |
296 | struct v4l2_mbus_framefmt *fmt); | 318 | struct v4l2_mbus_framefmt *fmt); |
319 | int (*g_mbus_config)(struct v4l2_subdev *sd, | ||
320 | struct v4l2_mbus_config *cfg); | ||
321 | int (*s_mbus_config)(struct v4l2_subdev *sd, | ||
322 | const struct v4l2_mbus_config *cfg); | ||
297 | }; | 323 | }; |
298 | 324 | ||
299 | /* | 325 | /* |
@@ -509,8 +535,6 @@ struct v4l2_subdev { | |||
509 | void *host_priv; | 535 | void *host_priv; |
510 | /* subdev device node */ | 536 | /* subdev device node */ |
511 | struct video_device devnode; | 537 | struct video_device devnode; |
512 | /* number of events to be allocated on open */ | ||
513 | unsigned int nevents; | ||
514 | }; | 538 | }; |
515 | 539 | ||
516 | #define media_entity_to_v4l2_subdev(ent) \ | 540 | #define media_entity_to_v4l2_subdev(ent) \ |