aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/echoaudio/echoaudio.c
diff options
context:
space:
mode:
authorGiuliano Pochini <pochini@shiny.it>2006-11-24 07:03:58 -0500
committerJaroslav Kysela <perex@suse.cz>2007-02-09 03:01:47 -0500
commit048b945077bdc7e8dff5d5810ff2a0ced3590ca9 (patch)
tree759b12cfa42c737ce7390b9cb4b1c60a70204c78 /sound/pci/echoaudio/echoaudio.c
parentd1d985f019c3b290e09881b7b23abdc87aee2895 (diff)
[ALSA] echoaudio, add TLV support
This patch adds TLV support to the echoaudio driver. All gains are in the range -127dB to +6dB with steps of 1dB, and -128 is mute. VU-meters levels go from -128 to 0dB. The input gain of the Layla20 ranges from -25dB to +25dB in steps of 0.5dB. Signed-off-by: Giuliano Pochini <pochini@shiny.it> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/echoaudio/echoaudio.c')
-rw-r--r--sound/pci/echoaudio/echoaudio.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index 047e0b5bf15d..3410bd4450ad 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -34,6 +34,7 @@ module_param_array(enable, bool, NULL, 0444);
34MODULE_PARM_DESC(enable, "Enable " ECHOCARD_NAME " soundcard."); 34MODULE_PARM_DESC(enable, "Enable " ECHOCARD_NAME " soundcard.");
35 35
36static unsigned int channels_list[10] = {1, 2, 4, 6, 8, 10, 12, 14, 16, 999999}; 36static unsigned int channels_list[10] = {1, 2, 4, 6, 8, 10, 12, 14, 16, 999999};
37static DECLARE_TLV_DB_SCALE(db_scale_output_gain, -12800, 100, 1);
37 38
38static int get_firmware(const struct firmware **fw_entry, 39static int get_firmware(const struct firmware **fw_entry,
39 const struct firmware *frm, struct echoaudio *chip) 40 const struct firmware *frm, struct echoaudio *chip)
@@ -1011,17 +1012,21 @@ static int snd_echo_output_gain_put(struct snd_kcontrol *kcontrol,
1011static struct snd_kcontrol_new snd_echo_line_output_gain __devinitdata = { 1012static struct snd_kcontrol_new snd_echo_line_output_gain __devinitdata = {
1012 .name = "Line Playback Volume", 1013 .name = "Line Playback Volume",
1013 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1014 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1015 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
1014 .info = snd_echo_output_gain_info, 1016 .info = snd_echo_output_gain_info,
1015 .get = snd_echo_output_gain_get, 1017 .get = snd_echo_output_gain_get,
1016 .put = snd_echo_output_gain_put, 1018 .put = snd_echo_output_gain_put,
1019 .tlv = {.p = db_scale_output_gain},
1017}; 1020};
1018#else 1021#else
1019static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = { 1022static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = {
1020 .name = "PCM Playback Volume", 1023 .name = "PCM Playback Volume",
1021 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1024 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1025 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
1022 .info = snd_echo_output_gain_info, 1026 .info = snd_echo_output_gain_info,
1023 .get = snd_echo_output_gain_get, 1027 .get = snd_echo_output_gain_get,
1024 .put = snd_echo_output_gain_put, 1028 .put = snd_echo_output_gain_put,
1029 .tlv = {.p = db_scale_output_gain},
1025}; 1030};
1026#endif 1031#endif
1027 1032
@@ -1080,12 +1085,16 @@ static int snd_echo_input_gain_put(struct snd_kcontrol *kcontrol,
1080 return changed; 1085 return changed;
1081} 1086}
1082 1087
1088static DECLARE_TLV_DB_SCALE(db_scale_input_gain, -2500, 50, 0);
1089
1083static struct snd_kcontrol_new snd_echo_line_input_gain __devinitdata = { 1090static struct snd_kcontrol_new snd_echo_line_input_gain __devinitdata = {
1084 .name = "Line Capture Volume", 1091 .name = "Line Capture Volume",
1085 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1092 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1093 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
1086 .info = snd_echo_input_gain_info, 1094 .info = snd_echo_input_gain_info,
1087 .get = snd_echo_input_gain_get, 1095 .get = snd_echo_input_gain_get,
1088 .put = snd_echo_input_gain_put, 1096 .put = snd_echo_input_gain_put,
1097 .tlv = {.p = db_scale_input_gain},
1089}; 1098};
1090 1099
1091#endif /* ECHOCARD_HAS_INPUT_GAIN */ 1100#endif /* ECHOCARD_HAS_INPUT_GAIN */
@@ -1277,9 +1286,11 @@ static int snd_echo_mixer_put(struct snd_kcontrol *kcontrol,
1277static struct snd_kcontrol_new snd_echo_monitor_mixer __devinitdata = { 1286static struct snd_kcontrol_new snd_echo_monitor_mixer __devinitdata = {
1278 .name = "Monitor Mixer Volume", 1287 .name = "Monitor Mixer Volume",
1279 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1288 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1289 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
1280 .info = snd_echo_mixer_info, 1290 .info = snd_echo_mixer_info,
1281 .get = snd_echo_mixer_get, 1291 .get = snd_echo_mixer_get,
1282 .put = snd_echo_mixer_put, 1292 .put = snd_echo_mixer_put,
1293 .tlv = {.p = db_scale_output_gain},
1283}; 1294};
1284 1295
1285#endif /* ECHOCARD_HAS_MONITOR */ 1296#endif /* ECHOCARD_HAS_MONITOR */
@@ -1343,9 +1354,11 @@ static int snd_echo_vmixer_put(struct snd_kcontrol *kcontrol,
1343static struct snd_kcontrol_new snd_echo_vmixer __devinitdata = { 1354static struct snd_kcontrol_new snd_echo_vmixer __devinitdata = {
1344 .name = "VMixer Volume", 1355 .name = "VMixer Volume",
1345 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1356 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1357 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
1346 .info = snd_echo_vmixer_info, 1358 .info = snd_echo_vmixer_info,
1347 .get = snd_echo_vmixer_get, 1359 .get = snd_echo_vmixer_get,
1348 .put = snd_echo_vmixer_put, 1360 .put = snd_echo_vmixer_put,
1361 .tlv = {.p = db_scale_output_gain},
1349}; 1362};
1350 1363
1351#endif /* ECHOCARD_HAS_VMIXER */ 1364#endif /* ECHOCARD_HAS_VMIXER */
@@ -1753,9 +1766,12 @@ static int snd_echo_vumeters_get(struct snd_kcontrol *kcontrol,
1753static struct snd_kcontrol_new snd_echo_vumeters __devinitdata = { 1766static struct snd_kcontrol_new snd_echo_vumeters __devinitdata = {
1754 .name = "VU-meters", 1767 .name = "VU-meters",
1755 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1768 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1756 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, 1769 .access = SNDRV_CTL_ELEM_ACCESS_READ |
1770 SNDRV_CTL_ELEM_ACCESS_VOLATILE |
1771 SNDRV_CTL_ELEM_ACCESS_TLV_READ,
1757 .info = snd_echo_vumeters_info, 1772 .info = snd_echo_vumeters_info,
1758 .get = snd_echo_vumeters_get, 1773 .get = snd_echo_vumeters_get,
1774 .tlv = {.p = db_scale_output_gain},
1759}; 1775};
1760 1776
1761 1777