diff mbox series

[26/28] media: ov2680: Add g_skip_frames op support

Message ID 20230607164712.63579-27-hdegoede@redhat.com (mailing list archive)
State New, archived
Headers show
Series media: ov2680: Bugfixes + ACPI + selection(crop-tgt) API support | expand

Commit Message

Hans de Goede June 7, 2023, 4:47 p.m. UTC
Add support for v4l2_subdev_sensor_ops.g_skip_frames.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/media/i2c/ov2680.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Laurent Pinchart June 7, 2023, 5:04 p.m. UTC | #1
Hi Hans,

Thank you for the patch.

On Wed, Jun 07, 2023 at 06:47:10PM +0200, Hans de Goede wrote:
> Add support for v4l2_subdev_sensor_ops.g_skip_frames.

The .g_skip_frames() subdev operation was a mistake in hindsight, and
should probably not be used in new drivers (or existing drivers that
don't use it yet). Why do you need it ?

> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/media/i2c/ov2680.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c
> index 867df602ee53..9e4f0bcbe979 100644
> --- a/drivers/media/i2c/ov2680.c
> +++ b/drivers/media/i2c/ov2680.c
> @@ -62,6 +62,8 @@
>  
>  #define OV2680_FRAME_RATE			30
>  
> +#define OV2680_SKIP_FRAMES			3
> +
>  #define OV2680_NATIVE_WIDTH			1616
>  #define OV2680_NATIVE_HEIGHT			1216
>  #define OV2680_NATIVE_START_LEFT		0
> @@ -759,6 +761,12 @@ static int ov2680_enum_frame_interval(struct v4l2_subdev *sd,
>  	return 0;
>  }
>  
> +static int ov2680_g_skip_frames(struct v4l2_subdev *sd, u32 *frames)
> +{
> +	*frames = OV2680_SKIP_FRAMES;
> +	return 0;
> +}
> +
>  static int ov2680_s_ctrl(struct v4l2_ctrl *ctrl)
>  {
>  	struct v4l2_subdev *sd = ctrl_to_sd(ctrl);
> @@ -806,6 +814,10 @@ static const struct v4l2_subdev_video_ops ov2680_video_ops = {
>  	.s_stream		= ov2680_s_stream,
>  };
>  
> +static const struct v4l2_subdev_sensor_ops ov2680_sensor_ops = {
> +	.g_skip_frames	= ov2680_g_skip_frames,
> +};
> +
>  static const struct v4l2_subdev_pad_ops ov2680_pad_ops = {
>  	.init_cfg		= ov2680_init_cfg,
>  	.enum_mbus_code		= ov2680_enum_mbus_code,
> @@ -820,6 +832,7 @@ static const struct v4l2_subdev_pad_ops ov2680_pad_ops = {
>  static const struct v4l2_subdev_ops ov2680_subdev_ops = {
>  	.video	= &ov2680_video_ops,
>  	.pad	= &ov2680_pad_ops,
> +	.sensor = &ov2680_sensor_ops,
>  };
>  
>  static int ov2680_mode_init(struct ov2680_dev *sensor)
Hans de Goede June 7, 2023, 5:49 p.m. UTC | #2
Hi Laurent,

On 6/7/23 19:04, Laurent Pinchart wrote:
> Hi Hans,
> 
> Thank you for the patch.
> 
> On Wed, Jun 07, 2023 at 06:47:10PM +0200, Hans de Goede wrote:
>> Add support for v4l2_subdev_sensor_ops.g_skip_frames.
> 
> The .g_skip_frames() subdev operation was a mistake in hindsight, and
> should probably not be used in new drivers (or existing drivers that
> don't use it yet). Why do you need it ?

I don't need it. The atomisp-ov2680.c version of the ov2680
driver had it and I thought it would be useful to preserve
that functionality.

Since you say it is deprecated this can be dropped.

Regards,

Hans






>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>  drivers/media/i2c/ov2680.c | 13 +++++++++++++
>>  1 file changed, 13 insertions(+)
>>
>> diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c
>> index 867df602ee53..9e4f0bcbe979 100644
>> --- a/drivers/media/i2c/ov2680.c
>> +++ b/drivers/media/i2c/ov2680.c
>> @@ -62,6 +62,8 @@
>>  
>>  #define OV2680_FRAME_RATE			30
>>  
>> +#define OV2680_SKIP_FRAMES			3
>> +
>>  #define OV2680_NATIVE_WIDTH			1616
>>  #define OV2680_NATIVE_HEIGHT			1216
>>  #define OV2680_NATIVE_START_LEFT		0
>> @@ -759,6 +761,12 @@ static int ov2680_enum_frame_interval(struct v4l2_subdev *sd,
>>  	return 0;
>>  }
>>  
>> +static int ov2680_g_skip_frames(struct v4l2_subdev *sd, u32 *frames)
>> +{
>> +	*frames = OV2680_SKIP_FRAMES;
>> +	return 0;
>> +}
>> +
>>  static int ov2680_s_ctrl(struct v4l2_ctrl *ctrl)
>>  {
>>  	struct v4l2_subdev *sd = ctrl_to_sd(ctrl);
>> @@ -806,6 +814,10 @@ static const struct v4l2_subdev_video_ops ov2680_video_ops = {
>>  	.s_stream		= ov2680_s_stream,
>>  };
>>  
>> +static const struct v4l2_subdev_sensor_ops ov2680_sensor_ops = {
>> +	.g_skip_frames	= ov2680_g_skip_frames,
>> +};
>> +
>>  static const struct v4l2_subdev_pad_ops ov2680_pad_ops = {
>>  	.init_cfg		= ov2680_init_cfg,
>>  	.enum_mbus_code		= ov2680_enum_mbus_code,
>> @@ -820,6 +832,7 @@ static const struct v4l2_subdev_pad_ops ov2680_pad_ops = {
>>  static const struct v4l2_subdev_ops ov2680_subdev_ops = {
>>  	.video	= &ov2680_video_ops,
>>  	.pad	= &ov2680_pad_ops,
>> +	.sensor = &ov2680_sensor_ops,
>>  };
>>  
>>  static int ov2680_mode_init(struct ov2680_dev *sensor)
>
diff mbox series

Patch

diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c
index 867df602ee53..9e4f0bcbe979 100644
--- a/drivers/media/i2c/ov2680.c
+++ b/drivers/media/i2c/ov2680.c
@@ -62,6 +62,8 @@ 
 
 #define OV2680_FRAME_RATE			30
 
+#define OV2680_SKIP_FRAMES			3
+
 #define OV2680_NATIVE_WIDTH			1616
 #define OV2680_NATIVE_HEIGHT			1216
 #define OV2680_NATIVE_START_LEFT		0
@@ -759,6 +761,12 @@  static int ov2680_enum_frame_interval(struct v4l2_subdev *sd,
 	return 0;
 }
 
+static int ov2680_g_skip_frames(struct v4l2_subdev *sd, u32 *frames)
+{
+	*frames = OV2680_SKIP_FRAMES;
+	return 0;
+}
+
 static int ov2680_s_ctrl(struct v4l2_ctrl *ctrl)
 {
 	struct v4l2_subdev *sd = ctrl_to_sd(ctrl);
@@ -806,6 +814,10 @@  static const struct v4l2_subdev_video_ops ov2680_video_ops = {
 	.s_stream		= ov2680_s_stream,
 };
 
+static const struct v4l2_subdev_sensor_ops ov2680_sensor_ops = {
+	.g_skip_frames	= ov2680_g_skip_frames,
+};
+
 static const struct v4l2_subdev_pad_ops ov2680_pad_ops = {
 	.init_cfg		= ov2680_init_cfg,
 	.enum_mbus_code		= ov2680_enum_mbus_code,
@@ -820,6 +832,7 @@  static const struct v4l2_subdev_pad_ops ov2680_pad_ops = {
 static const struct v4l2_subdev_ops ov2680_subdev_ops = {
 	.video	= &ov2680_video_ops,
 	.pad	= &ov2680_pad_ops,
+	.sensor = &ov2680_sensor_ops,
 };
 
 static int ov2680_mode_init(struct ov2680_dev *sensor)