Skip to content

Commit 3569e25

Browse files
author
André Apitzsch
committed
media: i2c: imx214: Read clock frequency from device tree
Replace the hard coded external clock frequency by the one read from device tree. Signed-off-by: André Apitzsch <git@apitzsch.eu>
1 parent 76edc05 commit 3569e25

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/media/i2c/imx214.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1386,6 +1386,7 @@ static int imx214_probe(struct i2c_client *client)
13861386
{
13871387
struct device *dev = &client->dev;
13881388
struct imx214 *imx214;
1389+
u32 xclk_freq;
13891390
int ret;
13901391

13911392
imx214 = devm_kzalloc(dev, sizeof(*imx214), GFP_KERNEL);
@@ -1399,7 +1400,14 @@ static int imx214_probe(struct i2c_client *client)
13991400
return dev_err_probe(dev, PTR_ERR(imx214->xclk),
14001401
"failed to get xclk\n");
14011402

1402-
ret = clk_set_rate(imx214->xclk, IMX214_DEFAULT_CLK_FREQ);
1403+
ret = device_property_read_u32(dev, "clock-frequency", &xclk_freq);
1404+
if (ret) {
1405+
dev_warn(dev,
1406+
"clock-frequency not set, please review your DT. Fallback to default\n");
1407+
xclk_freq = IMX214_DEFAULT_CLK_FREQ;
1408+
}
1409+
1410+
ret = clk_set_rate(imx214->xclk, xclk_freq);
14031411
if (ret)
14041412
return dev_err_probe(dev, ret,
14051413
"failed to set xclk frequency\n");

0 commit comments

Comments
 (0)