Skip to content

Commit

Permalink
ASoC: simple-card: Add device's module clock selection.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Xiubo Li authored and Mark Brown committed Jan 1, 2014
1 parent e874dde commit 71467e4
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions sound/soc/generic/simple-card.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,29 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
* dai->sysclk come from
* "clocks = <&xxx>" (if system has common clock)
* or "system-clock-frequency = <xxx>"
* or device's module clock.
*/
clk = of_clk_get(np, 0);
if (IS_ERR(clk))
if (of_property_read_bool(np, "clocks")) {
clk = of_clk_get(np, 0);
if (IS_ERR(clk)) {
ret = PTR_ERR(clk);
goto parse_error;
}

dai->sysclk = clk_get_rate(clk);
} else if (of_property_read_bool(np, "system-clock-frequency")) {
of_property_read_u32(np,
"system-clock-frequency",
&dai->sysclk);
else
} else {
clk = of_clk_get(*node, 0);
if (IS_ERR(clk)) {
ret = PTR_ERR(clk);
goto parse_error;
}

dai->sysclk = clk_get_rate(clk);
}

ret = 0;

Expand Down

0 comments on commit 71467e4

Please sign in to comment.