@@ -39,6 +39,10 @@ MODULE_PARM_DESC(qbc_adjust, "Quad Bayer broken line correction strength [0,2-5]
3939
4040#define IMX708_REG_ORIENTATION CCI_REG8(0x101)
4141
42+ #define IMX708_REG_CSI_LANE_MODE CCI_REG8(0x0114)
43+ #define IMX708_CSI_2_LANE_MODE 0x01
44+ #define IMX708_CSI_4_LANE_MODE 0x03
45+
4246#define IMX708_REG_EXCK_FREQ CCI_REG16(0x0136)
4347 #define IMX708_EXCLK_FREQ 0x1800
4448#define IMX708_INCLK_FREQ 24000000
@@ -236,7 +240,6 @@ static const struct cci_reg_sequence mode_common_regs[] = {
236240 {CCI_REG8 (0xF03F ), 0x10 },
237241 {CCI_REG8 (0x0112 ), 0x0A },
238242 {CCI_REG8 (0x0113 ), 0x0A },
239- {CCI_REG8 (0x0114 ), 0x01 },
240243 {CCI_REG8 (0x0B8E ), 0x01 },
241244 {CCI_REG8 (0x0B8F ), 0x00 },
242245 {CCI_REG8 (0x0B94 ), 0x01 },
@@ -782,6 +785,8 @@ struct imx708 {
782785
783786 u64 link_freq_value ;
784787 u16 iop_pll_mpy ;
788+
789+ unsigned int lanes ;
785790};
786791
787792static inline struct imx708 * to_imx708 (struct v4l2_subdev * _sd )
@@ -1352,6 +1357,10 @@ static int imx708_start_streaming(struct imx708 *imx708)
13521357 imx708 -> common_regs_written = true;
13531358 }
13541359
1360+ ret = cci_write (imx708 -> regmap , IMX708_REG_CSI_LANE_MODE ,
1361+ imx708 -> lanes == 2 ? IMX708_CSI_2_LANE_MODE :
1362+ IMX708_CSI_4_LANE_MODE , NULL );
1363+
13551364 /* Apply default values of current mode */
13561365 reg_list = & imx708 -> mode -> reg_list ;
13571366 ret = cci_multi_reg_write (imx708 -> regmap , reg_list -> regs ,
@@ -1803,10 +1812,13 @@ static int imx708_check_hwcfg(struct device *dev, struct imx708 *imx708)
18031812 }
18041813
18051814 /* Check the number of MIPI CSI2 data lanes */
1806- if (ep_cfg .bus .mipi_csi2 .num_data_lanes != 2 ) {
1807- dev_err (dev , "only 2 data lanes are currently supported\n" );
1815+ if (ep_cfg .bus .mipi_csi2 .num_data_lanes != 2 &&
1816+ ep_cfg .bus .mipi_csi2 .num_data_lanes != 4 ) {
1817+ dev_err_probe (dev , - EINVAL ,
1818+ "only 2 or 4 data lanes are currently supported\n" );
18081819 goto error_out ;
18091820 }
1821+ imx708 -> lanes = ep_cfg .bus .mipi_csi2 .num_data_lanes ;
18101822
18111823 /* Check the link frequency set in device tree */
18121824 if (!ep_cfg .nr_of_link_frequencies ) {
0 commit comments