[08/10] media: ar0521: Setup controls at s_stream time

Message ID 20221005190613.394277-9-jacopo@jmondi.org (mailing list archive)
State Changes Requested
Headers
Series media: ar0521: Add analog gain, rework clock tree |

Commit Message

Jacopo Mondi Oct. 5, 2022, 7:06 p.m. UTC
  Setup all the registered controls at s_stream(1) time instead of
manually configure gains.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 drivers/media/i2c/ar0521.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Dave Stevenson Oct. 6, 2022, 3:43 p.m. UTC | #1
On Wed, 5 Oct 2022 at 20:07, Jacopo Mondi <jacopo@jmondi.org> wrote:
>
> Setup all the registered controls at s_stream(1) time instead of
> manually configure gains.
>
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

Ah, lovely. I'm surprised it doesn't error out with no s_ctrl handler
for link_freq when r/w though.

Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>

> ---
>  drivers/media/i2c/ar0521.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/ar0521.c b/drivers/media/i2c/ar0521.c
> index 26bb1b8f7453..d46a51332964 100644
> --- a/drivers/media/i2c/ar0521.c
> +++ b/drivers/media/i2c/ar0521.c
> @@ -460,7 +460,7 @@ static int ar0521_set_stream(struct ar0521_dev *sensor, bool on)
>                 if (ret)
>                         goto err;
>
> -               ret = ar0521_set_gains(sensor);
> +               ret =  __v4l2_ctrl_handler_setup(&sensor->ctrls.handler);
>                 if (ret)
>                         goto err;
>
> --
> 2.37.3
>
  
Jacopo Mondi Oct. 7, 2022, 7:23 a.m. UTC | #2
Hi Dave

On Thu, Oct 06, 2022 at 04:43:14PM +0100, Dave Stevenson wrote:
> On Wed, 5 Oct 2022 at 20:07, Jacopo Mondi <jacopo@jmondi.org> wrote:
> >
> > Setup all the registered controls at s_stream(1) time instead of
> > manually configure gains.
> >
> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
>
> Ah, lovely. I'm surprised it doesn't error out with no s_ctrl handler
> for link_freq when r/w though.
>

I don't have the usual safety "default: return -EINVAL" case in my
s_ctrl handler.

Will fix that!

> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
>
> > ---
> >  drivers/media/i2c/ar0521.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/i2c/ar0521.c b/drivers/media/i2c/ar0521.c
> > index 26bb1b8f7453..d46a51332964 100644
> > --- a/drivers/media/i2c/ar0521.c
> > +++ b/drivers/media/i2c/ar0521.c
> > @@ -460,7 +460,7 @@ static int ar0521_set_stream(struct ar0521_dev *sensor, bool on)
> >                 if (ret)
> >                         goto err;
> >
> > -               ret = ar0521_set_gains(sensor);
> > +               ret =  __v4l2_ctrl_handler_setup(&sensor->ctrls.handler);
> >                 if (ret)
> >                         goto err;
> >
> > --
> > 2.37.3
> >
  

Patch

diff --git a/drivers/media/i2c/ar0521.c b/drivers/media/i2c/ar0521.c
index 26bb1b8f7453..d46a51332964 100644
--- a/drivers/media/i2c/ar0521.c
+++ b/drivers/media/i2c/ar0521.c
@@ -460,7 +460,7 @@  static int ar0521_set_stream(struct ar0521_dev *sensor, bool on)
 		if (ret)
 			goto err;
 
-		ret = ar0521_set_gains(sensor);
+		ret =  __v4l2_ctrl_handler_setup(&sensor->ctrls.handler);
 		if (ret)
 			goto err;