]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - include/media/davinci/vpbe.h
Merge branches 'for-4.11/upstream-fixes', 'for-4.12/accutouch', 'for-4.12/cp2112...
[mirror_ubuntu-artful-kernel.git] / include / media / davinci / vpbe.h
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 #ifndef _VPBE_H
14 #define _VPBE_H
15
16 #include <linux/videodev2.h>
17 #include <linux/i2c.h>
18
19 #include <media/v4l2-dev.h>
20 #include <media/v4l2-ioctl.h>
21 #include <media/v4l2-device.h>
22 #include <media/davinci/vpbe_osd.h>
23 #include <media/davinci/vpbe_venc.h>
24 #include <media/davinci/vpbe_types.h>
25
26 /* OSD configuration info */
27 struct osd_config_info {
28 char module_name[32];
29 };
30
31 struct vpbe_output {
32 struct v4l2_output output;
33 /*
34 * If output capabilities include dv_timings, list supported timings
35 * below
36 */
37 char *subdev_name;
38 /*
39 * defualt_mode identifies the default timings set at the venc or
40 * external encoder.
41 */
42 char *default_mode;
43 /*
44 * Fields below are used for supporting multiple modes. For example,
45 * LCD panel might support different modes and they are listed here.
46 * Similarly for supporting external encoders, lcd controller port
47 * requires a set of non-standard timing values to be listed here for
48 * each supported mode since venc is used in non-standard timing mode
49 * for interfacing with external encoder similar to configuring lcd
50 * panel timings
51 */
52 unsigned int num_modes;
53 struct vpbe_enc_mode_info *modes;
54 /*
55 * Bus configuration goes here for external encoders. Some encoders
56 * may require multiple interface types for each of the output. For
57 * example, SD modes would use YCC8 where as HD mode would use YCC16.
58 * Not sure if this is needed on a per mode basis instead of per
59 * output basis. If per mode is needed, we may have to move this to
60 * mode_info structure
61 */
62 u32 if_params;
63 };
64
65 /* encoder configuration info */
66 struct encoder_config_info {
67 char module_name[32];
68 /* Is this an i2c device ? */
69 unsigned int is_i2c:1;
70 /* i2c subdevice board info */
71 struct i2c_board_info board_info;
72 };
73
74 /*amplifier configuration info */
75 struct amp_config_info {
76 char module_name[32];
77 /* Is this an i2c device ? */
78 unsigned int is_i2c:1;
79 /* i2c subdevice board info */
80 struct i2c_board_info board_info;
81 };
82
83 /* structure for defining vpbe display subsystem components */
84 struct vpbe_config {
85 char module_name[32];
86 /* i2c bus adapter no */
87 int i2c_adapter_id;
88 struct osd_config_info osd;
89 struct encoder_config_info venc;
90 /* external encoder information goes here */
91 int num_ext_encoders;
92 struct encoder_config_info *ext_encoders;
93 /* amplifier information goes here */
94 struct amp_config_info *amp;
95 int num_outputs;
96 /* Order is venc outputs followed by LCD and then external encoders */
97 struct vpbe_output *outputs;
98 };
99
100 struct vpbe_device;
101
102 struct vpbe_device_ops {
103 /* crop cap for the display */
104 int (*g_cropcap)(struct vpbe_device *vpbe_dev,
105 struct v4l2_cropcap *cropcap);
106
107 /* Enumerate the outputs */
108 int (*enum_outputs)(struct vpbe_device *vpbe_dev,
109 struct v4l2_output *output);
110
111 /* Set output to the given index */
112 int (*set_output)(struct vpbe_device *vpbe_dev,
113 int index);
114
115 /* Get current output */
116 unsigned int (*get_output)(struct vpbe_device *vpbe_dev);
117
118 /* Set DV preset at current output */
119 int (*s_dv_timings)(struct vpbe_device *vpbe_dev,
120 struct v4l2_dv_timings *dv_timings);
121
122 /* Get DV presets supported at the output */
123 int (*g_dv_timings)(struct vpbe_device *vpbe_dev,
124 struct v4l2_dv_timings *dv_timings);
125
126 /* Enumerate the DV Presets supported at the output */
127 int (*enum_dv_timings)(struct vpbe_device *vpbe_dev,
128 struct v4l2_enum_dv_timings *timings_info);
129
130 /* Set std at the output */
131 int (*s_std)(struct vpbe_device *vpbe_dev, v4l2_std_id std_id);
132
133 /* Get the current std at the output */
134 int (*g_std)(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id);
135
136 /* initialize the device */
137 int (*initialize)(struct device *dev, struct vpbe_device *vpbe_dev);
138
139 /* De-initialize the device */
140 void (*deinitialize)(struct device *dev, struct vpbe_device *vpbe_dev);
141
142 /* Get the current mode info */
143 int (*get_mode_info)(struct vpbe_device *vpbe_dev,
144 struct vpbe_enc_mode_info*);
145
146 /*
147 * Set the current mode in the encoder. Alternate way of setting
148 * standard or DV preset or custom timings in the encoder
149 */
150 int (*set_mode)(struct vpbe_device *vpbe_dev,
151 struct vpbe_enc_mode_info*);
152 /* Power management operations */
153 int (*suspend)(struct vpbe_device *vpbe_dev);
154 int (*resume)(struct vpbe_device *vpbe_dev);
155 };
156
157 /* struct for vpbe device */
158 struct vpbe_device {
159 /* V4l2 device */
160 struct v4l2_device v4l2_dev;
161 /* vpbe dispay controller cfg */
162 struct vpbe_config *cfg;
163 /* parent device */
164 struct device *pdev;
165 /* external encoder v4l2 sub devices */
166 struct v4l2_subdev **encoders;
167 /* current encoder index */
168 int current_sd_index;
169 /* external amplifier v4l2 subdevice */
170 struct v4l2_subdev *amp;
171 struct mutex lock;
172 /* device initialized */
173 int initialized;
174 /* vpbe dac clock */
175 struct clk *dac_clk;
176 /* osd_device pointer */
177 struct osd_state *osd_device;
178 /* venc device pointer */
179 struct venc_platform_data *venc_device;
180 /*
181 * fields below are accessed by users of vpbe_device. Not the
182 * ones above
183 */
184
185 /* current output */
186 int current_out_index;
187 /* lock used by caller to do atomic operation on vpbe device */
188 /* current timings set in the controller */
189 struct vpbe_enc_mode_info current_timings;
190 /* venc sub device */
191 struct v4l2_subdev *venc;
192 /* device operations below */
193 struct vpbe_device_ops ops;
194 };
195
196 #endif