diff options
| author | Clemens Ladisch <clemens@ladisch.de> | 2010-05-25 03:04:49 -0400 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2010-05-25 14:23:54 -0400 |
| commit | 4daf7a0c0b3dd3c2e2ec829ecee8608d04d67773 (patch) | |
| tree | 1934d7b283f2385afc27aa48fa020f86779b6098 | |
| parent | b406e6103baa3da85950f22d3d46d21a8da654c5 (diff) | |
ALSA: emu10k1: allow high-resolution mixer controls
Add a module option to allow the GPR mixer controls to have the full
resolution of the hardware, i.e., 0...2^31-1 instead of 0...100.
Because of bugs in userspace tools like alsactl and alsamixer, this is
not yet enabled by default.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
| -rw-r--r-- | sound/pci/emu10k1/emufx.c | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 4b302d86f5f2..7a9401462c1c 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | #include <linux/vmalloc.h> | 35 | #include <linux/vmalloc.h> |
| 36 | #include <linux/init.h> | 36 | #include <linux/init.h> |
| 37 | #include <linux/mutex.h> | 37 | #include <linux/mutex.h> |
| 38 | #include <linux/moduleparam.h> | ||
| 38 | 39 | ||
| 39 | #include <sound/core.h> | 40 | #include <sound/core.h> |
| 40 | #include <sound/tlv.h> | 41 | #include <sound/tlv.h> |
| @@ -50,6 +51,10 @@ | |||
| 50 | #define EMU10K1_CENTER_LFE_FROM_FRONT | 51 | #define EMU10K1_CENTER_LFE_FROM_FRONT |
| 51 | #endif | 52 | #endif |
| 52 | 53 | ||
| 54 | static bool high_res_gpr_volume; | ||
| 55 | module_param(high_res_gpr_volume, bool, 0444); | ||
| 56 | MODULE_PARM_DESC(high_res_gpr_volume, "GPR mixer controls use 31-bit range."); | ||
| 57 | |||
| 53 | /* | 58 | /* |
| 54 | * Tables | 59 | * Tables |
| 55 | */ | 60 | */ |
| @@ -296,6 +301,7 @@ static const u32 db_table[101] = { | |||
| 296 | 301 | ||
| 297 | /* EMU10k1/EMU10k2 DSP control db gain */ | 302 | /* EMU10k1/EMU10k2 DSP control db gain */ |
| 298 | static const DECLARE_TLV_DB_SCALE(snd_emu10k1_db_scale1, -4000, 40, 1); | 303 | static const DECLARE_TLV_DB_SCALE(snd_emu10k1_db_scale1, -4000, 40, 1); |
| 304 | static const DECLARE_TLV_DB_LINEAR(snd_emu10k1_db_linear, TLV_DB_GAIN_MUTE, 0); | ||
| 299 | 305 | ||
| 300 | static const u32 onoff_table[2] = { | 306 | static const u32 onoff_table[2] = { |
| 301 | 0x00000000, 0x00000001 | 307 | 0x00000000, 0x00000001 |
| @@ -1072,10 +1078,17 @@ snd_emu10k1_init_mono_control(struct snd_emu10k1_fx8010_control_gpr *ctl, | |||
| 1072 | strcpy(ctl->id.name, name); | 1078 | strcpy(ctl->id.name, name); |
| 1073 | ctl->vcount = ctl->count = 1; | 1079 | ctl->vcount = ctl->count = 1; |
| 1074 | ctl->gpr[0] = gpr + 0; ctl->value[0] = defval; | 1080 | ctl->gpr[0] = gpr + 0; ctl->value[0] = defval; |
| 1075 | ctl->min = 0; | 1081 | if (high_res_gpr_volume) { |
| 1076 | ctl->max = 100; | 1082 | ctl->min = 0; |
| 1077 | ctl->tlv = snd_emu10k1_db_scale1; | 1083 | ctl->max = 0x7fffffff; |
| 1078 | ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100; | 1084 | ctl->tlv = snd_emu10k1_db_linear; |
| 1085 | ctl->translation = EMU10K1_GPR_TRANSLATION_NONE; | ||
| 1086 | } else { | ||
| 1087 | ctl->min = 0; | ||
| 1088 | ctl->max = 100; | ||
| 1089 | ctl->tlv = snd_emu10k1_db_scale1; | ||
| 1090 | ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100; | ||
| 1091 | } | ||
| 1079 | } | 1092 | } |
| 1080 | 1093 | ||
| 1081 | static void __devinit | 1094 | static void __devinit |
| @@ -1087,10 +1100,17 @@ snd_emu10k1_init_stereo_control(struct snd_emu10k1_fx8010_control_gpr *ctl, | |||
| 1087 | ctl->vcount = ctl->count = 2; | 1100 | ctl->vcount = ctl->count = 2; |
| 1088 | ctl->gpr[0] = gpr + 0; ctl->value[0] = defval; | 1101 | ctl->gpr[0] = gpr + 0; ctl->value[0] = defval; |
| 1089 | ctl->gpr[1] = gpr + 1; ctl->value[1] = defval; | 1102 | ctl->gpr[1] = gpr + 1; ctl->value[1] = defval; |
| 1090 | ctl->min = 0; | 1103 | if (high_res_gpr_volume) { |
| 1091 | ctl->max = 100; | 1104 | ctl->min = 0; |
| 1092 | ctl->tlv = snd_emu10k1_db_scale1; | 1105 | ctl->max = 0x7fffffff; |
| 1093 | ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100; | 1106 | ctl->tlv = snd_emu10k1_db_linear; |
| 1107 | ctl->translation = EMU10K1_GPR_TRANSLATION_NONE; | ||
| 1108 | } else { | ||
| 1109 | ctl->min = 0; | ||
| 1110 | ctl->max = 100; | ||
| 1111 | ctl->tlv = snd_emu10k1_db_scale1; | ||
| 1112 | ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100; | ||
| 1113 | } | ||
| 1094 | } | 1114 | } |
| 1095 | 1115 | ||
| 1096 | static void __devinit | 1116 | static void __devinit |
