From 17c2d247ddd231199e682b0a7fda42fe46c2c07b Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 24 May 2021 15:12:04 +0900 Subject: [PATCH 1/3] ASoC: dt-bindings: renesas: rsnd: tidyup properties 1) resets/reset-names needs minItems 2) It can use ports, not only port 3) It is not using audio-graph properties Without this patch, we will get warnings Signed-off-by: Kuninori Morimoto Link: https://lore.kernel.org/r/87wnrooe2z.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- .../devicetree/bindings/sound/renesas,rsnd.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml b/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml index 605de3a5847f..ee936d1aa724 100644 --- a/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml +++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml @@ -86,9 +86,11 @@ properties: power-domains: true resets: + minItems: 1 maxItems: 11 reset-names: + minItems: 1 maxItems: 11 clocks: @@ -110,6 +112,13 @@ properties: - pattern: '^dvc\.[0-1]$' - pattern: '^clk_(a|b|c|i)$' + ports: + $ref: /schemas/graph.yaml#/properties/ports + properties: + port(@[0-9a-f]+)?: + $ref: audio-graph-port.yaml# + unevaluatedProperties: false + port: $ref: audio-graph-port.yaml# unevaluatedProperties: false @@ -257,7 +266,6 @@ required: - "#sound-dai-cells" allOf: - - $ref: audio-graph.yaml# - if: properties: compatible: From cf9d5c6619fadfc41cf8f5154cb990cc38e3da85 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 24 May 2021 15:12:09 +0900 Subject: [PATCH 2/3] ASoC: rsnd: tidyup loop on rsnd_adg_clk_query() commit 06e8f5c842f2d ("ASoC: rsnd: don't call clk_get_rate() under atomic context") used saved clk_rate, thus for_each_rsnd_clk() is no longer needed. This patch fixes it. Fixes: 06e8f5c842f2d ("ASoC: rsnd: don't call clk_get_rate() under atomic context") Signed-off-by: Kuninori Morimoto Link: https://lore.kernel.org/r/87v978oe2u.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- sound/soc/sh/rcar/adg.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c index 0b8ae3eee148..93751099465d 100644 --- a/sound/soc/sh/rcar/adg.c +++ b/sound/soc/sh/rcar/adg.c @@ -290,7 +290,6 @@ static void rsnd_adg_set_ssi_clk(struct rsnd_mod *ssi_mod, u32 val) int rsnd_adg_clk_query(struct rsnd_priv *priv, unsigned int rate) { struct rsnd_adg *adg = rsnd_priv_to_adg(priv); - struct clk *clk; int i; int sel_table[] = { [CLKA] = 0x1, @@ -303,10 +302,9 @@ int rsnd_adg_clk_query(struct rsnd_priv *priv, unsigned int rate) * find suitable clock from * AUDIO_CLKA/AUDIO_CLKB/AUDIO_CLKC/AUDIO_CLKI. */ - for_each_rsnd_clk(clk, adg, i) { + for (i = 0; i < CLKMAX; i++) if (rate == adg->clk_rate[i]) return sel_table[i]; - } /* * find divided clock from BRGA/BRGB From d6956a7dde6fbf843da117f8b69cc512101fdea2 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 24 May 2021 15:12:14 +0900 Subject: [PATCH 3/3] ASoC: rsnd: add null CLOCKIN support Some Renesas SoC doesn't have full CLOCKIN. This patch add null_clk, and accepts it. Signed-off-by: Kuninori Morimoto Link: https://lore.kernel.org/r/87tumsoe2p.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- sound/soc/sh/rcar/adg.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c index 93751099465d..e13eb201d550 100644 --- a/sound/soc/sh/rcar/adg.c +++ b/sound/soc/sh/rcar/adg.c @@ -3,8 +3,8 @@ // Helper routines for R-Car sound ADG. // // Copyright (C) 2013 Kuninori Morimoto - #include +#include #include "rsnd.h" #define CLKA 0 @@ -389,6 +389,30 @@ void rsnd_adg_clk_control(struct rsnd_priv *priv, int enable) } } +#define NULL_CLK "rsnd_adg_null" +static struct clk *rsnd_adg_null_clk_get(struct rsnd_priv *priv) +{ + static struct clk_hw *hw; + struct device *dev = rsnd_priv_to_dev(priv); + + if (!hw) { + struct clk_hw *_hw; + int ret; + + _hw = clk_hw_register_fixed_rate_with_accuracy(dev, NULL_CLK, NULL, 0, 0, 0); + if (IS_ERR(_hw)) + return NULL; + + ret = of_clk_add_hw_provider(dev->of_node, of_clk_hw_simple_get, _hw); + if (ret < 0) + clk_hw_unregister_fixed_rate(_hw); + + hw = _hw; + } + + return clk_hw_get_clk(hw, NULL_CLK); +} + static void rsnd_adg_get_clkin(struct rsnd_priv *priv, struct rsnd_adg *adg) { @@ -398,7 +422,12 @@ static void rsnd_adg_get_clkin(struct rsnd_priv *priv, for (i = 0; i < CLKMAX; i++) { struct clk *clk = devm_clk_get(dev, clk_name[i]); - adg->clk[i] = IS_ERR(clk) ? NULL : clk; + if (IS_ERR(clk)) + clk = rsnd_adg_null_clk_get(priv); + if (IS_ERR(clk)) + dev_err(dev, "no adg clock (%s)\n", clk_name[i]); + + adg->clk[i] = clk; } }