diff options
Diffstat (limited to 'include/media/v4l2-subdev.h')
-rw-r--r-- | include/media/v4l2-subdev.h | 54 |
1 files changed, 38 insertions, 16 deletions
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 02c6f4d11ed3..4a97d7341a94 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h | |||
@@ -35,6 +35,7 @@ | |||
35 | #define V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ 0x00000001 | 35 | #define V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ 0x00000001 |
36 | 36 | ||
37 | struct v4l2_device; | 37 | struct v4l2_device; |
38 | struct v4l2_ctrl_handler; | ||
38 | struct v4l2_subdev; | 39 | struct v4l2_subdev; |
39 | struct tuner_setup; | 40 | struct tuner_setup; |
40 | 41 | ||
@@ -90,10 +91,31 @@ struct v4l2_decode_vbi_line { | |||
90 | not yet implemented) since ops provide proper type-checking. | 91 | not yet implemented) since ops provide proper type-checking. |
91 | */ | 92 | */ |
92 | 93 | ||
94 | /* Subdevice external IO pin configuration */ | ||
95 | #define V4L2_SUBDEV_IO_PIN_DISABLE (1 << 0) /* ENABLE assumed */ | ||
96 | #define V4L2_SUBDEV_IO_PIN_OUTPUT (1 << 1) | ||
97 | #define V4L2_SUBDEV_IO_PIN_INPUT (1 << 2) | ||
98 | #define V4L2_SUBDEV_IO_PIN_SET_VALUE (1 << 3) /* Set output value */ | ||
99 | #define V4L2_SUBDEV_IO_PIN_ACTIVE_LOW (1 << 4) /* ACTIVE HIGH assumed */ | ||
100 | |||
101 | struct v4l2_subdev_io_pin_config { | ||
102 | u32 flags; /* V4L2_SUBDEV_IO_PIN_* flags for this pin's config */ | ||
103 | u8 pin; /* Chip external IO pin to configure */ | ||
104 | u8 function; /* Internal signal pad/function to route to IO pin */ | ||
105 | u8 value; /* Initial value for pin - e.g. GPIO output value */ | ||
106 | u8 strength; /* Pin drive strength */ | ||
107 | }; | ||
108 | |||
93 | /* s_config: if set, then it is always called by the v4l2_i2c_new_subdev* | 109 | /* s_config: if set, then it is always called by the v4l2_i2c_new_subdev* |
94 | functions after the v4l2_subdev was registered. It is used to pass | 110 | functions after the v4l2_subdev was registered. It is used to pass |
95 | platform data to the subdev which can be used during initialization. | 111 | platform data to the subdev which can be used during initialization. |
96 | 112 | ||
113 | s_io_pin_config: configure one or more chip I/O pins for chips that | ||
114 | multiplex different internal signal pads out to IO pins. This function | ||
115 | takes a pointer to an array of 'n' pin configuration entries, one for | ||
116 | each pin being configured. This function could be called at times | ||
117 | other than just subdevice initialization. | ||
118 | |||
97 | init: initialize the sensor registors to some sort of reasonable default | 119 | init: initialize the sensor registors to some sort of reasonable default |
98 | values. Do not use for new drivers and should be removed in existing | 120 | values. Do not use for new drivers and should be removed in existing |
99 | drivers. | 121 | drivers. |
@@ -110,11 +132,18 @@ struct v4l2_decode_vbi_line { | |||
110 | 132 | ||
111 | s_power: puts subdevice in power saving mode (on == 0) or normal operation | 133 | s_power: puts subdevice in power saving mode (on == 0) or normal operation |
112 | mode (on == 1). | 134 | mode (on == 1). |
135 | |||
136 | interrupt_service_routine: Called by the bridge chip's interrupt service | ||
137 | handler, when an interrupt status has be raised due to this subdev, | ||
138 | so that this subdev can handle the details. It may schedule work to be | ||
139 | performed later. It must not sleep. *Called from an IRQ context*. | ||
113 | */ | 140 | */ |
114 | struct v4l2_subdev_core_ops { | 141 | struct v4l2_subdev_core_ops { |
115 | int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); | 142 | int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); |
116 | int (*log_status)(struct v4l2_subdev *sd); | 143 | int (*log_status)(struct v4l2_subdev *sd); |
117 | int (*s_config)(struct v4l2_subdev *sd, int irq, void *platform_data); | 144 | int (*s_config)(struct v4l2_subdev *sd, int irq, void *platform_data); |
145 | int (*s_io_pin_config)(struct v4l2_subdev *sd, size_t n, | ||
146 | struct v4l2_subdev_io_pin_config *pincfg); | ||
118 | int (*init)(struct v4l2_subdev *sd, u32 val); | 147 | int (*init)(struct v4l2_subdev *sd, u32 val); |
119 | int (*load_fw)(struct v4l2_subdev *sd); | 148 | int (*load_fw)(struct v4l2_subdev *sd); |
120 | int (*reset)(struct v4l2_subdev *sd, u32 val); | 149 | int (*reset)(struct v4l2_subdev *sd, u32 val); |
@@ -133,6 +162,8 @@ struct v4l2_subdev_core_ops { | |||
133 | int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); | 162 | int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); |
134 | #endif | 163 | #endif |
135 | int (*s_power)(struct v4l2_subdev *sd, int on); | 164 | int (*s_power)(struct v4l2_subdev *sd, int on); |
165 | int (*interrupt_service_routine)(struct v4l2_subdev *sd, | ||
166 | u32 status, bool *handled); | ||
136 | }; | 167 | }; |
137 | 168 | ||
138 | /* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. | 169 | /* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. |
@@ -307,11 +338,6 @@ struct v4l2_subdev_sensor_ops { | |||
307 | }; | 338 | }; |
308 | 339 | ||
309 | /* | 340 | /* |
310 | interrupt_service_routine: Called by the bridge chip's interrupt service | ||
311 | handler, when an IR interrupt status has be raised due to this subdev, | ||
312 | so that this subdev can handle the details. It may schedule work to be | ||
313 | performed later. It must not sleep. *Called from an IRQ context*. | ||
314 | |||
315 | [rt]x_g_parameters: Get the current operating parameters and state of the | 341 | [rt]x_g_parameters: Get the current operating parameters and state of the |
316 | the IR receiver or transmitter. | 342 | the IR receiver or transmitter. |
317 | 343 | ||
@@ -335,14 +361,9 @@ struct v4l2_subdev_sensor_ops { | |||
335 | */ | 361 | */ |
336 | 362 | ||
337 | enum v4l2_subdev_ir_mode { | 363 | enum v4l2_subdev_ir_mode { |
338 | V4L2_SUBDEV_IR_MODE_PULSE_WIDTH, /* space & mark widths in nanosecs */ | 364 | V4L2_SUBDEV_IR_MODE_PULSE_WIDTH, /* uses struct ir_raw_event records */ |
339 | }; | 365 | }; |
340 | 366 | ||
341 | /* Data format of data read or written for V4L2_SUBDEV_IR_MODE_PULSE_WIDTH */ | ||
342 | #define V4L2_SUBDEV_IR_PULSE_MAX_WIDTH_NS 0x7fffffff | ||
343 | #define V4L2_SUBDEV_IR_PULSE_LEVEL_MASK 0x80000000 | ||
344 | #define V4L2_SUBDEV_IR_PULSE_RX_SEQ_END 0xffffffff | ||
345 | |||
346 | struct v4l2_subdev_ir_parameters { | 367 | struct v4l2_subdev_ir_parameters { |
347 | /* Either Rx or Tx */ | 368 | /* Either Rx or Tx */ |
348 | unsigned int bytes_per_data_element; /* of data in read or write call */ | 369 | unsigned int bytes_per_data_element; /* of data in read or write call */ |
@@ -356,7 +377,10 @@ struct v4l2_subdev_ir_parameters { | |||
356 | u32 max_pulse_width; /* ns, valid only for baseband signal */ | 377 | u32 max_pulse_width; /* ns, valid only for baseband signal */ |
357 | unsigned int carrier_freq; /* Hz, valid only for modulated signal*/ | 378 | unsigned int carrier_freq; /* Hz, valid only for modulated signal*/ |
358 | unsigned int duty_cycle; /* percent, valid only for modulated signal*/ | 379 | unsigned int duty_cycle; /* percent, valid only for modulated signal*/ |
359 | bool invert; /* logically invert sense of mark/space */ | 380 | bool invert_level; /* invert signal level */ |
381 | |||
382 | /* Tx only */ | ||
383 | bool invert_carrier_sense; /* Send 0/space as a carrier burst */ | ||
360 | 384 | ||
361 | /* Rx only */ | 385 | /* Rx only */ |
362 | u32 noise_filter_min_width; /* ns, min time of a valid pulse */ | 386 | u32 noise_filter_min_width; /* ns, min time of a valid pulse */ |
@@ -366,10 +390,6 @@ struct v4l2_subdev_ir_parameters { | |||
366 | }; | 390 | }; |
367 | 391 | ||
368 | struct v4l2_subdev_ir_ops { | 392 | struct v4l2_subdev_ir_ops { |
369 | /* Common to receiver and transmitter */ | ||
370 | int (*interrupt_service_routine)(struct v4l2_subdev *sd, | ||
371 | u32 status, bool *handled); | ||
372 | |||
373 | /* Receiver */ | 393 | /* Receiver */ |
374 | int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count, | 394 | int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count, |
375 | ssize_t *num); | 395 | ssize_t *num); |
@@ -415,6 +435,8 @@ struct v4l2_subdev { | |||
415 | u32 flags; | 435 | u32 flags; |
416 | struct v4l2_device *v4l2_dev; | 436 | struct v4l2_device *v4l2_dev; |
417 | const struct v4l2_subdev_ops *ops; | 437 | const struct v4l2_subdev_ops *ops; |
438 | /* The control handler of this subdev. May be NULL. */ | ||
439 | struct v4l2_ctrl_handler *ctrl_handler; | ||
418 | /* name must be unique */ | 440 | /* name must be unique */ |
419 | char name[V4L2_SUBDEV_NAME_SIZE]; | 441 | char name[V4L2_SUBDEV_NAME_SIZE]; |
420 | /* can be used to group similar subdevs, value is driver-specific */ | 442 | /* can be used to group similar subdevs, value is driver-specific */ |