mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-30 07:56:45 +07:00
ASoC: AD1836: Fix setting the PCM format
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@kernel.org
This commit is contained in:
parent
fd137e2bba
commit
8ca695f273
@ -145,22 +145,22 @@ static int ad1836_hw_params(struct snd_pcm_substream *substream,
|
||||
/* bit size */
|
||||
switch (params_format(params)) {
|
||||
case SNDRV_PCM_FORMAT_S16_LE:
|
||||
word_len = 3;
|
||||
word_len = AD1836_WORD_LEN_16;
|
||||
break;
|
||||
case SNDRV_PCM_FORMAT_S20_3LE:
|
||||
word_len = 1;
|
||||
word_len = AD1836_WORD_LEN_20;
|
||||
break;
|
||||
case SNDRV_PCM_FORMAT_S24_LE:
|
||||
case SNDRV_PCM_FORMAT_S32_LE:
|
||||
word_len = 0;
|
||||
word_len = AD1836_WORD_LEN_24;
|
||||
break;
|
||||
}
|
||||
|
||||
snd_soc_update_bits(codec, AD1836_DAC_CTRL1,
|
||||
AD1836_DAC_WORD_LEN_MASK, word_len);
|
||||
snd_soc_update_bits(codec, AD1836_DAC_CTRL1, AD1836_DAC_WORD_LEN_MASK,
|
||||
word_len << AD1836_DAC_WORD_LEN_OFFSET);
|
||||
|
||||
snd_soc_update_bits(codec, AD1836_ADC_CTRL2,
|
||||
AD1836_ADC_WORD_LEN_MASK, word_len);
|
||||
snd_soc_update_bits(codec, AD1836_ADC_CTRL2, AD1836_ADC_WORD_LEN_MASK,
|
||||
word_len << AD1836_ADC_WORD_OFFSET);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#define AD1836_DAC_SERFMT_PCK256 (0x4 << 5)
|
||||
#define AD1836_DAC_SERFMT_PCK128 (0x5 << 5)
|
||||
#define AD1836_DAC_WORD_LEN_MASK 0x18
|
||||
#define AD1836_DAC_WORD_LEN_OFFSET 3
|
||||
|
||||
#define AD1836_DAC_CTRL2 1
|
||||
#define AD1836_DACL1_MUTE 0
|
||||
@ -51,6 +52,7 @@
|
||||
#define AD1836_ADCL2_MUTE 2
|
||||
#define AD1836_ADCR2_MUTE 3
|
||||
#define AD1836_ADC_WORD_LEN_MASK 0x30
|
||||
#define AD1836_ADC_WORD_OFFSET 5
|
||||
#define AD1836_ADC_SERFMT_MASK (7 << 6)
|
||||
#define AD1836_ADC_SERFMT_PCK256 (0x4 << 6)
|
||||
#define AD1836_ADC_SERFMT_PCK128 (0x5 << 6)
|
||||
@ -60,4 +62,8 @@
|
||||
|
||||
#define AD1836_NUM_REGS 16
|
||||
|
||||
#define AD1836_WORD_LEN_24 0x0
|
||||
#define AD1836_WORD_LEN_20 0x1
|
||||
#define AD1836_WORD_LEN_16 0x2
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user