aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2006-08-23 13:53:02 -0400
committerJaroslav Kysela <perex@suse.cz>2006-09-23 04:44:05 -0400
commitc6ff77f71fe692fa48fe02dbfe74a01f3d5e55e2 (patch)
tree4c2f87ba3e36ba9f2af6023e1eecfd9d87f4387e /sound
parent3479307f8ca3cbf4181b8bf7d8c824156a9e63b7 (diff)
[ALSA] Add dB scale information to pcxhr driver
Added the dB scale information to pcxhr driver. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/pcxhr/pcxhr_mixer.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sound/pci/pcxhr/pcxhr_mixer.c b/sound/pci/pcxhr/pcxhr_mixer.c
index 94e63a1e90d9..b133ad9e095e 100644
--- a/sound/pci/pcxhr/pcxhr_mixer.c
+++ b/sound/pci/pcxhr/pcxhr_mixer.c
@@ -31,6 +31,7 @@
31#include "pcxhr_hwdep.h" 31#include "pcxhr_hwdep.h"
32#include "pcxhr_core.h" 32#include "pcxhr_core.h"
33#include <sound/control.h> 33#include <sound/control.h>
34#include <sound/tlv.h>
34#include <sound/asoundef.h> 35#include <sound/asoundef.h>
35#include "pcxhr_mixer.h" 36#include "pcxhr_mixer.h"
36 37
@@ -43,6 +44,9 @@
43#define PCXHR_ANALOG_PLAYBACK_LEVEL_MAX 128 /* 0.0 dB */ 44#define PCXHR_ANALOG_PLAYBACK_LEVEL_MAX 128 /* 0.0 dB */
44#define PCXHR_ANALOG_PLAYBACK_ZERO_LEVEL 104 /* -24.0 dB ( 0.0 dB - fix level +24.0 dB ) */ 45#define PCXHR_ANALOG_PLAYBACK_ZERO_LEVEL 104 /* -24.0 dB ( 0.0 dB - fix level +24.0 dB ) */
45 46
47static DECLARE_TLV_DB_SCALE(db_scale_analog_capture, -9600, 50, 0);
48static DECLARE_TLV_DB_SCALE(db_scale_analog_playback, -12800, 100, 0);
49
46static int pcxhr_update_analog_audio_level(struct snd_pcxhr *chip, int is_capture, int channel) 50static int pcxhr_update_analog_audio_level(struct snd_pcxhr *chip, int is_capture, int channel)
47{ 51{
48 int err, vol; 52 int err, vol;
@@ -130,10 +134,13 @@ static int pcxhr_analog_vol_put(struct snd_kcontrol *kcontrol,
130 134
131static struct snd_kcontrol_new pcxhr_control_analog_level = { 135static struct snd_kcontrol_new pcxhr_control_analog_level = {
132 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 136 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
137 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
138 SNDRV_CTL_ELEM_ACCESS_TLV_READ),
133 /* name will be filled later */ 139 /* name will be filled later */
134 .info = pcxhr_analog_vol_info, 140 .info = pcxhr_analog_vol_info,
135 .get = pcxhr_analog_vol_get, 141 .get = pcxhr_analog_vol_get,
136 .put = pcxhr_analog_vol_put, 142 .put = pcxhr_analog_vol_put,
143 /* tlv will be filled later */
137}; 144};
138 145
139/* shared */ 146/* shared */
@@ -188,6 +195,7 @@ static struct snd_kcontrol_new pcxhr_control_output_switch = {
188#define PCXHR_DIGITAL_LEVEL_MAX 0x1ff /* +18 dB */ 195#define PCXHR_DIGITAL_LEVEL_MAX 0x1ff /* +18 dB */
189#define PCXHR_DIGITAL_ZERO_LEVEL 0x1b7 /* 0 dB */ 196#define PCXHR_DIGITAL_ZERO_LEVEL 0x1b7 /* 0 dB */
190 197
198static DECLARE_TLV_DB_SCALE(db_scale_digital, -10950, 50, 0);
191 199
192#define MORE_THAN_ONE_STREAM_LEVEL 0x000001 200#define MORE_THAN_ONE_STREAM_LEVEL 0x000001
193#define VALID_STREAM_PAN_LEVEL_MASK 0x800000 201#define VALID_STREAM_PAN_LEVEL_MASK 0x800000
@@ -343,11 +351,14 @@ static int pcxhr_pcm_vol_put(struct snd_kcontrol *kcontrol,
343static struct snd_kcontrol_new snd_pcxhr_pcm_vol = 351static struct snd_kcontrol_new snd_pcxhr_pcm_vol =
344{ 352{
345 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 353 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
354 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
355 SNDRV_CTL_ELEM_ACCESS_TLV_READ),
346 /* name will be filled later */ 356 /* name will be filled later */
347 /* count will be filled later */ 357 /* count will be filled later */
348 .info = pcxhr_digital_vol_info, /* shared */ 358 .info = pcxhr_digital_vol_info, /* shared */
349 .get = pcxhr_pcm_vol_get, 359 .get = pcxhr_pcm_vol_get,
350 .put = pcxhr_pcm_vol_put, 360 .put = pcxhr_pcm_vol_put,
361 .tlv = { .p = db_scale_digital },
351}; 362};
352 363
353 364
@@ -433,10 +444,13 @@ static int pcxhr_monitor_vol_put(struct snd_kcontrol *kcontrol,
433 444
434static struct snd_kcontrol_new pcxhr_control_monitor_vol = { 445static struct snd_kcontrol_new pcxhr_control_monitor_vol = {
435 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 446 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
447 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
448 SNDRV_CTL_ELEM_ACCESS_TLV_READ),
436 .name = "Monitoring Volume", 449 .name = "Monitoring Volume",
437 .info = pcxhr_digital_vol_info, /* shared */ 450 .info = pcxhr_digital_vol_info, /* shared */
438 .get = pcxhr_monitor_vol_get, 451 .get = pcxhr_monitor_vol_get,
439 .put = pcxhr_monitor_vol_put, 452 .put = pcxhr_monitor_vol_put,
453 .tlv = { .p = db_scale_digital },
440}; 454};
441 455
442/* 456/*
@@ -928,6 +942,7 @@ int pcxhr_create_mixer(struct pcxhr_mgr *mgr)
928 temp = pcxhr_control_analog_level; 942 temp = pcxhr_control_analog_level;
929 temp.name = "Master Playback Volume"; 943 temp.name = "Master Playback Volume";
930 temp.private_value = 0; /* playback */ 944 temp.private_value = 0; /* playback */
945 temp.tlv.p = db_scale_analog_playback;
931 if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&temp, chip))) < 0) 946 if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&temp, chip))) < 0)
932 return err; 947 return err;
933 /* output mute controls */ 948 /* output mute controls */
@@ -963,6 +978,7 @@ int pcxhr_create_mixer(struct pcxhr_mgr *mgr)
963 temp = pcxhr_control_analog_level; 978 temp = pcxhr_control_analog_level;
964 temp.name = "Master Capture Volume"; 979 temp.name = "Master Capture Volume";
965 temp.private_value = 1; /* capture */ 980 temp.private_value = 1; /* capture */
981 temp.tlv.p = db_scale_analog_capture;
966 if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&temp, chip))) < 0) 982 if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&temp, chip))) < 0)
967 return err; 983 return err;
968 984