From: Tarang Raval Date: Sat, 29 Mar 2025 05:43:26 +0000 (+0530) Subject: media: i2c: imx334: Configure lane mode dynamically X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=9e089a649a229fb08942ada75b0f1c7f5814e065;p=users%2Fdwmw2%2Flinux.git media: i2c: imx334: Configure lane mode dynamically Configure the lane mode dynamically from the streaming function instead of using a hardcoded value. Signed-off-by: Tarang Raval [Sakari Ailus: Fix checkpatch.pl issue, lower Dynamically.] Signed-off-by: Sakari Ailus Signed-off-by: Hans Verkuil --- diff --git a/drivers/media/i2c/imx334.c b/drivers/media/i2c/imx334.c index 9d4d15df8dcf3..561ed2c870058 100644 --- a/drivers/media/i2c/imx334.c +++ b/drivers/media/i2c/imx334.c @@ -47,6 +47,8 @@ #define IMX334_EXPOSURE_DEFAULT 0x0648 #define IMX334_REG_LANEMODE CCI_REG8(0x3a01) +#define IMX334_CSI_4_LANE_MODE 3 +#define IMX334_CSI_8_LANE_MODE 7 /* Window cropping Settings */ #define IMX334_REG_AREA3_ST_ADR_1 CCI_REG16_LE(0x3074) @@ -240,7 +242,6 @@ static const struct cci_reg_sequence common_mode_regs[] = { { IMX334_REG_HADD_VADD, 0x00 }, { IMX334_REG_VALID_EXPAND, 0x03 }, { IMX334_REG_TCYCLE, 0x00 }, - { IMX334_REG_LANEMODE, 0x03 }, { IMX334_REG_TCLKPOST, 0x007f }, { IMX334_REG_TCLKPREPARE, 0x0037 }, { IMX334_REG_TCLKTRAIL, 0x0037 }, @@ -876,6 +877,13 @@ static int imx334_start_streaming(struct imx334 *imx334) return ret; } + ret = cci_write(imx334->cci, IMX334_REG_LANEMODE, + IMX334_CSI_4_LANE_MODE, NULL); + if (ret) { + dev_err(imx334->dev, "failed to configure lanes\n"); + return ret; + } + ret = imx334_set_framefmt(imx334); if (ret) { dev_err(imx334->dev, "%s failed to set frame format: %d\n",