aboutsummaryrefslogtreecommitdiffstats
path: root/include/media/v4l2-subdev.h
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2009-09-27 16:50:04 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 15:40:19 -0500
commit1d986add96a06f311cfef377b36602514db54507 (patch)
tree1103c87d08313ec1dbf0196241ada88584fa355b /include/media/v4l2-subdev.h
parent8c2d7821d4e3827c29e4e4e345ee25390a141e55 (diff)
V4L/DVB (13096): v4l2-subdev: Add v4l2_subdev_ir_ops and IR notify defines for v4l2_device
Add v4l2_subdev_ir_ops and IR notify defines for v4l2_device. This change is specifically needed at this time to support the integrated IR controller in the CX2388[58] chips. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media/v4l2-subdev.h')
-rw-r--r--include/media/v4l2-subdev.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index d411345f244b..ecc2818938b3 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;
@@ -231,11 +241,95 @@ struct v4l2_subdev_video_ops {
231 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival); 241 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival);
232}; 242};
233 243
244/*
245 interrupt_service_routine: Called by the bridge chip's interrupt service
246 handler, when an IR interrupt status has be raised due to this subdev,
247 so that this subdev can handle the details. It may schedule work to be
248 performed later. It must not sleep. *Called from an IRQ context*.
249
250 [rt]x_g_parameters: Get the current operating parameters and state of the
251 the IR receiver or transmitter.
252
253 [rt]x_s_parameters: Set the current operating parameters and state of the
254 the IR receiver or transmitter. It is recommended to call
255 [rt]x_g_parameters first to fill out the current state, and only change
256 the fields that need to be changed. Upon return, the actual device
257 operating parameters and state will be returned. Note that hardware
258 limitations may prevent the actual settings from matching the requested
259 settings - e.g. an actual carrier setting of 35,904 Hz when 36,000 Hz
260 was requested. An exception is when the shutdown parameter is true.
261 The last used operational parameters will be returned, but the actual
262 state of the hardware be different to minimize power consumption and
263 processing when shutdown is true.
264
265 rx_read: Reads received codes or pulse width data.
266 The semantics are similar to a non-blocking read() call.
267
268 tx_write: Writes codes or pulse width data for transmission.
269 The semantics are similar to a non-blocking write() call.
270 */
271
272enum v4l2_subdev_ir_mode {
273 V4L2_SUBDEV_IR_MODE_PULSE_WIDTH, /* space & mark widths in nanosecs */
274};
275
276/* Data format of data read or written for V4L2_SUBDEV_IR_MODE_PULSE_WIDTH */
277#define V4L2_SUBDEV_IR_PULSE_MAX_WIDTH_NS 0x7fffffff
278#define V4L2_SUBDEV_IR_PULSE_LEVEL_MASK 0x80000000
279#define V4L2_SUBDEV_IR_PULSE_RX_SEQ_END 0xffffffff
280
281struct v4l2_subdev_ir_parameters {
282 /* Either Rx or Tx */
283 unsigned int bytes_per_data_element; /* of data in read or write call */
284 enum v4l2_subdev_ir_mode mode;
285
286 bool enable;
287 bool interrupt_enable;
288 bool shutdown; /* true: set hardware to low/no power, false: normal */
289
290 bool modulation; /* true: uses carrier, false: baseband */
291 u32 max_pulse_width; /* ns, valid only for baseband signal */
292 unsigned int carrier_freq; /* Hz, valid only for modulated signal*/
293 unsigned int duty_cycle; /* percent, valid only for modulated signal*/
294 bool invert; /* logically invert sense of mark/space */
295
296 /* Rx only */
297 u32 noise_filter_min_width; /* ns, min time of a valid pulse */
298 unsigned int carrier_range_lower; /* Hz, valid only for modulated sig */
299 unsigned int carrier_range_upper; /* Hz, valid only for modulated sig */
300 u32 resolution; /* ns */
301};
302
303struct v4l2_subdev_ir_ops {
304 /* Common to receiver and transmitter */
305 int (*interrupt_service_routine)(struct v4l2_subdev *sd,
306 u32 status, bool *handled);
307
308 /* Receiver */
309 int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count,
310 ssize_t *num);
311
312 int (*rx_g_parameters)(struct v4l2_subdev *sd,
313 struct v4l2_subdev_ir_parameters *params);
314 int (*rx_s_parameters)(struct v4l2_subdev *sd,
315 struct v4l2_subdev_ir_parameters *params);
316
317 /* Transmitter */
318 int (*tx_write)(struct v4l2_subdev *sd, u8 *buf, size_t count,
319 ssize_t *num);
320
321 int (*tx_g_parameters)(struct v4l2_subdev *sd,
322 struct v4l2_subdev_ir_parameters *params);
323 int (*tx_s_parameters)(struct v4l2_subdev *sd,
324 struct v4l2_subdev_ir_parameters *params);
325};
326
234struct v4l2_subdev_ops { 327struct v4l2_subdev_ops {
235 const struct v4l2_subdev_core_ops *core; 328 const struct v4l2_subdev_core_ops *core;
236 const struct v4l2_subdev_tuner_ops *tuner; 329 const struct v4l2_subdev_tuner_ops *tuner;
237 const struct v4l2_subdev_audio_ops *audio; 330 const struct v4l2_subdev_audio_ops *audio;
238 const struct v4l2_subdev_video_ops *video; 331 const struct v4l2_subdev_video_ops *video;
332 const struct v4l2_subdev_ir_ops *ir;
239}; 333};
240 334
241#define V4L2_SUBDEV_NAME_SIZE 32 335#define V4L2_SUBDEV_NAME_SIZE 32