summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWalker Chen <walker.chen@starfivetech.com>2022-07-26 05:36:17 +0300
committerWalker Chen <walker.chen@starfivetech.com>2022-07-26 05:38:15 +0300
commit96409c1b0907bc486ed97ffd0b1d1d8b3192f5a2 (patch)
treeb36dbee1faf2bc4c836d31cdee4e0aaac5f85c19
parentebbdad27560c8ffe2d1731d92af83ddc23d9457d (diff)
downloadlinux-96409c1b0907bc486ed97ffd0b1d1d8b3192f5a2.tar.xz
TDM:fix 32bit only has 1 channel of data
TDM: playback or record with 32bit format, only has 1 channel of data. This bug has been resolved. Signed-off-by: Walker Chen <walker.chen@starfivetech.com>
-rwxr-xr-xsound/soc/codecs/wm8960.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 589c0af50b5d..cf964a5a75ba 100755
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -819,6 +819,7 @@ static int wm8960_hw_params(struct snd_pcm_substream *substream,
u16 audio_format = iface & 0x3;
int freq_out, freq_in;
int i, j, k;
+ u16 word_length = 0;
wm8960->bclk = snd_soc_params_to_bclk(params);
if (params_channels(params) == 1)
@@ -830,12 +831,15 @@ static int wm8960_hw_params(struct snd_pcm_substream *substream,
break;
case 20:
iface |= 0x0004;
+ word_length |= 0x0004;
break;
case 24:
iface |= 0x0008;
+ word_length |= 0x0008;
break;
case 32:
/* right justify mode does not support 32 word length */
+ word_length |= 0x000c;
if ((iface & 0x3) != 0) {
iface |= 0x000c;
break;
@@ -885,9 +889,10 @@ static int wm8960_hw_params(struct snd_pcm_substream *substream,
snd_soc_component_write(component, WM8960_POWER2, 0x1f9);
snd_soc_component_write(component, WM8960_POWER2, 0x1f9);
snd_soc_component_write(component, WM8960_IFACE1, 0x3);
- snd_soc_component_write(component, WM8960_IFACE1, 0x43);
+ snd_soc_component_write(component, WM8960_IFACE1, 0x43 | word_length);
snd_soc_component_write(component, WM8960_POWER1, 0xd6);
snd_soc_component_write(component, WM8960_POWER1, 0xc6);
+ snd_soc_component_write(component, WM8960_ADDCTL2, 0x4);
} else {
snd_soc_component_write(component, WM8960_POWER3, 0x30);
snd_soc_component_write(component, WM8960_POWER1, 0xfe);
@@ -898,7 +903,7 @@ static int wm8960_hw_params(struct snd_pcm_substream *substream,
snd_soc_component_write(component, WM8960_POWER1, 0xfe);
snd_soc_component_write(component, WM8960_ADDCTL2, 0x0);
snd_soc_component_write(component, WM8960_IFACE1, 0x3);
- snd_soc_component_write(component, WM8960_IFACE1, 0x43);
+ snd_soc_component_write(component, WM8960_IFACE1, 0x43 | word_length);
snd_soc_component_write(component, WM8960_POWER1, 0xfe);
snd_soc_component_write(component, WM8960_LINPATH, 0x108);
snd_soc_component_write(component, WM8960_POWER1, 0xfe);
@@ -922,6 +927,7 @@ static int wm8960_hw_params(struct snd_pcm_substream *substream,
alc_rates[i].val);
/* bclk inverted */
snd_soc_component_update_bits(component, WM8960_IFACE1, 0x80, 0x80);
+ snd_soc_component_write(component, WM8960_POWER2, 0x1f9);
} else if (audio_format == 0x2) {//I2S Format
if (!tx) {
snd_soc_component_update_bits(component, WM8960_LINVOL, 0x3<<7, 0x2<<7);