diff mbox series

[v2] media: rcar-vin: add G/S_PARM ioctls

Message ID 20210924135138.29950-1-nikita.yoush@cogentembedded.com (mailing list archive)
State Mainlined
Commit cd0e5e8c4281375f1aa94ff5fabe02963b025a71
Delegated to: Kieran Bingham
Headers show
Series [v2] media: rcar-vin: add G/S_PARM ioctls | expand

Commit Message

Nikita Yushchenko Sept. 24, 2021, 1:51 p.m. UTC
From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>

This adds g/s_parm ioctls for parallel interface.

Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
---
Changes from v1:
- use &vin->vdev to access vin's struct video_device

 drivers/media/platform/rcar-vin/rcar-v4l2.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Comments

Niklas Söderlund Sept. 28, 2021, 12:03 a.m. UTC | #1
Hello Nikita and Vladimir,

Thanks for your work.

On 2021-09-24 16:51:38 +0300, Nikita Yushchenko wrote:
> From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
> 
> This adds g/s_parm ioctls for parallel interface.
> 
> Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
> Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
> Changes from v1:
> - use &vin->vdev to access vin's struct video_device
> 
>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> index bdeff51bf768..a5bfa76fdac6 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -527,6 +527,24 @@ static int rvin_s_selection(struct file *file, void *fh,
>  	return 0;
>  }
>  
> +static int rvin_g_parm(struct file *file, void *priv,
> +		       struct v4l2_streamparm *parm)
> +{
> +	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_source(vin);
> +
> +	return v4l2_g_parm_cap(&vin->vdev, sd, parm);
> +}
> +
> +static int rvin_s_parm(struct file *file, void *priv,
> +		       struct v4l2_streamparm *parm)
> +{
> +	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_source(vin);
> +
> +	return v4l2_s_parm_cap(&vin->vdev, sd, parm);
> +}
> +
>  static int rvin_g_pixelaspect(struct file *file, void *priv,
>  			      int type, struct v4l2_fract *f)
>  {
> @@ -743,6 +761,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>  	.vidioc_g_selection		= rvin_g_selection,
>  	.vidioc_s_selection		= rvin_s_selection,
>  
> +	.vidioc_g_parm			= rvin_g_parm,
> +	.vidioc_s_parm			= rvin_s_parm,
> +
>  	.vidioc_g_pixelaspect		= rvin_g_pixelaspect,
>  
>  	.vidioc_enum_input		= rvin_enum_input,
> -- 
> 2.30.2
>
Jacopo Mondi Sept. 28, 2021, 8:43 a.m. UTC | #2
Hello
  explicit Cc Hans, as I recall the usage of s/g_parm was deprecated
and discouraged in mainline.

Hans: Support for g/s_param is required by Nikita to maintain
compatibility with (out of tree?) subdevice drivers. Should we add it
to the mainline receiver driver ?

What other API should be used to control the subdevice framerate ?
Should it go through VIDIOC_SUBDEV_S_FRAME_INTERVAL instead ?

Thanks
   j

On Fri, Sep 24, 2021 at 04:51:38PM +0300, Nikita Yushchenko wrote:
> From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
>
> This adds g/s_parm ioctls for parallel interface.
>
> Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
> Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
> ---
> Changes from v1:
> - use &vin->vdev to access vin's struct video_device
>
>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> index bdeff51bf768..a5bfa76fdac6 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -527,6 +527,24 @@ static int rvin_s_selection(struct file *file, void *fh,
>  	return 0;
>  }
>
> +static int rvin_g_parm(struct file *file, void *priv,
> +		       struct v4l2_streamparm *parm)
> +{
> +	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_source(vin);
> +
> +	return v4l2_g_parm_cap(&vin->vdev, sd, parm);
> +}
> +
> +static int rvin_s_parm(struct file *file, void *priv,
> +		       struct v4l2_streamparm *parm)
> +{
> +	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_source(vin);
> +
> +	return v4l2_s_parm_cap(&vin->vdev, sd, parm);
> +}
> +
>  static int rvin_g_pixelaspect(struct file *file, void *priv,
>  			      int type, struct v4l2_fract *f)
>  {
> @@ -743,6 +761,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>  	.vidioc_g_selection		= rvin_g_selection,
>  	.vidioc_s_selection		= rvin_s_selection,
>
> +	.vidioc_g_parm			= rvin_g_parm,
> +	.vidioc_s_parm			= rvin_s_parm,
> +
>  	.vidioc_g_pixelaspect		= rvin_g_pixelaspect,
>
>  	.vidioc_enum_input		= rvin_enum_input,
> --
> 2.30.2
>
Hans Verkuil Oct. 12, 2021, 7:33 a.m. UTC | #3
Hi Jacopo,

On 28/09/2021 10:43, Jacopo Mondi wrote:
> Hello
>   explicit Cc Hans, as I recall the usage of s/g_parm was deprecated
> and discouraged in mainline.

It's perfectly fine to use it, but for the non-MC case only. Which is what
this patch does, so I'm accepting it.

s/g_parm isn't deprecated for non-MC drivers, it's ugly but it's the only
way to set or report the framerate for such drivers.

Regards,

	Hans

> 
> Hans: Support for g/s_param is required by Nikita to maintain
> compatibility with (out of tree?) subdevice drivers. Should we add it
> to the mainline receiver driver ?
> 
> What other API should be used to control the subdevice framerate ?
> Should it go through VIDIOC_SUBDEV_S_FRAME_INTERVAL instead ?
> 
> Thanks
>    j
> 
> On Fri, Sep 24, 2021 at 04:51:38PM +0300, Nikita Yushchenko wrote:
>> From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
>>
>> This adds g/s_parm ioctls for parallel interface.
>>
>> Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
>> Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
>> ---
>> Changes from v1:
>> - use &vin->vdev to access vin's struct video_device
>>
>>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 21 +++++++++++++++++++++
>>  1 file changed, 21 insertions(+)
>>
>> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
>> index bdeff51bf768..a5bfa76fdac6 100644
>> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
>> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
>> @@ -527,6 +527,24 @@ static int rvin_s_selection(struct file *file, void *fh,
>>  	return 0;
>>  }
>>
>> +static int rvin_g_parm(struct file *file, void *priv,
>> +		       struct v4l2_streamparm *parm)
>> +{
>> +	struct rvin_dev *vin = video_drvdata(file);
>> +	struct v4l2_subdev *sd = vin_to_source(vin);
>> +
>> +	return v4l2_g_parm_cap(&vin->vdev, sd, parm);
>> +}
>> +
>> +static int rvin_s_parm(struct file *file, void *priv,
>> +		       struct v4l2_streamparm *parm)
>> +{
>> +	struct rvin_dev *vin = video_drvdata(file);
>> +	struct v4l2_subdev *sd = vin_to_source(vin);
>> +
>> +	return v4l2_s_parm_cap(&vin->vdev, sd, parm);
>> +}
>> +
>>  static int rvin_g_pixelaspect(struct file *file, void *priv,
>>  			      int type, struct v4l2_fract *f)
>>  {
>> @@ -743,6 +761,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>>  	.vidioc_g_selection		= rvin_g_selection,
>>  	.vidioc_s_selection		= rvin_s_selection,
>>
>> +	.vidioc_g_parm			= rvin_g_parm,
>> +	.vidioc_s_parm			= rvin_s_parm,
>> +
>>  	.vidioc_g_pixelaspect		= rvin_g_pixelaspect,
>>
>>  	.vidioc_enum_input		= rvin_enum_input,
>> --
>> 2.30.2
>>
diff mbox series

Patch

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index bdeff51bf768..a5bfa76fdac6 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -527,6 +527,24 @@  static int rvin_s_selection(struct file *file, void *fh,
 	return 0;
 }
 
+static int rvin_g_parm(struct file *file, void *priv,
+		       struct v4l2_streamparm *parm)
+{
+	struct rvin_dev *vin = video_drvdata(file);
+	struct v4l2_subdev *sd = vin_to_source(vin);
+
+	return v4l2_g_parm_cap(&vin->vdev, sd, parm);
+}
+
+static int rvin_s_parm(struct file *file, void *priv,
+		       struct v4l2_streamparm *parm)
+{
+	struct rvin_dev *vin = video_drvdata(file);
+	struct v4l2_subdev *sd = vin_to_source(vin);
+
+	return v4l2_s_parm_cap(&vin->vdev, sd, parm);
+}
+
 static int rvin_g_pixelaspect(struct file *file, void *priv,
 			      int type, struct v4l2_fract *f)
 {
@@ -743,6 +761,9 @@  static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
 	.vidioc_g_selection		= rvin_g_selection,
 	.vidioc_s_selection		= rvin_s_selection,
 
+	.vidioc_g_parm			= rvin_g_parm,
+	.vidioc_s_parm			= rvin_s_parm,
+
 	.vidioc_g_pixelaspect		= rvin_g_pixelaspect,
 
 	.vidioc_enum_input		= rvin_enum_input,