[ALSA] Add dB scale information to mixart driver
authorTakashi Iwai <tiwai@suse.de>
Fri, 1 Sep 2006 15:09:44 +0000 (17:09 +0200)
committerJaroslav Kysela <perex@suse.cz>
Sat, 23 Sep 2006 08:45:37 +0000 (10:45 +0200)
Added the dB scale information to mixart driver.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
sound/pci/mixart/mixart_mixer.c

index ed47b732c10345fe75735be972b8800522d022c3..13de0f71d4b74650f4bad2a85ba5032ba551c389 100644 (file)
@@ -31,6 +31,7 @@
 #include "mixart_core.h"
 #include "mixart_hwdep.h"
 #include <sound/control.h>
+#include <sound/tlv.h>
 #include "mixart_mixer.h"
 
 static u32 mixart_analog_level[256] = {
@@ -388,12 +389,17 @@ static int mixart_analog_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
        return changed;
 }
 
+static DECLARE_TLV_DB_SCALE(db_scale_analog, -9600, 50, 0);
+
 static struct snd_kcontrol_new mixart_control_analog_level = {
        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
+       .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                  SNDRV_CTL_ELEM_ACCESS_TLV_READ),
        /* name will be filled later */
        .info =         mixart_analog_vol_info,
        .get =          mixart_analog_vol_get,
        .put =          mixart_analog_vol_put,
+       .tlv = { .p = db_scale_analog },
 };
 
 /* shared */
@@ -866,14 +872,19 @@ static int mixart_pcm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
        return changed;
 }
 
+static DECLARE_TLV_DB_SCALE(db_scale_digital, -10950, 50, 0);
+
 static struct snd_kcontrol_new snd_mixart_pcm_vol =
 {
        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
+       .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                  SNDRV_CTL_ELEM_ACCESS_TLV_READ),
        /* name will be filled later */
        /* count will be filled later */
        .info =         mixart_digital_vol_info,                /* shared */
        .get =          mixart_pcm_vol_get,
        .put =          mixart_pcm_vol_put,
+       .tlv = { .p = db_scale_digital },
 };
 
 
@@ -984,10 +995,13 @@ static int mixart_monitor_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_
 
 static struct snd_kcontrol_new mixart_control_monitor_vol = {
        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
+       .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                  SNDRV_CTL_ELEM_ACCESS_TLV_READ),
        .name =         "Monitoring Volume",
        .info =         mixart_digital_vol_info,                /* shared */
        .get =          mixart_monitor_vol_get,
        .put =          mixart_monitor_vol_put,
+       .tlv = { .p = db_scale_digital },
 };
 
 /*