1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2010 Texas Instruments Inc
8 #include <linux/videodev2.h>
11 #include <media/v4l2-dev.h>
12 #include <media/v4l2-ioctl.h>
13 #include <media/v4l2-device.h>
14 #include <media/davinci/vpbe_osd.h>
15 #include <media/davinci/vpbe_venc.h>
16 #include <media/davinci/vpbe_types.h>
18 /* OSD configuration info */
19 struct osd_config_info
{
24 struct v4l2_output output
;
26 * If output capabilities include dv_timings, list supported timings
31 * defualt_mode identifies the default timings set at the venc or
36 * Fields below are used for supporting multiple modes. For example,
37 * LCD panel might support different modes and they are listed here.
38 * Similarly for supporting external encoders, lcd controller port
39 * requires a set of non-standard timing values to be listed here for
40 * each supported mode since venc is used in non-standard timing mode
41 * for interfacing with external encoder similar to configuring lcd
44 unsigned int num_modes
;
45 struct vpbe_enc_mode_info
*modes
;
47 * Bus configuration goes here for external encoders. Some encoders
48 * may require multiple interface types for each of the output. For
49 * example, SD modes would use YCC8 where as HD mode would use YCC16.
50 * Not sure if this is needed on a per mode basis instead of per
51 * output basis. If per mode is needed, we may have to move this to
57 /* encoder configuration info */
58 struct encoder_config_info
{
60 /* Is this an i2c device ? */
61 unsigned int is_i2c
:1;
62 /* i2c subdevice board info */
63 struct i2c_board_info board_info
;
66 /*amplifier configuration info */
67 struct amp_config_info
{
69 /* Is this an i2c device ? */
70 unsigned int is_i2c
:1;
71 /* i2c subdevice board info */
72 struct i2c_board_info board_info
;
75 /* structure for defining vpbe display subsystem components */
78 /* i2c bus adapter no */
80 struct osd_config_info osd
;
81 struct encoder_config_info venc
;
82 /* external encoder information goes here */
84 struct encoder_config_info
*ext_encoders
;
85 /* amplifier information goes here */
86 struct amp_config_info
*amp
;
87 unsigned int num_outputs
;
88 /* Order is venc outputs followed by LCD and then external encoders */
89 struct vpbe_output
*outputs
;
94 struct vpbe_device_ops
{
95 /* Enumerate the outputs */
96 int (*enum_outputs
)(struct vpbe_device
*vpbe_dev
,
97 struct v4l2_output
*output
);
99 /* Set output to the given index */
100 int (*set_output
)(struct vpbe_device
*vpbe_dev
,
103 /* Get current output */
104 unsigned int (*get_output
)(struct vpbe_device
*vpbe_dev
);
106 /* Set DV preset at current output */
107 int (*s_dv_timings
)(struct vpbe_device
*vpbe_dev
,
108 struct v4l2_dv_timings
*dv_timings
);
110 /* Get DV presets supported at the output */
111 int (*g_dv_timings
)(struct vpbe_device
*vpbe_dev
,
112 struct v4l2_dv_timings
*dv_timings
);
114 /* Enumerate the DV Presets supported at the output */
115 int (*enum_dv_timings
)(struct vpbe_device
*vpbe_dev
,
116 struct v4l2_enum_dv_timings
*timings_info
);
118 /* Set std at the output */
119 int (*s_std
)(struct vpbe_device
*vpbe_dev
, v4l2_std_id std_id
);
121 /* Get the current std at the output */
122 int (*g_std
)(struct vpbe_device
*vpbe_dev
, v4l2_std_id
*std_id
);
124 /* initialize the device */
125 int (*initialize
)(struct device
*dev
, struct vpbe_device
*vpbe_dev
);
127 /* De-initialize the device */
128 void (*deinitialize
)(struct device
*dev
, struct vpbe_device
*vpbe_dev
);
130 /* Get the current mode info */
131 int (*get_mode_info
)(struct vpbe_device
*vpbe_dev
,
132 struct vpbe_enc_mode_info
*);
135 * Set the current mode in the encoder. Alternate way of setting
136 * standard or DV preset or custom timings in the encoder
138 int (*set_mode
)(struct vpbe_device
*vpbe_dev
,
139 struct vpbe_enc_mode_info
*);
140 /* Power management operations */
141 int (*suspend
)(struct vpbe_device
*vpbe_dev
);
142 int (*resume
)(struct vpbe_device
*vpbe_dev
);
145 /* struct for vpbe device */
148 struct v4l2_device v4l2_dev
;
149 /* vpbe dispay controller cfg */
150 struct vpbe_config
*cfg
;
153 /* external encoder v4l2 sub devices */
154 struct v4l2_subdev
**encoders
;
155 /* current encoder index */
156 int current_sd_index
;
157 /* external amplifier v4l2 subdevice */
158 struct v4l2_subdev
*amp
;
160 /* device initialized */
164 /* osd_device pointer */
165 struct osd_state
*osd_device
;
166 /* venc device pointer */
167 struct venc_platform_data
*venc_device
;
169 * fields below are accessed by users of vpbe_device. Not the
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
;