[alsa-devel] Choosing the sysclk in simple-card looks broken to me.
jonsmirl at gmail.com
jonsmirl at gmail.com
Mon Aug 11 02:04:43 CEST 2014
After much messing around and learning the internals of OF clocks, it
looks like this is what I need.
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 03a7fdc..05d074b 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -13,6 +13,7 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
+#include <linux/of_platform.h>
#include <linux/string.h>
#include <sound/simple_card.h>
#include <sound/soc-dai.h>
@@ -116,6 +117,7 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
{
struct device_node *node;
struct clk *clk;
+ struct of_phandle_args clkspec;
int ret;
/*
@@ -156,11 +158,14 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
"system-clock-frequency",
&dai->sysclk);
} else {
- clk = of_clk_get(node, 0);
- if (!IS_ERR(clk))
+ clkspec.np = node;
+ clk = of_clk_get_from_provider(&clkspec);
+
+ if (!IS_ERR(clk)) {
dai->sysclk = clk_get_rate(clk);
+ clk_put(clk);
+ }
}
-
return 0;
}
--
Jon Smirl
jonsmirl at gmail.com
More information about the Alsa-devel
mailing list