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 | |
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>
-rw-r--r-- | sound/core/vmaster.c | 9 | ||||
-rw-r--r-- | sound/pci/hda/Makefile | 2 | ||||
-rw-r--r-- | sound/pci/hda/patch_analog.c | 6 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 6 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 8 |
5 files changed, 16 insertions, 15 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 | ||
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile index 9e0d8a1268aa..ab0c726d648e 100644 --- a/sound/pci/hda/Makefile +++ b/sound/pci/hda/Makefile | |||
@@ -2,7 +2,7 @@ snd-hda-intel-y := hda_intel.o | |||
2 | # since snd-hda-intel is the only driver using hda-codec, | 2 | # since snd-hda-intel is the only driver using hda-codec, |
3 | # merge it into a single module although it was originally | 3 | # merge it into a single module although it was originally |
4 | # designed to be individual modules | 4 | # designed to be individual modules |
5 | snd-hda-intel-y += hda_codec.o vmaster.o | 5 | snd-hda-intel-y += hda_codec.o |
6 | snd-hda-intel-$(CONFIG_PROC_FS) += hda_proc.o | 6 | snd-hda-intel-$(CONFIG_PROC_FS) += hda_proc.o |
7 | snd-hda-intel-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o | 7 | snd-hda-intel-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o |
8 | snd-hda-intel-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o | 8 | snd-hda-intel-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 3f3905cc4e01..e0f3559f8b13 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -80,7 +80,6 @@ struct ad198x_spec { | |||
80 | #endif | 80 | #endif |
81 | /* for virtual master */ | 81 | /* for virtual master */ |
82 | hda_nid_t vmaster_nid; | 82 | hda_nid_t vmaster_nid; |
83 | u32 vmaster_tlv[4]; | ||
84 | const char **slave_vols; | 83 | const char **slave_vols; |
85 | const char **slave_sws; | 84 | const char **slave_sws; |
86 | }; | 85 | }; |
@@ -185,10 +184,11 @@ static int ad198x_build_controls(struct hda_codec *codec) | |||
185 | 184 | ||
186 | /* if we have no master control, let's create it */ | 185 | /* if we have no master control, let's create it */ |
187 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | 186 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
187 | unsigned int vmaster_tlv[4]; | ||
188 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, | 188 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
189 | HDA_OUTPUT, spec->vmaster_tlv); | 189 | HDA_OUTPUT, vmaster_tlv); |
190 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", | 190 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
191 | spec->vmaster_tlv, | 191 | vmaster_tlv, |
192 | (spec->slave_vols ? | 192 | (spec->slave_vols ? |
193 | spec->slave_vols : ad_slave_vols)); | 193 | spec->slave_vols : ad_slave_vols)); |
194 | if (err < 0) | 194 | if (err < 0) |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index eea18b3336d3..e8ce525d297b 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -272,7 +272,6 @@ struct alc_spec { | |||
272 | 272 | ||
273 | /* for virtual master */ | 273 | /* for virtual master */ |
274 | hda_nid_t vmaster_nid; | 274 | hda_nid_t vmaster_nid; |
275 | u32 vmaster_tlv[4]; | ||
276 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 275 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
277 | struct hda_loopback_check loopback; | 276 | struct hda_loopback_check loopback; |
278 | #endif | 277 | #endif |
@@ -1534,10 +1533,11 @@ static int alc_build_controls(struct hda_codec *codec) | |||
1534 | 1533 | ||
1535 | /* if we have no master control, let's create it */ | 1534 | /* if we have no master control, let's create it */ |
1536 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | 1535 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
1536 | unsigned int vmaster_tlv[4]; | ||
1537 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, | 1537 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
1538 | HDA_OUTPUT, spec->vmaster_tlv); | 1538 | HDA_OUTPUT, vmaster_tlv); |
1539 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", | 1539 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
1540 | spec->vmaster_tlv, alc_slave_vols); | 1540 | vmaster_tlv, alc_slave_vols); |
1541 | if (err < 0) | 1541 | if (err < 0) |
1542 | return err; | 1542 | return err; |
1543 | } | 1543 | } |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 7901e76f2690..132d1e3eafa5 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -186,9 +186,6 @@ struct sigmatel_spec { | |||
186 | struct hda_input_mux private_dimux; | 186 | struct hda_input_mux private_dimux; |
187 | struct hda_input_mux private_imux; | 187 | struct hda_input_mux private_imux; |
188 | struct hda_input_mux private_mono_mux; | 188 | struct hda_input_mux private_mono_mux; |
189 | |||
190 | /* virtual master */ | ||
191 | unsigned int vmaster_tlv[4]; | ||
192 | }; | 189 | }; |
193 | 190 | ||
194 | static hda_nid_t stac9200_adc_nids[1] = { | 191 | static hda_nid_t stac9200_adc_nids[1] = { |
@@ -930,10 +927,11 @@ static int stac92xx_build_controls(struct hda_codec *codec) | |||
930 | 927 | ||
931 | /* if we have no master control, let's create it */ | 928 | /* if we have no master control, let's create it */ |
932 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | 929 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
930 | unsigned int vmaster_tlv[4]; | ||
933 | snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0], | 931 | snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0], |
934 | HDA_OUTPUT, spec->vmaster_tlv); | 932 | HDA_OUTPUT, vmaster_tlv); |
935 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", | 933 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
936 | spec->vmaster_tlv, slave_vols); | 934 | vmaster_tlv, slave_vols); |
937 | if (err < 0) | 935 | if (err < 0) |
938 | return err; | 936 | return err; |
939 | } | 937 | } |