Skip to content

Commit b3065f6

Browse files
committed
media: imx477: Use auto global timings if not at 450MHz link freq
The timing registers configured are for 450MHz. If running at a different link frequency, use the automatic timing control. Signed-off-by: Dave Stevenson <[email protected]>
1 parent 8457304 commit b3065f6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/media/i2c/imx477.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ MODULE_PARM_DESC(fstrobe_delay, "Set fstrobe delay from end all lines starting t
130130
#define IMX477_TEST_PATTERN_B_DEFAULT 0
131131
#define IMX477_TEST_PATTERN_GB_DEFAULT 0
132132

133+
#define IMX477_REG_DPHY_CTRL CCI_REG8(0x0808)
134+
#define IMX477_DPHY_CTRL_AUTO 0
135+
#define IMX477_DPHY_CTRL_UI 1
136+
#define IMX477_DPHY_CTRL_REGISTER 2
133137
#define IMX477_REG_REQ_LINK_BIT_RATE CCI_REG32(0x0820)
134138

135139
/* Trigger mode */
@@ -188,7 +192,7 @@ static const struct cci_reg_sequence mode_common_regs[] = {
188192
{CCI_REG8(0x0138), 0x01},
189193
{CCI_REG8(0xe000), 0x00},
190194
{CCI_REG8(0xe07a), 0x01},
191-
{CCI_REG8(0x0808), 0x02},
195+
{IMX477_REG_DPHY_CTRL, IMX477_DPHY_CTRL_REGISTER},
192196
{CCI_REG8(0x4ae9), 0x18},
193197
{CCI_REG8(0x4aea), 0x08},
194198
{CCI_REG8(0xf61c), 0x04},
@@ -1602,6 +1606,13 @@ static int imx477_start_streaming(struct imx477 *imx477)
16021606
cci_write(imx477->regmap, IMX477_REG_REQ_LINK_BIT_RATE,
16031607
((imx477->link_freq_value / 1000000) * 2 * 2) << 16,
16041608
&ret);
1609+
/*
1610+
* DPHY timings are those specified for 450MHz. Switch to auto
1611+
* if using some other link frequency
1612+
*/
1613+
if (imx477->link_freq_value != 450000000UL)
1614+
cci_write(imx477->regmap, IMX477_REG_DPHY_CTRL,
1615+
IMX477_DPHY_CTRL_AUTO, &ret);
16051616

16061617
if (ret) {
16071618
dev_err(&client->dev, "%s failed to set common settings\n",

0 commit comments

Comments
 (0)