@@ -113,6 +113,8 @@ MODULE_PARM_DESC(trigger_mode, "Set vsync trigger mode: 1=source, 2=sink");
113113#define IMX477_REG_XVS_IO_CTRL 0x3040
114114#define IMX477_REG_EXTOUT_EN 0x4b81
115115
116+ #define IMX477_REG_FRAME_BLANKSTOP_CLK 0xE000
117+
116118/* Embedded metadata stream structure */
117119#define IMX477_EMBEDDED_LINE_WIDTH 16384
118120#define IMX477_NUM_EMBEDDED_LINES 1
@@ -170,7 +172,6 @@ static const struct imx477_reg mode_common_regs[] = {
170172 {0x0136 , 0x18 },
171173 {0x0137 , 0x00 },
172174 {0x0138 , 0x01 },
173- {0xe000 , 0x00 },
174175 {0xe07a , 0x01 },
175176 {0x0808 , 0x02 },
176177 {0x4ae9 , 0x18 },
@@ -964,6 +965,11 @@ struct imx477 {
964965 /* Streaming on/off */
965966 bool streaming ;
966967
968+ /* Flags field from parsing the endpoint - used for (non)continuous
969+ * clock mode
970+ */
971+ unsigned int csi2_flags ;
972+
967973 /* Rewrite common registers on stream on? */
968974 bool common_regs_written ;
969975
@@ -1557,6 +1563,12 @@ static int imx477_start_streaming(struct imx477 *imx477)
15571563 __func__ );
15581564 return ret ;
15591565 }
1566+
1567+ imx477_write_reg (imx477 , IMX477_REG_FRAME_BLANKSTOP_CLK ,
1568+ IMX477_REG_VALUE_08BIT ,
1569+ imx477 -> csi2_flags & V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK ?
1570+ 1 : 0 );
1571+
15601572 imx477 -> common_regs_written = true;
15611573 }
15621574
@@ -1937,7 +1949,7 @@ static void imx477_free_controls(struct imx477 *imx477)
19371949 mutex_destroy (& imx477 -> mutex );
19381950}
19391951
1940- static int imx477_check_hwcfg (struct device * dev )
1952+ static int imx477_check_hwcfg (struct device * dev , struct imx477 * imx477 )
19411953{
19421954 struct fwnode_handle * endpoint ;
19431955 struct v4l2_fwnode_endpoint ep_cfg = {
@@ -1975,6 +1987,8 @@ static int imx477_check_hwcfg(struct device *dev)
19751987 goto error_out ;
19761988 }
19771989
1990+ imx477 -> csi2_flags = ep_cfg .bus .mipi_csi2 .flags ;
1991+
19781992 ret = 0 ;
19791993
19801994error_out :
@@ -2033,7 +2047,7 @@ static int imx477_probe(struct i2c_client *client)
20332047 (const struct imx477_compatible_data * )match -> data ;
20342048
20352049 /* Check the hardware configuration in device tree */
2036- if (imx477_check_hwcfg (dev ))
2050+ if (imx477_check_hwcfg (dev , imx477 ))
20372051 return - EINVAL ;
20382052
20392053 /* Default the trigger mode from OF to -1, which means invalid */
0 commit comments