aboutsummaryrefslogtreecommitdiffstats
path: root/include/media/v4l2-subdev.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/media/v4l2-subdev.h')
-rw-r--r--include/media/v4l2-subdev.h103
1 files changed, 99 insertions, 4 deletions
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index d411345f244b..00bf17608453 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -23,6 +23,16 @@
23 23
24#include <media/v4l2-common.h> 24#include <media/v4l2-common.h>
25 25
26/* generic v4l2_device notify callback notification values */
27#define V4L2_SUBDEV_IR_RX_NOTIFY _IOW('v', 0, u32)
28#define V4L2_SUBDEV_IR_RX_FIFO_SERVICE_REQ 0x00000001
29#define V4L2_SUBDEV_IR_RX_END_OF_RX_DETECTED 0x00000002
30#define V4L2_SUBDEV_IR_RX_HW_FIFO_OVERRUN 0x00000004
31#define V4L2_SUBDEV_IR_RX_SW_FIFO_OVERRUN 0x00000008
32
33#define V4L2_SUBDEV_IR_TX_NOTIFY _IOW('v', 1, u32)
34#define V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ 0x00000001
35
26struct v4l2_device; 36struct v4l2_device;
27struct v4l2_subdev; 37struct v4l2_subdev;
28struct tuner_setup; 38struct tuner_setup;
@@ -96,6 +106,9 @@ struct v4l2_decode_vbi_line {
96 106
97 s_gpio: set GPIO pins. Very simple right now, might need to be extended with 107 s_gpio: set GPIO pins. Very simple right now, might need to be extended with
98 a direction argument if needed. 108 a direction argument if needed.
109
110 s_power: puts subdevice in power saving mode (on == 0) or normal operation
111 mode (on == 1).
99 */ 112 */
100struct v4l2_subdev_core_ops { 113struct v4l2_subdev_core_ops {
101 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); 114 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip);
@@ -118,6 +131,7 @@ struct v4l2_subdev_core_ops {
118 int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); 131 int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
119 int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); 132 int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
120#endif 133#endif
134 int (*s_power)(struct v4l2_subdev *sd, int on);
121}; 135};
122 136
123/* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. 137/* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio.
@@ -127,8 +141,6 @@ struct v4l2_subdev_core_ops {
127 s_type_addr: sets tuner type and its I2C addr. 141 s_type_addr: sets tuner type and its I2C addr.
128 142
129 s_config: sets tda9887 specific stuff, like port1, port2 and qss 143 s_config: sets tda9887 specific stuff, like port1, port2 and qss
130
131 s_standby: puts tuner on powersaving state, disabling it, except for i2c.
132 */ 144 */
133struct v4l2_subdev_tuner_ops { 145struct v4l2_subdev_tuner_ops {
134 int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type); 146 int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type);
@@ -141,7 +153,6 @@ struct v4l2_subdev_tuner_ops {
141 int (*s_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm); 153 int (*s_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm);
142 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type); 154 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type);
143 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config); 155 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config);
144 int (*s_standby)(struct v4l2_subdev *sd);
145}; 156};
146 157
147/* s_clock_freq: set the frequency (in Hz) of the audio clock output. 158/* s_clock_freq: set the frequency (in Hz) of the audio clock output.
@@ -231,11 +242,95 @@ struct v4l2_subdev_video_ops {
231 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival); 242 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival);
232}; 243};
233 244
245/*
246 interrupt_service_routine: Called by the bridge chip's interrupt service
247 handler, when an IR interrupt status has be raised due to this subdev,
248 so that this subdev can handle the details. It may schedule work to be
249 performed later. It must not sleep. *Called from an IRQ context*.
250
251 [rt]x_g_parameters: Get the current operating parameters and state of the
252 the IR receiver or transmitter.
253
254 [rt]x_s_parameters: Set the current operating parameters and state of the
255 the IR receiver or transmitter. It is recommended to call
256 [rt]x_g_parameters first to fill out the current state, and only change
257 the fields that need to be changed. Upon return, the actual device
258 operating parameters and state will be returned. Note that hardware
259 limitations may prevent the actual settings from matching the requested
260 settings - e.g. an actual carrier setting of 35,904 Hz when 36,000 Hz
261 was requested. An exception is when the shutdown parameter is true.
262 The last used operational parameters will be returned, but the actual
263 state of the hardware be different to minimize power consumption and
264 processing when shutdown is true.
265
266 rx_read: Reads received codes or pulse width data.
267 The semantics are similar to a non-blocking read() call.
268
269 tx_write: Writes codes or pulse width data for transmission.
270 The semantics are similar to a non-blocking write() call.
271 */
272
273enum v4l2_subdev_ir_mode {
274 V4L2_SUBDEV_IR_MODE_PULSE_WIDTH, /* space & mark widths in nanosecs */
275};
276
277/* Data format of data read or written for V4L2_SUBDEV_IR_MODE_PULSE_WIDTH */
278#define V4L2_SUBDEV_IR_PULSE_MAX_WIDTH_NS 0x7fffffff
279#define V4L2_SUBDEV_IR_PULSE_LEVEL_MASK 0x80000000
280#define V4L2_SUBDEV_IR_PULSE_RX_SEQ_END 0xffffffff
281
282struct v4l2_subdev_ir_parameters {
283 /* Either Rx or Tx */
284 unsigned int bytes_per_data_element; /* of data in read or write call */
285 enum v4l2_subdev_ir_mode mode;
286
287 bool enable;
288 bool interrupt_enable;
289 bool shutdown; /* true: set hardware to low/no power, false: normal */
290
291 bool modulation; /* true: uses carrier, false: baseband */
292 u32 max_pulse_width; /* ns, valid only for baseband signal */
293 unsigned int carrier_freq; /* Hz, valid only for modulated signal*/
294 unsigned int duty_cycle; /* percent, valid only for modulated signal*/
295 bool invert; /* logically invert sense of mark/space */
296
297 /* Rx only */
298 u32 noise_filter_min_width; /* ns, min time of a valid pulse */
299 unsigned int carrier_range_lower; /* Hz, valid only for modulated sig */
300 unsigned int carrier_range_upper; /* Hz, valid only for modulated sig */
301 u32 resolution; /* ns */
302};
303
304struct v4l2_subdev_ir_ops {
305 /* Common to receiver and transmitter */
306 int (*interrupt_service_routine)(struct v4l2_subdev *sd,
307 u32 status, bool *handled);
308
309 /* Receiver */
310 int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count,
311 ssize_t *num);
312
313 int (*rx_g_parameters)(struct v4l2_subdev *sd,
314 struct v4l2_subdev_ir_parameters *params);
315 int (*rx_s_parameters)(struct v4l2_subdev *sd,
316 struct v4l2_subdev_ir_parameters *params);
317
318 /* Transmitter */
319 int (*tx_write)(struct v4l2_subdev *sd, u8 *buf, size_t count,
320 ssize_t *num);
321
322 int (*tx_g_parameters)(struct v4l2_subdev *sd,
323 struct v4l2_subdev_ir_parameters *params);
324 int (*tx_s_parameters)(struct v4l2_subdev *sd,
325 struct v4l2_subdev_ir_parameters *params);
326};
327
234struct v4l2_subdev_ops { 328struct v4l2_subdev_ops {
235 const struct v4l2_subdev_core_ops *core; 329 const struct v4l2_subdev_core_ops *core;
236 const struct v4l2_subdev_tuner_ops *tuner; 330 const struct v4l2_subdev_tuner_ops *tuner;
237 const struct v4l2_subdev_audio_ops *audio; 331 const struct v4l2_subdev_audio_ops *audio;
238 const struct v4l2_subdev_video_ops *video; 332 const struct v4l2_subdev_video_ops *video;
333 const struct v4l2_subdev_ir_ops *ir;
239}; 334};
240 335
241#define V4L2_SUBDEV_NAME_SIZE 32 336#define V4L2_SUBDEV_NAME_SIZE 32
@@ -290,7 +385,7 @@ static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
290 Example: err = v4l2_subdev_call(sd, core, g_chip_ident, &chip); 385 Example: err = v4l2_subdev_call(sd, core, g_chip_ident, &chip);
291 */ 386 */
292#define v4l2_subdev_call(sd, o, f, args...) \ 387#define v4l2_subdev_call(sd, o, f, args...) \
293 (!(sd) ? -ENODEV : (((sd) && (sd)->ops->o && (sd)->ops->o->f) ? \ 388 (!(sd) ? -ENODEV : (((sd)->ops->o && (sd)->ops->o->f) ? \
294 (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD)) 389 (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD))
295 390
296/* Send a notification to v4l2_device. */ 391/* Send a notification to v4l2_device. */