From: Mehdi Djait <mehdi.djait@linux.intel.com>
To: sakari.ailus@linux.intel.com, dave.stevenson@raspberrypi.com,
laurent.pinchart@ideasonboard.com,
tomi.valkeinen@ideasonboard.com
Cc: linux-media@vger.kernel.org, Mehdi Djait <mehdi.djait@linux.intel.com>
Subject: [PATCH] media: i2c: imx219: Add support for 'clock-frequency' parsing
Date: Thu, 20 Feb 2025 16:49:09 +0100 [thread overview]
Message-ID: <20250220154909.152538-1-mehdi.djait@linux.intel.com> (raw)
Make the clock producer reference lookup optional
Add support for ACPI-based platforms by parsing the 'clock-frequency'
property when no clock producer is available
Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com>
---
drivers/media/i2c/imx219.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
index 2d54cea113e1..a876a6d80a47 100644
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -1103,12 +1103,22 @@ static int imx219_probe(struct i2c_client *client)
"failed to initialize CCI\n");
/* Get system clock (xclk) */
- imx219->xclk = devm_clk_get(dev, NULL);
+ imx219->xclk = devm_clk_get_optional(dev, NULL);
if (IS_ERR(imx219->xclk))
return dev_err_probe(dev, PTR_ERR(imx219->xclk),
"failed to get xclk\n");
- imx219->xclk_freq = clk_get_rate(imx219->xclk);
+ if (imx219->xclk) {
+ imx219->xclk_freq = clk_get_rate(imx219->xclk);
+ } else {
+ ret = fwnode_property_read_u32(dev_fwnode(dev),
+ "clock-frequency",
+ &imx219->xclk_freq);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "failed to get clock frequency");
+ }
+
if (imx219->xclk_freq != IMX219_XCLK_FREQ)
return dev_err_probe(dev, -EINVAL,
"xclk frequency not supported: %d Hz\n",
--
2.48.1
next reply other threads:[~2025-02-20 15:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-20 15:49 Mehdi Djait [this message]
2025-02-23 23:06 ` [PATCH] media: i2c: imx219: Add support for 'clock-frequency' parsing Laurent Pinchart
2025-02-24 7:59 ` Mehdi Djait
2025-02-24 9:42 ` Sakari Ailus
2025-02-24 11:54 ` Mehdi Djait
2025-02-24 12:24 ` Sakari Ailus
2025-02-24 12:24 ` Tomi Valkeinen
2025-02-24 12:49 ` Sakari Ailus
2025-02-24 13:25 ` Laurent Pinchart
2025-02-24 14:38 ` Sakari Ailus
2025-02-24 16:16 ` Laurent Pinchart
2025-02-24 16:28 ` Sakari Ailus
2025-02-24 16:34 ` Laurent Pinchart
2025-02-24 17:06 ` Sakari Ailus
2025-02-24 18:19 ` Laurent Pinchart
2025-02-24 18:28 ` Mehdi Djait
2025-02-25 11:11 ` Mehdi Djait
2025-02-25 11:43 ` Sakari Ailus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250220154909.152538-1-mehdi.djait@linux.intel.com \
--to=mehdi.djait@linux.intel.com \
--cc=dave.stevenson@raspberrypi.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=tomi.valkeinen@ideasonboard.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox