drivers/counter/ti-eqep.c | 6 ++++++ 1 file changed, 6 insertions(+)
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.
Fixes: f213729f6796 ("counter: new TI eQEP driver")
Reviewed-by: Judith Mendez <jm@ti.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
---
Changes in v2:
- Added Fixes: tag to commit message
- Picked up Judith's Reviewed-by tag
- Link to v1: https://lore.kernel.org/r/20240609-ti-eqep-enable-clock-v1-1-1e9e7626467e@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))
+ 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
On Fri, 21 Jun 2024 17:22:40 -0500, 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.
>
>
> [...]
Applied, thanks!
[1/1] counter: ti-eqep: enable clock at probe
commit: 0cf81c73e4c6a4861128a8f27861176ec312af4e
Best regards,
--
William Breathitt Gray <wbg@kernel.org>
© 2016 - 2025 Red Hat, Inc.