-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IMX219: Adjust PLL settings based on the number of configured MIPI lanes
Signed-off-by: Peyton Howe <[email protected]>
- Loading branch information
1 parent
5fa4b1f
commit 52d7f8a
Showing
1 changed file
with
34 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -224,15 +224,6 @@ static const struct cci_reg_sequence imx219_common_regs[] = { | |
{ CCI_REG8(0x30eb), 0x05 }, | ||
{ CCI_REG8(0x30eb), 0x09 }, | ||
|
||
/* PLL Clock Table */ | ||
{ IMX219_REG_VTPXCK_DIV, 5 }, | ||
{ IMX219_REG_VTSYCK_DIV, 1 }, | ||
{ IMX219_REG_PREPLLCK_VT_DIV, 3 }, /* 0x03 = AUTO set */ | ||
{ IMX219_REG_PREPLLCK_OP_DIV, 3 }, /* 0x03 = AUTO set */ | ||
{ IMX219_REG_PLL_VT_MPY, 57 }, | ||
{ IMX219_REG_OPSYCK_DIV, 1 }, | ||
{ IMX219_REG_PLL_OP_MPY, 114 }, | ||
|
||
/* Undocumented registers */ | ||
{ CCI_REG8(0x455e), 0x00 }, | ||
{ CCI_REG8(0x471e), 0x4b }, | ||
|
@@ -257,6 +248,34 @@ static const struct cci_reg_sequence imx219_common_regs[] = { | |
{ IMX219_REG_EXCK_FREQ, IMX219_EXCK_FREQ(IMX219_XCLK_FREQ / 1000000) }, | ||
}; | ||
|
||
static const struct cci_reg_sequence imx219_2lane_regs[] = { | ||
/* PLL Clock Table */ | ||
{ IMX219_REG_VTPXCK_DIV, 5 }, | ||
{ IMX219_REG_VTSYCK_DIV, 1 }, | ||
{ IMX219_REG_PREPLLCK_VT_DIV, 3 }, /* 0x03 = AUTO set */ | ||
{ IMX219_REG_PREPLLCK_OP_DIV, 3 }, /* 0x03 = AUTO set */ | ||
{ IMX219_REG_PLL_VT_MPY, 57 }, | ||
{ IMX219_REG_OPSYCK_DIV, 1 }, | ||
{ IMX219_REG_PLL_OP_MPY, 114 }, | ||
|
||
/* 2-Lane CSI Mode */ | ||
{ IMX219_REG_CSI_LANE_MODE, IMX219_CSI_2_LANE_MODE }, | ||
}; | ||
|
||
static const struct cci_reg_sequence imx219_4lane_regs[] = { | ||
/* PLL Clock Table */ | ||
{ IMX219_REG_VTPXCK_DIV, 5 }, | ||
{ IMX219_REG_VTSYCK_DIV, 1 }, | ||
{ IMX219_REG_PREPLLCK_VT_DIV, 3 }, /* 0x03 = AUTO set */ | ||
{ IMX219_REG_PREPLLCK_OP_DIV, 3 }, /* 0x03 = AUTO set */ | ||
{ IMX219_REG_PLL_VT_MPY, 88 }, | ||
{ IMX219_REG_OPSYCK_DIV, 1 }, | ||
{ IMX219_REG_PLL_OP_MPY, 91 }, | ||
|
||
/* 4-Lane CSI Mode */ | ||
{ IMX219_REG_CSI_LANE_MODE, IMX219_CSI_4_LANE_MODE }, | ||
}; | ||
|
||
/* | ||
* Register sets lifted off the i2C interface from the Raspberry Pi firmware | ||
* driver. | ||
|
@@ -941,9 +960,11 @@ static int imx219_get_selection(struct v4l2_subdev *sd, | |
|
||
static int imx219_configure_lanes(struct imx219 *imx219) | ||
{ | ||
return cci_write(imx219->regmap, IMX219_REG_CSI_LANE_MODE, | ||
imx219->lanes == 2 ? IMX219_CSI_2_LANE_MODE : | ||
IMX219_CSI_4_LANE_MODE, NULL); | ||
/* Write the appropriate PLL settings for the number of MIPI lanes */ | ||
return cci_multi_reg_write(imx219->regmap, | ||
imx219->lanes == 2 ? imx219_2lane_regs : imx219_4lane_regs, | ||
imx219->lanes == 2 ? ARRAY_SIZE(imx219_2lane_regs) : | ||
ARRAY_SIZE(imx219_4lane_regs), NULL); | ||
}; | ||
|
||
static int imx219_start_streaming(struct imx219 *imx219, | ||
|
@@ -1553,4 +1574,4 @@ module_i2c_driver(imx219_i2c_driver); | |
|
||
MODULE_AUTHOR("Dave Stevenson <[email protected]"); | ||
MODULE_DESCRIPTION("Sony IMX219 sensor driver"); | ||
MODULE_LICENSE("GPL v2"); | ||
MODULE_LICENSE("GPL v2"); | ||
Check failure on line 1577 in drivers/media/i2c/imx219.c GitHub Actions / checkpatch review
|