Skip to content

Commit 89c8f1a

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 b8a7954 commit 89c8f1a

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
@@ -116,6 +116,8 @@ MODULE_PARM_DESC(trigger_mode, "Set vsync trigger mode: 1=source, 2=sink");
116116
/* Temperature sensor */
117117
#define IMX477_REG_TEMP_SEN_CTL 0x0138
118118

119+
#define IMX477_REG_FRAME_BLANKSTOP_CLK 0xE000
120+
119121
/* Embedded metadata stream structure */
120122
#define IMX477_EMBEDDED_LINE_WIDTH 16384
121123
#define IMX477_NUM_EMBEDDED_LINES 1
@@ -246,7 +248,6 @@ static const struct imx477_reg mode_common_regs[] = {
246248
{0x0136, 0x18},
247249
{0x0137, 0x00},
248250
{0x0138, 0x01},
249-
{0xe000, 0x00},
250251
{0xe07a, 0x01},
251252
{0x0808, 0x02},
252253
{0x4ae9, 0x18},
@@ -1040,6 +1041,11 @@ struct imx477 {
10401041
/* Streaming on/off */
10411042
bool streaming;
10421043

1044+
/* Flags field from parsing the endpoint - used for (non)continuous
1045+
* clock mode
1046+
*/
1047+
unsigned int csi2_flags;
1048+
10431049
/* Rewrite common registers on stream on? */
10441050
bool common_regs_written;
10451051

@@ -1647,6 +1653,12 @@ static int imx477_start_streaming(struct imx477 *imx477)
16471653
__func__);
16481654
return ret;
16491655
}
1656+
1657+
imx477_write_reg(imx477, IMX477_REG_FRAME_BLANKSTOP_CLK,
1658+
IMX477_REG_VALUE_08BIT,
1659+
imx477->csi2_flags & V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK ?
1660+
1 : 0);
1661+
16501662
imx477->common_regs_written = true;
16511663
}
16521664

@@ -2082,6 +2094,8 @@ static int imx477_check_hwcfg(struct device *dev, struct imx477 *imx477)
20822094
goto error_out;
20832095
}
20842096

2097+
imx477->csi2_flags = ep_cfg.bus.mipi_csi2.flags;
2098+
20852099
ret = 0;
20862100

20872101
error_out:

0 commit comments

Comments
 (0)