From b7e412faea4e18ee51252ef4a6dc7b5f51d82be6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= Date: Fri, 22 Oct 2021 18:11:26 +0200 Subject: [PATCH 331/464] 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 2c0e691466fe..b7b81c74c798 100644 --- a/drivers/media/i2c/imx258.c +++ b/drivers/media/i2c/imx258.c @@ -80,7 +80,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; @@ -1300,8 +1302,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.34.1