[PATCH v2 3/3] media: imx-mipi-csis: Get number of active lanes via mbus_config

Isaac Scott posted 3 patches 4 weeks, 1 day ago
There is a newer version of this series
[PATCH v2 3/3] media: imx-mipi-csis: Get number of active lanes via mbus_config
Posted by Isaac Scott 4 weeks, 1 day ago
The number of lanes actively used by a MIPI CSI transmitter may differ
from that which is defined in device tree. As such, call on
v4l2_get_active_data_lanes to check if the driver reports a
differing number of lanes to device tree, and use that number of active
lanes.

If the number of active data lanes is invalid, or the op is not
supported, it will use the number of lanes defined in device tree.

Signed-off-by: Isaac Scott <isaac.scott@ideasonboard.com>
---
 drivers/media/platform/nxp/imx-mipi-csis.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
index fc89325f2f94..985be511bcd0 100644
--- a/drivers/media/platform/nxp/imx-mipi-csis.c
+++ b/drivers/media/platform/nxp/imx-mipi-csis.c
@@ -967,6 +967,9 @@ static int mipi_csis_s_stream(struct v4l2_subdev *sd, int enable)
 	format = v4l2_subdev_state_get_format(state, CSIS_PAD_SINK);
 	csis_fmt = find_csis_format(format->code);
 
+	csis->bus.num_data_lanes = v4l2_get_active_data_lanes(csis->source.pad,
+							      csis->max_data_lanes);
+
 	ret = mipi_csis_calculate_params(csis, csis_fmt);
 	if (ret < 0)
 		goto err_unlock;
-- 
2.43.0
Re: [PATCH v2 3/3] media: imx-mipi-csis: Get number of active lanes via mbus_config
Posted by Frank Li 4 weeks, 1 day ago
On Wed, Sep 03, 2025 at 11:22:42AM +0100, Isaac Scott wrote:
> The number of lanes actively used by a MIPI CSI transmitter may differ
> from that which is defined in device tree. As such, call on
> v4l2_get_active_data_lanes to check if the driver reports a

function need (), v4l2_get_active_data_lanes()

> differing number of lanes to device tree, and use that number of active
> lanes.
>
> If the number of active data lanes is invalid, or the op is not
> supported, it will use the number of lanes defined in device tree.

remove "it will" to keep simple.

Frank
>
> Signed-off-by: Isaac Scott <isaac.scott@ideasonboard.com>
> ---
>  drivers/media/platform/nxp/imx-mipi-csis.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
> index fc89325f2f94..985be511bcd0 100644
> --- a/drivers/media/platform/nxp/imx-mipi-csis.c
> +++ b/drivers/media/platform/nxp/imx-mipi-csis.c
> @@ -967,6 +967,9 @@ static int mipi_csis_s_stream(struct v4l2_subdev *sd, int enable)
>  	format = v4l2_subdev_state_get_format(state, CSIS_PAD_SINK);
>  	csis_fmt = find_csis_format(format->code);
>
> +	csis->bus.num_data_lanes = v4l2_get_active_data_lanes(csis->source.pad,
> +							      csis->max_data_lanes);
> +
>  	ret = mipi_csis_calculate_params(csis, csis_fmt);
>  	if (ret < 0)
>  		goto err_unlock;
> --
> 2.43.0
>
Re: [PATCH v2 3/3] media: imx-mipi-csis: Get number of active lanes via mbus_config
Posted by Isaac Scott 2 weeks, 3 days ago
Hi Frank,

Thank you for the review!

Quoting Frank Li (2025-09-03 16:35:16)
> On Wed, Sep 03, 2025 at 11:22:42AM +0100, Isaac Scott wrote:
> > The number of lanes actively used by a MIPI CSI transmitter may differ
> > from that which is defined in device tree. As such, call on
> > v4l2_get_active_data_lanes to check if the driver reports a
> 
> function need (), v4l2_get_active_data_lanes()
> 
> > differing number of lanes to device tree, and use that number of active
> > lanes.
> >
> > If the number of active data lanes is invalid, or the op is not
> > supported, it will use the number of lanes defined in device tree.
> 
> remove "it will" to keep simple.

Thanks, I'll change this in v3.

> 
> Frank

Best wishes,

Isaac

> >
> > Signed-off-by: Isaac Scott <isaac.scott@ideasonboard.com>
> > ---
> >  drivers/media/platform/nxp/imx-mipi-csis.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
> > index fc89325f2f94..985be511bcd0 100644
> > --- a/drivers/media/platform/nxp/imx-mipi-csis.c
> > +++ b/drivers/media/platform/nxp/imx-mipi-csis.c
> > @@ -967,6 +967,9 @@ static int mipi_csis_s_stream(struct v4l2_subdev *sd, int enable)
> >       format = v4l2_subdev_state_get_format(state, CSIS_PAD_SINK);
> >       csis_fmt = find_csis_format(format->code);
> >
> > +     csis->bus.num_data_lanes = v4l2_get_active_data_lanes(csis->source.pad,
> > +                                                           csis->max_data_lanes);
> > +
> >       ret = mipi_csis_calculate_params(csis, csis_fmt);
> >       if (ret < 0)
> >               goto err_unlock;
> > --
> > 2.43.0
> >