Re: [PATCH RFC 1/5] media: imx219: Move LP-11 state switch to power_on()

From: Dave Stevenson

Date: Thu Oct 01 2026 - 13:06:07 EST


Hi Mattijs

On Thu, 1 Oct 2026 at 13:55, Mattijs Korpershoek
<mkorpershoek@xxxxxxxxxx> wrote:
>
> During probe(), we write the IMX219_MODE_STREAMING register to
> transition from streaming -> standby to force LP-11 state.
>
> This should be done at each power-up of the sensor, but is only
> done *once* for the driver lifecycle (at probe).
>
> Move the LP-11 sequence to power_on() to ensure that it's always put
> into standby mode whenever the pm framework detects it's a power up.

Actually this is an interesting one for the Renesas folks to answer as
they added this.

Yes the sensor powers up with the MIPI lanes in LP00, transitioning to
LP10, then LP11, and finally to HS when starting streaming.
On stopping streaming, the MIPI lanes remain in LP11 until the XCLR
reset line is dropped.

If their hardware wants to see LP11, then how does it keep working if
the sensor has the reset line wired up which would take it back to
LP00? What phase exactly is it that needs this, and how long does LP11
need to be held for?
Do they have power gating such that the CSI receiver block ever gets
powered off and needs to go through the loop again?

I'm not against the patch, but it'd be nice to understand what the
requirements actually are. The sensor goes through LP11 even without
this, so it's something sensitive in a state machine somewhere.

Dave

> Signed-off-by: Mattijs Korpershoek <mkorpershoek@xxxxxxxxxx>
> ---
> drivers/media/i2c/imx219.c | 44 ++++++++++++++++++++++++--------------------
> 1 file changed, 24 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
> index 9571f3622d2d..7978fee5f4a2 100644
> --- a/drivers/media/i2c/imx219.c
> +++ b/drivers/media/i2c/imx219.c
> @@ -1056,8 +1056,32 @@ static int imx219_power_on(struct device *dev)
> usleep_range(IMX219_XCLR_MIN_DELAY_US,
> IMX219_XCLR_MIN_DELAY_US + IMX219_XCLR_DELAY_RANGE_US);
>
> + /*
> + * Sensor doesn't enter LP-11 state upon power up until and unless
> + * streaming is started, so upon power up switch the modes to:
> + * streaming -> standby
> + */
> + ret = cci_write(imx219->regmap, IMX219_REG_MODE_SELECT,
> + IMX219_MODE_STREAMING, NULL);
> + if (ret < 0)
> + goto gpio_off;
> +
> + usleep_range(100, 110);
> +
> + /* put sensor back to standby mode */
> + ret = cci_write(imx219->regmap, IMX219_REG_MODE_SELECT,
> + IMX219_MODE_STANDBY, NULL);
> + if (ret < 0)
> + goto gpio_off;
> +
> + usleep_range(100, 110);
> +
> return 0;
>
> +gpio_off:
> + gpiod_set_value_cansleep(imx219->reset_gpio, 0);
> + clk_disable_unprepare(imx219->xclk);
> +
> reg_off:
> regulator_bulk_disable(IMX219_NUM_SUPPLIES, imx219->supplies);
>
> @@ -1240,26 +1264,6 @@ static int imx219_probe(struct i2c_client *client)
> if (ret)
> goto error_power_off;
>
> - /*
> - * Sensor doesn't enter LP-11 state upon power up until and unless
> - * streaming is started, so upon power up switch the modes to:
> - * streaming -> standby
> - */
> - ret = cci_write(imx219->regmap, IMX219_REG_MODE_SELECT,
> - IMX219_MODE_STREAMING, NULL);
> - if (ret < 0)
> - goto error_power_off;
> -
> - usleep_range(100, 110);
> -
> - /* put sensor back to standby mode */
> - ret = cci_write(imx219->regmap, IMX219_REG_MODE_SELECT,
> - IMX219_MODE_STANDBY, NULL);
> - if (ret < 0)
> - goto error_power_off;
> -
> - usleep_range(100, 110);
> -
> ret = imx219_init_controls(imx219);
> if (ret)
> goto error_power_off;
>
> --
> 2.55.0
>