Commit d170b0ea authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab

media: imx258: Fix getting clock frequency

Obtain the clock frequency by reading the clock-frequency property if
there's no clock.

Fixes: 9fda2533 ("media: i2c: imx258: get clock from device properties and enable it via runtime PM")
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 96d309a9
......@@ -1260,18 +1260,18 @@ static int imx258_probe(struct i2c_client *client)
return -ENOMEM;
imx258->clk = devm_clk_get_optional(&client->dev, NULL);
if (IS_ERR(imx258->clk))
return dev_err_probe(&client->dev, PTR_ERR(imx258->clk),
"error getting clock\n");
if (!imx258->clk) {
dev_dbg(&client->dev,
"no clock provided, using clock-frequency property\n");
device_property_read_u32(&client->dev, "clock-frequency", &val);
if (val != IMX258_INPUT_CLOCK_FREQ)
return -EINVAL;
} else if (IS_ERR(imx258->clk)) {
return dev_err_probe(&client->dev, PTR_ERR(imx258->clk),
"error getting clock\n");
} else {
val = clk_get_rate(imx258->clk);
}
if (clk_get_rate(imx258->clk) != IMX258_INPUT_CLOCK_FREQ) {
if (val != IMX258_INPUT_CLOCK_FREQ) {
dev_err(&client->dev, "input clock frequency not supported\n");
return -EINVAL;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment