Skip to content

Commit 71467e4

Browse files
Xiubo Libroonie
authored andcommitted
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>
1 parent e874dde commit 71467e4

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

‎sound/soc/generic/simple-card.c‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,29 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
9090
* dai->sysclk come from
9191
* "clocks = <&xxx>" (if system has common clock)
9292
* or "system-clock-frequency = <xxx>"
93+
* or device's module clock.
9394
*/
94-
clk = of_clk_get(np, 0);
95-
if (IS_ERR(clk))
95+
if (of_property_read_bool(np, "clocks")) {
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")) {
96104
of_property_read_u32(np,
97105
"system-clock-frequency",
98106
&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+
100114
dai->sysclk = clk_get_rate(clk);
115+
}
101116

102117
ret = 0;
103118

0 commit comments

Comments
 (0)