Skip to content

Commit 8457304

Browse files
committed
media: imx477: Write the REQ_LINK_BIT_RATE reg programmatically
Now that the link frequency can be varied, write the link bit rate registers to reflect the speed being used. Signed-off-by: Dave Stevenson <[email protected]>
1 parent 21c6a06 commit 8457304

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

drivers/media/i2c/imx477.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ 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_REQ_LINK_BIT_RATE CCI_REG32(0x0820)
134+
133135
/* Trigger mode */
134136
#define IMX477_REG_MC_MODE CCI_REG8(0x3f0b)
135137
#define IMX477_REG_MS_SEL CCI_REG8(0x3041)
@@ -510,10 +512,6 @@ static const struct cci_reg_sequence mode_common_regs[] = {
510512
{IMX477_REG_IOP_SYSCK_DIV, IMX477_IOP_SYSCK_DIV},
511513
{IMX477_REG_IOP_PREDIV, IMX477_IOP_PREDIV},
512514
{CCI_REG8(0x0310), 0x01},
513-
{CCI_REG8(0x0820), 0x07},
514-
{CCI_REG8(0x0821), 0x08},
515-
{CCI_REG8(0x0822), 0x00},
516-
{CCI_REG8(0x0823), 0x00},
517515
{CCI_REG8(0x080a), 0x00},
518516
{CCI_REG8(0x080b), 0x7f},
519517
{CCI_REG8(0x080c), 0x00},
@@ -1597,6 +1595,14 @@ static int imx477_start_streaming(struct imx477 *imx477)
15971595
cci_write(imx477->regmap, IMX477_REG_IOP_MPY,
15981596
imx477->iop_pll_mpy, &ret);
15991597

1598+
/*
1599+
* Bit rate = link freq * 2 for DDR * 2 for num lanes.
1600+
* 16p16 fixed point in the register. Ignore fractional part.
1601+
*/
1602+
cci_write(imx477->regmap, IMX477_REG_REQ_LINK_BIT_RATE,
1603+
((imx477->link_freq_value / 1000000) * 2 * 2) << 16,
1604+
&ret);
1605+
16001606
if (ret) {
16011607
dev_err(&client->dev, "%s failed to set common settings\n",
16021608
__func__);

0 commit comments

Comments
 (0)