@@ -299,16 +299,6 @@ static const struct cci_reg_sequence mode_4096x2304[] = {
299299 { IMX214_REG_DIG_CROP_WIDTH , 4096 },
300300 { IMX214_REG_DIG_CROP_HEIGHT , 2304 },
301301
302- { IMX214_REG_VTPXCK_DIV , 5 },
303- { IMX214_REG_VTSYCK_DIV , 2 },
304- { IMX214_REG_PREPLLCK_VT_DIV , 3 },
305- { IMX214_REG_PLL_VT_MPY , 150 },
306- { IMX214_REG_OPPXCK_DIV , 10 },
307- { IMX214_REG_OPSYCK_DIV , 1 },
308- { IMX214_REG_PLL_MULT_DRIV , IMX214_PLL_SINGLE },
309-
310- { IMX214_REG_REQ_LINK_BIT_RATE , IMX214_LINK_BIT_RATE_MBPS (4800 ) },
311-
312302 { CCI_REG8 (0x3A03 ), 0x09 },
313303 { CCI_REG8 (0x3A04 ), 0x50 },
314304 { CCI_REG8 (0x3A05 ), 0x01 },
@@ -362,16 +352,6 @@ static const struct cci_reg_sequence mode_1920x1080[] = {
362352 { IMX214_REG_DIG_CROP_WIDTH , 1920 },
363353 { IMX214_REG_DIG_CROP_HEIGHT , 1080 },
364354
365- { IMX214_REG_VTPXCK_DIV , 5 },
366- { IMX214_REG_VTSYCK_DIV , 2 },
367- { IMX214_REG_PREPLLCK_VT_DIV , 3 },
368- { IMX214_REG_PLL_VT_MPY , 150 },
369- { IMX214_REG_OPPXCK_DIV , 10 },
370- { IMX214_REG_OPSYCK_DIV , 1 },
371- { IMX214_REG_PLL_MULT_DRIV , IMX214_PLL_SINGLE },
372-
373- { IMX214_REG_REQ_LINK_BIT_RATE , IMX214_LINK_BIT_RATE_MBPS (4800 ) },
374-
375355 { CCI_REG8 (0x3A03 ), 0x04 },
376356 { CCI_REG8 (0x3A04 ), 0xF8 },
377357 { CCI_REG8 (0x3A05 ), 0x02 },
@@ -405,9 +385,6 @@ static const struct cci_reg_sequence mode_table_common[] = {
405385 /* ATR setting */
406386 { IMX214_REG_ATR_FAST_MOVE , 2 },
407387
408- /* external clock setting */
409- { IMX214_REG_EXCK_FREQ , IMX214_EXCK_FREQ (IMX214_DEFAULT_CLK_FREQ / 1000000 ) },
410-
411388 /* global setting */
412389 /* basic config */
413390 { IMX214_REG_MASK_CORR_FRAMES , IMX214_CORR_FRAMES_MASK },
@@ -777,6 +754,24 @@ static int imx214_entity_init_state(struct v4l2_subdev *subdev,
777754 return 0 ;
778755}
779756
757+ static int imx214_configure_pll (struct imx214 * imx214 )
758+ {
759+ int ret = 0 ;
760+
761+ cci_write (imx214 -> regmap , IMX214_REG_VTPXCK_DIV , 5 , & ret );
762+ cci_write (imx214 -> regmap , IMX214_REG_VTSYCK_DIV , 2 , & ret );
763+ cci_write (imx214 -> regmap , IMX214_REG_PREPLLCK_VT_DIV , 3 , & ret );
764+ cci_write (imx214 -> regmap , IMX214_REG_PLL_VT_MPY , 150 , & ret );
765+ cci_write (imx214 -> regmap , IMX214_REG_OPPXCK_DIV , 10 , & ret );
766+ cci_write (imx214 -> regmap , IMX214_REG_OPSYCK_DIV , 1 , & ret );
767+ cci_write (imx214 -> regmap , IMX214_REG_PLL_MULT_DRIV ,
768+ IMX214_PLL_SINGLE , & ret );
769+ cci_write (imx214 -> regmap , IMX214_REG_EXCK_FREQ ,
770+ IMX214_EXCK_FREQ (IMX214_DEFAULT_CLK_FREQ / 1000000 ), & ret );
771+
772+ return ret ;
773+ }
774+
780775static int imx214_update_digital_gain (struct imx214 * imx214 , u32 val )
781776{
782777 int ret = 0 ;
@@ -1020,6 +1015,19 @@ static int imx214_start_streaming(struct imx214 *imx214)
10201015 return ret ;
10211016 }
10221017
1018+ ret = imx214_configure_pll (imx214 );
1019+ if (ret ) {
1020+ dev_err (imx214 -> dev , "failed to configure PLL: %d\n" , ret );
1021+ return ret ;
1022+ }
1023+
1024+ ret = cci_write (imx214 -> regmap , IMX214_REG_REQ_LINK_BIT_RATE ,
1025+ IMX214_LINK_BIT_RATE_MBPS (4800 ), NULL );
1026+ if (ret ) {
1027+ dev_err (imx214 -> dev , "failed to configure link bit rate\n" );
1028+ return ret ;
1029+ }
1030+
10231031 ret = cci_write (imx214 -> regmap , IMX214_REG_CSI_LANE_MODE ,
10241032 IMX214_CSI_4_LANE_MODE , NULL );
10251033 if (ret ) {
0 commit comments