On 2/17/26 02:27, Richard Acayan wrote:
The IMX355 sensor driver currently supports having 4 data lanes. There
can't be more or less, so check if the firmware specifies 4 lanes.

Does IMX355 sensor hardware support any other number of lanes?

1) If no, then it makes no practical sense to check for data lanes number
given by firmware, there can be any stored value, but it's known that the
number of sensor data lanes is 4.

2) If yes, then please return to the sensor dt bindings, and reflect any
other options, right now it is set strictly to 4 lanes only. In case if
'data-lanes' property is omitted, you can use 4 lanes as a default number
of data lanes, and this information shall be documented in the dt bindings.


Existing ACPI hardware descriptions may not have the data lanes defined
so this check also accepts a placeholder of 0 lanes.

Suggested-by: Sakari Ailus <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Richard Acayan <[email protected]>
---
  drivers/media/i2c/imx355.c | 7 +++++++
  1 file changed, 7 insertions(+)

diff --git a/drivers/media/i2c/imx355.c b/drivers/media/i2c/imx355.c
index 9ca87488c933..0d6aabea7d59 100644
--- a/drivers/media/i2c/imx355.c
+++ b/drivers/media/i2c/imx355.c
@@ -66,6 +66,9 @@
  #define IMX355_EXT_CLK                        19200000
  #define IMX355_LINK_FREQ_INDEX                0
+/* number of data lanes */
+#define IMX355_DATA_LANES              4
+
  struct imx355_reg {
        u16 address;
        u8 val;
@@ -1705,6 +1708,10 @@ static struct imx355_hwcfg *imx355_get_hwcfg(struct 
device *dev)
        if (!cfg)
                goto out_err;
+ if (bus_cfg.bus.mipi_csi2.num_data_lanes != 0
+        && bus_cfg.bus.mipi_csi2.num_data_lanes != IMX355_DATA_LANES)
+               goto out_err;
+
        ret = v4l2_link_freq_to_bitmap(dev, bus_cfg.link_frequencies,
                                       bus_cfg.nr_of_link_frequencies,
                                       link_freq_menu_items,

--
Best wishes,
Vladimir

Reply via email to