diff mbox

Choosing the sysclk in simple-card looks broken to me.

Message ID CAKON4Ozth8VHa3OK+HNU7Lp29MqCbvVD7mh3v6KM7ejF0CGDpA@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jon Smirl Aug. 11, 2014, 12:04 a.m. UTC
After much messing around and learning the internals of OF clocks, it
looks like this is what I need.
diff mbox

Patch

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;
 }