ALSA: ASoC: tlv320aic3x add dsp_a
Subsystems (3)
PATCH 1/4 ALSA: ASoC: tlv320aic3x add dsp_a
Add SND_SOC_DAIFMT_DSP_A mode option.
Signed-off-by Troy Kisky <[email protected]>
sound/soc/codecs/tlv320aic3x.c +4 -0
@@ -847,6 +847,7 @@ static int aic3x_set_dai_fmt(struct snd_soc_dai *codec_dai,struct snd_soc_codec *codec = codec_dai->codec;struct aic3x_priv *aic3x = codec->private_data;u8 iface_areg, iface_breg; +int delay =0 ; iface_areg =aic3x_read_reg_cache (codec,AIC3X_ASD_INTF_CTRLA ) &0x3f ; iface_breg =aic3x_read_reg_cache (codec,AIC3X_ASD_INTF_CTRLB ) &0x3f ;
@@ -872,6 +873,8 @@ static int aic3x_set_dai_fmt(struct snd_soc_dai *codec_dai, SND_SOC_DAIFMT_INV_MASK)) {case (SND_SOC_DAIFMT_I2S |SND_SOC_DAIFMT_NB_NF ):break ; +case (SND_SOC_DAIFMT_DSP_A |SND_SOC_DAIFMT_IB_NF ): + delay =1 ;case (SND_SOC_DAIFMT_DSP_B |SND_SOC_DAIFMT_IB_NF ): iface_breg |= (0x01 <<6 );break ;
@@ -888,6 +891,7 @@ static int aic3x_set_dai_fmt(struct snd_soc_dai *codec_dai,/* set iface */ aic3x_write (codec,AIC3X_ASD_INTF_CTRLA , iface_areg);aic3x_write (codec,AIC3X_ASD_INTF_CTRLB , iface_breg); +aic3x_write (codec,AIC3X_ASD_INTF_CTRLC , delay);return 0 ; }
sound/soc/codecs/tlv320aic3x.h +2 -0
@@ -35,6 +35,8 @@#define AIC3X_ASD_INTF_CTRLA 8/* Audio serial data interface control register B */ #define AIC3X_ASD_INTF_CTRLB 9 +/* Audio serial data interface control register C */ +#define AIC3X_ASD_INTF_CTRLC 10/* Audio overflow status and PLL R value programming register */ #define AIC3X_OVRF_STATUS_AND_PLLR_REG 11/* Audio codec digital filter control register */
Signature · 1 line
1.5.4.3
PATCH 2/4 ALSA: ASoC: DaVinci: i2s, evm, pass same value to codec and cpu_dai
Fix the meaning of SND_SOC_DAIFMT_NB_NF to match that used in the codec.
Signed-off-by Troy Kisky <[email protected]>
sound/soc/davinci/davinci-evm.c +4 -6
@@ -28,6 +28,8 @@#define EVM_CODEC_CLOCK 22579200 +#define AUDIO_FORMAT (SND_SOC_DAIFMT_I2S | \ + SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_NB_NF)static int evm_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params) {
@@ -37,16 +39,12 @@ static int evm_hw_params(struct snd_pcm_substream *substream,int ret =0 ;/* set codec DAI configuration */ - ret =snd_soc_dai_set_fmt (codec_dai,SND_SOC_DAIFMT_I2S | -SND_SOC_DAIFMT_CBM_CFM | -SND_SOC_DAIFMT_NB_NF ); + ret =snd_soc_dai_set_fmt (codec_dai,AUDIO_FORMAT );if (ret <0 )return ret;/* set cpu DAI configuration */ - ret =snd_soc_dai_set_fmt (cpu_dai,SND_SOC_DAIFMT_I2S | -SND_SOC_DAIFMT_CBM_CFM | -SND_SOC_DAIFMT_IB_NF ); + ret =snd_soc_dai_set_fmt (cpu_dai,AUDIO_FORMAT );if (ret <0 )return ret;
sound/soc/davinci/davinci-i2s.c +4 -4
@@ -254,7 +254,7 @@ static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, }switch (fmt &SND_SOC_DAIFMT_INV_MASK ) { -case SND_SOC_DAIFMT_IB_NF : +case SND_SOC_DAIFMT_NB_NF :/* CLKRP Receive clock polarity, * 1 - sampled on rising edge of CLKR * valid on rising edge
@@ -266,7 +266,7 @@ static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,*/ pcr |= (DAVINCI_MCBSP_PCR_CLKXP |DAVINCI_MCBSP_PCR_CLKRP );break ; -case SND_SOC_DAIFMT_NB_IF : +case SND_SOC_DAIFMT_IB_IF :/* CLKRP Receive clock polarity, * 0 - sampled on falling edge of CLKR * valid on falling edge
@@ -278,7 +278,7 @@ static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,*/ pcr |= (DAVINCI_MCBSP_PCR_FSXP |DAVINCI_MCBSP_PCR_FSRP );break ; -case SND_SOC_DAIFMT_IB_IF : +case SND_SOC_DAIFMT_NB_IF :/* CLKRP Receive clock polarity, * 1 - sampled on rising edge of CLKR * valid on rising edge
@@ -291,7 +291,7 @@ static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, pcr |= (DAVINCI_MCBSP_PCR_CLKXP |DAVINCI_MCBSP_PCR_CLKRP |DAVINCI_MCBSP_PCR_FSXP |DAVINCI_MCBSP_PCR_FSRP );break ; -case SND_SOC_DAIFMT_NB_NF : +case SND_SOC_DAIFMT_IB_NF :/* CLKRP Receive clock polarity, * 0 - sampled on falling edge of CLKR * valid on falling edge
Signature · 1 line
1.5.4.3
PATCH 3/4 ALSA: ASoC: DaVinci: document I2S limitations
DaVinci does not support true I2S or right justified mode so not all I2S codecs will work with it when the codec is master. Document this limitation.
Add dsp_a, dsp_b mode options
Signed-off-by Troy Kisky <[email protected]>
sound/soc/davinci/davinci-i2s.c +19 -2
@@ -241,10 +241,27 @@ static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, rcr =DAVINCI_MCBSP_RCR_RFRLEN1 (1 ); xcr =DAVINCI_MCBSP_XCR_XFIG |DAVINCI_MCBSP_XCR_XFRLEN1 (1 );switch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) { -case SND_SOC_DAIFMT_RIGHT_J : +case SND_SOC_DAIFMT_DSP_B :break ;case SND_SOC_DAIFMT_I2S : -case SND_SOC_DAIFMT_DSP_B : +/* Davinci doesn't support TRUE I2S, but some codecs will have +* the left and right channels contiguous. This allows +* dsp_a mode to be used with an inverted normal frame clk. +* If your codec is master and does not have contiguous +* channels, then you will have sound on only one channel. +* Try using a different mode, or codec as slave. +* +* The TLV320AIC33 is an example of a codec where this works. +* It has a variable bit clock frequency allowing it to have +* valid data on every bit clock. +* +* The TLV320AIC23 is an example of a codec where this does not +* work. It has a fixed bit clock frequency with progressively +* more empty bit clock slots between channels as the sample +* rate is lowered. +*/ + fmt ^=SND_SOC_DAIFMT_NB_IF ; +case SND_SOC_DAIFMT_DSP_A : rcr |=DAVINCI_MCBSP_RCR_RDATDLY (1 ); xcr |=DAVINCI_MCBSP_XCR_XDATDLY (1 );break ;
Signature · 1 line
1.5.4.3
PATCH 4/4 ALSA: ASoc: DaVinci: davinci-evm use dsp_b mode
Sense DaVinci does not support true I2S mode and we don't have to use the hack, use dsp_b mode instead
Signed-off-by Troy Kisky <[email protected]>
sound/soc/davinci/davinci-evm.c +2 -2
@@ -28,8 +28,8 @@#define EVM_CODEC_CLOCK 22579200 -#define AUDIO_FORMAT (SND_SOC_DAIFMT_I2S | \ - SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_NB_NF) +#define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \ + SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF)static int evm_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params) {
Signature · 1 line
1.5.4.3
Mark Brown
AppliedQuoted 3 lines · Troy Kisky
Add
SND_SOC_DAIFMT_DSP_Amode option.Signed-off-by Troy Kisky <[email protected]>
Applied, thanks.