gjdwebserver-overlay/sys-kernel/pinephone-pro-sources/files/0027-media-i2c-imx258-Don-t-be-too-strict-about-clock-rat.patch
Gerben Jan Dijkman 4b1427b69b Changed ebuild
2022-01-15 02:12:55 +01:00

42 lines
1.2 KiB
Diff

From: Ondrej Jirman <megous@megous.com>
Date: Fri, 22 Oct 2021 18:11:26 +0200
Subject: [PATCH 21/36] media: i2c: imx258: Don't be too strict about clock
rate
On Pinephone Pro, we are not able to set 19.2MHz precisely.
Allow some slack in clock rate.
Signed-off-by: Ondrej Jirman <megous@megous.com>
---
drivers/media/i2c/imx258.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c
index be5adcc..e64fadc 100644
--- a/drivers/media/i2c/imx258.c
+++ b/drivers/media/i2c/imx258.c
@@ -79,7 +79,9 @@
#define REG_CONFIG_FLIP_TEST_PATTERN 0x02
/* Input clock frequency in Hz */
+#define IMX258_INPUT_CLOCK_FREQ_MIN 19000000
#define IMX258_INPUT_CLOCK_FREQ 19200000
+#define IMX258_INPUT_CLOCK_FREQ_MAX 19400000
struct imx258_reg {
u16 address;
@@ -1277,8 +1279,11 @@ static int imx258_probe(struct i2c_client *client)
} else {
val = clk_get_rate(imx258->clk);
}
- if (val != IMX258_INPUT_CLOCK_FREQ) {
- dev_err(&client->dev, "input clock frequency not supported\n");
+
+ if (val < IMX258_INPUT_CLOCK_FREQ_MIN
+ || val > IMX258_INPUT_CLOCK_FREQ_MAX) {
+ dev_err(&client->dev, "input clock frequency %u not supported\n",
+ val);
return -EINVAL;
}