ASoC: Intel: cirrus-common: fix incorrect channel mapping
Subsystems (3)
PATCH 1/1 ASoC: Intel: cirrus-common: fix incorrect channel mapping
From: xliu <[email protected]>
The default mapping of ASPRX1 Slot is left channel. Map the slots of right amplifiers (WR and TR) to right channel.
--- sound/soc/intel/boards/sof_cirrus_common.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
sound/soc/intel/boards/sof_cirrus_common.c +12 -0
@@ -107,6 +107,7 @@ static int cs35l41_hw_params(struct snd_pcm_substream *substream,struct snd_soc_pcm_runtime *rtd =asoc_substream_to_rtd (substream);struct snd_soc_dai *codec_dai;int clk_freq, i, ret; +int rx_ch[2 ] = {1 ,0 }; clk_freq =sof_dai_get_bclk (rtd);/* BCLK freq */
@@ -134,6 +135,17 @@ static int cs35l41_hw_params(struct snd_pcm_substream *substream, ret);return ret; } + +/* Setup for R channel Slot: WR and TR */ +if (i %2 ) { + ret =snd_soc_dai_set_channel_map (codec_dai,0 ,NULL , +ARRAY_SIZE (rx_ch), rx_ch); +if (ret <0 ) { +dev_err (codec_dai->dev,"fail to set channel map, ret %d\n" , + ret); +return ret; + } + } }return 0 ;
Signature · 1 line
2.25.1
Quoted 16 lines · Brent Lu
From: xliu <[email protected]>
The default mapping of ASPRX1 Slot is left channel. Map the slots of right amplifiers (WR and TR) to right channel.
Signed-off-by xliu <[email protected]>Signed-off-by Brent Lu <[email protected]>--- sound/soc/intel/boards/sof_cirrus_common.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)sound/soc/intel/boards/sof_cirrus_common.c +0
-0
sound/soc/intel/boards/sof_cirrus_common.c static int cs35l41_hw_params(struct snd_pcm_substream *substream, · line 110
Quoted 4 lines
sound/soc/intel/boards/sof_cirrus_common.c +1
-0@@ -107,6 +107,7 @@ static int cs35l41_hw_params(struct snd_pcm_substream *substream,struct snd_soc_pcm_runtime *rtd =asoc_substream_to_rtd (substream);struct snd_soc_dai *codec_dai;int clk_freq, i, ret; +int rx_ch[2 ] = {1 ,0 };
Should this be 'const'?
I am also not clear on the mapping, how does this select the right channel? This selects slot0 and the left channel, what am I missing?
Quoted 8 lines
sound/soc/intel/boards/sof_cirrus_common.c +1
-0clk_freq =sof_dai_get_bclk (rtd);/* BCLK freq */ @@ -134,6 +135,17 @@ static int cs35l41_hw_params(struct snd_pcm_substream *substream, ret);return ret; } +
sound/soc/intel/boards/sof_cirrus_common.c static int cs35l41_hw_params(struct snd_pcm_substream *substream, · line 148
Quoted 10 lines
sound/soc/intel/boards/sof_cirrus_common.c +10
-0+/* Setup for R channel Slot: WR and TR */ +if (i %2 ) { + ret =snd_soc_dai_set_channel_map (codec_dai,0 ,NULL , +ARRAY_SIZE (rx_ch), rx_ch); +if (ret <0 ) { +dev_err (codec_dai->dev,"fail to set channel map, ret %d\n" , + ret); +return ret; + } + }
Should we do this loop for the left channels as well to have an explicit setting?
Quoted 3 lines
sound/soc/intel/boards/sof_cirrus_common.c +0
-0}return 0 ;
Quoted 3 lines
sound/soc/intel/boards/sof_cirrus_common.c static int cs35l41_hw_params(struct snd_pcm_substream *substream, · line 110
Quoted 1 line
sound/soc/intel/boards/sof_cirrus_common.c +1
-0+int rx_ch[2 ] = {1 ,0 };Should this be 'const'?
Will fix it.
Quoted 3 lines
I am also not clear on the mapping, how does this select the right channel? This selects slot0 and the left channel, what am I missing?
There are two DAC sources ASPRX1 and ASPRX2 which is on slot 0 and slot 1 by default. And the DAC is using ASPRX1 as source. The {1, 0} will setup ASPRX1 to be on slot 1 and ASPRX2 on slot 0 so the amps will be using slot 1 as DAC source.
Quoted 15 lines
Review static int cs35l41_hw_params(struct
Quoted 1 line
(quoted diff) +0
-0@@ -134,6 +135,17 @@ static int cs35l41_hw_params(struct
snd_pcm_substream*substream,sound/soc/intel/boards/sof_cirrus_common.c static int cs35l41_hw_params(struct snd_pcm_substream *substream,
Quoted 7 lines
sound/soc/intel/boards/sof_cirrus_common.c +4
-0ret);return ret; } + +/* Setup for R channel Slot: WR and TR */ +if (i %2 ) { + ret = snd_soc_dai_set_channel_map(codec_dai, 0,NULL,
Review static int cs35l41_hw_params(struct · line 142
Quoted 1 line
(quoted diff) +1
-0+ ARRAY_SIZE(rx_ch),
rx_ch);Review static int cs35l41_hw_params(struct · line 144
Quoted 2 lines
(quoted diff) +2
-0+ if (ret < 0) { + dev_err(codec_dai->dev, "fail to set channelmap, ret %d\n",
Quoted 6 lines
sound/soc/intel/boards/sof_cirrus_common.c static int cs35l41_hw_params(struct snd_pcm_substream *substream, · line 148
Quoted 4 lines
sound/soc/intel/boards/sof_cirrus_common.c +4
-0+ ret); +return ret; + } + }Should we do this loop for the left channels as well to have an explicit setting?
Will do it in V2 patch.
Quoted 4 lines
Quoted 4 lines
sound/soc/intel/boards/sof_cirrus_common.c +0
-0}return 0 ;