1 From 1551a08118c8e468b3afe0dd5ae0cfa47b7518e1 Mon Sep 17 00:00:00 2001
2 From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
3 Date: Mon, 16 Jan 2023 15:44:53 +0100
4 Subject: [PATCH] media: i2c: imx290: Simplify imx290_set_data_lanes()
6 Upstream commit 76c001287f6a
8 There's no need to check for an incorrect number of data lanes in
9 imx290_set_data_lanes() as the value is validated at probe() time. Drop
12 The PHY_LANE_NUM and CSI_LANE_MODE registers are programmed with a value
13 equal to the number of lanes minus one. Compute it instead of handling
14 it in the switch/case.
16 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
17 Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
18 Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
19 Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
21 drivers/media/i2c/imx290.c | 17 +++++------------
22 1 file changed, 5 insertions(+), 12 deletions(-)
24 --- a/drivers/media/i2c/imx290.c
25 +++ b/drivers/media/i2c/imx290.c
26 @@ -512,28 +512,21 @@ static int imx290_set_register_array(str
28 static int imx290_set_data_lanes(struct imx290 *imx290)
30 - int ret = 0, laneval, frsel;
34 switch (imx290->nlanes) {
46 - * We should never hit this since the data lane count is
47 - * validated in probe itself
49 - dev_err(imx290->dev, "Lane configuration not supported\n");
53 - imx290_write(imx290, IMX290_PHY_LANE_NUM, laneval, &ret);
54 - imx290_write(imx290, IMX290_CSI_LANE_MODE, laneval, &ret);
55 + imx290_write(imx290, IMX290_PHY_LANE_NUM, imx290->nlanes - 1, &ret);
56 + imx290_write(imx290, IMX290_CSI_LANE_MODE, imx290->nlanes - 1, &ret);
57 imx290_write(imx290, IMX290_FR_FDG_SEL, frsel, &ret);