[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220630134835.592521-5-tommaso.merciai@amarulasolutions.com>
Date: Thu, 30 Jun 2022 15:48:33 +0200
From: Tommaso Merciai <tommaso.merciai@...rulasolutions.com>
To: tommaso.merciai@...rulasolutions.com
Cc: linuxfancy@...glegroups.com, linux-amarula@...rulasolutions.com,
quentin.schulz@...obroma-systems.com,
Jacopo Mondi <jacopo@...ndi.org>,
Daniel Scally <djrscally@...il.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH v5 4/6] 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@...rulasolutions.com>
Reviewed-by: Jacopo Mondi <jacopo@...ndi.org>
---
Changes since v2:
- Fix commit body as suggested by Sakari, Jacopo
- Add details to commit body as suggested by Jacopo
- Move ov5693_check_hwcfg into ov5693_hwcfg
- Fix xvclk_rate position as suggested by Jacopo
- Use devm_clk_get_optional instead of devm_clk_get as suggested Jacopo
Changes since v3:
- Fix commit body as suggested by Jacopo
- Add reviewed-by tags, suggested by Jacopo, Krzysztof
Changes since v4:
- Remove wrong Sakari reviewed-by tag, suggested by Krzysztof, Sakari
- Revert ov5693_check_hwcfg function changes. Keep clk init on probe function
as suggested by Sakari
- Fix commit body
- Fix commit msg
drivers/media/i2c/ov5693.c | 22 +++++++++++++++++-----
1 file 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);
--
2.25.1
Powered by blists - more mailing lists