diff options
author | Takashi Iwai <tiwai@suse.de> | 2006-08-22 07:16:39 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-09-23 04:43:33 -0400 |
commit | a1c7a7d890634eaec106e5fb3a7d9c92b8f85b0d (patch) | |
tree | 260025bde47e31aafb7e5e72fdfe8bbbd1ac79f6 /sound/isa/opl3sa2.c | |
parent | eac06a10d2b814dfacc36a8fff35ef07bf4eec8e (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.c | 26 |
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 | ||
341 | static int snd_opl3sa2_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 350 | static 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 | ||
399 | static int snd_opl3sa2_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 416 | static 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 | ||
489 | static DECLARE_TLV_DB_SCALE(db_scale_master, -3000, 200, 0); | ||
490 | static DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0); | ||
491 | |||
472 | static struct snd_kcontrol_new snd_opl3sa2_controls[] = { | 492 | static struct snd_kcontrol_new snd_opl3sa2_controls[] = { |
473 | OPL3SA2_DOUBLE("Master Playback Switch", 0, 0x07, 0x08, 7, 7, 1, 1), | 493 | OPL3SA2_DOUBLE("Master Playback Switch", 0, 0x07, 0x08, 7, 7, 1, 1), |
474 | OPL3SA2_DOUBLE("Master Playback Volume", 0, 0x07, 0x08, 0, 0, 15, 1), | 494 | OPL3SA2_DOUBLE_TLV("Master Playback Volume", 0, 0x07, 0x08, 0, 0, 15, 1, |
495 | db_scale_master), | ||
475 | OPL3SA2_SINGLE("Mic Playback Switch", 0, 0x09, 7, 1, 1), | 496 | OPL3SA2_SINGLE("Mic Playback Switch", 0, 0x09, 7, 1, 1), |
476 | OPL3SA2_SINGLE("Mic Playback Volume", 0, 0x09, 0, 31, 1) | 497 | OPL3SA2_SINGLE_TLV("Mic Playback Volume", 0, 0x09, 0, 31, 1, |
498 | db_scale_5bit_12db_max), | ||
477 | }; | 499 | }; |
478 | 500 | ||
479 | static struct snd_kcontrol_new snd_opl3sa2_tone_controls[] = { | 501 | static struct snd_kcontrol_new snd_opl3sa2_tone_controls[] = { |