diff mbox

[3/7] ASoC: simple_card_utils: Set clock frequency

Message ID 20180130110844.GD18123@lenoch (mailing list archive)
State New, archived
Headers show

Commit Message

Ladislav Michl Jan. 30, 2018, 11:08 a.m. UTC
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
 sound/soc/generic/simple-card-utils.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Alexandre Belloni Feb. 27, 2018, 5:19 p.m. UTC | #1
On 30/01/2018 at 12:08:45 +0100, Ladislav Michl wrote:
> Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> ---
>  sound/soc/generic/simple-card-utils.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
> index 3751a07de6aa..6b0cadc56933 100644
> --- a/sound/soc/generic/simple-card-utils.c
> +++ b/sound/soc/generic/simple-card-utils.c
> @@ -185,6 +185,10 @@ int asoc_simple_card_parse_clk(struct device *dev,
>  	 */
>  	clk = devm_get_clk_from_child(dev, node, NULL);
>  	if (!IS_ERR(clk)) {
> +		if (!of_property_read_u32(node, "clock-frequency", &val)) {
> +			if (clk_set_rate(clk, val))
> +				dev_err(dev, "failed to set frequency %d\n", val);
> +		}

This would need to be documented in the simple card bindings but I think
you may instead use: assigned-clocks and assigned-clock-rates.
diff mbox

Patch

diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index 3751a07de6aa..6b0cadc56933 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -185,6 +185,10 @@  int asoc_simple_card_parse_clk(struct device *dev,
 	 */
 	clk = devm_get_clk_from_child(dev, node, NULL);
 	if (!IS_ERR(clk)) {
+		if (!of_property_read_u32(node, "clock-frequency", &val)) {
+			if (clk_set_rate(clk, val))
+				dev_err(dev, "failed to set frequency %d\n", val);
+		}
 		simple_dai->sysclk = clk_get_rate(clk);
 
 		asoc_simple_card_clk_register(simple_dai, clk);