Commit f640c320 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] Add dB scale information to ice1724 driver

Added the dB scale information to each board support code of ice1724 driver.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent 680ef792
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#include "ice1712.h" #include "ice1712.h"
#include "envy24ht.h" #include "envy24ht.h"
#include "aureon.h" #include "aureon.h"
#include <sound/tlv.h>
/* WM8770 registers */ /* WM8770 registers */
#define WM_DAC_ATTEN 0x00 /* DAC1-8 analog attenuation */ #define WM_DAC_ATTEN 0x00 /* DAC1-8 analog attenuation */
...@@ -660,6 +661,12 @@ static int aureon_ac97_mmute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e ...@@ -660,6 +661,12 @@ static int aureon_ac97_mmute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
return change; return change;
} }
static DECLARE_TLV_DB_SCALE(db_scale_wm_dac, -12700, 100, 1);
static DECLARE_TLV_DB_SCALE(db_scale_wm_pcm, -6400, 50, 1);
static DECLARE_TLV_DB_SCALE(db_scale_wm_adc, -1200, 100, 0);
static DECLARE_TLV_DB_SCALE(db_scale_ac97_master, -4650, 150, 0);
static DECLARE_TLV_DB_SCALE(db_scale_ac97_gain, -3450, 150, 0);
/* /*
* Logarithmic volume values for WM8770 * Logarithmic volume values for WM8770
* Computed as 20 * Log10(255 / x) * Computed as 20 * Log10(255 / x)
...@@ -1409,10 +1416,13 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = { ...@@ -1409,10 +1416,13 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = {
}, },
{ {
.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 Volume", .name = "Master Playback Volume",
.info = wm_master_vol_info, .info = wm_master_vol_info,
.get = wm_master_vol_get, .get = wm_master_vol_get,
.put = wm_master_vol_put .put = wm_master_vol_put,
.tlv = { .p = db_scale_wm_dac }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -1424,11 +1434,14 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = { ...@@ -1424,11 +1434,14 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = {
}, },
{ {
.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 = "Front Playback Volume", .name = "Front Playback Volume",
.info = wm_vol_info, .info = wm_vol_info,
.get = wm_vol_get, .get = wm_vol_get,
.put = wm_vol_put, .put = wm_vol_put,
.private_value = (2 << 8) | 0 .private_value = (2 << 8) | 0,
.tlv = { .p = db_scale_wm_dac }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -1440,11 +1453,14 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = { ...@@ -1440,11 +1453,14 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = {
}, },
{ {
.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 = "Rear Playback Volume", .name = "Rear Playback Volume",
.info = wm_vol_info, .info = wm_vol_info,
.get = wm_vol_get, .get = wm_vol_get,
.put = wm_vol_put, .put = wm_vol_put,
.private_value = (2 << 8) | 2 .private_value = (2 << 8) | 2,
.tlv = { .p = db_scale_wm_dac }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -1456,11 +1472,14 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = { ...@@ -1456,11 +1472,14 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = {
}, },
{ {
.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 = "Center Playback Volume", .name = "Center Playback Volume",
.info = wm_vol_info, .info = wm_vol_info,
.get = wm_vol_get, .get = wm_vol_get,
.put = wm_vol_put, .put = wm_vol_put,
.private_value = (1 << 8) | 4 .private_value = (1 << 8) | 4,
.tlv = { .p = db_scale_wm_dac }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -1472,11 +1491,14 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = { ...@@ -1472,11 +1491,14 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = {
}, },
{ {
.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 = "LFE Playback Volume", .name = "LFE Playback Volume",
.info = wm_vol_info, .info = wm_vol_info,
.get = wm_vol_get, .get = wm_vol_get,
.put = wm_vol_put, .put = wm_vol_put,
.private_value = (1 << 8) | 5 .private_value = (1 << 8) | 5,
.tlv = { .p = db_scale_wm_dac }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -1488,11 +1510,14 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = { ...@@ -1488,11 +1510,14 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = {
}, },
{ {
.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 = "Side Playback Volume", .name = "Side Playback Volume",
.info = wm_vol_info, .info = wm_vol_info,
.get = wm_vol_get, .get = wm_vol_get,
.put = wm_vol_put, .put = wm_vol_put,
.private_value = (2 << 8) | 6 .private_value = (2 << 8) | 6,
.tlv = { .p = db_scale_wm_dac }
} }
}; };
...@@ -1506,10 +1531,13 @@ static struct snd_kcontrol_new wm_controls[] __devinitdata = { ...@@ -1506,10 +1531,13 @@ static struct snd_kcontrol_new wm_controls[] __devinitdata = {
}, },
{ {
.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 = "PCM Playback Volume", .name = "PCM Playback Volume",
.info = wm_pcm_vol_info, .info = wm_pcm_vol_info,
.get = wm_pcm_vol_get, .get = wm_pcm_vol_get,
.put = wm_pcm_vol_put .put = wm_pcm_vol_put,
.tlv = { .p = db_scale_wm_pcm }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -1520,10 +1548,13 @@ static struct snd_kcontrol_new wm_controls[] __devinitdata = { ...@@ -1520,10 +1548,13 @@ static struct snd_kcontrol_new wm_controls[] __devinitdata = {
}, },
{ {
.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 = "Capture Volume", .name = "Capture Volume",
.info = wm_adc_vol_info, .info = wm_adc_vol_info,
.get = wm_adc_vol_get, .get = wm_adc_vol_get,
.put = wm_adc_vol_put .put = wm_adc_vol_put,
.tlv = { .p = db_scale_wm_adc }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -1567,11 +1598,14 @@ static struct snd_kcontrol_new ac97_controls[] __devinitdata = { ...@@ -1567,11 +1598,14 @@ static struct snd_kcontrol_new ac97_controls[] __devinitdata = {
}, },
{ {
.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 = "AC97 Playback Volume", .name = "AC97 Playback Volume",
.info = aureon_ac97_vol_info, .info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get, .get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put, .put = aureon_ac97_vol_put,
.private_value = AC97_MASTER|AUREON_AC97_STEREO .private_value = AC97_MASTER|AUREON_AC97_STEREO,
.tlv = { .p = db_scale_ac97_master }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -1583,11 +1617,14 @@ static struct snd_kcontrol_new ac97_controls[] __devinitdata = { ...@@ -1583,11 +1617,14 @@ static struct snd_kcontrol_new ac97_controls[] __devinitdata = {
}, },
{ {
.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 = "CD Playback Volume", .name = "CD Playback Volume",
.info = aureon_ac97_vol_info, .info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get, .get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put, .put = aureon_ac97_vol_put,
.private_value = AC97_CD|AUREON_AC97_STEREO .private_value = AC97_CD|AUREON_AC97_STEREO,
.tlv = { .p = db_scale_ac97_gain }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -1599,11 +1636,14 @@ static struct snd_kcontrol_new ac97_controls[] __devinitdata = { ...@@ -1599,11 +1636,14 @@ static struct snd_kcontrol_new ac97_controls[] __devinitdata = {
}, },
{ {
.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 = "Aux Playback Volume", .name = "Aux Playback Volume",
.info = aureon_ac97_vol_info, .info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get, .get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put, .put = aureon_ac97_vol_put,
.private_value = AC97_AUX|AUREON_AC97_STEREO .private_value = AC97_AUX|AUREON_AC97_STEREO,
.tlv = { .p = db_scale_ac97_gain }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -1615,11 +1655,14 @@ static struct snd_kcontrol_new ac97_controls[] __devinitdata = { ...@@ -1615,11 +1655,14 @@ static struct snd_kcontrol_new ac97_controls[] __devinitdata = {
}, },
{ {
.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 = "Line Playback Volume", .name = "Line Playback Volume",
.info = aureon_ac97_vol_info, .info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get, .get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put, .put = aureon_ac97_vol_put,
.private_value = AC97_LINE|AUREON_AC97_STEREO .private_value = AC97_LINE|AUREON_AC97_STEREO,
.tlv = { .p = db_scale_ac97_gain }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -1631,11 +1674,14 @@ static struct snd_kcontrol_new ac97_controls[] __devinitdata = { ...@@ -1631,11 +1674,14 @@ static struct snd_kcontrol_new ac97_controls[] __devinitdata = {
}, },
{ {
.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 = "Mic Playback Volume", .name = "Mic Playback Volume",
.info = aureon_ac97_vol_info, .info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get, .get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put, .put = aureon_ac97_vol_put,
.private_value = AC97_MIC .private_value = AC97_MIC,
.tlv = { .p = db_scale_ac97_gain }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -1657,11 +1703,14 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = { ...@@ -1657,11 +1703,14 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = {
}, },
{ {
.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 = "AC97 Playback Volume", .name = "AC97 Playback Volume",
.info = aureon_ac97_vol_info, .info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get, .get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put, .put = aureon_ac97_vol_put,
.private_value = AC97_MASTER|AUREON_AC97_STEREO .private_value = AC97_MASTER|AUREON_AC97_STEREO,
.tlv = { .p = db_scale_ac97_master }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -1673,11 +1722,14 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = { ...@@ -1673,11 +1722,14 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = {
}, },
{ {
.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 = "CD Playback Volume", .name = "CD Playback Volume",
.info = aureon_ac97_vol_info, .info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get, .get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put, .put = aureon_ac97_vol_put,
.private_value = AC97_AUX|AUREON_AC97_STEREO .private_value = AC97_AUX|AUREON_AC97_STEREO,
.tlv = { .p = db_scale_ac97_gain }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -1685,15 +1737,18 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = { ...@@ -1685,15 +1737,18 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = {
.info = aureon_ac97_mute_info, .info = aureon_ac97_mute_info,
.get = aureon_ac97_mute_get, .get = aureon_ac97_mute_get,
.put = aureon_ac97_mute_put, .put = aureon_ac97_mute_put,
.private_value = AC97_CD, .private_value = AC97_CD
}, },
{ {
.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 = "Phono Playback Volume", .name = "Phono Playback Volume",
.info = aureon_ac97_vol_info, .info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get, .get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put, .put = aureon_ac97_vol_put,
.private_value = AC97_CD|AUREON_AC97_STEREO .private_value = AC97_CD|AUREON_AC97_STEREO,
.tlv = { .p = db_scale_ac97_gain }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -1705,11 +1760,14 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = { ...@@ -1705,11 +1760,14 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = {
}, },
{ {
.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 = "Line Playback Volume", .name = "Line Playback Volume",
.info = aureon_ac97_vol_info, .info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get, .get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put, .put = aureon_ac97_vol_put,
.private_value = AC97_LINE|AUREON_AC97_STEREO .private_value = AC97_LINE|AUREON_AC97_STEREO,
.tlv = { .p = db_scale_ac97_gain }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -1721,11 +1779,14 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = { ...@@ -1721,11 +1779,14 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = {
}, },
{ {
.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 = "Mic Playback Volume", .name = "Mic Playback Volume",
.info = aureon_ac97_vol_info, .info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get, .get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put, .put = aureon_ac97_vol_put,
.private_value = AC97_MIC .private_value = AC97_MIC,
.tlv = { .p = db_scale_ac97_gain }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -1744,11 +1805,14 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = { ...@@ -1744,11 +1805,14 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = {
}, },
{ {
.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 = "Aux Playback Volume", .name = "Aux Playback Volume",
.info = aureon_ac97_vol_info, .info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get, .get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put, .put = aureon_ac97_vol_put,
.private_value = AC97_VIDEO|AUREON_AC97_STEREO .private_value = AC97_VIDEO|AUREON_AC97_STEREO,
.tlv = { .p = db_scale_ac97_gain }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include "ice1712.h" #include "ice1712.h"
#include "envy24ht.h" #include "envy24ht.h"
#include "phase.h" #include "phase.h"
#include <sound/tlv.h>
/* WM8770 registers */ /* WM8770 registers */
#define WM_DAC_ATTEN 0x00 /* DAC1-8 analog attenuation */ #define WM_DAC_ATTEN 0x00 /* DAC1-8 analog attenuation */
...@@ -696,6 +697,9 @@ static int phase28_oversampling_put(struct snd_kcontrol *kcontrol, struct snd_ct ...@@ -696,6 +697,9 @@ static int phase28_oversampling_put(struct snd_kcontrol *kcontrol, struct snd_ct
return 0; return 0;
} }
static DECLARE_TLV_DB_SCALE(db_scale_wm_dac, -12700, 100, 1);
static DECLARE_TLV_DB_SCALE(db_scale_wm_pcm, -6400, 50, 1);
static struct snd_kcontrol_new phase28_dac_controls[] __devinitdata = { static struct snd_kcontrol_new phase28_dac_controls[] __devinitdata = {
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -706,10 +710,13 @@ static struct snd_kcontrol_new phase28_dac_controls[] __devinitdata = { ...@@ -706,10 +710,13 @@ static struct snd_kcontrol_new phase28_dac_controls[] __devinitdata = {
}, },
{ {
.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 Volume", .name = "Master Playback Volume",
.info = wm_master_vol_info, .info = wm_master_vol_info,
.get = wm_master_vol_get, .get = wm_master_vol_get,
.put = wm_master_vol_put .put = wm_master_vol_put,
.tlv = { .p = db_scale_wm_dac }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -721,11 +728,14 @@ static struct snd_kcontrol_new phase28_dac_controls[] __devinitdata = { ...@@ -721,11 +728,14 @@ static struct snd_kcontrol_new phase28_dac_controls[] __devinitdata = {
}, },
{ {
.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 = "Front Playback Volume", .name = "Front Playback Volume",
.info = wm_vol_info, .info = wm_vol_info,
.get = wm_vol_get, .get = wm_vol_get,
.put = wm_vol_put, .put = wm_vol_put,
.private_value = (2 << 8) | 0 .private_value = (2 << 8) | 0,
.tlv = { .p = db_scale_wm_dac }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -737,11 +747,14 @@ static struct snd_kcontrol_new phase28_dac_controls[] __devinitdata = { ...@@ -737,11 +747,14 @@ static struct snd_kcontrol_new phase28_dac_controls[] __devinitdata = {
}, },
{ {
.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 = "Rear Playback Volume", .name = "Rear Playback Volume",
.info = wm_vol_info, .info = wm_vol_info,
.get = wm_vol_get, .get = wm_vol_get,
.put = wm_vol_put, .put = wm_vol_put,
.private_value = (2 << 8) | 2 .private_value = (2 << 8) | 2,
.tlv = { .p = db_scale_wm_dac }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -753,11 +766,14 @@ static struct snd_kcontrol_new phase28_dac_controls[] __devinitdata = { ...@@ -753,11 +766,14 @@ static struct snd_kcontrol_new phase28_dac_controls[] __devinitdata = {
}, },
{ {
.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 = "Center Playback Volume", .name = "Center Playback Volume",
.info = wm_vol_info, .info = wm_vol_info,
.get = wm_vol_get, .get = wm_vol_get,
.put = wm_vol_put, .put = wm_vol_put,
.private_value = (1 << 8) | 4 .private_value = (1 << 8) | 4,
.tlv = { .p = db_scale_wm_dac }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -769,11 +785,14 @@ static struct snd_kcontrol_new phase28_dac_controls[] __devinitdata = { ...@@ -769,11 +785,14 @@ static struct snd_kcontrol_new phase28_dac_controls[] __devinitdata = {
}, },
{ {
.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 = "LFE Playback Volume", .name = "LFE Playback Volume",
.info = wm_vol_info, .info = wm_vol_info,
.get = wm_vol_get, .get = wm_vol_get,
.put = wm_vol_put, .put = wm_vol_put,
.private_value = (1 << 8) | 5 .private_value = (1 << 8) | 5,
.tlv = { .p = db_scale_wm_dac }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -785,11 +804,14 @@ static struct snd_kcontrol_new phase28_dac_controls[] __devinitdata = { ...@@ -785,11 +804,14 @@ static struct snd_kcontrol_new phase28_dac_controls[] __devinitdata = {
}, },
{ {
.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 = "Side Playback Volume", .name = "Side Playback Volume",
.info = wm_vol_info, .info = wm_vol_info,
.get = wm_vol_get, .get = wm_vol_get,
.put = wm_vol_put, .put = wm_vol_put,
.private_value = (2 << 8) | 6 .private_value = (2 << 8) | 6,
.tlv = { .p = db_scale_wm_dac }
} }
}; };
...@@ -803,10 +825,13 @@ static struct snd_kcontrol_new wm_controls[] __devinitdata = { ...@@ -803,10 +825,13 @@ static struct snd_kcontrol_new wm_controls[] __devinitdata = {
}, },
{ {
.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 = "PCM Playback Volume", .name = "PCM Playback Volume",
.info = wm_pcm_vol_info, .info = wm_pcm_vol_info,
.get = wm_pcm_vol_get, .get = wm_pcm_vol_get,
.put = wm_pcm_vol_put .put = wm_pcm_vol_put,
.tlv = { .p = db_scale_wm_pcm }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <sound/core.h> #include <sound/core.h>
#include <sound/info.h> #include <sound/info.h>
#include <sound/tlv.h>
#include "ice1712.h" #include "ice1712.h"
#include "envy24ht.h" #include "envy24ht.h"
...@@ -564,6 +565,8 @@ static int pontis_gpio_data_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el ...@@ -564,6 +565,8 @@ static int pontis_gpio_data_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
return changed; return changed;
} }
static DECLARE_TLV_DB_SCALE(db_scale_volume, -6400, 50, 1);
/* /*
* mixers * mixers
*/ */
...@@ -571,17 +574,23 @@ static int pontis_gpio_data_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el ...@@ -571,17 +574,23 @@ static int pontis_gpio_data_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
static struct snd_kcontrol_new pontis_controls[] __devinitdata = { static struct snd_kcontrol_new pontis_controls[] __devinitdata = {
{ {
.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 = "PCM Playback Volume", .name = "PCM Playback Volume",
.info = wm_dac_vol_info, .info = wm_dac_vol_info,
.get = wm_dac_vol_get, .get = wm_dac_vol_get,
.put = wm_dac_vol_put, .put = wm_dac_vol_put,
.tlv = { .p = db_scale_volume },
}, },
{ {
.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 = "Capture Volume", .name = "Capture Volume",
.info = wm_adc_vol_info, .info = wm_adc_vol_info,
.get = wm_adc_vol_get, .get = wm_adc_vol_get,
.put = wm_adc_vol_put, .put = wm_adc_vol_put,
.tlv = { .p = db_scale_volume },
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "envy24ht.h" #include "envy24ht.h"
#include "prodigy192.h" #include "prodigy192.h"
#include "stac946x.h" #include "stac946x.h"
#include <sound/tlv.h>
static inline void stac9460_put(struct snd_ice1712 *ice, int reg, unsigned char val) static inline void stac9460_put(struct snd_ice1712 *ice, int reg, unsigned char val)
{ {
...@@ -356,6 +357,9 @@ static int aureon_oversampling_put(struct snd_kcontrol *kcontrol, struct snd_ctl ...@@ -356,6 +357,9 @@ static int aureon_oversampling_put(struct snd_kcontrol *kcontrol, struct snd_ctl
} }
#endif #endif
static DECLARE_TLV_DB_SCALE(db_scale_dac, -19125, 75, 0);
static DECLARE_TLV_DB_SCALE(db_scale_adc, 0, 150, 0);
/* /*
* mixers * mixers
*/ */
...@@ -368,14 +372,18 @@ static struct snd_kcontrol_new stac_controls[] __devinitdata = { ...@@ -368,14 +372,18 @@ static struct snd_kcontrol_new stac_controls[] __devinitdata = {
.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,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "Master Playback Volume", .name = "Master Playback Volume",
.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,
.private_value = 1, .private_value = 1,
.tlv = { .p = db_scale_dac }
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -387,11 +395,14 @@ static struct snd_kcontrol_new stac_controls[] __devinitdata = { ...@@ -387,11 +395,14 @@ static struct snd_kcontrol_new stac_controls[] __devinitdata = {
}, },
{ {
.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 = 6, .count = 6,
.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,
...@@ -404,11 +415,14 @@ static struct snd_kcontrol_new stac_controls[] __devinitdata = { ...@@ -404,11 +415,14 @@ static struct snd_kcontrol_new stac_controls[] __devinitdata = {
}, },
{ {
.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 = 1, .count = 1,
.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 }
}, },
#if 0 #if 0
{ {
......
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