Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
vpbe.h
Go to the documentation of this file.
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>
29 
30 /* OSD configuration info */
32  char module_name[32];
33 };
34 
35 struct vpbe_output {
37  /*
38  * If output capabilities include dv_timings, list supported timings
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;
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  */
67 };
68 
69 /* encoder configuration info */
71  char module_name[32];
72  /* Is this an i2c device ? */
73  unsigned int is_i2c:1;
74  /* i2c subdevice board info */
76 };
77 
78 /*amplifier configuration info */
80  char module_name[32];
81  /* Is this an i2c device ? */
82  unsigned int is_i2c:1;
83  /* i2c subdevice board info */
85 };
86 
87 /* structure for defining vpbe display subsystem components */
88 struct vpbe_config {
89  char module_name[32];
90  /* i2c bus adapter no */
94  /* external encoder information goes here */
97  /* amplifier information goes here */
100  /* Order is venc outputs followed by LCD and then external encoders */
102 };
103 
104 struct vpbe_device;
105 
107  /* crop cap for the display */
108  int (*g_cropcap)(struct vpbe_device *vpbe_dev,
109  struct v4l2_cropcap *cropcap);
110 
111  /* Enumerate the outputs */
112  int (*enum_outputs)(struct vpbe_device *vpbe_dev,
113  struct v4l2_output *output);
114 
115  /* Set output to the given index */
116  int (*set_output)(struct vpbe_device *vpbe_dev,
117  int index);
118 
119  /* Get current output */
120  unsigned int (*get_output)(struct vpbe_device *vpbe_dev);
121 
122  /* Set DV preset at current output */
123  int (*s_dv_timings)(struct vpbe_device *vpbe_dev,
124  struct v4l2_dv_timings *dv_timings);
125 
126  /* Get DV presets supported at the output */
127  int (*g_dv_timings)(struct vpbe_device *vpbe_dev,
128  struct v4l2_dv_timings *dv_timings);
129 
130  /* Enumerate the DV Presets supported at the output */
131  int (*enum_dv_timings)(struct vpbe_device *vpbe_dev,
132  struct v4l2_enum_dv_timings *timings_info);
133 
134  /* Set std at the output */
135  int (*s_std)(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id);
136 
137  /* Get the current std at the output */
138  int (*g_std)(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id);
139 
140  /* initialize the device */
141  int (*initialize)(struct device *dev, struct vpbe_device *vpbe_dev);
142 
143  /* De-initialize the device */
144  void (*deinitialize)(struct device *dev, struct vpbe_device *vpbe_dev);
145 
146  /* Get the current mode info */
147  int (*get_mode_info)(struct vpbe_device *vpbe_dev,
148  struct vpbe_enc_mode_info*);
149 
150  /*
151  * Set the current mode in the encoder. Alternate way of setting
152  * standard or DV preset or custom timings in the encoder
153  */
154  int (*set_mode)(struct vpbe_device *vpbe_dev,
155  struct vpbe_enc_mode_info*);
156  /* Power management operations */
157  int (*suspend)(struct vpbe_device *vpbe_dev);
158  int (*resume)(struct vpbe_device *vpbe_dev);
159 };
160 
161 /* struct for vpbe device */
162 struct vpbe_device {
163  /* V4l2 device */
165  /* vpbe dispay controller cfg */
166  struct vpbe_config *cfg;
167  /* parent device */
168  struct device *pdev;
169  /* external encoder v4l2 sub devices */
171  /* current encoder index */
173  /* external amplifier v4l2 subdevice */
174  struct v4l2_subdev *amp;
175  struct mutex lock;
176  /* device initialized */
178  /* vpbe dac clock */
179  struct clk *dac_clk;
180  /* osd_device pointer */
182  /* venc device pointer */
184  /*
185  * fields below are accessed by users of vpbe_device. Not the
186  * ones above
187  */
188 
189  /* current output */
191  /* lock used by caller to do atomic operation on vpbe device */
192  /* current timings set in the controller */
194  /* venc sub device */
195  struct v4l2_subdev *venc;
196  /* device operations below */
198 };
199 
200 #endif