diff mbox series

[4/8] media: ov08x40: Get clock on ACPI platforms too

Message ID 20241219134940.15472-5-hdegoede@redhat.com
State Superseded
Headers show
Series media: ov08x40: Various improvements | expand

Commit Message

Hans de Goede Dec. 19, 2024, 1:49 p.m. UTC
ACPI platforms might also have a clk provider which needs to be controlled,
always try to get a clk using clk_get_optional() and when that fails fall
back to getting the xvclk frequency from the "clock-frequency" property.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/media/i2c/ov08x40.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

Comments

Bryan O'Donoghue Dec. 20, 2024, 2:31 p.m. UTC | #1
On 19/12/2024 13:49, Hans de Goede wrote:
> ACPI platforms might also have a clk provider which needs to be controlled,
> always try to get a clk using clk_get_optional() and when that fails fall
> back to getting the xvclk frequency from the "clock-frequency" property.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
diff mbox series

Patch

diff --git a/drivers/media/i2c/ov08x40.c b/drivers/media/i2c/ov08x40.c
index 8b1380506778..de8291e8b6e7 100644
--- a/drivers/media/i2c/ov08x40.c
+++ b/drivers/media/i2c/ov08x40.c
@@ -2175,15 +2175,13 @@  static int ov08x40_check_hwcfg(struct ov08x40 *ov08x, struct device *dev)
 	if (ret)
 		goto out_err;
 
-	if (!is_acpi_node(fwnode)) {
-		ov08x->xvclk = devm_clk_get(dev, NULL);
-		if (IS_ERR(ov08x->xvclk)) {
-			dev_err(dev, "could not get xvclk clock (%pe)\n",
-				ov08x->xvclk);
-			ret = PTR_ERR(ov08x->xvclk);
-			goto out_err;
-		}
-
+	ov08x->xvclk = devm_clk_get_optional(dev, NULL);
+	if (IS_ERR(ov08x->xvclk)) {
+		ret = dev_err_probe(dev, PTR_ERR(ov08x->xvclk),
+				    "getting xvclk\n");
+		goto out_err;
+	}
+	if (ov08x->xvclk) {
 		xvclk_rate = clk_get_rate(ov08x->xvclk);
 	} else {
 		ret = fwnode_property_read_u32(dev_fwnode(dev), "clock-frequency",