From: Judith Mendez <jm@ti.com>
To: David Lechner <dlechner@baylibre.com>,
William Breathitt Gray <wbg@kernel.org>
Cc: <linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] counter: ti-eqep: enable clock at probe
Date: Mon, 10 Jun 2024 08:44:08 -0500 [thread overview]
Message-ID: <c08d2d51-e2e1-4b68-a4fb-ebf3a919c1b8@ti.com> (raw)
In-Reply-To: <20240609-ti-eqep-enable-clock-v1-1-1e9e7626467e@baylibre.com>
Hi David,
On 6/9/24 3:27 PM, David Lechner wrote:
> The TI eQEP clock is both a functional and interface clock. Since it is
> required for the device to function, we should be enabling it at probe.
>
> Up to now, we've just been lucky that the clock was enabled by something
> else on the system already.
>
> Signed-off-by: David Lechner <dlechner@baylibre.com>
> ---
> drivers/counter/ti-eqep.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/counter/ti-eqep.c b/drivers/counter/ti-eqep.c
> index 072b11fd6b32..825ae22c3ebc 100644
> --- a/drivers/counter/ti-eqep.c
> +++ b/drivers/counter/ti-eqep.c
> @@ -6,6 +6,7 @@
> */
>
> #include <linux/bitops.h>
> +#include <linux/clk.h>
> #include <linux/counter.h>
> #include <linux/kernel.h>
> #include <linux/mod_devicetable.h>
> @@ -376,6 +377,7 @@ static int ti_eqep_probe(struct platform_device *pdev)
> struct counter_device *counter;
> struct ti_eqep_cnt *priv;
> void __iomem *base;
> + struct clk *clk;
> int err;
>
> counter = devm_counter_alloc(dev, sizeof(*priv));
> @@ -415,6 +417,10 @@ static int ti_eqep_probe(struct platform_device *pdev)
> pm_runtime_enable(dev);
> pm_runtime_get_sync(dev);
>
> + clk = devm_clk_get_enabled(dev, NULL);
> + if (IS_ERR(clk))
I think it would be nice to have print here in case the we fail to get
the clock.
~ Judith
> + return dev_err_probe(dev, PTR_ERR(clk), "failed to enable clock\n");
> +
> err = counter_add(counter);
> if (err < 0) {
> pm_runtime_put_sync(dev);
>
> ---
> base-commit: bb3f1c5fc434b0b177449f7f73ea9b112b397dd1
> change-id: 20240609-ti-eqep-enable-clock-91697095ca81
next prev parent reply other threads:[~2024-06-10 13:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-09 20:27 [PATCH] counter: ti-eqep: enable clock at probe David Lechner
2024-06-10 13:44 ` Judith Mendez [this message]
2024-06-10 13:53 ` David Lechner
2024-06-10 14:11 ` Judith Mendez
2024-06-16 9:15 ` William Breathitt Gray
2024-06-17 12:57 ` David Lechner
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=c08d2d51-e2e1-4b68-a4fb-ebf3a919c1b8@ti.com \
--to=jm@ti.com \
--cc=dlechner@baylibre.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wbg@kernel.org \
/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