]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blame - include/media/davinci/vpbe.h
Merge tag 'powerpc-5.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[mirror_ubuntu-hirsute-kernel.git] / include / media / davinci / vpbe.h
CommitLineData
66715cdc
MH
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.
66715cdc
MH
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 */
27struct osd_config_info {
28 char module_name[32];
29};
30
31struct vpbe_output {
32 struct v4l2_output output;
33 /*
36864082 34 * If output capabilities include dv_timings, list supported timings
66715cdc
MH
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 */
27ffaeb0 62 u32 if_params;
66715cdc
MH
63};
64
65/* encoder configuration info */
66struct 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
9a7f95ad
MH
74/*amplifier configuration info */
75struct 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
66715cdc
MH
83/* structure for defining vpbe display subsystem components */
84struct 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;
9a7f95ad
MH
93 /* amplifier information goes here */
94 struct amp_config_info *amp;
b72845ee 95 unsigned int num_outputs;
66715cdc
MH
96 /* Order is venc outputs followed by LCD and then external encoders */
97 struct vpbe_output *outputs;
98};
99
100struct vpbe_device;
101
102struct vpbe_device_ops {
66715cdc
MH
103 /* Enumerate the outputs */
104 int (*enum_outputs)(struct vpbe_device *vpbe_dev,
105 struct v4l2_output *output);
106
107 /* Set output to the given index */
108 int (*set_output)(struct vpbe_device *vpbe_dev,
109 int index);
110
111 /* Get current output */
112 unsigned int (*get_output)(struct vpbe_device *vpbe_dev);
113
114 /* Set DV preset at current output */
36864082
HV
115 int (*s_dv_timings)(struct vpbe_device *vpbe_dev,
116 struct v4l2_dv_timings *dv_timings);
66715cdc
MH
117
118 /* Get DV presets supported at the output */
36864082
HV
119 int (*g_dv_timings)(struct vpbe_device *vpbe_dev,
120 struct v4l2_dv_timings *dv_timings);
66715cdc
MH
121
122 /* Enumerate the DV Presets supported at the output */
36864082
HV
123 int (*enum_dv_timings)(struct vpbe_device *vpbe_dev,
124 struct v4l2_enum_dv_timings *timings_info);
66715cdc
MH
125
126 /* Set std at the output */
314527ac 127 int (*s_std)(struct vpbe_device *vpbe_dev, v4l2_std_id std_id);
66715cdc
MH
128
129 /* Get the current std at the output */
130 int (*g_std)(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id);
131
132 /* initialize the device */
133 int (*initialize)(struct device *dev, struct vpbe_device *vpbe_dev);
134
135 /* De-initialize the device */
136 void (*deinitialize)(struct device *dev, struct vpbe_device *vpbe_dev);
137
138 /* Get the current mode info */
139 int (*get_mode_info)(struct vpbe_device *vpbe_dev,
140 struct vpbe_enc_mode_info*);
141
142 /*
143 * Set the current mode in the encoder. Alternate way of setting
144 * standard or DV preset or custom timings in the encoder
145 */
146 int (*set_mode)(struct vpbe_device *vpbe_dev,
147 struct vpbe_enc_mode_info*);
148 /* Power management operations */
149 int (*suspend)(struct vpbe_device *vpbe_dev);
150 int (*resume)(struct vpbe_device *vpbe_dev);
151};
152
153/* struct for vpbe device */
154struct vpbe_device {
155 /* V4l2 device */
156 struct v4l2_device v4l2_dev;
157 /* vpbe dispay controller cfg */
158 struct vpbe_config *cfg;
159 /* parent device */
160 struct device *pdev;
161 /* external encoder v4l2 sub devices */
162 struct v4l2_subdev **encoders;
163 /* current encoder index */
164 int current_sd_index;
9a7f95ad
MH
165 /* external amplifier v4l2 subdevice */
166 struct v4l2_subdev *amp;
66715cdc
MH
167 struct mutex lock;
168 /* device initialized */
169 int initialized;
170 /* vpbe dac clock */
171 struct clk *dac_clk;
172 /* osd_device pointer */
173 struct osd_state *osd_device;
9a7f95ad
MH
174 /* venc device pointer */
175 struct venc_platform_data *venc_device;
66715cdc
MH
176 /*
177 * fields below are accessed by users of vpbe_device. Not the
178 * ones above
179 */
180
181 /* current output */
182 int current_out_index;
183 /* lock used by caller to do atomic operation on vpbe device */
184 /* current timings set in the controller */
185 struct vpbe_enc_mode_info current_timings;
186 /* venc sub device */
187 struct v4l2_subdev *venc;
188 /* device operations below */
189 struct vpbe_device_ops ops;
190};
191
192#endif