* [PATCH 0/2] ASoC: add mclk-fs support to audio graph card @ 2017-11-09 14:07 ` Olivier Moysan 0 siblings, 0 replies; 16+ messages in thread From: Olivier Moysan @ 2017-11-09 14:07 UTC (permalink / raw) To: lgirdwood, broonie, perex, tiwai, mcoquelin.stm32, alexandre.torgue, alsa-devel, robh, mark.rutland, devicetree, linux-arm-kernel, kernel, linux-kernel, olivier.moysan Cc: arnaud.pouliquen, benjamin.gaignard The aim of these patches is to port mclk-fs property to audio graph card, as originally implemented in simple card. Olivier Moysan (2): ASoC: add mclk-fs to audio graph card binding ASoC: add mclk-fs support to audio graph card .../devicetree/bindings/sound/audio-graph-card.txt | 1 + sound/soc/generic/audio-graph-card.c | 47 ++++++++++++++++++---- 2 files changed, 40 insertions(+), 8 deletions(-) -- 1.9.1 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 0/2] ASoC: add mclk-fs support to audio graph card @ 2017-11-09 14:07 ` Olivier Moysan 0 siblings, 0 replies; 16+ messages in thread From: Olivier Moysan @ 2017-11-09 14:07 UTC (permalink / raw) To: linux-arm-kernel The aim of these patches is to port mclk-fs property to audio graph card, as originally implemented in simple card. Olivier Moysan (2): ASoC: add mclk-fs to audio graph card binding ASoC: add mclk-fs support to audio graph card .../devicetree/bindings/sound/audio-graph-card.txt | 1 + sound/soc/generic/audio-graph-card.c | 47 ++++++++++++++++++---- 2 files changed, 40 insertions(+), 8 deletions(-) -- 1.9.1 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 0/2] ASoC: add mclk-fs support to audio graph card @ 2017-11-09 14:07 ` Olivier Moysan 0 siblings, 0 replies; 16+ messages in thread From: Olivier Moysan @ 2017-11-09 14:07 UTC (permalink / raw) To: lgirdwood, broonie, perex, tiwai, mcoquelin.stm32, alexandre.torgue, alsa-devel, robh, mark.rutland, devicetree, linux-arm-kernel, kernel, linux-kernel, olivier.moysan Cc: arnaud.pouliquen, benjamin.gaignard The aim of these patches is to port mclk-fs property to audio graph card, as originally implemented in simple card. Olivier Moysan (2): ASoC: add mclk-fs to audio graph card binding ASoC: add mclk-fs support to audio graph card .../devicetree/bindings/sound/audio-graph-card.txt | 1 + sound/soc/generic/audio-graph-card.c | 47 ++++++++++++++++++---- 2 files changed, 40 insertions(+), 8 deletions(-) -- 1.9.1 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/2] ASoC: add mclk-fs to audio graph card binding 2017-11-09 14:07 ` Olivier Moysan (?) @ 2017-11-09 14:07 ` Olivier Moysan -1 siblings, 0 replies; 16+ messages in thread From: Olivier Moysan @ 2017-11-09 14:07 UTC (permalink / raw) To: lgirdwood, broonie, perex, tiwai, mcoquelin.stm32, alexandre.torgue, alsa-devel, robh, mark.rutland, devicetree, linux-arm-kernel, kernel, linux-kernel, olivier.moysan Cc: arnaud.pouliquen, benjamin.gaignard Add mclk-fs support to audio graph card as initially supported in simple card. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> --- Documentation/devicetree/bindings/sound/audio-graph-card.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/sound/audio-graph-card.txt b/Documentation/devicetree/bindings/sound/audio-graph-card.txt index 6e6720a..d04ea3b 100644 --- a/Documentation/devicetree/bindings/sound/audio-graph-card.txt +++ b/Documentation/devicetree/bindings/sound/audio-graph-card.txt @@ -17,6 +17,7 @@ Below are same as Simple-Card. - bitclock-master - bitclock-inversion - frame-inversion +- mclk-fs - dai-tdm-slot-num - dai-tdm-slot-width - clocks / system-clock-frequency -- 1.9.1 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 1/2] ASoC: add mclk-fs to audio graph card binding @ 2017-11-09 14:07 ` Olivier Moysan 0 siblings, 0 replies; 16+ messages in thread From: Olivier Moysan @ 2017-11-09 14:07 UTC (permalink / raw) To: linux-arm-kernel Add mclk-fs support to audio graph card as initially supported in simple card. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> --- Documentation/devicetree/bindings/sound/audio-graph-card.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/sound/audio-graph-card.txt b/Documentation/devicetree/bindings/sound/audio-graph-card.txt index 6e6720a..d04ea3b 100644 --- a/Documentation/devicetree/bindings/sound/audio-graph-card.txt +++ b/Documentation/devicetree/bindings/sound/audio-graph-card.txt @@ -17,6 +17,7 @@ Below are same as Simple-Card. - bitclock-master - bitclock-inversion - frame-inversion +- mclk-fs - dai-tdm-slot-num - dai-tdm-slot-width - clocks / system-clock-frequency -- 1.9.1 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 1/2] ASoC: add mclk-fs to audio graph card binding @ 2017-11-09 14:07 ` Olivier Moysan 0 siblings, 0 replies; 16+ messages in thread From: Olivier Moysan @ 2017-11-09 14:07 UTC (permalink / raw) To: lgirdwood, broonie, perex, tiwai, mcoquelin.stm32, alexandre.torgue, alsa-devel, robh, mark.rutland, devicetree, linux-arm-kernel, kernel, linux-kernel, olivier.moysan Cc: arnaud.pouliquen, benjamin.gaignard Add mclk-fs support to audio graph card as initially supported in simple card. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> --- Documentation/devicetree/bindings/sound/audio-graph-card.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/sound/audio-graph-card.txt b/Documentation/devicetree/bindings/sound/audio-graph-card.txt index 6e6720a..d04ea3b 100644 --- a/Documentation/devicetree/bindings/sound/audio-graph-card.txt +++ b/Documentation/devicetree/bindings/sound/audio-graph-card.txt @@ -17,6 +17,7 @@ Below are same as Simple-Card. - bitclock-master - bitclock-inversion - frame-inversion +- mclk-fs - dai-tdm-slot-num - dai-tdm-slot-width - clocks / system-clock-frequency -- 1.9.1 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Applied "ASoC: add mclk-fs to audio graph card binding" to the asoc tree 2017-11-09 14:07 ` Olivier Moysan @ 2017-11-10 21:29 ` Mark Brown -1 siblings, 0 replies; 16+ messages in thread From: Mark Brown @ 2017-11-10 21:29 UTC (permalink / raw) To: Olivier Moysan Cc: Kuninori Morimoto, Mark Brown, lgirdwood, broonie, perex, tiwai, mcoquelin.stm32, alexandre.torgue, alsa-devel, robh, mark.rutland, devicetree, linux-arm-kernel, kernel, linux-kernel, olivier.moysan, arnaud.pouliquen, benjamin.gaignard, alsa-devel The patch ASoC: add mclk-fs to audio graph card binding has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From b8b0d10c3a9b6ee94d56d0c3b162d05c177fb101 Mon Sep 17 00:00:00 2001 From: Olivier Moysan <olivier.moysan@st.com> Date: Thu, 9 Nov 2017 15:07:57 +0100 Subject: [PATCH] ASoC: add mclk-fs to audio graph card binding Add mclk-fs support to audio graph card as initially supported in simple card. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org> --- Documentation/devicetree/bindings/sound/audio-graph-card.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/sound/audio-graph-card.txt b/Documentation/devicetree/bindings/sound/audio-graph-card.txt index 6e6720aa33f1..d04ea3b1a1dd 100644 --- a/Documentation/devicetree/bindings/sound/audio-graph-card.txt +++ b/Documentation/devicetree/bindings/sound/audio-graph-card.txt @@ -17,6 +17,7 @@ Below are same as Simple-Card. - bitclock-master - bitclock-inversion - frame-inversion +- mclk-fs - dai-tdm-slot-num - dai-tdm-slot-width - clocks / system-clock-frequency -- 2.15.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Applied "ASoC: add mclk-fs to audio graph card binding" to the asoc tree @ 2017-11-10 21:29 ` Mark Brown 0 siblings, 0 replies; 16+ messages in thread From: Mark Brown @ 2017-11-10 21:29 UTC (permalink / raw) Cc: Kuninori Morimoto, Mark Brown, lgirdwood The patch ASoC: add mclk-fs to audio graph card binding has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From b8b0d10c3a9b6ee94d56d0c3b162d05c177fb101 Mon Sep 17 00:00:00 2001 From: Olivier Moysan <olivier.moysan@st.com> Date: Thu, 9 Nov 2017 15:07:57 +0100 Subject: [PATCH] ASoC: add mclk-fs to audio graph card binding Add mclk-fs support to audio graph card as initially supported in simple card. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org> --- Documentation/devicetree/bindings/sound/audio-graph-card.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/sound/audio-graph-card.txt b/Documentation/devicetree/bindings/sound/audio-graph-card.txt index 6e6720aa33f1..d04ea3b1a1dd 100644 --- a/Documentation/devicetree/bindings/sound/audio-graph-card.txt +++ b/Documentation/devicetree/bindings/sound/audio-graph-card.txt @@ -17,6 +17,7 @@ Below are same as Simple-Card. - bitclock-master - bitclock-inversion - frame-inversion +- mclk-fs - dai-tdm-slot-num - dai-tdm-slot-width - clocks / system-clock-frequency -- 2.15.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/2] ASoC: add mclk-fs support to audio graph card 2017-11-09 14:07 ` Olivier Moysan (?) @ 2017-11-09 14:07 ` Olivier Moysan -1 siblings, 0 replies; 16+ messages in thread From: Olivier Moysan @ 2017-11-09 14:07 UTC (permalink / raw) To: lgirdwood, broonie, perex, tiwai, mcoquelin.stm32, alexandre.torgue, alsa-devel, robh, mark.rutland, devicetree, linux-arm-kernel, kernel, linux-kernel, olivier.moysan Cc: arnaud.pouliquen, benjamin.gaignard Add mclk-fs support to audio graph card as it was previously implemented in simple card. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> --- sound/soc/generic/audio-graph-card.c | 47 ++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 488c52f..1b61642 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -29,7 +29,9 @@ struct graph_card_data { struct graph_dai_props { struct asoc_simple_dai cpu_dai; struct asoc_simple_dai codec_dai; + unsigned int mclk_fs; } *dai_props; + unsigned int mclk_fs; struct snd_soc_dai_link *dai_link; struct gpio_desc *pa_gpio; }; @@ -95,9 +97,43 @@ static void asoc_graph_card_shutdown(struct snd_pcm_substream *substream) asoc_simple_card_clk_disable(&dai_props->codec_dai); } +static int asoc_graph_card_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + struct graph_card_data *priv = snd_soc_card_get_drvdata(rtd->card); + struct graph_dai_props *dai_props = graph_priv_to_props(priv, rtd->num); + unsigned int mclk, mclk_fs = 0; + int ret = 0; + + if (priv->mclk_fs) + mclk_fs = priv->mclk_fs; + else if (dai_props->mclk_fs) + mclk_fs = dai_props->mclk_fs; + + if (mclk_fs) { + mclk = params_rate(params) * mclk_fs; + ret = snd_soc_dai_set_sysclk(codec_dai, 0, mclk, + SND_SOC_CLOCK_IN); + if (ret && ret != -ENOTSUPP) + goto err; + + ret = snd_soc_dai_set_sysclk(cpu_dai, 0, mclk, + SND_SOC_CLOCK_OUT); + if (ret && ret != -ENOTSUPP) + goto err; + } + return 0; +err: + return ret; +} + static const struct snd_soc_ops asoc_graph_card_ops = { .startup = asoc_graph_card_startup, .shutdown = asoc_graph_card_shutdown, + .hw_params = asoc_graph_card_hw_params, }; static int asoc_graph_card_dai_init(struct snd_soc_pcm_runtime *rtd) @@ -146,10 +182,7 @@ static int asoc_graph_card_dai_link_of(struct device_node *cpu_port, if (ret < 0) goto dai_link_of_err; - /* - * we need to consider "mclk-fs" around here - * see simple-card - */ + of_property_read_u32(rcpu_ep, "mclk-fs", &dai_props->mclk_fs); ret = asoc_simple_card_parse_graph_cpu(cpu_ep, dai_link); if (ret < 0) @@ -217,10 +250,8 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv) if (ret < 0) return ret; - /* - * we need to consider "mclk-fs" around here - * see simple-card - */ + /* Factor to mclk, used in hw_params() */ + of_property_read_u32(node, "mclk-fs", &priv->mclk_fs); of_for_each_phandle(&it, rc, node, "dais", NULL, 0) { ret = asoc_graph_card_dai_link_of(it.node, priv, idx++); -- 1.9.1 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/2] ASoC: add mclk-fs support to audio graph card @ 2017-11-09 14:07 ` Olivier Moysan 0 siblings, 0 replies; 16+ messages in thread From: Olivier Moysan @ 2017-11-09 14:07 UTC (permalink / raw) To: linux-arm-kernel Add mclk-fs support to audio graph card as it was previously implemented in simple card. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> --- sound/soc/generic/audio-graph-card.c | 47 ++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 488c52f..1b61642 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -29,7 +29,9 @@ struct graph_card_data { struct graph_dai_props { struct asoc_simple_dai cpu_dai; struct asoc_simple_dai codec_dai; + unsigned int mclk_fs; } *dai_props; + unsigned int mclk_fs; struct snd_soc_dai_link *dai_link; struct gpio_desc *pa_gpio; }; @@ -95,9 +97,43 @@ static void asoc_graph_card_shutdown(struct snd_pcm_substream *substream) asoc_simple_card_clk_disable(&dai_props->codec_dai); } +static int asoc_graph_card_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + struct graph_card_data *priv = snd_soc_card_get_drvdata(rtd->card); + struct graph_dai_props *dai_props = graph_priv_to_props(priv, rtd->num); + unsigned int mclk, mclk_fs = 0; + int ret = 0; + + if (priv->mclk_fs) + mclk_fs = priv->mclk_fs; + else if (dai_props->mclk_fs) + mclk_fs = dai_props->mclk_fs; + + if (mclk_fs) { + mclk = params_rate(params) * mclk_fs; + ret = snd_soc_dai_set_sysclk(codec_dai, 0, mclk, + SND_SOC_CLOCK_IN); + if (ret && ret != -ENOTSUPP) + goto err; + + ret = snd_soc_dai_set_sysclk(cpu_dai, 0, mclk, + SND_SOC_CLOCK_OUT); + if (ret && ret != -ENOTSUPP) + goto err; + } + return 0; +err: + return ret; +} + static const struct snd_soc_ops asoc_graph_card_ops = { .startup = asoc_graph_card_startup, .shutdown = asoc_graph_card_shutdown, + .hw_params = asoc_graph_card_hw_params, }; static int asoc_graph_card_dai_init(struct snd_soc_pcm_runtime *rtd) @@ -146,10 +182,7 @@ static int asoc_graph_card_dai_link_of(struct device_node *cpu_port, if (ret < 0) goto dai_link_of_err; - /* - * we need to consider "mclk-fs" around here - * see simple-card - */ + of_property_read_u32(rcpu_ep, "mclk-fs", &dai_props->mclk_fs); ret = asoc_simple_card_parse_graph_cpu(cpu_ep, dai_link); if (ret < 0) @@ -217,10 +250,8 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv) if (ret < 0) return ret; - /* - * we need to consider "mclk-fs" around here - * see simple-card - */ + /* Factor to mclk, used in hw_params() */ + of_property_read_u32(node, "mclk-fs", &priv->mclk_fs); of_for_each_phandle(&it, rc, node, "dais", NULL, 0) { ret = asoc_graph_card_dai_link_of(it.node, priv, idx++); -- 1.9.1 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/2] ASoC: add mclk-fs support to audio graph card @ 2017-11-09 14:07 ` Olivier Moysan 0 siblings, 0 replies; 16+ messages in thread From: Olivier Moysan @ 2017-11-09 14:07 UTC (permalink / raw) To: lgirdwood, broonie, perex, tiwai, mcoquelin.stm32, alexandre.torgue, alsa-devel, robh, mark.rutland, devicetree, linux-arm-kernel, kernel, linux-kernel, olivier.moysan Cc: arnaud.pouliquen, benjamin.gaignard Add mclk-fs support to audio graph card as it was previously implemented in simple card. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> --- sound/soc/generic/audio-graph-card.c | 47 ++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 488c52f..1b61642 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -29,7 +29,9 @@ struct graph_card_data { struct graph_dai_props { struct asoc_simple_dai cpu_dai; struct asoc_simple_dai codec_dai; + unsigned int mclk_fs; } *dai_props; + unsigned int mclk_fs; struct snd_soc_dai_link *dai_link; struct gpio_desc *pa_gpio; }; @@ -95,9 +97,43 @@ static void asoc_graph_card_shutdown(struct snd_pcm_substream *substream) asoc_simple_card_clk_disable(&dai_props->codec_dai); } +static int asoc_graph_card_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + struct graph_card_data *priv = snd_soc_card_get_drvdata(rtd->card); + struct graph_dai_props *dai_props = graph_priv_to_props(priv, rtd->num); + unsigned int mclk, mclk_fs = 0; + int ret = 0; + + if (priv->mclk_fs) + mclk_fs = priv->mclk_fs; + else if (dai_props->mclk_fs) + mclk_fs = dai_props->mclk_fs; + + if (mclk_fs) { + mclk = params_rate(params) * mclk_fs; + ret = snd_soc_dai_set_sysclk(codec_dai, 0, mclk, + SND_SOC_CLOCK_IN); + if (ret && ret != -ENOTSUPP) + goto err; + + ret = snd_soc_dai_set_sysclk(cpu_dai, 0, mclk, + SND_SOC_CLOCK_OUT); + if (ret && ret != -ENOTSUPP) + goto err; + } + return 0; +err: + return ret; +} + static const struct snd_soc_ops asoc_graph_card_ops = { .startup = asoc_graph_card_startup, .shutdown = asoc_graph_card_shutdown, + .hw_params = asoc_graph_card_hw_params, }; static int asoc_graph_card_dai_init(struct snd_soc_pcm_runtime *rtd) @@ -146,10 +182,7 @@ static int asoc_graph_card_dai_link_of(struct device_node *cpu_port, if (ret < 0) goto dai_link_of_err; - /* - * we need to consider "mclk-fs" around here - * see simple-card - */ + of_property_read_u32(rcpu_ep, "mclk-fs", &dai_props->mclk_fs); ret = asoc_simple_card_parse_graph_cpu(cpu_ep, dai_link); if (ret < 0) @@ -217,10 +250,8 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv) if (ret < 0) return ret; - /* - * we need to consider "mclk-fs" around here - * see simple-card - */ + /* Factor to mclk, used in hw_params() */ + of_property_read_u32(node, "mclk-fs", &priv->mclk_fs); of_for_each_phandle(&it, rc, node, "dais", NULL, 0) { ret = asoc_graph_card_dai_link_of(it.node, priv, idx++); -- 1.9.1 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Applied "ASoC: add mclk-fs support to audio graph card" to the asoc tree 2017-11-09 14:07 ` Olivier Moysan @ 2017-11-10 21:29 ` Mark Brown -1 siblings, 0 replies; 16+ messages in thread From: Mark Brown @ 2017-11-10 21:29 UTC (permalink / raw) To: Olivier Moysan Cc: Kuninori Morimoto, Mark Brown, lgirdwood, broonie, perex, tiwai, mcoquelin.stm32, alexandre.torgue, alsa-devel, robh, mark.rutland, devicetree, linux-arm-kernel, kernel, linux-kernel, olivier.moysan, arnaud.pouliquen, benjamin.gaignard, alsa-devel The patch ASoC: add mclk-fs support to audio graph card has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 757652dd597139adb09e196a93db93feb6fb8a64 Mon Sep 17 00:00:00 2001 From: Olivier Moysan <olivier.moysan@st.com> Date: Thu, 9 Nov 2017 15:07:58 +0100 Subject: [PATCH] ASoC: add mclk-fs support to audio graph card Add mclk-fs support to audio graph card as it was previously implemented in simple card. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org> --- sound/soc/generic/audio-graph-card.c | 47 ++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 488c52f9405f..1b6164249341 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -29,7 +29,9 @@ struct graph_card_data { struct graph_dai_props { struct asoc_simple_dai cpu_dai; struct asoc_simple_dai codec_dai; + unsigned int mclk_fs; } *dai_props; + unsigned int mclk_fs; struct snd_soc_dai_link *dai_link; struct gpio_desc *pa_gpio; }; @@ -95,9 +97,43 @@ static void asoc_graph_card_shutdown(struct snd_pcm_substream *substream) asoc_simple_card_clk_disable(&dai_props->codec_dai); } +static int asoc_graph_card_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + struct graph_card_data *priv = snd_soc_card_get_drvdata(rtd->card); + struct graph_dai_props *dai_props = graph_priv_to_props(priv, rtd->num); + unsigned int mclk, mclk_fs = 0; + int ret = 0; + + if (priv->mclk_fs) + mclk_fs = priv->mclk_fs; + else if (dai_props->mclk_fs) + mclk_fs = dai_props->mclk_fs; + + if (mclk_fs) { + mclk = params_rate(params) * mclk_fs; + ret = snd_soc_dai_set_sysclk(codec_dai, 0, mclk, + SND_SOC_CLOCK_IN); + if (ret && ret != -ENOTSUPP) + goto err; + + ret = snd_soc_dai_set_sysclk(cpu_dai, 0, mclk, + SND_SOC_CLOCK_OUT); + if (ret && ret != -ENOTSUPP) + goto err; + } + return 0; +err: + return ret; +} + static const struct snd_soc_ops asoc_graph_card_ops = { .startup = asoc_graph_card_startup, .shutdown = asoc_graph_card_shutdown, + .hw_params = asoc_graph_card_hw_params, }; static int asoc_graph_card_dai_init(struct snd_soc_pcm_runtime *rtd) @@ -146,10 +182,7 @@ static int asoc_graph_card_dai_link_of(struct device_node *cpu_port, if (ret < 0) goto dai_link_of_err; - /* - * we need to consider "mclk-fs" around here - * see simple-card - */ + of_property_read_u32(rcpu_ep, "mclk-fs", &dai_props->mclk_fs); ret = asoc_simple_card_parse_graph_cpu(cpu_ep, dai_link); if (ret < 0) @@ -217,10 +250,8 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv) if (ret < 0) return ret; - /* - * we need to consider "mclk-fs" around here - * see simple-card - */ + /* Factor to mclk, used in hw_params() */ + of_property_read_u32(node, "mclk-fs", &priv->mclk_fs); of_for_each_phandle(&it, rc, node, "dais", NULL, 0) { ret = asoc_graph_card_dai_link_of(it.node, priv, idx++); -- 2.15.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Applied "ASoC: add mclk-fs support to audio graph card" to the asoc tree @ 2017-11-10 21:29 ` Mark Brown 0 siblings, 0 replies; 16+ messages in thread From: Mark Brown @ 2017-11-10 21:29 UTC (permalink / raw) Cc: Kuninori Morimoto, Mark Brown, lgirdwood The patch ASoC: add mclk-fs support to audio graph card has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 757652dd597139adb09e196a93db93feb6fb8a64 Mon Sep 17 00:00:00 2001 From: Olivier Moysan <olivier.moysan@st.com> Date: Thu, 9 Nov 2017 15:07:58 +0100 Subject: [PATCH] ASoC: add mclk-fs support to audio graph card Add mclk-fs support to audio graph card as it was previously implemented in simple card. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org> --- sound/soc/generic/audio-graph-card.c | 47 ++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 488c52f9405f..1b6164249341 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -29,7 +29,9 @@ struct graph_card_data { struct graph_dai_props { struct asoc_simple_dai cpu_dai; struct asoc_simple_dai codec_dai; + unsigned int mclk_fs; } *dai_props; + unsigned int mclk_fs; struct snd_soc_dai_link *dai_link; struct gpio_desc *pa_gpio; }; @@ -95,9 +97,43 @@ static void asoc_graph_card_shutdown(struct snd_pcm_substream *substream) asoc_simple_card_clk_disable(&dai_props->codec_dai); } +static int asoc_graph_card_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + struct graph_card_data *priv = snd_soc_card_get_drvdata(rtd->card); + struct graph_dai_props *dai_props = graph_priv_to_props(priv, rtd->num); + unsigned int mclk, mclk_fs = 0; + int ret = 0; + + if (priv->mclk_fs) + mclk_fs = priv->mclk_fs; + else if (dai_props->mclk_fs) + mclk_fs = dai_props->mclk_fs; + + if (mclk_fs) { + mclk = params_rate(params) * mclk_fs; + ret = snd_soc_dai_set_sysclk(codec_dai, 0, mclk, + SND_SOC_CLOCK_IN); + if (ret && ret != -ENOTSUPP) + goto err; + + ret = snd_soc_dai_set_sysclk(cpu_dai, 0, mclk, + SND_SOC_CLOCK_OUT); + if (ret && ret != -ENOTSUPP) + goto err; + } + return 0; +err: + return ret; +} + static const struct snd_soc_ops asoc_graph_card_ops = { .startup = asoc_graph_card_startup, .shutdown = asoc_graph_card_shutdown, + .hw_params = asoc_graph_card_hw_params, }; static int asoc_graph_card_dai_init(struct snd_soc_pcm_runtime *rtd) @@ -146,10 +182,7 @@ static int asoc_graph_card_dai_link_of(struct device_node *cpu_port, if (ret < 0) goto dai_link_of_err; - /* - * we need to consider "mclk-fs" around here - * see simple-card - */ + of_property_read_u32(rcpu_ep, "mclk-fs", &dai_props->mclk_fs); ret = asoc_simple_card_parse_graph_cpu(cpu_ep, dai_link); if (ret < 0) @@ -217,10 +250,8 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv) if (ret < 0) return ret; - /* - * we need to consider "mclk-fs" around here - * see simple-card - */ + /* Factor to mclk, used in hw_params() */ + of_property_read_u32(node, "mclk-fs", &priv->mclk_fs); of_for_each_phandle(&it, rc, node, "dais", NULL, 0) { ret = asoc_graph_card_dai_link_of(it.node, priv, idx++); -- 2.15.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [alsa-devel] [PATCH 0/2] ASoC: add mclk-fs support to audio graph card @ 2017-11-09 23:54 ` Kuninori Morimoto 0 siblings, 0 replies; 16+ messages in thread From: Kuninori Morimoto @ 2017-11-09 23:54 UTC (permalink / raw) To: Olivier Moysan Cc: lgirdwood, broonie, perex, tiwai, mcoquelin.stm32, alexandre.torgue, alsa-devel, robh, mark.rutland, devicetree, linux-arm-kernel, kernel, linux-kernel, arnaud.pouliquen, benjamin.gaignard Hi > The aim of these patches is to port mclk-fs property to audio graph card, > as originally implemented in simple card. > > Olivier Moysan (2): > ASoC: add mclk-fs to audio graph card binding > ASoC: add mclk-fs support to audio graph card > > .../devicetree/bindings/sound/audio-graph-card.txt | 1 + > sound/soc/generic/audio-graph-card.c | 47 ++++++++++++++++++---- > 2 files changed, 40 insertions(+), 8 deletions(-) For all patches Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Best regards --- Kuninori Morimoto ^ permalink raw reply [flat|nested] 16+ messages in thread
* [alsa-devel] [PATCH 0/2] ASoC: add mclk-fs support to audio graph card @ 2017-11-09 23:54 ` Kuninori Morimoto 0 siblings, 0 replies; 16+ messages in thread From: Kuninori Morimoto @ 2017-11-09 23:54 UTC (permalink / raw) To: linux-arm-kernel Hi > The aim of these patches is to port mclk-fs property to audio graph card, > as originally implemented in simple card. > > Olivier Moysan (2): > ASoC: add mclk-fs to audio graph card binding > ASoC: add mclk-fs support to audio graph card > > .../devicetree/bindings/sound/audio-graph-card.txt | 1 + > sound/soc/generic/audio-graph-card.c | 47 ++++++++++++++++++---- > 2 files changed, 40 insertions(+), 8 deletions(-) For all patches Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Best regards --- Kuninori Morimoto ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [alsa-devel] [PATCH 0/2] ASoC: add mclk-fs support to audio graph card @ 2017-11-09 23:54 ` Kuninori Morimoto 0 siblings, 0 replies; 16+ messages in thread From: Kuninori Morimoto @ 2017-11-09 23:54 UTC (permalink / raw) To: Olivier Moysan Cc: lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A, perex-/Fr2/VpizcU, tiwai-IBi9RG/b67k, mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w, alexandre.torgue-qxv4g6HH51o, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, robh-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, kernel-F5mvAk5X5gdBDgjK7y7TUQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA, arnaud.pouliquen-qxv4g6HH51o, benjamin.gaignard-qxv4g6HH51o Hi > The aim of these patches is to port mclk-fs property to audio graph card, > as originally implemented in simple card. > > Olivier Moysan (2): > ASoC: add mclk-fs to audio graph card binding > ASoC: add mclk-fs support to audio graph card > > .../devicetree/bindings/sound/audio-graph-card.txt | 1 + > sound/soc/generic/audio-graph-card.c | 47 ++++++++++++++++++---- > 2 files changed, 40 insertions(+), 8 deletions(-) For all patches Acked-by: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org> Best regards --- Kuninori Morimoto -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2017-11-10 21:30 UTC | newest] Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-11-09 14:07 [PATCH 0/2] ASoC: add mclk-fs support to audio graph card Olivier Moysan 2017-11-09 14:07 ` Olivier Moysan 2017-11-09 14:07 ` Olivier Moysan 2017-11-09 14:07 ` [PATCH 1/2] ASoC: add mclk-fs to audio graph card binding Olivier Moysan 2017-11-09 14:07 ` Olivier Moysan 2017-11-09 14:07 ` Olivier Moysan 2017-11-10 21:29 ` Applied "ASoC: add mclk-fs to audio graph card binding" to the asoc tree Mark Brown 2017-11-10 21:29 ` Mark Brown 2017-11-09 14:07 ` [PATCH 2/2] ASoC: add mclk-fs support to audio graph card Olivier Moysan 2017-11-09 14:07 ` Olivier Moysan 2017-11-09 14:07 ` Olivier Moysan 2017-11-10 21:29 ` Applied "ASoC: add mclk-fs support to audio graph card" to the asoc tree Mark Brown 2017-11-10 21:29 ` Mark Brown 2017-11-09 23:54 ` [alsa-devel] [PATCH 0/2] ASoC: add mclk-fs support to audio graph card Kuninori Morimoto 2017-11-09 23:54 ` Kuninori Morimoto 2017-11-09 23:54 ` Kuninori Morimoto
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.