aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/opl3sa2.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2006-08-22 07:16:39 -0400
committerJaroslav Kysela <perex@suse.cz>2006-09-23 04:43:33 -0400
commita1c7a7d890634eaec106e5fb3a7d9c92b8f85b0d (patch)
tree260025bde47e31aafb7e5e72fdfe8bbbd1ac79f6 /sound/isa/opl3sa2.c
parenteac06a10d2b814dfacc36a8fff35ef07bf4eec8e (diff)
[ALSA] Add dB scale information to opl3sa2 driver
Added the dB scale information to opl3sa2 driver. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/isa/opl3sa2.c')
-rw-r--r--sound/isa/opl3sa2.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 4031b61b797f..da92bf6c392b 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -33,6 +33,7 @@
33#include <sound/mpu401.h> 33#include <sound/mpu401.h>
34#include <sound/opl3.h> 34#include <sound/opl3.h>
35#include <sound/initval.h> 35#include <sound/initval.h>
36#include <sound/tlv.h>
36 37
37#include <asm/io.h> 38#include <asm/io.h>
38 39
@@ -337,6 +338,14 @@ static irqreturn_t snd_opl3sa2_interrupt(int irq, void *dev_id, struct pt_regs *
337 .info = snd_opl3sa2_info_single, \ 338 .info = snd_opl3sa2_info_single, \
338 .get = snd_opl3sa2_get_single, .put = snd_opl3sa2_put_single, \ 339 .get = snd_opl3sa2_get_single, .put = snd_opl3sa2_put_single, \
339 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } 340 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) }
341#define OPL3SA2_SINGLE_TLV(xname, xindex, reg, shift, mask, invert, xtlv) \
342{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
343 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \
344 .name = xname, .index = xindex, \
345 .info = snd_opl3sa2_info_single, \
346 .get = snd_opl3sa2_get_single, .put = snd_opl3sa2_put_single, \
347 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24), \
348 .tlv = { .p = (xtlv) } }
340 349
341static int snd_opl3sa2_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 350static int snd_opl3sa2_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
342{ 351{
@@ -395,6 +404,14 @@ static int snd_opl3sa2_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_
395 .info = snd_opl3sa2_info_double, \ 404 .info = snd_opl3sa2_info_double, \
396 .get = snd_opl3sa2_get_double, .put = snd_opl3sa2_put_double, \ 405 .get = snd_opl3sa2_get_double, .put = snd_opl3sa2_put_double, \
397 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } 406 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }
407#define OPL3SA2_DOUBLE_TLV(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert, xtlv) \
408{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
409 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \
410 .name = xname, .index = xindex, \
411 .info = snd_opl3sa2_info_double, \
412 .get = snd_opl3sa2_get_double, .put = snd_opl3sa2_put_double, \
413 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22), \
414 .tlv = { .p = (xtlv) } }
398 415
399static int snd_opl3sa2_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 416static int snd_opl3sa2_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
400{ 417{
@@ -469,11 +486,16 @@ static int snd_opl3sa2_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_
469 return change; 486 return change;
470} 487}
471 488
489static DECLARE_TLV_DB_SCALE(db_scale_master, -3000, 200, 0);
490static DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0);
491
472static struct snd_kcontrol_new snd_opl3sa2_controls[] = { 492static struct snd_kcontrol_new snd_opl3sa2_controls[] = {
473OPL3SA2_DOUBLE("Master Playback Switch", 0, 0x07, 0x08, 7, 7, 1, 1), 493OPL3SA2_DOUBLE("Master Playback Switch", 0, 0x07, 0x08, 7, 7, 1, 1),
474OPL3SA2_DOUBLE("Master Playback Volume", 0, 0x07, 0x08, 0, 0, 15, 1), 494OPL3SA2_DOUBLE_TLV("Master Playback Volume", 0, 0x07, 0x08, 0, 0, 15, 1,
495 db_scale_master),
475OPL3SA2_SINGLE("Mic Playback Switch", 0, 0x09, 7, 1, 1), 496OPL3SA2_SINGLE("Mic Playback Switch", 0, 0x09, 7, 1, 1),
476OPL3SA2_SINGLE("Mic Playback Volume", 0, 0x09, 0, 31, 1) 497OPL3SA2_SINGLE_TLV("Mic Playback Volume", 0, 0x09, 0, 31, 1,
498 db_scale_5bit_12db_max),
477}; 499};
478 500
479static struct snd_kcontrol_new snd_opl3sa2_tone_controls[] = { 501static struct snd_kcontrol_new snd_opl3sa2_tone_controls[] = {