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