@@ -224,15 +224,6 @@ static const struct cci_reg_sequence imx219_common_regs[] = {
224224 { CCI_REG8 (0x30eb ), 0x05 },
225225 { CCI_REG8 (0x30eb ), 0x09 },
226226
227- /* PLL Clock Table */
228- { IMX219_REG_VTPXCK_DIV , 5 },
229- { IMX219_REG_VTSYCK_DIV , 1 },
230- { IMX219_REG_PREPLLCK_VT_DIV , 3 }, /* 0x03 = AUTO set */
231- { IMX219_REG_PREPLLCK_OP_DIV , 3 }, /* 0x03 = AUTO set */
232- { IMX219_REG_PLL_VT_MPY , 57 },
233- { IMX219_REG_OPSYCK_DIV , 1 },
234- { IMX219_REG_PLL_OP_MPY , 114 },
235-
236227 /* Undocumented registers */
237228 { CCI_REG8 (0x455e ), 0x00 },
238229 { CCI_REG8 (0x471e ), 0x4b },
@@ -257,6 +248,34 @@ static const struct cci_reg_sequence imx219_common_regs[] = {
257248 { IMX219_REG_EXCK_FREQ , IMX219_EXCK_FREQ (IMX219_XCLK_FREQ / 1000000 ) },
258249};
259250
251+ static const struct cci_reg_sequence imx219_2lane_regs [] = {
252+ /* PLL Clock Table */
253+ { IMX219_REG_VTPXCK_DIV , 5 },
254+ { IMX219_REG_VTSYCK_DIV , 1 },
255+ { IMX219_REG_PREPLLCK_VT_DIV , 3 }, /* 0x03 = AUTO set */
256+ { IMX219_REG_PREPLLCK_OP_DIV , 3 }, /* 0x03 = AUTO set */
257+ { IMX219_REG_PLL_VT_MPY , 57 },
258+ { IMX219_REG_OPSYCK_DIV , 1 },
259+ { IMX219_REG_PLL_OP_MPY , 114 },
260+
261+ /* 2-Lane CSI Mode */
262+ { IMX219_REG_CSI_LANE_MODE , IMX219_CSI_2_LANE_MODE },
263+ };
264+
265+ static const struct cci_reg_sequence imx219_4lane_regs [] = {
266+ /* PLL Clock Table */
267+ { IMX219_REG_VTPXCK_DIV , 5 },
268+ { IMX219_REG_VTSYCK_DIV , 1 },
269+ { IMX219_REG_PREPLLCK_VT_DIV , 3 }, /* 0x03 = AUTO set */
270+ { IMX219_REG_PREPLLCK_OP_DIV , 3 }, /* 0x03 = AUTO set */
271+ { IMX219_REG_PLL_VT_MPY , 88 },
272+ { IMX219_REG_OPSYCK_DIV , 1 },
273+ { IMX219_REG_PLL_OP_MPY , 91 },
274+
275+ /* 4-Lane CSI Mode */
276+ { IMX219_REG_CSI_LANE_MODE , IMX219_CSI_4_LANE_MODE },
277+ };
278+
260279/*
261280 * Register sets lifted off the i2C interface from the Raspberry Pi firmware
262281 * driver.
@@ -941,9 +960,11 @@ static int imx219_get_selection(struct v4l2_subdev *sd,
941960
942961static int imx219_configure_lanes (struct imx219 * imx219 )
943962{
944- return cci_write (imx219 -> regmap , IMX219_REG_CSI_LANE_MODE ,
945- imx219 -> lanes == 2 ? IMX219_CSI_2_LANE_MODE :
946- IMX219_CSI_4_LANE_MODE , NULL );
963+ /* Write the appropriate PLL settings for the number of MIPI lanes */
964+ return cci_multi_reg_write (imx219 -> regmap ,
965+ imx219 -> lanes == 2 ? imx219_2lane_regs : imx219_4lane_regs ,
966+ imx219 -> lanes == 2 ? ARRAY_SIZE (imx219_2lane_regs ) :
967+ ARRAY_SIZE (imx219_4lane_regs ), NULL );
947968};
948969
949970static int imx219_start_streaming (struct imx219 * imx219 ,
0 commit comments