Skip to content

Commit 60af5a2

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 <dave.stevenson@raspberrypi.com>
1 parent b0e8939 commit 60af5a2

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
@@ -210,7 +212,6 @@ static const struct imx477_reg mode_common_regs[] = {
210212
{0x0136, 0x18},
211213
{0x0137, 0x00},
212214
{0x0138, 0x01},
213-
{0xe000, 0x00},
214215
{0xe07a, 0x01},
215216
{0x0808, 0x02},
216217
{0x4ae9, 0x18},
@@ -1004,6 +1005,11 @@ struct imx477 {
10041005
/* Streaming on/off */
10051006
bool streaming;
10061007

1008+
/* Flags field from parsing the endpoint - used for (non)continuous
1009+
* clock mode
1010+
*/
1011+
unsigned int csi2_flags;
1012+
10071013
/* Rewrite common registers on stream on? */
10081014
bool common_regs_written;
10091015

@@ -1604,6 +1610,12 @@ static int imx477_start_streaming(struct imx477 *imx477)
16041610
__func__);
16051611
return ret;
16061612
}
1613+
1614+
imx477_write_reg(imx477, IMX477_REG_FRAME_BLANKSTOP_CLK,
1615+
IMX477_REG_VALUE_08BIT,
1616+
imx477->csi2_flags & V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK ?
1617+
1 : 0);
1618+
16071619
imx477->common_regs_written = true;
16081620
}
16091621

@@ -2029,6 +2041,8 @@ static int imx477_check_hwcfg(struct device *dev, struct imx477 *imx477)
20292041
goto error_out;
20302042
}
20312043

2044+
imx477->csi2_flags = ep_cfg.bus.mipi_csi2.flags;
2045+
20322046
ret = 0;
20332047

20342048
error_out:

0 commit comments

Comments
 (0)