diff options
author | Xiubo Li <Li.Xiubo@freescale.com> | 2013-12-23 02:25:38 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-01-01 07:24:56 -0500 |
commit | 71467e46414d3bab220de77d3d085be0c0aa03e1 (patch) | |
tree | 747b3114cce3679c81edc6d10930ef3dbbd95c65 /sound/soc/generic/simple-card.c | |
parent | e874ddead38996ec40c6a6be2347a69fac520126 (diff) |
ASoC: simple-card: Add device's module clock selection.
Try to get the device's module clock if the dt has no clocks and
system-clock-frequency properties.
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/generic/simple-card.c')
-rw-r--r-- | sound/soc/generic/simple-card.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 3ba65bb63439..58c217e403ae 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c | |||
@@ -90,14 +90,29 @@ asoc_simple_card_sub_parse_of(struct device_node *np, | |||
90 | * dai->sysclk come from | 90 | * dai->sysclk come from |
91 | * "clocks = <&xxx>" (if system has common clock) | 91 | * "clocks = <&xxx>" (if system has common clock) |
92 | * or "system-clock-frequency = <xxx>" | 92 | * or "system-clock-frequency = <xxx>" |
93 | * or device's module clock. | ||
93 | */ | 94 | */ |
94 | clk = of_clk_get(np, 0); | 95 | if (of_property_read_bool(np, "clocks")) { |
95 | if (IS_ERR(clk)) | 96 | clk = of_clk_get(np, 0); |
97 | if (IS_ERR(clk)) { | ||
98 | ret = PTR_ERR(clk); | ||
99 | goto parse_error; | ||
100 | } | ||
101 | |||
102 | dai->sysclk = clk_get_rate(clk); | ||
103 | } else if (of_property_read_bool(np, "system-clock-frequency")) { | ||
96 | of_property_read_u32(np, | 104 | of_property_read_u32(np, |
97 | "system-clock-frequency", | 105 | "system-clock-frequency", |
98 | &dai->sysclk); | 106 | &dai->sysclk); |
99 | else | 107 | } else { |
108 | clk = of_clk_get(*node, 0); | ||
109 | if (IS_ERR(clk)) { | ||
110 | ret = PTR_ERR(clk); | ||
111 | goto parse_error; | ||
112 | } | ||
113 | |||
100 | dai->sysclk = clk_get_rate(clk); | 114 | dai->sysclk = clk_get_rate(clk); |
115 | } | ||
101 | 116 | ||
102 | ret = 0; | 117 | ret = 0; |
103 | 118 | ||