mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
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: f213729f67
("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>
This commit is contained in:
parent
1613e604df
commit
0cf81c73e4
@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/bitops.h>
|
#include <linux/bitops.h>
|
||||||
|
#include <linux/clk.h>
|
||||||
#include <linux/counter.h>
|
#include <linux/counter.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/mod_devicetable.h>
|
#include <linux/mod_devicetable.h>
|
||||||
@ -376,6 +377,7 @@ static int ti_eqep_probe(struct platform_device *pdev)
|
|||||||
struct counter_device *counter;
|
struct counter_device *counter;
|
||||||
struct ti_eqep_cnt *priv;
|
struct ti_eqep_cnt *priv;
|
||||||
void __iomem *base;
|
void __iomem *base;
|
||||||
|
struct clk *clk;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
counter = devm_counter_alloc(dev, sizeof(*priv));
|
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_enable(dev);
|
||||||
pm_runtime_get_sync(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);
|
err = counter_add(counter);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
pm_runtime_put_sync(dev);
|
pm_runtime_put_sync(dev);
|
||||||
|
Loading…
Reference in New Issue
Block a user