diff options
author | Takashi Iwai <tiwai@suse.de> | 2006-08-23 06:32:06 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-09-23 04:43:10 -0400 |
commit | 666c70ffd1c4be795de988f26a8ab13524d4ed47 (patch) | |
tree | 3a930d34f8a1bcace53ff403333ec37e395cb6e4 | |
parent | 9f6ab25063f04597e02968ae8393e8f4703c1563 (diff) |
[ALSA] Add dB scale information to fm801 driver
Added the dB scale information to fm801 driver.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
-rw-r--r-- | sound/pci/fm801.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index f3f2b2c99723..bdfda1997d5b 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/moduleparam.h> | 29 | #include <linux/moduleparam.h> |
30 | #include <sound/core.h> | 30 | #include <sound/core.h> |
31 | #include <sound/pcm.h> | 31 | #include <sound/pcm.h> |
32 | #include <sound/tlv.h> | ||
32 | #include <sound/ac97_codec.h> | 33 | #include <sound/ac97_codec.h> |
33 | #include <sound/mpu401.h> | 34 | #include <sound/mpu401.h> |
34 | #include <sound/opl3.h> | 35 | #include <sound/opl3.h> |
@@ -1053,6 +1054,13 @@ static int snd_fm801_put_single(struct snd_kcontrol *kcontrol, | |||
1053 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .info = snd_fm801_info_double, \ | 1054 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .info = snd_fm801_info_double, \ |
1054 | .get = snd_fm801_get_double, .put = snd_fm801_put_double, \ | 1055 | .get = snd_fm801_get_double, .put = snd_fm801_put_double, \ |
1055 | .private_value = reg | (shift_left << 8) | (shift_right << 12) | (mask << 16) | (invert << 24) } | 1056 | .private_value = reg | (shift_left << 8) | (shift_right << 12) | (mask << 16) | (invert << 24) } |
1057 | #define FM801_DOUBLE_TLV(xname, reg, shift_left, shift_right, mask, invert, xtlv) \ | ||
1058 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
1059 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \ | ||
1060 | .name = xname, .info = snd_fm801_info_double, \ | ||
1061 | .get = snd_fm801_get_double, .put = snd_fm801_put_double, \ | ||
1062 | .private_value = reg | (shift_left << 8) | (shift_right << 12) | (mask << 16) | (invert << 24), \ | ||
1063 | .tlv = { .p = (xtlv) } } | ||
1056 | 1064 | ||
1057 | static int snd_fm801_info_double(struct snd_kcontrol *kcontrol, | 1065 | static int snd_fm801_info_double(struct snd_kcontrol *kcontrol, |
1058 | struct snd_ctl_elem_info *uinfo) | 1066 | struct snd_ctl_elem_info *uinfo) |
@@ -1149,14 +1157,19 @@ static int snd_fm801_put_mux(struct snd_kcontrol *kcontrol, | |||
1149 | return snd_fm801_update_bits(chip, FM801_REC_SRC, 7, val); | 1157 | return snd_fm801_update_bits(chip, FM801_REC_SRC, 7, val); |
1150 | } | 1158 | } |
1151 | 1159 | ||
1160 | static DECLARE_TLV_DB_SCALE(db_scale_dsp, -3450, 150, 0); | ||
1161 | |||
1152 | #define FM801_CONTROLS ARRAY_SIZE(snd_fm801_controls) | 1162 | #define FM801_CONTROLS ARRAY_SIZE(snd_fm801_controls) |
1153 | 1163 | ||
1154 | static struct snd_kcontrol_new snd_fm801_controls[] __devinitdata = { | 1164 | static struct snd_kcontrol_new snd_fm801_controls[] __devinitdata = { |
1155 | FM801_DOUBLE("Wave Playback Volume", FM801_PCM_VOL, 0, 8, 31, 1), | 1165 | FM801_DOUBLE_TLV("Wave Playback Volume", FM801_PCM_VOL, 0, 8, 31, 1, |
1166 | db_scale_dsp), | ||
1156 | FM801_SINGLE("Wave Playback Switch", FM801_PCM_VOL, 15, 1, 1), | 1167 | FM801_SINGLE("Wave Playback Switch", FM801_PCM_VOL, 15, 1, 1), |
1157 | FM801_DOUBLE("I2S Playback Volume", FM801_I2S_VOL, 0, 8, 31, 1), | 1168 | FM801_DOUBLE_TLV("I2S Playback Volume", FM801_I2S_VOL, 0, 8, 31, 1, |
1169 | db_scale_dsp), | ||
1158 | FM801_SINGLE("I2S Playback Switch", FM801_I2S_VOL, 15, 1, 1), | 1170 | FM801_SINGLE("I2S Playback Switch", FM801_I2S_VOL, 15, 1, 1), |
1159 | FM801_DOUBLE("FM Playback Volume", FM801_FM_VOL, 0, 8, 31, 1), | 1171 | FM801_DOUBLE_TLV("FM Playback Volume", FM801_FM_VOL, 0, 8, 31, 1, |
1172 | db_scale_dsp), | ||
1160 | FM801_SINGLE("FM Playback Switch", FM801_FM_VOL, 15, 1, 1), | 1173 | FM801_SINGLE("FM Playback Switch", FM801_FM_VOL, 15, 1, 1), |
1161 | { | 1174 | { |
1162 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1175 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |