Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 0cf81c7

Browse files
dlechWilliam Breathitt Gray
authored andcommitted
counter: ti-eqep: enable clock at probe
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: f213729 ("counter: new TI eQEP driver") Reviewed-by: Judith Mendez <jm@ti.com> Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://lore.kernel.org/r/20240621-ti-eqep-enable-clock-v2-1-edd3421b54d4@baylibre.com Signed-off-by: William Breathitt Gray <wbg@kernel.org>
1 parent 1613e60 commit 0cf81c7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/counter/ti-eqep.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#include <linux/bitops.h>
9+
#include <linux/clk.h>
910
#include <linux/counter.h>
1011
#include <linux/kernel.h>
1112
#include <linux/mod_devicetable.h>
@@ -376,6 +377,7 @@ static int ti_eqep_probe(struct platform_device *pdev)
376377
struct counter_device *counter;
377378
struct ti_eqep_cnt *priv;
378379
void __iomem *base;
380+
struct clk *clk;
379381
int err;
380382

381383
counter = devm_counter_alloc(dev, sizeof(*priv));
@@ -415,6 +417,10 @@ static int ti_eqep_probe(struct platform_device *pdev)
415417
pm_runtime_enable(dev);
416418
pm_runtime_get_sync(dev);
417419

420+
clk = devm_clk_get_enabled(dev, NULL);
421+
if (IS_ERR(clk))
422+
return dev_err_probe(dev, PTR_ERR(clk), "failed to enable clock\n");
423+
418424
err = counter_add(counter);
419425
if (err < 0) {
420426
pm_runtime_put_sync(dev);

0 commit comments

Comments
 (0)