aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorClément Guedez <klem.dev@gmail.com>2015-03-17 21:26:29 -0400
committerTakashi Iwai <tiwai@suse.de>2015-03-18 03:05:48 -0400
commit16ddbe738a5bd2afe80aa10492f762f34b09cbf0 (patch)
tree2c0201a62b15f7645f04035589b6b343346bd166 /sound/pci
parentf8a8b3a835ef9e5f94163c9dc62fc2e2e375b10c (diff)
ALSA: ice1724: ESI W192M: Add TLV support for control value in dB scale
Add TLV support to control volume using dB scale for input and ouput on ESI W192M. Signed-off-by: Clément Guedez <klem.dev@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/ice1712/wtm.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/sound/pci/ice1712/wtm.c b/sound/pci/ice1712/wtm.c
index 59483b4d6dd0..c7ffafaa1c5c 100644
--- a/sound/pci/ice1712/wtm.c
+++ b/sound/pci/ice1712/wtm.c
@@ -29,6 +29,7 @@
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/init.h> 30#include <linux/init.h>
31#include <sound/core.h> 31#include <sound/core.h>
32#include <sound/tlv.h>
32 33
33#include "ice1712.h" 34#include "ice1712.h"
34#include "envy24ht.h" 35#include "envy24ht.h"
@@ -380,17 +381,25 @@ static int stac9460_mic_sw_put(struct snd_kcontrol *kcontrol,
380 return change; 381 return change;
381} 382}
382 383
384
385/*Limits value in dB for fader*/
386static const DECLARE_TLV_DB_SCALE(db_scale_dac, -19125, 75, 0);
387static const DECLARE_TLV_DB_SCALE(db_scale_adc, 0, 150, 0);
388
383/* 389/*
384 * Control tabs 390 * Control tabs
385 */ 391 */
386static struct snd_kcontrol_new stac9640_controls[] = { 392static struct snd_kcontrol_new stac9640_controls[] = {
387 { 393 {
388 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 394 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
395 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
396 SNDRV_CTL_ELEM_ACCESS_TLV_READ),
389 .name = "Master Playback Switch", 397 .name = "Master Playback Switch",
390 .info = stac9460_dac_mute_info, 398 .info = stac9460_dac_mute_info,
391 .get = stac9460_dac_mute_get, 399 .get = stac9460_dac_mute_get,
392 .put = stac9460_dac_mute_put, 400 .put = stac9460_dac_mute_put,
393 .private_value = 1 401 .private_value = 1,
402 .tlv = { .p = db_scale_dac }
394 }, 403 },
395 { 404 {
396 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 405 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -419,11 +428,15 @@ static struct snd_kcontrol_new stac9640_controls[] = {
419 }, 428 },
420 { 429 {
421 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 430 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
431 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
432 SNDRV_CTL_ELEM_ACCESS_TLV_READ),
433
422 .name = "DAC Volume", 434 .name = "DAC Volume",
423 .count = 8, 435 .count = 8,
424 .info = stac9460_dac_vol_info, 436 .info = stac9460_dac_vol_info,
425 .get = stac9460_dac_vol_get, 437 .get = stac9460_dac_vol_get,
426 .put = stac9460_dac_vol_put, 438 .put = stac9460_dac_vol_put,
439 .tlv = { .p = db_scale_dac }
427 }, 440 },
428 { 441 {
429 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 442 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -435,12 +448,15 @@ static struct snd_kcontrol_new stac9640_controls[] = {
435 }, 448 },
436 { 449 {
437 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 450 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
451 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
452 SNDRV_CTL_ELEM_ACCESS_TLV_READ),
453
438 .name = "ADC Volume", 454 .name = "ADC Volume",
439 .count = 2, 455 .count = 2,
440 .info = stac9460_adc_vol_info, 456 .info = stac9460_adc_vol_info,
441 .get = stac9460_adc_vol_get, 457 .get = stac9460_adc_vol_get,
442 .put = stac9460_adc_vol_put, 458 .put = stac9460_adc_vol_put,
443 459 .tlv = { .p = db_scale_adc }
444 } 460 }
445}; 461};
446 462