summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTommaso Merciai <tommaso.merciai@amarulasolutions.com>2022-07-13 16:05:04 +0100
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-07-15 15:33:08 +0100
commit88b0c212e358444b0e0710163c0f8d75a6296561 (patch)
tree09a6d64a9ed939b8d4c4b3316503e82e008866d1
parent8a47d09eda479912c3518e99636b5de8665f33c0 (diff)
downloadlinux-stable-88b0c212e358444b0e0710163c0f8d75a6296561.tar.gz
linux-stable-88b0c212e358444b0e0710163c0f8d75a6296561.tar.bz2
linux-stable-88b0c212e358444b0e0710163c0f8d75a6296561.zip
media: ov5693: add support for acpi clock-frequency prop
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>
-rw-r--r--drivers/media/i2c/ov5693.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/media/i2c/ov5693.c b/drivers/media/i2c/ov5693.c
index d2adc5513a21..701468267f20 100644
--- a/drivers/media/i2c/ov5693.c
+++ b/drivers/media/i2c/ov5693.c
@@ -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);