diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-02-18 07:05:50 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-04-24 06:00:12 -0400 |
commit | 1c82ed1bc531746a8fa9b46c593ddce546f28026 (patch) | |
tree | bc86ba78100f31856cff9b596634d795d2793984 /sound/core | |
parent | e922b0028fad87de0d262f9fa51f98595d2df258 (diff) |
[ALSA] Keep private TLV entry in vmaster itself
Use a private array for TLV entries of virtual master controls instead
of (supposed) static array. This cleans up the existing codes.
Also, now vmaster assumes the simple dB-range TLV that is the only type
it can handle.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/vmaster.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c index 7cfd8b8fb4e7..4cc57f902e2c 100644 --- a/sound/core/vmaster.c +++ b/sound/core/vmaster.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
13 | #include <sound/core.h> | 13 | #include <sound/core.h> |
14 | #include <sound/control.h> | 14 | #include <sound/control.h> |
15 | #include <sound/tlv.h> | ||
15 | 16 | ||
16 | /* | 17 | /* |
17 | * a subset of information returned via ctl info callback | 18 | * a subset of information returned via ctl info callback |
@@ -34,6 +35,7 @@ struct link_master { | |||
34 | struct list_head slaves; | 35 | struct list_head slaves; |
35 | struct link_ctl_info info; | 36 | struct link_ctl_info info; |
36 | int val; /* the master value */ | 37 | int val; /* the master value */ |
38 | unsigned int tlv[4]; | ||
37 | }; | 39 | }; |
38 | 40 | ||
39 | /* | 41 | /* |
@@ -357,11 +359,12 @@ struct snd_kcontrol *snd_ctl_make_virtual_master(char *name, | |||
357 | kctl->private_free = master_free; | 359 | kctl->private_free = master_free; |
358 | 360 | ||
359 | /* additional (constant) TLV read */ | 361 | /* additional (constant) TLV read */ |
360 | if (tlv) { | 362 | if (tlv && tlv[0] == SNDRV_CTL_TLVT_DB_SCALE) { |
361 | /* FIXME: this assumes that the max volume is 0 dB */ | ||
362 | kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ; | 363 | kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ; |
363 | kctl->tlv.p = tlv; | 364 | memcpy(master->tlv, tlv, sizeof(master->tlv)); |
365 | kctl->tlv.p = master->tlv; | ||
364 | } | 366 | } |
367 | |||
365 | return kctl; | 368 | return kctl; |
366 | } | 369 | } |
367 | 370 | ||