aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorJames Courtier-Dutton <James@superbug.co.uk>2006-07-22 12:02:10 -0400
committerJaroslav Kysela <perex@suse.cz>2006-09-23 04:38:32 -0400
commit31508f83f591dc8764427b6321c89f8f9e84bad2 (patch)
treee8b131303a9397232b33fbaaf5591f097f93af35 /sound/pci
parentfff36e472b4315df77513f4339c5c199c6aad28b (diff)
[ALSA] snd-emu10k1: Implement dB gain infomation.
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/emu10k1/emufx.c11
-rw-r--r--sound/pci/emu10k1/p16v.c5
2 files changed, 16 insertions, 0 deletions
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index dfba00230d4d..00fc904c251d 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -35,6 +35,7 @@
35#include <linux/mutex.h> 35#include <linux/mutex.h>
36 36
37#include <sound/core.h> 37#include <sound/core.h>
38#include <sound/tlv.h>
38#include <sound/emu10k1.h> 39#include <sound/emu10k1.h>
39 40
40#if 0 /* for testing purposes - digital out -> capture */ 41#if 0 /* for testing purposes - digital out -> capture */
@@ -290,6 +291,9 @@ static const u32 db_table[101] = {
290 0x7fffffff, 291 0x7fffffff,
291}; 292};
292 293
294/* EMU10k1/EMU10k2 DSP control db gain */
295static DECLARE_TLV_DB_SCALE(snd_emu10k1_db_scale1, -4000, 40, 1);
296
293static const u32 onoff_table[2] = { 297static const u32 onoff_table[2] = {
294 0x00000000, 0x00000001 298 0x00000000, 0x00000001
295}; 299};
@@ -755,6 +759,11 @@ static int snd_emu10k1_add_controls(struct snd_emu10k1 *emu,
755 knew.device = gctl->id.device; 759 knew.device = gctl->id.device;
756 knew.subdevice = gctl->id.subdevice; 760 knew.subdevice = gctl->id.subdevice;
757 knew.info = snd_emu10k1_gpr_ctl_info; 761 knew.info = snd_emu10k1_gpr_ctl_info;
762 if (gctl->tlv.p) {
763 knew.tlv.p = gctl->tlv.p;
764 knew.access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
765 SNDRV_CTL_ELEM_ACCESS_TLV_READ;
766 }
758 knew.get = snd_emu10k1_gpr_ctl_get; 767 knew.get = snd_emu10k1_gpr_ctl_get;
759 knew.put = snd_emu10k1_gpr_ctl_put; 768 knew.put = snd_emu10k1_gpr_ctl_put;
760 memset(nctl, 0, sizeof(*nctl)); 769 memset(nctl, 0, sizeof(*nctl));
@@ -1013,6 +1022,7 @@ snd_emu10k1_init_mono_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
1013 ctl->gpr[0] = gpr + 0; ctl->value[0] = defval; 1022 ctl->gpr[0] = gpr + 0; ctl->value[0] = defval;
1014 ctl->min = 0; 1023 ctl->min = 0;
1015 ctl->max = 100; 1024 ctl->max = 100;
1025 ctl->tlv.p = snd_emu10k1_db_scale1;
1016 ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100; 1026 ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100;
1017} 1027}
1018 1028
@@ -1027,6 +1037,7 @@ snd_emu10k1_init_stereo_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
1027 ctl->gpr[1] = gpr + 1; ctl->value[1] = defval; 1037 ctl->gpr[1] = gpr + 1; ctl->value[1] = defval;
1028 ctl->min = 0; 1038 ctl->min = 0;
1029 ctl->max = 100; 1039 ctl->max = 100;
1040 ctl->tlv.p = snd_emu10k1_db_scale1;
1030 ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100; 1041 ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100;
1031} 1042}
1032 1043
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c
index 9905651935fb..1e44714b8623 100644
--- a/sound/pci/emu10k1/p16v.c
+++ b/sound/pci/emu10k1/p16v.c
@@ -100,6 +100,7 @@
100#include <sound/pcm.h> 100#include <sound/pcm.h>
101#include <sound/ac97_codec.h> 101#include <sound/ac97_codec.h>
102#include <sound/info.h> 102#include <sound/info.h>
103#include <sound/tlv.h>
103#include <sound/emu10k1.h> 104#include <sound/emu10k1.h>
104#include "p16v.h" 105#include "p16v.h"
105 106
@@ -784,12 +785,16 @@ static int snd_p16v_capture_channel_put(struct snd_kcontrol *kcontrol,
784 } 785 }
785 return change; 786 return change;
786} 787}
788static DECLARE_TLV_DB_SCALE(snd_p16v_db_scale1, -5175, 25, 1);
787 789
788#define P16V_VOL(xname,xreg,xhl) { \ 790#define P16V_VOL(xname,xreg,xhl) { \
789 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 791 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
792 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \
793 SNDRV_CTL_ELEM_ACCESS_TLV_READ, \
790 .info = snd_p16v_volume_info, \ 794 .info = snd_p16v_volume_info, \
791 .get = snd_p16v_volume_get, \ 795 .get = snd_p16v_volume_get, \
792 .put = snd_p16v_volume_put, \ 796 .put = snd_p16v_volume_put, \
797 .tlv.p = snd_p16v_db_scale1, \
793 .private_value = ((xreg) | ((xhl) << 8)) \ 798 .private_value = ((xreg) | ((xhl) << 8)) \
794} 799}
795 800