Skip to content

Commit c5317ee

Browse files
committed
media: i2c: imx477: Add selection of (non)continuous clock mode
The register set was always selecting continuous clock mode, even though all our overlays were saying it should be non-continuous. Read the configuration from fwnode and configure the sensor accordingly. Signed-off-by: Dave Stevenson <[email protected]>
1 parent e71eccc commit c5317ee

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

drivers/media/i2c/imx477.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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
@@ -243,7 +245,6 @@ static const struct imx477_reg mode_common_regs[] = {
243245
{0x0136, 0x18},
244246
{0x0137, 0x00},
245247
{0x0138, 0x01},
246-
{0xe000, 0x00},
247248
{0xe07a, 0x01},
248249
{0x0808, 0x02},
249250
{0x4ae9, 0x18},
@@ -1037,6 +1038,11 @@ struct imx477 {
10371038
/* Streaming on/off */
10381039
bool streaming;
10391040

1041+
/* Flags field from parsing the endpoint - used for (non)continuous
1042+
* clock mode
1043+
*/
1044+
unsigned int csi2_flags;
1045+
10401046
/* Rewrite common registers on stream on? */
10411047
bool common_regs_written;
10421048

@@ -1637,6 +1643,12 @@ static int imx477_start_streaming(struct imx477 *imx477)
16371643
__func__);
16381644
return ret;
16391645
}
1646+
1647+
imx477_write_reg(imx477, IMX477_REG_FRAME_BLANKSTOP_CLK,
1648+
IMX477_REG_VALUE_08BIT,
1649+
imx477->csi2_flags & V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK ?
1650+
1 : 0);
1651+
16401652
imx477->common_regs_written = true;
16411653
}
16421654

@@ -2062,6 +2074,8 @@ static int imx477_check_hwcfg(struct device *dev, struct imx477 *imx477)
20622074
goto error_out;
20632075
}
20642076

2077+
imx477->csi2_flags = ep_cfg.bus.mipi_csi2.flags;
2078+
20652079
ret = 0;
20662080

20672081
error_out:

0 commit comments

Comments
 (0)