From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: git@apitzsch.eu
Cc: Ricardo Ribalda <ribalda@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
~postmarketos/upstreaming@lists.sr.ht,
phone-devel@vger.kernel.org, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] media: i2c: imx214: Read clock frequency from device tree
Date: Mon, 5 May 2025 15:05:49 +0000 [thread overview]
Message-ID: <aBjTzbrYXHV_ztA3@kekkonen.localdomain> (raw)
In-Reply-To: <20250415-imx214_ccs_pll-v1-4-d3d7748e5fbd@apitzsch.eu>
Hi André,
On Tue, Apr 15, 2025 at 11:22:18PM +0200, André Apitzsch via B4 Relay wrote:
> From: André Apitzsch <git@apitzsch.eu>
>
> Replace the hard coded external clock frequency by the one read from
> device tree.
>
> Signed-off-by: André Apitzsch <git@apitzsch.eu>
> ---
> drivers/media/i2c/imx214.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c
> index 5589228d2b44417c0dbf15a6a17fd8f954f1a2bc..6d7f05073aa9ffb054d454771ce22e3141af60e8 100644
> --- a/drivers/media/i2c/imx214.c
> +++ b/drivers/media/i2c/imx214.c
> @@ -1388,6 +1388,7 @@ static int imx214_probe(struct i2c_client *client)
> {
> struct device *dev = &client->dev;
> struct imx214 *imx214;
> + u32 xclk_freq;
> int ret;
>
> imx214 = devm_kzalloc(dev, sizeof(*imx214), GFP_KERNEL);
> @@ -1401,7 +1402,14 @@ static int imx214_probe(struct i2c_client *client)
> return dev_err_probe(dev, PTR_ERR(imx214->xclk),
> "failed to get xclk\n");
>
> - ret = clk_set_rate(imx214->xclk, IMX214_DEFAULT_CLK_FREQ);
> + ret = device_property_read_u32(dev, "clock-frequency", &xclk_freq);
> + if (ret) {
> + dev_warn(dev,
> + "clock-frequency not set, please review your DT. Fallback to default\n");
> + xclk_freq = IMX214_DEFAULT_CLK_FREQ;
> + }
> +
> + ret = clk_set_rate(imx214->xclk, xclk_freq);
Please instead rely on the rate set on the clock (using
assigned-clock-rates etc.). See how other drivers do this. Essentially,
"clock-frequency" is only relevant for ancient systems and ACPI today.
<URL:https://hverkuil.home.xs4all.nl/spec/driver-api/camera-sensor.html>
> if (ret)
> return dev_err_probe(dev, ret,
> "failed to set xclk frequency\n");
>
--
Kind regards,
Sakari Ailus
next prev parent reply other threads:[~2025-05-05 15:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-15 21:22 [PATCH 0/4] media: i2c: imx214: Add support for more clock frequencies André Apitzsch via B4 Relay
2025-04-15 21:22 ` [PATCH 1/4] media: i2c: imx214: Reorder imx214_parse_fwnode call André Apitzsch via B4 Relay
2025-04-15 21:22 ` [PATCH 2/4] media: i2c: imx214: Prepare for variable clock frequency André Apitzsch via B4 Relay
2025-04-15 21:22 ` [PATCH 3/4] media: i2c: imx214: Make use of CCS PLL calculator André Apitzsch via B4 Relay
2025-05-05 15:03 ` Sakari Ailus
2025-04-15 21:22 ` [PATCH 4/4] media: i2c: imx214: Read clock frequency from device tree André Apitzsch via B4 Relay
2025-05-05 15:05 ` Sakari Ailus [this message]
2025-04-24 0:28 ` [PATCH 0/4] media: i2c: imx214: Add support for more clock frequencies Ricardo Ribalda Delgado
2025-05-02 14:26 ` André Apitzsch
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=aBjTzbrYXHV_ztA3@kekkonen.localdomain \
--to=sakari.ailus@linux.intel.com \
--cc=git@apitzsch.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=phone-devel@vger.kernel.org \
--cc=ribalda@kernel.org \
--cc=~postmarketos/upstreaming@lists.sr.ht \
/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
all inboxes | Powered by JetHome®