From 3fb558f6c3bbcc4825e9d9cbd0f8a8c02d1fca84 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 5 Oct 2017 15:14:50 -0400 Subject: media: v4l2-subdev: create cross-references for ioctls When generating Sphinx output, create cross-references for the callbacks for each ioctl. While here, fix a few wrong names for ioctls. Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-subdev.h | 65 ++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 31 deletions(-) (limited to 'include/media/v4l2-subdev.h') diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index ec399c770301..5459bcf5a423 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -140,7 +140,7 @@ struct v4l2_subdev_io_pin_config { /** * struct v4l2_subdev_core_ops - Define core ops callbacks for subdevs * - * @log_status: callback for %VIDIOC_LOG_STATUS ioctl handler code. + * @log_status: callback for VIDIOC_LOG_STATUS() ioctl handler code. * * @s_io_pin_config: configure one or more chip I/O pins for chips that * multiplex different internal signal pads out to IO pins. This function @@ -168,9 +168,9 @@ struct v4l2_subdev_io_pin_config { * @compat_ioctl32: called when a 32 bits application uses a 64 bits Kernel, * in order to fix data passed from/to userspace. * - * @g_register: callback for %VIDIOC_G_REGISTER ioctl handler code. + * @g_register: callback for VIDIOC_DBG_G_REGISTER() ioctl handler code. * - * @s_register: callback for %VIDIOC_G_REGISTER ioctl handler code. + * @s_register: callback for VIDIOC_DBG_S_REGISTER() ioctl handler code. * * @s_power: puts subdevice in power saving mode (on == 0) or normal operation * mode (on == 1). @@ -215,25 +215,25 @@ struct v4l2_subdev_core_ops { * struct v4l2_subdev_tuner_ops - Callbacks used when v4l device was opened * in radio mode. * - * @s_radio: callback for %VIDIOC_S_RADIO ioctl handler code. + * @s_radio: callback for VIDIOC_S_RADIO() ioctl handler code. * - * @s_frequency: callback for %VIDIOC_S_FREQUENCY ioctl handler code. + * @s_frequency: callback for VIDIOC_S_FREQUENCY() ioctl handler code. * - * @g_frequency: callback for %VIDIOC_G_FREQUENCY ioctl handler code. + * @g_frequency: callback for VIDIOC_G_FREQUENCY() ioctl handler code. * freq->type must be filled in. Normally done by video_ioctl2() * or the bridge driver. * - * @enum_freq_bands: callback for %VIDIOC_ENUM_FREQ_BANDS ioctl handler code. + * @enum_freq_bands: callback for VIDIOC_ENUM_FREQ_BANDS() ioctl handler code. * - * @g_tuner: callback for %VIDIOC_G_TUNER ioctl handler code. + * @g_tuner: callback for VIDIOC_G_TUNER() ioctl handler code. * - * @s_tuner: callback for %VIDIOC_S_TUNER ioctl handler code. @vt->type must be + * @s_tuner: callback for VIDIOC_S_TUNER() ioctl handler code. @vt->type must be * filled in. Normally done by video_ioctl2 or the * bridge driver. * - * @g_modulator: callback for %VIDIOC_G_MODULATOR ioctl handler code. + * @g_modulator: callback for VIDIOC_G_MODULATOR() ioctl handler code. * - * @s_modulator: callback for %VIDIOC_S_MODULATOR ioctl handler code. + * @s_modulator: callback for VIDIOC_S_MODULATOR() ioctl handler code. * * @s_type_addr: sets tuner type and its I2C addr. * @@ -332,9 +332,9 @@ struct v4l2_mbus_frame_desc { * regarding clock frequency dividers, etc. If not used, then set flags * to 0. If the frequency is not supported, then -EINVAL is returned. * - * @g_std: callback for %VIDIOC_G_STD ioctl handler code. + * @g_std: callback for VIDIOC_G_STD() ioctl handler code. * - * @s_std: callback for %VIDIOC_S_STD ioctl handler code. + * @s_std: callback for VIDIOC_S_STD() ioctl handler code. * * @s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by * video input devices. @@ -342,7 +342,7 @@ struct v4l2_mbus_frame_desc { * @g_std_output: get current standard for video OUTPUT devices. This is ignored * by video input devices. * - * @querystd: callback for %VIDIOC_QUERYSTD ioctl handler code. + * @querystd: callback for VIDIOC_QUERYSTD() ioctl handler code. * * @g_tvnorms: get &v4l2_std_id with all standards supported by the video * CAPTURE device. This is ignored by video output devices. @@ -358,13 +358,15 @@ struct v4l2_mbus_frame_desc { * * @g_pixelaspect: callback to return the pixelaspect ratio. * - * @g_parm: callback for %VIDIOC_G_PARM ioctl handler code. + * @g_parm: callback for VIDIOC_G_PARM() ioctl handler code. * - * @s_parm: callback for %VIDIOC_S_PARM ioctl handler code. + * @s_parm: callback for VIDIOC_S_PARM() ioctl handler code. * - * @g_frame_interval: callback for %VIDIOC_G_FRAMEINTERVAL ioctl handler code. + * @g_frame_interval: callback for VIDIOC_SUBDEV_G_FRAME_INTERVAL() + * ioctl handler code. * - * @s_frame_interval: callback for %VIDIOC_S_FRAMEINTERVAL ioctl handler code. + * @s_frame_interval: callback for VIDIOC_SUBDEV_S_FRAME_INTERVAL() + * ioctl handler code. * * @s_dv_timings: Set custom dv timings in the sub device. This is used * when sub device is capable of setting detailed timing information @@ -372,7 +374,7 @@ struct v4l2_mbus_frame_desc { * * @g_dv_timings: Get custom dv timings in the sub device. * - * @query_dv_timings: callback for %VIDIOC_QUERY_DV_TIMINGS ioctl handler code. + * @query_dv_timings: callback for VIDIOC_QUERY_DV_TIMINGS() ioctl handler code. * * @g_mbus_config: get supported mediabus configurations * @@ -443,7 +445,8 @@ struct v4l2_subdev_video_ops { * member (to determine whether CC data from the first or second field * should be obtained). * - * @g_sliced_vbi_cap: callback for %VIDIOC_SLICED_VBI_CAP ioctl handler code. + * @g_sliced_vbi_cap: callback for VIDIOC_G_SLICED_VBI_CAP() ioctl handler + * code. * * @s_raw_fmt: setup the video encoder/decoder for raw VBI. * @@ -610,30 +613,30 @@ struct v4l2_subdev_pad_config { * struct v4l2_subdev_pad_ops - v4l2-subdev pad level operations * * @init_cfg: initialize the pad config to default values - * @enum_mbus_code: callback for %VIDIOC_SUBDEV_ENUM_MBUS_CODE ioctl handler + * @enum_mbus_code: callback for VIDIOC_SUBDEV_ENUM_MBUS_CODE() ioctl handler * code. - * @enum_frame_size: callback for %VIDIOC_SUBDEV_ENUM_FRAME_SIZE ioctl handler + * @enum_frame_size: callback for VIDIOC_SUBDEV_ENUM_FRAME_SIZE() ioctl handler * code. * - * @enum_frame_interval: callback for %VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL ioctl + * @enum_frame_interval: callback for VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL() ioctl * handler code. * - * @get_fmt: callback for %VIDIOC_SUBDEV_G_FMT ioctl handler code. + * @get_fmt: callback for VIDIOC_SUBDEV_G_FMT() ioctl handler code. * - * @set_fmt: callback for %VIDIOC_SUBDEV_S_FMT ioctl handler code. + * @set_fmt: callback for VIDIOC_SUBDEV_S_FMT() ioctl handler code. * - * @get_selection: callback for %VIDIOC_SUBDEV_G_SELECTION ioctl handler code. + * @get_selection: callback for VIDIOC_SUBDEV_G_SELECTION() ioctl handler code. * - * @set_selection: callback for %VIDIOC_SUBDEV_S_SELECTION ioctl handler code. + * @set_selection: callback for VIDIOC_SUBDEV_S_SELECTION() ioctl handler code. * - * @get_edid: callback for %VIDIOC_SUBDEV_G_EDID ioctl handler code. + * @get_edid: callback for VIDIOC_SUBDEV_G_EDID() ioctl handler code. * - * @set_edid: callback for %VIDIOC_SUBDEV_S_EDID ioctl handler code. + * @set_edid: callback for VIDIOC_SUBDEV_S_EDID() ioctl handler code. * - * @dv_timings_cap: callback for %VIDIOC_SUBDEV_DV_TIMINGS_CAP ioctl handler + * @dv_timings_cap: callback for VIDIOC_SUBDEV_DV_TIMINGS_CAP() ioctl handler * code. * - * @enum_dv_timings: callback for %VIDIOC_SUBDEV_ENUM_DV_TIMINGS ioctl handler + * @enum_dv_timings: callback for VIDIOC_SUBDEV_ENUM_DV_TIMINGS() ioctl handler * code. * * @link_validate: used by the media controller code to check if the links -- cgit From 07bf9355cab2bcfa917704fb759ec07229d3037a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 6 Oct 2017 09:50:28 -0400 Subject: media: v4l2-subdev: fix description of tuner.s_radio ops The description there is completely broken and it mentions an ioctl that doesn't exist. Fix it. Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-subdev.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'include/media/v4l2-subdev.h') diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 5459bcf5a423..a6a9e54388e2 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -215,7 +215,10 @@ struct v4l2_subdev_core_ops { * struct v4l2_subdev_tuner_ops - Callbacks used when v4l device was opened * in radio mode. * - * @s_radio: callback for VIDIOC_S_RADIO() ioctl handler code. + * @s_radio: callback that switches the tuner to radio mode. + * drivers should explicitly call it when a tuner ops should + * operate on radio mode, before being able to handle it. + * Used on devices that have both AM/FM radio receiver and TV. * * @s_frequency: callback for VIDIOC_S_FREQUENCY() ioctl handler code. * @@ -238,6 +241,22 @@ struct v4l2_subdev_core_ops { * @s_type_addr: sets tuner type and its I2C addr. * * @s_config: sets tda9887 specific stuff, like port1, port2 and qss + * + * .. note:: + * + * On devices that have both AM/FM and TV, it is up to the driver + * to explicitly call s_radio when the tuner should be switched to + * radio mode, before handling other &struct v4l2_subdev_tuner_ops + * that would require it. An example of such usage is:: + * + * static void s_frequency(void *priv, const struct v4l2_frequency *f) + * { + * ... + * if (f.type == V4L2_TUNER_RADIO) + * v4l2_device_call_all(v4l2_dev, 0, tuner, s_radio); + * ... + * v4l2_device_call_all(v4l2_dev, 0, tuner, s_frequency); + * } */ struct v4l2_subdev_tuner_ops { int (*s_radio)(struct v4l2_subdev *sd); -- cgit From 0722ef82e573bce8254f69ff314ef0edbfd1c1f0 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 6 Oct 2017 09:54:05 -0400 Subject: media: v4l2-subdev: fix a typo ownner -> owner Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-subdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/media/v4l2-subdev.h') diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index a6a9e54388e2..8040db3d62bf 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -788,7 +788,7 @@ struct v4l2_subdev_platform_data { * @list: List of sub-devices * @owner: The owner is the same as the driver's &struct device owner. * @owner_v4l2_dev: true if the &sd->owner matches the owner of @v4l2_dev->dev - * ownner. Initialized by v4l2_device_register_subdev(). + * owner. Initialized by v4l2_device_register_subdev(). * @flags: subdev flags. Can be: * %V4L2_SUBDEV_FL_IS_I2C - Set this flag if this subdev is a i2c device; * %V4L2_SUBDEV_FL_IS_SPI - Set this flag if this subdev is a spi device; -- cgit From 4eb2f55728abbe5adb526a9553752d0add5a9550 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 5 Oct 2017 16:17:27 -0400 Subject: media: v4l2-subdev: better document IO pin configuration flags Convert V4L2_SUBDEV_IO_PIN_* to enums, use BIT() and document via kernel-doc. Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-subdev.h | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'include/media/v4l2-subdev.h') diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 8040db3d62bf..3b80e8537198 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -108,22 +108,31 @@ struct v4l2_decode_vbi_line { * not yet implemented) since ops provide proper type-checking. */ -/* Subdevice external IO pin configuration */ -#define V4L2_SUBDEV_IO_PIN_DISABLE (1 << 0) /* ENABLE assumed */ -#define V4L2_SUBDEV_IO_PIN_OUTPUT (1 << 1) -#define V4L2_SUBDEV_IO_PIN_INPUT (1 << 2) -#define V4L2_SUBDEV_IO_PIN_SET_VALUE (1 << 3) /* Set output value */ -#define V4L2_SUBDEV_IO_PIN_ACTIVE_LOW (1 << 4) /* ACTIVE HIGH assumed */ +/** + * enum v4l2_subdev_io_pin_bits - Subdevice external IO pin configuration + * bits + * + * @V4L2_SUBDEV_IO_PIN_DISABLE: disables a pin config. ENABLE assumed. + * @V4L2_SUBDEV_IO_PIN_OUTPUT: set it if pin is an output. + * @V4L2_SUBDEV_IO_PIN_INPUT: set it if pin is an input. + * @V4L2_SUBDEV_IO_PIN_SET_VALUE: to set the output value via + * &struct v4l2_subdev_io_pin_config->value. + * @V4L2_SUBDEV_IO_PIN_ACTIVE_LOW: pin active is bit 0. + * Otherwise, ACTIVE HIGH is assumed. + */ +enum v4l2_subdev_io_pin_bits { + V4L2_SUBDEV_IO_PIN_DISABLE = 0, + V4L2_SUBDEV_IO_PIN_OUTPUT = 1, + V4L2_SUBDEV_IO_PIN_INPUT = 2, + V4L2_SUBDEV_IO_PIN_SET_VALUE = 3, + V4L2_SUBDEV_IO_PIN_ACTIVE_LOW = 4, +}; /** * struct v4l2_subdev_io_pin_config - Subdevice external IO pin configuration * - * @flags: bitmask with flags for this pin's config: - * %V4L2_SUBDEV_IO_PIN_DISABLE - disables a pin config, - * %V4L2_SUBDEV_IO_PIN_OUTPUT - if pin is an output, - * %V4L2_SUBDEV_IO_PIN_INPUT - if pin is an input, - * %V4L2_SUBDEV_IO_PIN_SET_VALUE - to set the output value via @value - * and %V4L2_SUBDEV_IO_PIN_ACTIVE_LOW - if active is 0. + * @flags: bitmask with flags for this pin's config, whose bits are defined by + * &enum v4l2_subdev_io_pin_bits. * @pin: Chip external IO pin to configure * @function: Internal signal pad/function to route to IO pin * @value: Initial value for pin - e.g. GPIO output value -- cgit From bb92895a1c68569055106a6d9bf5c330e5e6a371 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 5 Oct 2017 16:32:30 -0400 Subject: media: v4l2-subdev: convert frame description to enum As kernel-doc doesn't support documenting #define values, and using enum makes easier to identify where the values are used, convert V4L2_MBUS_FRAME_DESC_FL_* to enum, and use BIT() macro. While here, fix the description at v4l2_mbus_frame_desc_entry, in order to match what's described for V4L2_MBUS_FRAME_DESC_FL_LEN_MAX. Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-subdev.h | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'include/media/v4l2-subdev.h') diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 3b80e8537198..71b8ff4b2e0e 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -313,25 +313,32 @@ struct v4l2_subdev_audio_ops { int (*s_stream)(struct v4l2_subdev *sd, int enable); }; -/* Indicates the @length field specifies maximum data length. */ -#define V4L2_MBUS_FRAME_DESC_FL_LEN_MAX (1U << 0) -/* - * Indicates that the format does not have line offsets, i.e. the - * receiver should use 1D DMA. +/** + * enum v4l2_mbus_frame_desc_entry - media bus frame description flags + * + * @V4L2_MBUS_FRAME_DESC_FL_LEN_MAX: + * Indicates that &struct v4l2_mbus_frame_desc_entry->length field + * specifies maximum data length. + * @V4L2_MBUS_FRAME_DESC_FL_BLOB: + * Indicates that the format does not have line offsets, i.e. + * the receiver should use 1D DMA. */ -#define V4L2_MBUS_FRAME_DESC_FL_BLOB (1U << 1) +enum v4l2_mbus_frame_desc_flags { + V4L2_MBUS_FRAME_DESC_FL_LEN_MAX = BIT(0), + V4L2_MBUS_FRAME_DESC_FL_BLOB = BIT(1), +}; /** * struct v4l2_mbus_frame_desc_entry - media bus frame description structure * - * @flags: bitmask flags: %V4L2_MBUS_FRAME_DESC_FL_LEN_MAX and - * %V4L2_MBUS_FRAME_DESC_FL_BLOB. - * @pixelcode: media bus pixel code, valid if FRAME_DESC_FL_BLOB is not set - * @length: number of octets per frame, valid if V4L2_MBUS_FRAME_DESC_FL_BLOB - * is set + * @flags: bitmask flags, as defined by &enum v4l2_mbus_frame_desc_flags. + * @pixelcode: media bus pixel code, valid if @flags + * %FRAME_DESC_FL_BLOB is not set. + * @length: number of octets per frame, valid if @flags + * %V4L2_MBUS_FRAME_DESC_FL_LEN_MAX is set. */ struct v4l2_mbus_frame_desc_entry { - u16 flags; + enum v4l2_mbus_frame_desc_flags flags; u32 pixelcode; u32 length; }; -- cgit From 4a3fad709bbc74c85fffff8903d17b5e35723365 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 4 Jan 2018 06:47:28 -0500 Subject: media: fix usage of whitespaces and on indentation On several places, whitespaces are being used for indentation, or even at the end of the line. Fix them. Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-subdev.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include/media/v4l2-subdev.h') diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 71b8ff4b2e0e..980a86c08fce 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -116,7 +116,7 @@ struct v4l2_decode_vbi_line { * @V4L2_SUBDEV_IO_PIN_OUTPUT: set it if pin is an output. * @V4L2_SUBDEV_IO_PIN_INPUT: set it if pin is an input. * @V4L2_SUBDEV_IO_PIN_SET_VALUE: to set the output value via - * &struct v4l2_subdev_io_pin_config->value. + * &struct v4l2_subdev_io_pin_config->value. * @V4L2_SUBDEV_IO_PIN_ACTIVE_LOW: pin active is bit 0. * Otherwise, ACTIVE HIGH is assumed. */ @@ -253,14 +253,14 @@ struct v4l2_subdev_core_ops { * * .. note:: * - * On devices that have both AM/FM and TV, it is up to the driver + * On devices that have both AM/FM and TV, it is up to the driver * to explicitly call s_radio when the tuner should be switched to * radio mode, before handling other &struct v4l2_subdev_tuner_ops * that would require it. An example of such usage is:: * * static void s_frequency(void *priv, const struct v4l2_frequency *f) * { - * ... + * ... * if (f.type == V4L2_TUNER_RADIO) * v4l2_device_call_all(v4l2_dev, 0, tuner, s_radio); * ... @@ -333,7 +333,7 @@ enum v4l2_mbus_frame_desc_flags { * * @flags: bitmask flags, as defined by &enum v4l2_mbus_frame_desc_flags. * @pixelcode: media bus pixel code, valid if @flags - * %FRAME_DESC_FL_BLOB is not set. + * %FRAME_DESC_FL_BLOB is not set. * @length: number of octets per frame, valid if @flags * %V4L2_MBUS_FRAME_DESC_FL_LEN_MAX is set. */ -- cgit