diff mbox series

[1/1] ASoC: qcom: sm8250: enable primary mi2s

Message ID 20240826134920.55148-2-adrian@travitia.xyz (mailing list archive)
State Accepted
Commit 851e3a2a4490b03bb8dd0cda1b8b2a78f6a92805
Headers show
Series Add support for primary mi2s on SM8250 | expand

Commit Message

Jens Reidel Aug. 26, 2024, 1:49 p.m. UTC
When using primary mi2s on sm8250-compatible SoCs, the correct clock
needs to get enabled to be able to use the mi2s interface.

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
---
 sound/soc/qcom/sm8250.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Danila Tikhonov Aug. 26, 2024, 8:09 p.m. UTC | #1
On 8/26/24 16:49, Jens Reidel wrote:
> When using primary mi2s on sm8250-compatible SoCs, the correct clock
> needs to get enabled to be able to use the mi2s interface.
>
> Signed-off-by: Jens Reidel <adrian@travitia.xyz>
> ---
>   sound/soc/qcom/sm8250.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c
> index a15dafb99b33..274bab28209a 100644
> --- a/sound/soc/qcom/sm8250.c
> +++ b/sound/soc/qcom/sm8250.c
> @@ -55,6 +55,14 @@ static int sm8250_snd_startup(struct snd_pcm_substream *substream)
>   	struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
>   
>   	switch (cpu_dai->id) {
> +	case PRIMARY_MI2S_RX:
> +		codec_dai_fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_I2S;
> +		snd_soc_dai_set_sysclk(cpu_dai,
> +			Q6AFE_LPASS_CLK_ID_PRI_MI2S_IBIT,
> +			MI2S_BCLK_RATE, SNDRV_PCM_STREAM_PLAYBACK);
> +		snd_soc_dai_set_fmt(cpu_dai, fmt);
> +		snd_soc_dai_set_fmt(codec_dai, codec_dai_fmt);
> +		break;
>   	case TERTIARY_MI2S_RX:
>   		codec_dai_fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_I2S;
>   		snd_soc_dai_set_sysclk(cpu_dai,
Thank you. I use sm8250-sndcard on sm7325 and it works for me:
https://github.com/mainlining/linux/commit/292a1ac9f093c639363f257e92d313489ec5a394

Let the maintainers decide whether it is really fair to add this tag.

Tested-by: Danila Tikhonov <danila@jiaxyga.com> # sm7325-nothing-spacewar

---
Best wishes,
Danila
Dmitry Baryshkov Aug. 29, 2024, 9:04 a.m. UTC | #2
On Mon, Aug 26, 2024 at 03:49:20PM GMT, Jens Reidel wrote:
> When using primary mi2s on sm8250-compatible SoCs, the correct clock
> needs to get enabled to be able to use the mi2s interface.
> 
> Signed-off-by: Jens Reidel <adrian@travitia.xyz>
> ---
>  sound/soc/qcom/sm8250.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
diff mbox series

Patch

diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c
index a15dafb99b33..274bab28209a 100644
--- a/sound/soc/qcom/sm8250.c
+++ b/sound/soc/qcom/sm8250.c
@@ -55,6 +55,14 @@  static int sm8250_snd_startup(struct snd_pcm_substream *substream)
 	struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
 
 	switch (cpu_dai->id) {
+	case PRIMARY_MI2S_RX:
+		codec_dai_fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_I2S;
+		snd_soc_dai_set_sysclk(cpu_dai,
+			Q6AFE_LPASS_CLK_ID_PRI_MI2S_IBIT,
+			MI2S_BCLK_RATE, SNDRV_PCM_STREAM_PLAYBACK);
+		snd_soc_dai_set_fmt(cpu_dai, fmt);
+		snd_soc_dai_set_fmt(codec_dai, codec_dai_fmt);
+		break;
 	case TERTIARY_MI2S_RX:
 		codec_dai_fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_I2S;
 		snd_soc_dai_set_sysclk(cpu_dai,