Lines Matching +full:no +full:- +full:sd

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * V4L2 sub-device support header.
12 #include <linux/v4l2-subdev.h>
13 #include <media/media-entity.h>
14 #include <media/v4l2-async.h>
15 #include <media/v4l2-common.h>
16 #include <media/v4l2-dev.h>
17 #include <media/v4l2-fh.h>
18 #include <media/v4l2-mediabus.h>
43 * struct v4l2_decode_vbi_line - used to decode_vbi_line
49 * @line: Line number of the sliced VBI data (1-23)
50 * @type: VBI service type (V4L2_SLICED_*). 0 if no service found
60 * Sub-devices are devices that are connected somehow to the main bridge
68 * generic manner. Most operations that these sub-devices support fall in
72 * limited set (no more than approx. 8 categories).
81 * These ops are all used internally so it is no problem to change, remove
97 * The ioctl ops is meant for generic ioctl-like commands. Depending on
98 * the use-case it might be better to use subdev-specific ops (currently
99 * not yet implemented) since ops provide proper type-checking.
103 * enum v4l2_subdev_io_pin_bits - Subdevice external IO pin configuration
110 * &struct v4l2_subdev_io_pin_config->value.
123 * struct v4l2_subdev_io_pin_config - Subdevice external IO pin configuration
129 * @value: Initial value for pin - e.g. GPIO output value
141 * struct v4l2_subdev_core_ops - Define core ops callbacks for subdevs
159 * drivers without discussing this first on the linux-media mailinglist.
160 * There should be no reason normally to reset a device.
189 int (*log_status)(struct v4l2_subdev *sd);
190 int (*s_io_pin_config)(struct v4l2_subdev *sd, size_t n,
192 int (*init)(struct v4l2_subdev *sd, u32 val);
193 int (*load_fw)(struct v4l2_subdev *sd);
194 int (*reset)(struct v4l2_subdev *sd, u32 val);
195 int (*s_gpio)(struct v4l2_subdev *sd, u32 val);
196 long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
198 long (*compat_ioctl32)(struct v4l2_subdev *sd, unsigned int cmd,
202 int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
203 int (*s_register)(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg);
205 int (*s_power)(struct v4l2_subdev *sd, int on);
206 int (*interrupt_service_routine)(struct v4l2_subdev *sd,
208 int (*subscribe_event)(struct v4l2_subdev *sd, struct v4l2_fh *fh,
210 int (*unsubscribe_event)(struct v4l2_subdev *sd, struct v4l2_fh *fh,
215 * struct v4l2_subdev_tuner_ops - Callbacks used when v4l device was opened
229 * freq->type must be filled in. Normally done by video_ioctl2()
236 * @s_tuner: callback for VIDIOC_S_TUNER() ioctl handler code. @vt->type must be
265 int (*standby)(struct v4l2_subdev *sd);
266 int (*s_radio)(struct v4l2_subdev *sd);
267 int (*s_frequency)(struct v4l2_subdev *sd, const struct v4l2_frequency *freq);
268 int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq);
269 int (*enum_freq_bands)(struct v4l2_subdev *sd, struct v4l2_frequency_band *band);
270 int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
271 int (*s_tuner)(struct v4l2_subdev *sd, const struct v4l2_tuner *vt);
272 int (*g_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm);
273 int (*s_modulator)(struct v4l2_subdev *sd, const struct v4l2_modulator *vm);
274 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type);
275 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config);
279 * struct v4l2_subdev_audio_ops - Callbacks used for audio-related settings
285 * -EINVAL is returned.
290 * If the frequency is not supported, then %-EINVAL is returned.
294 * Never attempt to use user-level input IDs (e.g. Composite, S-Video,
298 * The calling driver is responsible for mapping a user-level input to
305 int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
306 int (*s_i2s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
307 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
308 int (*s_stream)(struct v4l2_subdev *sd, int enable);
312 * enum v4l2_mbus_frame_desc_entry - media bus frame description flags
315 * Indicates that &struct v4l2_mbus_frame_desc_entry->length field
327 * struct v4l2_mbus_frame_desc_entry - media bus frame description structure
344 * struct v4l2_mbus_frame_desc - media bus data frame description
354 * struct v4l2_subdev_video_ops - Callbacks used when v4l device was opened
363 * to 0. If the frequency is not supported, then -EINVAL is returned.
410 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
411 int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags);
412 int (*g_std)(struct v4l2_subdev *sd, v4l2_std_id *norm);
413 int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);
414 int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std);
415 int (*g_std_output)(struct v4l2_subdev *sd, v4l2_std_id *std);
416 int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std);
417 int (*g_tvnorms)(struct v4l2_subdev *sd, v4l2_std_id *std);
418 int (*g_tvnorms_output)(struct v4l2_subdev *sd, v4l2_std_id *std);
419 int (*g_input_status)(struct v4l2_subdev *sd, u32 *status);
420 int (*s_stream)(struct v4l2_subdev *sd, int enable);
421 int (*g_pixelaspect)(struct v4l2_subdev *sd, struct v4l2_fract *aspect);
422 int (*g_frame_interval)(struct v4l2_subdev *sd,
424 int (*s_frame_interval)(struct v4l2_subdev *sd,
426 int (*s_dv_timings)(struct v4l2_subdev *sd,
428 int (*g_dv_timings)(struct v4l2_subdev *sd,
430 int (*query_dv_timings)(struct v4l2_subdev *sd,
432 int (*s_rx_buffer)(struct v4l2_subdev *sd, void *buf,
437 * struct v4l2_subdev_vbi_ops - Callbacks used when v4l device was opened
446 * &struct v4l2_sliced_vbi_data. If no valid VBI data was found, then the
452 * VBI signal is disabled. If no valid VBI data was found, then the type
456 * Not all video decoders support this. If no data is available because
457 * the readback register contains invalid or erroneous data %-EIO is
472 int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line);
473 int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data);
474 int (*g_vbi_data)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data);
475 int (*g_sliced_vbi_cap)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_cap *cap);
476 int (*s_raw_fmt)(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt);
477 int (*g_sliced_fmt)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);
478 int (*s_sliced_fmt)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);
482 * struct v4l2_subdev_sensor_ops - v4l2-subdev sensor operations
492 int (*g_skip_top_lines)(struct v4l2_subdev *sd, u32 *lines);
493 int (*g_skip_frames)(struct v4l2_subdev *sd, u32 *frames);
497 * enum v4l2_subdev_ir_mode- describes the type of IR supported
506 * struct v4l2_subdev_ir_parameters - Parameters for IR TX or TX
513 * @shutdown: if true: set hardware to low/no power, false: normal mode
555 * struct v4l2_subdev_ir_ops - operations for IR subdevices
558 * The semantics are similar to a non-blocking read() call.
567 * settings - e.g. an actual carrier setting of 35,904 Hz when 36,000 Hz
574 * The semantics are similar to a non-blocking write() call.
583 * settings - e.g. an actual carrier setting of 35,904 Hz when 36,000 Hz
591 int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count,
594 int (*rx_g_parameters)(struct v4l2_subdev *sd,
596 int (*rx_s_parameters)(struct v4l2_subdev *sd,
600 int (*tx_write)(struct v4l2_subdev *sd, u8 *buf, size_t count,
603 int (*tx_g_parameters)(struct v4l2_subdev *sd,
605 int (*tx_s_parameters)(struct v4l2_subdev *sd,
610 * struct v4l2_subdev_pad_config - Used for storing subdev pad information.
627 * struct v4l2_subdev_pad_ops - v4l2-subdev pad level operations
664 * @get_mbus_config: get the media bus configuration of a remote sub-device.
666 * firmware interface at sub-device probe time, immediately
668 * driver. Remote sub-devices (usually video receivers) shall
671 * Callers should make sure they get the most up-to-date as
677 * @set_mbus_config: set the media bus configuration of a remote sub-device.
680 * configuration parameters between media sub-devices. The
689 int (*init_cfg)(struct v4l2_subdev *sd,
691 int (*enum_mbus_code)(struct v4l2_subdev *sd,
694 int (*enum_frame_size)(struct v4l2_subdev *sd,
697 int (*enum_frame_interval)(struct v4l2_subdev *sd,
700 int (*get_fmt)(struct v4l2_subdev *sd,
703 int (*set_fmt)(struct v4l2_subdev *sd,
706 int (*get_selection)(struct v4l2_subdev *sd,
709 int (*set_selection)(struct v4l2_subdev *sd,
712 int (*get_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid);
713 int (*set_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid);
714 int (*dv_timings_cap)(struct v4l2_subdev *sd,
716 int (*enum_dv_timings)(struct v4l2_subdev *sd,
719 int (*link_validate)(struct v4l2_subdev *sd, struct media_link *link,
723 int (*get_frame_desc)(struct v4l2_subdev *sd, unsigned int pad,
725 int (*set_frame_desc)(struct v4l2_subdev *sd, unsigned int pad,
727 int (*get_mbus_config)(struct v4l2_subdev *sd, unsigned int pad,
729 int (*set_mbus_config)(struct v4l2_subdev *sd, unsigned int pad,
734 * struct v4l2_subdev_ops - Subdev operations
757 * struct v4l2_subdev_internal_ops - V4L2 subdev internal ops
772 * filehandle to the v4l-subdevX device node was closed. If no device
773 * node was created for this sub-device, then the @release callback
777 * sub-device that sets the V4L2_SUBDEV_FL_HAS_DEVNODE flag.
784 int (*registered)(struct v4l2_subdev *sd);
785 void (*unregistered)(struct v4l2_subdev *sd);
786 int (*open)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh);
787 int (*close)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh);
788 void (*release)(struct v4l2_subdev *sd);
809 * struct v4l2_subdev_platform_data - regulators config struct
813 * @host_priv: Per-subdevice data, specific for a certain video host device
823 * struct v4l2_subdev - describes a V4L2 sub-device
826 * @list: List of sub-devices
828 * @owner_v4l2_dev: true if the &sd->owner matches the owner of @v4l2_dev->dev
831 * %V4L2_SUBDEV_FL_IS_I2C - Set this flag if this subdev is a i2c device;
832 * %V4L2_SUBDEV_FL_IS_SPI - Set this flag if this subdev is a spi device;
833 * %V4L2_SUBDEV_FL_HAS_DEVNODE - Set this flag if this subdev needs a
835 * %V4L2_SUBDEV_FL_HAS_EVENTS - Set this flag if this subdev generates
843 * @name: Name of the sub-device. Please notice that the name must be unique.
844 * @grp_id: can be used to group similar subdevs. Value is driver-specific
851 * either dev->of_node->fwnode or dev->fwnode (whichever is non-NULL).
852 * @async_list: Links this subdev to a global subdev_list or @notifier->done
856 * @subdev_notifier: A sub-device notifier implicitly registered for the sub-
861 * stand-alone or embedded in a larger struct.
894 * media_entity_to_v4l2_subdev - Returns a &struct v4l2_subdev from
909 * vdev_to_v4l2_subdev - Returns a &struct v4l2_subdev from
918 * struct v4l2_subdev_fh - Used for storing subdev information per file handle
933 * to_v4l2_subdev_fh - Returns a &struct v4l2_subdev_fh from
944 * v4l2_subdev_get_try_format - ancillary routine to call
945 * &struct v4l2_subdev_pad_config->try_fmt
947 * @sd: pointer to &struct v4l2_subdev
952 v4l2_subdev_get_try_format(struct v4l2_subdev *sd, in v4l2_subdev_get_try_format() argument
956 if (WARN_ON(pad >= sd->entity.num_pads)) in v4l2_subdev_get_try_format()
962 * v4l2_subdev_get_try_crop - ancillary routine to call
963 * &struct v4l2_subdev_pad_config->try_crop
965 * @sd: pointer to &struct v4l2_subdev
970 v4l2_subdev_get_try_crop(struct v4l2_subdev *sd, in v4l2_subdev_get_try_crop() argument
974 if (WARN_ON(pad >= sd->entity.num_pads)) in v4l2_subdev_get_try_crop()
980 * v4l2_subdev_get_try_compose - ancillary routine to call
981 * &struct v4l2_subdev_pad_config->try_compose
983 * @sd: pointer to &struct v4l2_subdev
988 v4l2_subdev_get_try_compose(struct v4l2_subdev *sd, in v4l2_subdev_get_try_compose() argument
992 if (WARN_ON(pad >= sd->entity.num_pads)) in v4l2_subdev_get_try_compose()
1002 * v4l2_set_subdevdata - Sets V4L2 dev private device data
1004 * @sd: pointer to &struct v4l2_subdev
1007 static inline void v4l2_set_subdevdata(struct v4l2_subdev *sd, void *p) in v4l2_set_subdevdata() argument
1009 sd->dev_priv = p; in v4l2_set_subdevdata()
1013 * v4l2_get_subdevdata - Gets V4L2 dev private device data
1015 * @sd: pointer to &struct v4l2_subdev
1019 static inline void *v4l2_get_subdevdata(const struct v4l2_subdev *sd) in v4l2_get_subdevdata() argument
1021 return sd->dev_priv; in v4l2_get_subdevdata()
1025 * v4l2_set_subdev_hostdata - Sets V4L2 dev private host data
1027 * @sd: pointer to &struct v4l2_subdev
1030 static inline void v4l2_set_subdev_hostdata(struct v4l2_subdev *sd, void *p) in v4l2_set_subdev_hostdata() argument
1032 sd->host_priv = p; in v4l2_set_subdev_hostdata()
1036 * v4l2_get_subdev_hostdata - Gets V4L2 dev private data
1038 * @sd: pointer to &struct v4l2_subdev
1042 static inline void *v4l2_get_subdev_hostdata(const struct v4l2_subdev *sd) in v4l2_get_subdev_hostdata() argument
1044 return sd->host_priv; in v4l2_get_subdev_hostdata()
1050 * v4l2_subdev_get_fwnode_pad_1_to_1 - Get pad number from a subdev fwnode
1067 * v4l2_subdev_link_validate_default - validates a media link
1069 * @sd: pointer to &struct v4l2_subdev
1077 int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd,
1083 * v4l2_subdev_link_validate - validates a media link
1096 * v4l2_subdev_alloc_pad_config - Allocates memory for pad config
1098 * @sd: pointer to struct v4l2_subdev
1101 v4l2_subdev_pad_config *v4l2_subdev_alloc_pad_config(struct v4l2_subdev *sd);
1104 * v4l2_subdev_free_pad_config - Frees memory allocated by
1113 * v4l2_subdev_init - initializes the sub-device struct
1115 * @sd: pointer to the &struct v4l2_subdev to be initialized
1118 void v4l2_subdev_init(struct v4l2_subdev *sd,
1124 * v4l2_subdev_call - call an operation of a v4l2_subdev.
1126 * @sd: pointer to the &struct v4l2_subdev
1134 * Example: err = v4l2_subdev_call(sd, video, s_std, norm);
1136 #define v4l2_subdev_call(sd, o, f, args...) \ argument
1138 struct v4l2_subdev *__sd = (sd); \
1141 __result = -ENODEV; \
1142 else if (!(__sd->ops->o && __sd->ops->o->f)) \
1143 __result = -ENOIOCTLCMD; \
1145 v4l2_subdev_call_wrappers.o->f) \
1146 __result = v4l2_subdev_call_wrappers.o->f( \
1149 __result = __sd->ops->o->f(__sd, ##args); \
1154 * v4l2_subdev_has_op - Checks if a subdev defines a certain operation.
1156 * @sd: pointer to the &struct v4l2_subdev
1161 #define v4l2_subdev_has_op(sd, o, f) \ argument
1162 ((sd)->ops->o && (sd)->ops->o->f)
1165 * v4l2_subdev_notify_event() - Delivers event notification for subdevice
1166 * @sd: The subdev for which to deliver the event
1174 void v4l2_subdev_notify_event(struct v4l2_subdev *sd,