Skip to content

Commit

Permalink
media: ov5693: add support for acpi clock-frequency prop
Browse files Browse the repository at this point in the history
Add support for ACPI-based platforms that specify the clock frequency by
using the "clock-frequency" property instead of specifying a clock
provider reference

Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
  • Loading branch information
Tommaso Merciai authored and Mauro Carvalho Chehab committed Jul 15, 2022
1 parent 8a47d09 commit 88b0c21
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions drivers/media/i2c/ov5693.c
Original file line number Diff line number Diff line change
Expand Up @@ -1408,13 +1408,25 @@ static int ov5693_probe(struct i2c_client *client)

v4l2_i2c_subdev_init(&ov5693->sd, client, &ov5693_ops);

ov5693->xvclk = devm_clk_get(&client->dev, "xvclk");
if (IS_ERR(ov5693->xvclk)) {
dev_err(&client->dev, "Error getting clock\n");
return PTR_ERR(ov5693->xvclk);
ov5693->xvclk = devm_clk_get_optional(&client->dev, "xvclk");
if (IS_ERR(ov5693->xvclk))
return dev_err_probe(&client->dev, PTR_ERR(ov5693->xvclk),
"failed to get xvclk: %ld\n",
PTR_ERR(ov5693->xvclk));

if (ov5693->xvclk) {
xvclk_rate = clk_get_rate(ov5693->xvclk);
} else {
ret = fwnode_property_read_u32(dev_fwnode(&client->dev),
"clock-frequency",
&xvclk_rate);

if (ret) {
dev_err(&client->dev, "can't get clock frequency");
return ret;
}
}

xvclk_rate = clk_get_rate(ov5693->xvclk);
if (xvclk_rate != OV5693_XVCLK_FREQ)
dev_warn(&client->dev, "Found clk freq %u, expected %u\n",
xvclk_rate, OV5693_XVCLK_FREQ);
Expand Down

0 comments on commit 88b0c21

Please sign in to comment.