Skip to content

Commit ec5cfd7

Browse files
committed
media: imx708: Write line_length_pix based on mode table
The line_length_pix value was duplicated between the register tables and the mode descriptor, so remove from the tables and set it programmatically. Signed-off-by: Dave Stevenson <[email protected]>
1 parent 4dba86f commit ec5cfd7

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

drivers/media/i2c/imx708.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,6 @@ static const struct cci_reg_sequence mode_common_regs[] = {
259259

260260
/* 10-bit. */
261261
static const struct cci_reg_sequence mode_4608x2592_regs[] = {
262-
{CCI_REG8(0x0342), 0x3D},
263-
{CCI_REG8(0x0343), 0x20},
264262
{CCI_REG8(0x0344), 0x00},
265263
{CCI_REG8(0x0345), 0x00},
266264
{CCI_REG8(0x0346), 0x00},
@@ -342,8 +340,6 @@ static const struct cci_reg_sequence mode_4608x2592_regs[] = {
342340
};
343341

344342
static const struct cci_reg_sequence mode_2x2binned_regs[] = {
345-
{CCI_REG8(0x0342), 0x1E},
346-
{CCI_REG8(0x0343), 0x90},
347343
{CCI_REG8(0x0344), 0x00},
348344
{CCI_REG8(0x0345), 0x00},
349345
{CCI_REG8(0x0346), 0x00},
@@ -425,8 +421,6 @@ static const struct cci_reg_sequence mode_2x2binned_regs[] = {
425421
};
426422

427423
static const struct cci_reg_sequence mode_2x2binned_720p_regs[] = {
428-
{CCI_REG8(0x0342), 0x14},
429-
{CCI_REG8(0x0343), 0x60},
430424
{CCI_REG8(0x0344), 0x03},
431425
{CCI_REG8(0x0345), 0x00},
432426
{CCI_REG8(0x0346), 0x01},
@@ -508,8 +502,6 @@ static const struct cci_reg_sequence mode_2x2binned_720p_regs[] = {
508502
};
509503

510504
static const struct cci_reg_sequence mode_hdr_regs[] = {
511-
{CCI_REG8(0x0342), 0x14},
512-
{CCI_REG8(0x0343), 0x60},
513505
{CCI_REG8(0x0344), 0x00},
514506
{CCI_REG8(0x0345), 0x00},
515507
{CCI_REG8(0x0346), 0x00},
@@ -598,7 +590,7 @@ static const struct imx708_mode supported_modes_10bit_no_hdr[] = {
598590
/* Full resolution. */
599591
.width = 4608,
600592
.height = 2592,
601-
.line_length_pix = 0x3d20,
593+
.line_length_pix = 15648,
602594
.crop = {
603595
.left = IMX708_PIXEL_ARRAY_LEFT,
604596
.top = IMX708_PIXEL_ARRAY_TOP,
@@ -621,7 +613,7 @@ static const struct imx708_mode supported_modes_10bit_no_hdr[] = {
621613
/* regular 2x2 binned. */
622614
.width = 2304,
623615
.height = 1296,
624-
.line_length_pix = 0x1e90,
616+
.line_length_pix = 7824,
625617
.crop = {
626618
.left = IMX708_PIXEL_ARRAY_LEFT,
627619
.top = IMX708_PIXEL_ARRAY_TOP,
@@ -644,7 +636,7 @@ static const struct imx708_mode supported_modes_10bit_no_hdr[] = {
644636
/* 2x2 binned and cropped for 720p. */
645637
.width = 1536,
646638
.height = 864,
647-
.line_length_pix = 0x1460,
639+
.line_length_pix = 5216,
648640
.crop = {
649641
.left = IMX708_PIXEL_ARRAY_LEFT + 768,
650642
.top = IMX708_PIXEL_ARRAY_TOP + 432,
@@ -670,7 +662,7 @@ static const struct imx708_mode supported_modes_10bit_hdr[] = {
670662
/* There's only one HDR mode, which is 2x2 downscaled */
671663
.width = 2304,
672664
.height = 1296,
673-
.line_length_pix = 0x1460,
665+
.line_length_pix = 5216,
674666
.crop = {
675667
.left = IMX708_PIXEL_ARRAY_LEFT,
676668
.top = IMX708_PIXEL_ARRAY_TOP,
@@ -1369,6 +1361,14 @@ static int imx708_start_streaming(struct imx708 *imx708)
13691361
return ret;
13701362
}
13711363

1364+
/* Write line_length_pix */
1365+
ret = cci_write(imx708->regmap, IMX708_REG_LINE_LENGTH,
1366+
imx708->mode->line_length_pix, NULL);
1367+
if (ret) {
1368+
dev_err(&client->dev, "%s failed to set line length\n",
1369+
__func__);
1370+
return ret;
1371+
}
13721372
/* Update the link frequency registers */
13731373
ret = cci_write(imx708->regmap, IMX708_REG_IOP_MPY, imx708->iop_pll_mpy,
13741374
NULL);

0 commit comments

Comments
 (0)