aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2009-11-12 04:15:48 -0500
committerTakashi Iwai <tiwai@suse.de>2009-11-16 05:35:19 -0500
commit4d02d1b638af580ae3d69367248539a8b3893064 (patch)
tree2e3deb96c2fcd98e83644b816d1ae7294f67b05e /sound
parent3911a4c19e927738766003839aa447becbdbaa27 (diff)
ALSA: hda - proc - add support for dynamic controls to mixer<->NID mapping
This patch adds support for dynamically created controls to proc codec file (Control: lines). Signed-off-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/hda_codec.c7
-rw-r--r--sound/pci/hda/hda_local.h3
-rw-r--r--sound/pci/hda/patch_analog.c2
-rw-r--r--sound/pci/hda/patch_realtek.c2
-rw-r--r--sound/pci/hda/patch_sigmatel.c10
-rw-r--r--sound/pci/hda/patch_via.c2
6 files changed, 22 insertions, 4 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 1ed1d88e1834..d71e651046eb 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1523,6 +1523,11 @@ int snd_hda_ctl_add(struct hda_codec *codec, hda_nid_t nid,
1523 int err; 1523 int err;
1524 struct hda_nid_item *item; 1524 struct hda_nid_item *item;
1525 1525
1526 if (kctl->id.subdevice & (1<<31)) {
1527 if (nid == 0)
1528 nid = kctl->id.subdevice & 0xffff;
1529 kctl->id.subdevice = 0;
1530 }
1526 err = snd_ctl_add(codec->bus->card, kctl); 1531 err = snd_ctl_add(codec->bus->card, kctl);
1527 if (err < 0) 1532 if (err < 0)
1528 return err; 1533 return err;
@@ -3160,7 +3165,7 @@ EXPORT_SYMBOL_HDA(snd_hda_check_board_codec_sid_config);
3160 */ 3165 */
3161int snd_hda_add_new_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew) 3166int snd_hda_add_new_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew)
3162{ 3167{
3163 int err; 3168 int err;
3164 3169
3165 for (; knew->name; knew++) { 3170 for (; knew->name; knew++) {
3166 struct snd_kcontrol *kctl; 3171 struct snd_kcontrol *kctl;
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index e6a0918f70d3..3bfcf42ff6cf 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -33,6 +33,7 @@
33/* mono volume with index (index=0,1,...) (channel=1,2) */ 33/* mono volume with index (index=0,1,...) (channel=1,2) */
34#define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ 34#define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \
35 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ 35 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \
36 .subdevice = (1<<31)|(nid), \
36 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ 37 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \
37 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 38 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
38 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ 39 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \
@@ -53,6 +54,7 @@
53/* mono mute switch with index (index=0,1,...) (channel=1,2) */ 54/* mono mute switch with index (index=0,1,...) (channel=1,2) */
54#define HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ 55#define HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \
55 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ 56 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \
57 .subdevice = (1<<31)|(nid), \
56 .info = snd_hda_mixer_amp_switch_info, \ 58 .info = snd_hda_mixer_amp_switch_info, \
57 .get = snd_hda_mixer_amp_switch_get, \ 59 .get = snd_hda_mixer_amp_switch_get, \
58 .put = snd_hda_mixer_amp_switch_put, \ 60 .put = snd_hda_mixer_amp_switch_put, \
@@ -69,6 +71,7 @@
69/* special beep mono mute switch with index (index=0,1,...) (channel=1,2) */ 71/* special beep mono mute switch with index (index=0,1,...) (channel=1,2) */
70#define HDA_CODEC_MUTE_BEEP_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ 72#define HDA_CODEC_MUTE_BEEP_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \
71 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ 73 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \
74 .subdevice = (1<<31)|(nid), \
72 .info = snd_hda_mixer_amp_switch_info, \ 75 .info = snd_hda_mixer_amp_switch_info, \
73 .get = snd_hda_mixer_amp_switch_get, \ 76 .get = snd_hda_mixer_amp_switch_get, \
74 .put = snd_hda_mixer_amp_switch_put_beep, \ 77 .put = snd_hda_mixer_amp_switch_put_beep, \
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index ef3383912b6e..2d345606265b 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -2571,6 +2571,8 @@ static int add_control(struct ad198x_spec *spec, int type, const char *name,
2571 knew->name = kstrdup(name, GFP_KERNEL); 2571 knew->name = kstrdup(name, GFP_KERNEL);
2572 if (! knew->name) 2572 if (! knew->name)
2573 return -ENOMEM; 2573 return -ENOMEM;
2574 if (get_amp_nid_(val))
2575 knew->subdevice = (1<<31)|get_amp_nid_(val);
2574 knew->private_value = val; 2576 knew->private_value = val;
2575 return 0; 2577 return 0;
2576} 2578}
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index fff9de245646..c0a98e724a25 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4323,6 +4323,8 @@ static int add_control(struct alc_spec *spec, int type, const char *name,
4323 knew->name = kstrdup(name, GFP_KERNEL); 4323 knew->name = kstrdup(name, GFP_KERNEL);
4324 if (!knew->name) 4324 if (!knew->name)
4325 return -ENOMEM; 4325 return -ENOMEM;
4326 if (get_amp_nid_(val))
4327 knew->subdevice = (1<<31)|get_amp_nid_(val);
4326 knew->private_value = val; 4328 knew->private_value = val;
4327 return 0; 4329 return 0;
4328} 4330}
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index a3872b90d6ed..d2ddb959c290 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -2671,7 +2671,8 @@ static struct snd_kcontrol_new stac92xx_control_templates[] = {
2671static struct snd_kcontrol_new * 2671static struct snd_kcontrol_new *
2672stac_control_new(struct sigmatel_spec *spec, 2672stac_control_new(struct sigmatel_spec *spec,
2673 struct snd_kcontrol_new *ktemp, 2673 struct snd_kcontrol_new *ktemp,
2674 const char *name) 2674 const char *name,
2675 hda_nid_t nid)
2675{ 2676{
2676 struct snd_kcontrol_new *knew; 2677 struct snd_kcontrol_new *knew;
2677 2678
@@ -2687,6 +2688,8 @@ stac_control_new(struct sigmatel_spec *spec,
2687 spec->kctls.alloced--; 2688 spec->kctls.alloced--;
2688 return NULL; 2689 return NULL;
2689 } 2690 }
2691 if (nid)
2692 knew->subdevice = (1<<31)|nid;
2690 return knew; 2693 return knew;
2691} 2694}
2692 2695
@@ -2695,7 +2698,8 @@ static int stac92xx_add_control_temp(struct sigmatel_spec *spec,
2695 int idx, const char *name, 2698 int idx, const char *name,
2696 unsigned long val) 2699 unsigned long val)
2697{ 2700{
2698 struct snd_kcontrol_new *knew = stac_control_new(spec, ktemp, name); 2701 struct snd_kcontrol_new *knew = stac_control_new(spec, ktemp, name,
2702 get_amp_nid_(val));
2699 if (!knew) 2703 if (!knew)
2700 return -ENOMEM; 2704 return -ENOMEM;
2701 knew->index = idx; 2705 knew->index = idx;
@@ -2766,7 +2770,7 @@ static int stac92xx_add_input_source(struct sigmatel_spec *spec)
2766 if (!spec->num_adcs || imux->num_items <= 1) 2770 if (!spec->num_adcs || imux->num_items <= 1)
2767 return 0; /* no need for input source control */ 2771 return 0; /* no need for input source control */
2768 knew = stac_control_new(spec, &stac_input_src_temp, 2772 knew = stac_control_new(spec, &stac_input_src_temp,
2769 stac_input_src_temp.name); 2773 stac_input_src_temp.name, 0);
2770 if (!knew) 2774 if (!knew)
2771 return -ENOMEM; 2775 return -ENOMEM;
2772 knew->count = spec->num_adcs; 2776 knew->count = spec->num_adcs;
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 5a856009c916..14219d898b2e 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -442,6 +442,8 @@ static int via_add_control(struct via_spec *spec, int type, const char *name,
442 knew->name = kstrdup(name, GFP_KERNEL); 442 knew->name = kstrdup(name, GFP_KERNEL);
443 if (!knew->name) 443 if (!knew->name)
444 return -ENOMEM; 444 return -ENOMEM;
445 if (get_amp_nid_(val))
446 knew->subdevice = (1<<31)|get_amp_nid_(val);
445 knew->private_value = val; 447 knew->private_value = val;
446 return 0; 448 return 0;
447} 449}