diff options
Diffstat (limited to 'sound/soc/codecs/wm8753.c')
-rw-r--r-- | sound/soc/codecs/wm8753.c | 75 |
1 files changed, 50 insertions, 25 deletions
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index 285c5eaefe02..00b481183d45 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c | |||
@@ -260,28 +260,50 @@ static int wm8753_set_dai(struct snd_kcontrol *kcontrol, | |||
260 | return 1; | 260 | return 1; |
261 | } | 261 | } |
262 | 262 | ||
263 | static const DECLARE_TLV_DB_LINEAR(rec_mix_tlv, -1500, 600); | 263 | static const DECLARE_TLV_DB_SCALE(rec_mix_tlv, -1500, 300, 0); |
264 | static const DECLARE_TLV_DB_SCALE(mic_preamp_tlv, 1200, 600, 0); | ||
265 | static const DECLARE_TLV_DB_SCALE(adc_tlv, -9750, 50, 1); | ||
266 | static const DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1); | ||
267 | static const unsigned int out_tlv[] = { | ||
268 | TLV_DB_RANGE_HEAD(2), | ||
269 | /* 0000000 - 0101111 = "Analogue mute" */ | ||
270 | 0, 48, TLV_DB_SCALE_ITEM(-25500, 0, 0), | ||
271 | 48, 127, TLV_DB_SCALE_ITEM(-7300, 100, 0), | ||
272 | }; | ||
273 | static const DECLARE_TLV_DB_SCALE(mix_tlv, -1500, 300, 0); | ||
274 | static const DECLARE_TLV_DB_SCALE(voice_mix_tlv, -1200, 300, 0); | ||
275 | static const DECLARE_TLV_DB_SCALE(pga_tlv, -1725, 75, 0); | ||
264 | 276 | ||
265 | static const struct snd_kcontrol_new wm8753_snd_controls[] = { | 277 | static const struct snd_kcontrol_new wm8753_snd_controls[] = { |
266 | SOC_DOUBLE_R("PCM Volume", WM8753_LDAC, WM8753_RDAC, 0, 255, 0), | 278 | SOC_DOUBLE_R_TLV("PCM Volume", WM8753_LDAC, WM8753_RDAC, 0, 255, 0, dac_tlv), |
267 | 279 | ||
268 | SOC_DOUBLE_R("ADC Capture Volume", WM8753_LADC, WM8753_RADC, 0, 255, 0), | 280 | SOC_DOUBLE_R_TLV("ADC Capture Volume", WM8753_LADC, WM8753_RADC, 0, 255, 0, |
269 | 281 | adc_tlv), | |
270 | SOC_DOUBLE_R("Headphone Playback Volume", WM8753_LOUT1V, WM8753_ROUT1V, 0, 127, 0), | 282 | |
271 | SOC_DOUBLE_R("Speaker Playback Volume", WM8753_LOUT2V, WM8753_ROUT2V, 0, 127, 0), | 283 | SOC_DOUBLE_R_TLV("Headphone Playback Volume", WM8753_LOUT1V, WM8753_ROUT1V, |
272 | 284 | 0, 127, 0, out_tlv), | |
273 | SOC_SINGLE("Mono Playback Volume", WM8753_MOUTV, 0, 127, 0), | 285 | SOC_DOUBLE_R_TLV("Speaker Playback Volume", WM8753_LOUT2V, WM8753_ROUT2V, 0, |
274 | 286 | 127, 0, out_tlv), | |
275 | SOC_DOUBLE_R("Bypass Playback Volume", WM8753_LOUTM1, WM8753_ROUTM1, 4, 7, 1), | 287 | |
276 | SOC_DOUBLE_R("Sidetone Playback Volume", WM8753_LOUTM2, WM8753_ROUTM2, 4, 7, 1), | 288 | SOC_SINGLE_TLV("Mono Playback Volume", WM8753_MOUTV, 0, 127, 0, out_tlv), |
277 | SOC_DOUBLE_R("Voice Playback Volume", WM8753_LOUTM2, WM8753_ROUTM2, 0, 7, 1), | 289 | |
278 | 290 | SOC_DOUBLE_R_TLV("Bypass Playback Volume", WM8753_LOUTM1, WM8753_ROUTM1, 4, 7, | |
279 | SOC_DOUBLE_R("Headphone Playback ZC Switch", WM8753_LOUT1V, WM8753_ROUT1V, 7, 1, 0), | 291 | 1, mix_tlv), |
280 | SOC_DOUBLE_R("Speaker Playback ZC Switch", WM8753_LOUT2V, WM8753_ROUT2V, 7, 1, 0), | 292 | SOC_DOUBLE_R_TLV("Sidetone Playback Volume", WM8753_LOUTM2, WM8753_ROUTM2, 4, |
281 | 293 | 7, 1, mix_tlv), | |
282 | SOC_SINGLE("Mono Bypass Playback Volume", WM8753_MOUTM1, 4, 7, 1), | 294 | SOC_DOUBLE_R_TLV("Voice Playback Volume", WM8753_LOUTM2, WM8753_ROUTM2, 0, 7, |
283 | SOC_SINGLE("Mono Sidetone Playback Volume", WM8753_MOUTM2, 4, 7, 1), | 295 | 1, voice_mix_tlv), |
284 | SOC_SINGLE("Mono Voice Playback Volume", WM8753_MOUTM2, 0, 7, 1), | 296 | |
297 | SOC_DOUBLE_R("Headphone Playback ZC Switch", WM8753_LOUT1V, WM8753_ROUT1V, 7, | ||
298 | 1, 0), | ||
299 | SOC_DOUBLE_R("Speaker Playback ZC Switch", WM8753_LOUT2V, WM8753_ROUT2V, 7, | ||
300 | 1, 0), | ||
301 | |||
302 | SOC_SINGLE_TLV("Mono Bypass Playback Volume", WM8753_MOUTM1, 4, 7, 1, mix_tlv), | ||
303 | SOC_SINGLE_TLV("Mono Sidetone Playback Volume", WM8753_MOUTM2, 4, 7, 1, | ||
304 | mix_tlv), | ||
305 | SOC_SINGLE_TLV("Mono Voice Playback Volume", WM8753_MOUTM2, 0, 7, 1, | ||
306 | voice_mix_tlv), | ||
285 | SOC_SINGLE("Mono Playback ZC Switch", WM8753_MOUTV, 7, 1, 0), | 307 | SOC_SINGLE("Mono Playback ZC Switch", WM8753_MOUTV, 7, 1, 0), |
286 | 308 | ||
287 | SOC_ENUM("Bass Boost", wm8753_enum[0]), | 309 | SOC_ENUM("Bass Boost", wm8753_enum[0]), |
@@ -291,10 +313,13 @@ SOC_SINGLE("Bass Volume", WM8753_BASS, 0, 15, 1), | |||
291 | SOC_SINGLE("Treble Volume", WM8753_TREBLE, 0, 15, 1), | 313 | SOC_SINGLE("Treble Volume", WM8753_TREBLE, 0, 15, 1), |
292 | SOC_ENUM("Treble Cut-off", wm8753_enum[2]), | 314 | SOC_ENUM("Treble Cut-off", wm8753_enum[2]), |
293 | 315 | ||
294 | SOC_DOUBLE_TLV("Sidetone Capture Volume", WM8753_RECMIX1, 0, 4, 7, 1, rec_mix_tlv), | 316 | SOC_DOUBLE_TLV("Sidetone Capture Volume", WM8753_RECMIX1, 0, 4, 7, 1, |
295 | SOC_SINGLE_TLV("Voice Sidetone Capture Volume", WM8753_RECMIX2, 0, 7, 1, rec_mix_tlv), | 317 | rec_mix_tlv), |
318 | SOC_SINGLE_TLV("Voice Sidetone Capture Volume", WM8753_RECMIX2, 0, 7, 1, | ||
319 | rec_mix_tlv), | ||
296 | 320 | ||
297 | SOC_DOUBLE_R("Capture Volume", WM8753_LINVOL, WM8753_RINVOL, 0, 63, 0), | 321 | SOC_DOUBLE_R_TLV("Capture Volume", WM8753_LINVOL, WM8753_RINVOL, 0, 63, 0, |
322 | pga_tlv), | ||
298 | SOC_DOUBLE_R("Capture ZC Switch", WM8753_LINVOL, WM8753_RINVOL, 6, 1, 0), | 323 | SOC_DOUBLE_R("Capture ZC Switch", WM8753_LINVOL, WM8753_RINVOL, 6, 1, 0), |
299 | SOC_DOUBLE_R("Capture Switch", WM8753_LINVOL, WM8753_RINVOL, 7, 1, 1), | 324 | SOC_DOUBLE_R("Capture Switch", WM8753_LINVOL, WM8753_RINVOL, 7, 1, 1), |
300 | 325 | ||
@@ -326,8 +351,8 @@ SOC_ENUM("De-emphasis", wm8753_enum[8]), | |||
326 | SOC_ENUM("Playback Mono Mix", wm8753_enum[9]), | 351 | SOC_ENUM("Playback Mono Mix", wm8753_enum[9]), |
327 | SOC_ENUM("Playback Phase", wm8753_enum[10]), | 352 | SOC_ENUM("Playback Phase", wm8753_enum[10]), |
328 | 353 | ||
329 | SOC_SINGLE("Mic2 Capture Volume", WM8753_INCTL1, 7, 3, 0), | 354 | SOC_SINGLE_TLV("Mic2 Capture Volume", WM8753_INCTL1, 7, 3, 0, mic_preamp_tlv), |
330 | SOC_SINGLE("Mic1 Capture Volume", WM8753_INCTL1, 5, 3, 0), | 355 | SOC_SINGLE_TLV("Mic1 Capture Volume", WM8753_INCTL1, 5, 3, 0, mic_preamp_tlv), |
331 | 356 | ||
332 | SOC_ENUM_EXT("DAI Mode", wm8753_enum[26], wm8753_get_dai, wm8753_set_dai), | 357 | SOC_ENUM_EXT("DAI Mode", wm8753_enum[26], wm8753_get_dai, wm8753_set_dai), |
333 | 358 | ||