From d16bf10c0bbe17c4625d0cbc0e8cf4a80dea609c Mon Sep 17 00:00:00 2001 From: Ondrej Jirman Date: Fri, 22 Oct 2021 18:11:26 +0200 Subject: [PATCH 468/478] 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 --- 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 3c7e4c1a0c10..24c3a20eef0e 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; } -- 2.35.3