Commit 16ddbe73 authored by Clément Guedez's avatar Clément Guedez Committed by Takashi Iwai

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: default avatarClément Guedez <klem.dev@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent f8a8b3a8
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/init.h> #include <linux/init.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/tlv.h>
#include "ice1712.h" #include "ice1712.h"
#include "envy24ht.h" #include "envy24ht.h"
...@@ -380,17 +381,25 @@ static int stac9460_mic_sw_put(struct snd_kcontrol *kcontrol, ...@@ -380,17 +381,25 @@ static int stac9460_mic_sw_put(struct snd_kcontrol *kcontrol,
return change; return change;
} }
/*Limits value in dB for fader*/
static const DECLARE_TLV_DB_SCALE(db_scale_dac, -19125, 75, 0);
static const DECLARE_TLV_DB_SCALE(db_scale_adc, 0, 150, 0);
/* /*
* Control tabs * Control tabs
*/ */
static struct snd_kcontrol_new stac9640_controls[] = { static struct snd_kcontrol_new stac9640_controls[] = {
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "Master Playback Switch", .name = "Master Playback Switch",
.info = stac9460_dac_mute_info, .info = stac9460_dac_mute_info,
.get = stac9460_dac_mute_get, .get = stac9460_dac_mute_get,
.put = stac9460_dac_mute_put, .put = stac9460_dac_mute_put,
.private_value = 1 .private_value = 1,
.tlv = { .p = db_scale_dac }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -419,11 +428,15 @@ static struct snd_kcontrol_new stac9640_controls[] = { ...@@ -419,11 +428,15 @@ static struct snd_kcontrol_new stac9640_controls[] = {
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "DAC Volume", .name = "DAC Volume",
.count = 8, .count = 8,
.info = stac9460_dac_vol_info, .info = stac9460_dac_vol_info,
.get = stac9460_dac_vol_get, .get = stac9460_dac_vol_get,
.put = stac9460_dac_vol_put, .put = stac9460_dac_vol_put,
.tlv = { .p = db_scale_dac }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -435,12 +448,15 @@ static struct snd_kcontrol_new stac9640_controls[] = { ...@@ -435,12 +448,15 @@ static struct snd_kcontrol_new stac9640_controls[] = {
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "ADC Volume", .name = "ADC Volume",
.count = 2, .count = 2,
.info = stac9460_adc_vol_info, .info = stac9460_adc_vol_info,
.get = stac9460_adc_vol_get, .get = stac9460_adc_vol_get,
.put = stac9460_adc_vol_put, .put = stac9460_adc_vol_put,
.tlv = { .p = db_scale_adc }
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment