168
207
int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
169
208
int (*s_i2s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
170
209
int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
210
int (*s_stream)(struct v4l2_subdev *sd, int enable);
214
s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by
217
s_crystal_freq: sets the frequency of the crystal used to generate the
218
clocks in Hz. An extra flags field allows device specific configuration
219
regarding clock frequency dividers, etc. If not used, then set flags
220
to 0. If the frequency is not supported, then -EINVAL is returned.
222
g_input_status: get input status. Same as the status field in the v4l2_input
225
s_routing: see s_routing in audio_ops, except this version is for video
228
s_dv_preset: set dv (Digital Video) preset in the sub device. Similar to
231
query_dv_preset: query dv preset in the sub device. This is similar to
234
s_dv_timings(): Set custom dv timings in the sub device. This is used
235
when sub device is capable of setting detailed timing information
236
in the hardware to generate/detect the video signal.
238
g_dv_timings(): Get custom dv timings in the sub device.
240
enum_mbus_fmt: enumerate pixel formats, provided by a video data source
242
g_mbus_fmt: get the current pixel format, provided by a video data source
244
try_mbus_fmt: try to set a pixel format on a video data source
246
s_mbus_fmt: set a pixel format on a video data source
248
struct v4l2_subdev_video_ops {
249
int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
250
int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags);
251
int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std);
252
int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std);
253
int (*g_input_status)(struct v4l2_subdev *sd, u32 *status);
254
int (*s_stream)(struct v4l2_subdev *sd, int enable);
255
int (*cropcap)(struct v4l2_subdev *sd, struct v4l2_cropcap *cc);
256
int (*g_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop);
257
int (*s_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop);
258
int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
259
int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
260
int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize);
261
int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival);
262
int (*enum_dv_presets) (struct v4l2_subdev *sd,
263
struct v4l2_dv_enum_preset *preset);
264
int (*s_dv_preset)(struct v4l2_subdev *sd,
265
struct v4l2_dv_preset *preset);
266
int (*query_dv_preset)(struct v4l2_subdev *sd,
267
struct v4l2_dv_preset *preset);
268
int (*s_dv_timings)(struct v4l2_subdev *sd,
269
struct v4l2_dv_timings *timings);
270
int (*g_dv_timings)(struct v4l2_subdev *sd,
271
struct v4l2_dv_timings *timings);
272
int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index,
273
enum v4l2_mbus_pixelcode *code);
274
int (*g_mbus_fmt)(struct v4l2_subdev *sd,
275
struct v4l2_mbus_framefmt *fmt);
276
int (*try_mbus_fmt)(struct v4l2_subdev *sd,
277
struct v4l2_mbus_framefmt *fmt);
278
int (*s_mbus_fmt)(struct v4l2_subdev *sd,
279
struct v4l2_mbus_framefmt *fmt);
193
302
member (to determine whether CC data from the first or second field
194
303
should be obtained).
196
s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by
199
s_crystal_freq: sets the frequency of the crystal used to generate the
200
clocks in Hz. An extra flags field allows device specific configuration
201
regarding clock frequency dividers, etc. If not used, then set flags
202
to 0. If the frequency is not supported, then -EINVAL is returned.
204
g_input_status: get input status. Same as the status field in the v4l2_input
207
s_routing: see s_routing in audio_ops, except this version is for video
305
s_raw_fmt: setup the video encoder/decoder for raw VBI.
307
g_sliced_fmt: retrieve the current sliced VBI settings.
309
s_sliced_fmt: setup the sliced VBI settings.
210
struct v4l2_subdev_video_ops {
211
int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
212
int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags);
311
struct v4l2_subdev_vbi_ops {
213
312
int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line);
214
313
int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data);
215
314
int (*g_vbi_data)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data);
216
315
int (*g_sliced_vbi_cap)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_cap *cap);
217
int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std);
218
int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std);
219
int (*g_input_status)(struct v4l2_subdev *sd, u32 *status);
220
int (*s_stream)(struct v4l2_subdev *sd, int enable);
221
int (*enum_fmt)(struct v4l2_subdev *sd, struct v4l2_fmtdesc *fmtdesc);
222
int (*g_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt);
223
int (*try_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt);
224
int (*s_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt);
225
int (*cropcap)(struct v4l2_subdev *sd, struct v4l2_cropcap *cc);
226
int (*g_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop);
227
int (*s_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop);
228
int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
229
int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
230
int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize);
231
int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival);
316
int (*s_raw_fmt)(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt);
317
int (*g_sliced_fmt)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);
318
int (*s_sliced_fmt)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);
322
* struct v4l2_subdev_sensor_ops - v4l2-subdev sensor operations
323
* @g_skip_top_lines: number of lines at the top of the image to be skipped.
324
* This is needed for some sensors, which always corrupt
325
* several top lines of the output image, or which send their
328
struct v4l2_subdev_sensor_ops {
329
int (*g_skip_top_lines)(struct v4l2_subdev *sd, u32 *lines);
333
[rt]x_g_parameters: Get the current operating parameters and state of the
334
the IR receiver or transmitter.
336
[rt]x_s_parameters: Set the current operating parameters and state of the
337
the IR receiver or transmitter. It is recommended to call
338
[rt]x_g_parameters first to fill out the current state, and only change
339
the fields that need to be changed. Upon return, the actual device
340
operating parameters and state will be returned. Note that hardware
341
limitations may prevent the actual settings from matching the requested
342
settings - e.g. an actual carrier setting of 35,904 Hz when 36,000 Hz
343
was requested. An exception is when the shutdown parameter is true.
344
The last used operational parameters will be returned, but the actual
345
state of the hardware be different to minimize power consumption and
346
processing when shutdown is true.
348
rx_read: Reads received codes or pulse width data.
349
The semantics are similar to a non-blocking read() call.
351
tx_write: Writes codes or pulse width data for transmission.
352
The semantics are similar to a non-blocking write() call.
355
enum v4l2_subdev_ir_mode {
356
V4L2_SUBDEV_IR_MODE_PULSE_WIDTH, /* uses struct ir_raw_event records */
359
struct v4l2_subdev_ir_parameters {
360
/* Either Rx or Tx */
361
unsigned int bytes_per_data_element; /* of data in read or write call */
362
enum v4l2_subdev_ir_mode mode;
365
bool interrupt_enable;
366
bool shutdown; /* true: set hardware to low/no power, false: normal */
368
bool modulation; /* true: uses carrier, false: baseband */
369
u32 max_pulse_width; /* ns, valid only for baseband signal */
370
unsigned int carrier_freq; /* Hz, valid only for modulated signal*/
371
unsigned int duty_cycle; /* percent, valid only for modulated signal*/
372
bool invert_level; /* invert signal level */
375
bool invert_carrier_sense; /* Send 0/space as a carrier burst */
378
u32 noise_filter_min_width; /* ns, min time of a valid pulse */
379
unsigned int carrier_range_lower; /* Hz, valid only for modulated sig */
380
unsigned int carrier_range_upper; /* Hz, valid only for modulated sig */
381
u32 resolution; /* ns */
384
struct v4l2_subdev_ir_ops {
386
int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count,
389
int (*rx_g_parameters)(struct v4l2_subdev *sd,
390
struct v4l2_subdev_ir_parameters *params);
391
int (*rx_s_parameters)(struct v4l2_subdev *sd,
392
struct v4l2_subdev_ir_parameters *params);
395
int (*tx_write)(struct v4l2_subdev *sd, u8 *buf, size_t count,
398
int (*tx_g_parameters)(struct v4l2_subdev *sd,
399
struct v4l2_subdev_ir_parameters *params);
400
int (*tx_s_parameters)(struct v4l2_subdev *sd,
401
struct v4l2_subdev_ir_parameters *params);
234
404
struct v4l2_subdev_ops {
235
const struct v4l2_subdev_core_ops *core;
236
const struct v4l2_subdev_tuner_ops *tuner;
237
const struct v4l2_subdev_audio_ops *audio;
238
const struct v4l2_subdev_video_ops *video;
405
const struct v4l2_subdev_core_ops *core;
406
const struct v4l2_subdev_tuner_ops *tuner;
407
const struct v4l2_subdev_audio_ops *audio;
408
const struct v4l2_subdev_video_ops *video;
409
const struct v4l2_subdev_vbi_ops *vbi;
410
const struct v4l2_subdev_ir_ops *ir;
411
const struct v4l2_subdev_sensor_ops *sensor;
415
* Internal ops. Never call this from drivers, only the v4l2 framework can call
418
* registered: called when this subdev is registered. When called the v4l2_dev
419
* field is set to the correct v4l2_device.
421
* unregistered: called when this subdev is unregistered. When called the
422
* v4l2_dev field is still set to the correct v4l2_device.
424
struct v4l2_subdev_internal_ops {
425
int (*registered)(struct v4l2_subdev *sd);
426
void (*unregistered)(struct v4l2_subdev *sd);
241
429
#define V4L2_SUBDEV_NAME_SIZE 32
243
431
/* Set this flag if this subdev is a i2c device. */
244
432
#define V4L2_SUBDEV_FL_IS_I2C (1U << 0)
433
/* Set this flag if this subdev is a spi device. */
434
#define V4L2_SUBDEV_FL_IS_SPI (1U << 1)
246
436
/* Each instance of a subdev driver should create this struct, either
247
437
stand-alone or embedded in a larger struct.