[v3,5/7] media: i2c: imx290: Avoid communication during probe()
Checks
Context |
Check |
Description |
media-ci/HTML_report |
success
|
Link
|
media-ci/report |
success
|
Link
|
media-ci/bisect |
success
|
Link
|
media-ci/doc |
success
|
Link
|
media-ci/build |
success
|
Link
|
media-ci/static-upstream |
success
|
Link
|
media-ci/abi |
success
|
Link
|
media-ci/media-patchstyle |
success
|
Link
|
media-ci/checkpatch |
success
|
Link
|
Commit Message
From: Benjamin Bara <benjamin.bara@skidata.com>
As we don't know the mode during probe(), it doesn't make sense to
update the sensors' registers with assumptions. Avoid the communication
in this case.
Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
---
Changes since v2:
- new
---
drivers/media/i2c/imx290.c | 4 ++++
1 file changed, 4 insertions(+)
Comments
On Mon, Sep 02, 2024 at 05:57:30PM +0200, bbara93@gmail.com wrote:
> From: Benjamin Bara <benjamin.bara@skidata.com>
>
> As we don't know the mode during probe(), it doesn't make sense to
> update the sensors' registers with assumptions. Avoid the communication
> in this case.
That doesn't seem right. I think you can fix the problem by
moving initialization of the controls at probe time after the device
gets runtime-suspended. Please try it, and if it doesn't work, let's
figure out why.
> Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
> ---
> Changes since v2:
> - new
> ---
> drivers/media/i2c/imx290.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/media/i2c/imx290.c b/drivers/media/i2c/imx290.c
> index ece4d66001f5..9610e9fd2059 100644
> --- a/drivers/media/i2c/imx290.c
> +++ b/drivers/media/i2c/imx290.c
> @@ -769,6 +769,10 @@ static int imx290_set_ctrl(struct v4l2_ctrl *ctrl)
> if (!pm_runtime_get_if_in_use(imx290->dev))
> return 0;
>
> + /* V4L2 controls values will be applied only when mode is known */
> + if (imx290->current_mode == &imx290_mode_off)
> + return 0;
> +
> state = v4l2_subdev_get_locked_active_state(&imx290->sd);
> format = v4l2_subdev_state_get_format(state, 0);
>
Hi Laurent!
On Mon, 2 Sept 2024 at 22:00, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> On Mon, Sep 02, 2024 at 05:57:30PM +0200, bbara93@gmail.com wrote:
> > From: Benjamin Bara <benjamin.bara@skidata.com>
> >
> > As we don't know the mode during probe(), it doesn't make sense to
> > update the sensors' registers with assumptions. Avoid the communication
> > in this case.
>
> That doesn't seem right. I think you can fix the problem by
> moving initialization of the controls at probe time after the device
> gets runtime-suspended. Please try it, and if it doesn't work, let's
> figure out why.
Will do for the next iteration.
Thanks & kind regards
Benjamin
> > Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
> > ---
> > Changes since v2:
> > - new
> > ---
> > drivers/media/i2c/imx290.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/media/i2c/imx290.c b/drivers/media/i2c/imx290.c
> > index ece4d66001f5..9610e9fd2059 100644
> > --- a/drivers/media/i2c/imx290.c
> > +++ b/drivers/media/i2c/imx290.c
> > @@ -769,6 +769,10 @@ static int imx290_set_ctrl(struct v4l2_ctrl *ctrl)
> > if (!pm_runtime_get_if_in_use(imx290->dev))
> > return 0;
> >
> > + /* V4L2 controls values will be applied only when mode is known */
> > + if (imx290->current_mode == &imx290_mode_off)
> > + return 0;
> > +
> > state = v4l2_subdev_get_locked_active_state(&imx290->sd);
> > format = v4l2_subdev_state_get_format(state, 0);
> >
>
> --
> Regards,
>
> Laurent Pinchart
@@ -769,6 +769,10 @@ static int imx290_set_ctrl(struct v4l2_ctrl *ctrl)
if (!pm_runtime_get_if_in_use(imx290->dev))
return 0;
+ /* V4L2 controls values will be applied only when mode is known */
+ if (imx290->current_mode == &imx290_mode_off)
+ return 0;
+
state = v4l2_subdev_get_locked_active_state(&imx290->sd);
format = v4l2_subdev_state_get_format(state, 0);