aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/ad1836.c14
-rw-r--r--sound/soc/codecs/ad1836.h6
2 files changed, 13 insertions, 7 deletions
diff --git a/sound/soc/codecs/ad1836.c b/sound/soc/codecs/ad1836.c
index ab63d52e36e1..754c496412bd 100644
--- a/sound/soc/codecs/ad1836.c
+++ b/sound/soc/codecs/ad1836.c
@@ -145,22 +145,22 @@ static int ad1836_hw_params(struct snd_pcm_substream *substream,
145 /* bit size */ 145 /* bit size */
146 switch (params_format(params)) { 146 switch (params_format(params)) {
147 case SNDRV_PCM_FORMAT_S16_LE: 147 case SNDRV_PCM_FORMAT_S16_LE:
148 word_len = 3; 148 word_len = AD1836_WORD_LEN_16;
149 break; 149 break;
150 case SNDRV_PCM_FORMAT_S20_3LE: 150 case SNDRV_PCM_FORMAT_S20_3LE:
151 word_len = 1; 151 word_len = AD1836_WORD_LEN_20;
152 break; 152 break;
153 case SNDRV_PCM_FORMAT_S24_LE: 153 case SNDRV_PCM_FORMAT_S24_LE:
154 case SNDRV_PCM_FORMAT_S32_LE: 154 case SNDRV_PCM_FORMAT_S32_LE:
155 word_len = 0; 155 word_len = AD1836_WORD_LEN_24;
156 break; 156 break;
157 } 157 }
158 158
159 snd_soc_update_bits(codec, AD1836_DAC_CTRL1, 159 snd_soc_update_bits(codec, AD1836_DAC_CTRL1, AD1836_DAC_WORD_LEN_MASK,
160 AD1836_DAC_WORD_LEN_MASK, word_len); 160 word_len << AD1836_DAC_WORD_LEN_OFFSET);
161 161
162 snd_soc_update_bits(codec, AD1836_ADC_CTRL2, 162 snd_soc_update_bits(codec, AD1836_ADC_CTRL2, AD1836_ADC_WORD_LEN_MASK,
163 AD1836_ADC_WORD_LEN_MASK, word_len); 163 word_len << AD1836_ADC_WORD_OFFSET);
164 164
165 return 0; 165 return 0;
166} 166}
diff --git a/sound/soc/codecs/ad1836.h b/sound/soc/codecs/ad1836.h
index 845596717fdf..9d6a3f8f8aaf 100644
--- a/sound/soc/codecs/ad1836.h
+++ b/sound/soc/codecs/ad1836.h
@@ -25,6 +25,7 @@
25#define AD1836_DAC_SERFMT_PCK256 (0x4 << 5) 25#define AD1836_DAC_SERFMT_PCK256 (0x4 << 5)
26#define AD1836_DAC_SERFMT_PCK128 (0x5 << 5) 26#define AD1836_DAC_SERFMT_PCK128 (0x5 << 5)
27#define AD1836_DAC_WORD_LEN_MASK 0x18 27#define AD1836_DAC_WORD_LEN_MASK 0x18
28#define AD1836_DAC_WORD_LEN_OFFSET 3
28 29
29#define AD1836_DAC_CTRL2 1 30#define AD1836_DAC_CTRL2 1
30#define AD1836_DACL1_MUTE 0 31#define AD1836_DACL1_MUTE 0
@@ -51,6 +52,7 @@
51#define AD1836_ADCL2_MUTE 2 52#define AD1836_ADCL2_MUTE 2
52#define AD1836_ADCR2_MUTE 3 53#define AD1836_ADCR2_MUTE 3
53#define AD1836_ADC_WORD_LEN_MASK 0x30 54#define AD1836_ADC_WORD_LEN_MASK 0x30
55#define AD1836_ADC_WORD_OFFSET 5
54#define AD1836_ADC_SERFMT_MASK (7 << 6) 56#define AD1836_ADC_SERFMT_MASK (7 << 6)
55#define AD1836_ADC_SERFMT_PCK256 (0x4 << 6) 57#define AD1836_ADC_SERFMT_PCK256 (0x4 << 6)
56#define AD1836_ADC_SERFMT_PCK128 (0x5 << 6) 58#define AD1836_ADC_SERFMT_PCK128 (0x5 << 6)
@@ -60,4 +62,8 @@
60 62
61#define AD1836_NUM_REGS 16 63#define AD1836_NUM_REGS 16
62 64
65#define AD1836_WORD_LEN_24 0x0
66#define AD1836_WORD_LEN_20 0x1
67#define AD1836_WORD_LEN_16 0x2
68
63#endif 69#endif