diff options
author | Jaroslav Kysela <perex@perex.cz> | 2009-11-11 07:43:01 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-11-16 05:35:14 -0500 |
commit | 3911a4c19e927738766003839aa447becbdbaa27 (patch) | |
tree | 7a9dc03cfc6776a57a6e459cd4efe5d8e16797cd /sound/pci/hda/hda_codec.c | |
parent | 2dca0bba70ce3c233be152e384580c134935332d (diff) |
ALSA: hda - proc - introduce Control: lines to show mixer<->NID assignment
This is an initial patch to show universal control<->NID assigment in
proc codec file. The change helps to debug codec related problems.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 7fd2abe1129d..1ed1d88e1834 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -946,7 +946,7 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr | |||
946 | mutex_init(&codec->control_mutex); | 946 | mutex_init(&codec->control_mutex); |
947 | init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info)); | 947 | init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info)); |
948 | init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); | 948 | init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); |
949 | snd_array_init(&codec->mixers, sizeof(struct snd_kcontrol *), 32); | 949 | snd_array_init(&codec->mixers, sizeof(struct hda_nid_item), 60); |
950 | snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16); | 950 | snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16); |
951 | snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16); | 951 | snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16); |
952 | if (codec->bus->modelname) { | 952 | if (codec->bus->modelname) { |
@@ -1517,18 +1517,20 @@ struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec, | |||
1517 | EXPORT_SYMBOL_HDA(snd_hda_find_mixer_ctl); | 1517 | EXPORT_SYMBOL_HDA(snd_hda_find_mixer_ctl); |
1518 | 1518 | ||
1519 | /* Add a control element and assign to the codec */ | 1519 | /* Add a control element and assign to the codec */ |
1520 | int snd_hda_ctl_add(struct hda_codec *codec, struct snd_kcontrol *kctl) | 1520 | int snd_hda_ctl_add(struct hda_codec *codec, hda_nid_t nid, |
1521 | struct snd_kcontrol *kctl) | ||
1521 | { | 1522 | { |
1522 | int err; | 1523 | int err; |
1523 | struct snd_kcontrol **knewp; | 1524 | struct hda_nid_item *item; |
1524 | 1525 | ||
1525 | err = snd_ctl_add(codec->bus->card, kctl); | 1526 | err = snd_ctl_add(codec->bus->card, kctl); |
1526 | if (err < 0) | 1527 | if (err < 0) |
1527 | return err; | 1528 | return err; |
1528 | knewp = snd_array_new(&codec->mixers); | 1529 | item = snd_array_new(&codec->mixers); |
1529 | if (!knewp) | 1530 | if (!item) |
1530 | return -ENOMEM; | 1531 | return -ENOMEM; |
1531 | *knewp = kctl; | 1532 | item->kctl = kctl; |
1533 | item->nid = nid; | ||
1532 | return 0; | 1534 | return 0; |
1533 | } | 1535 | } |
1534 | EXPORT_SYMBOL_HDA(snd_hda_ctl_add); | 1536 | EXPORT_SYMBOL_HDA(snd_hda_ctl_add); |
@@ -1537,9 +1539,9 @@ EXPORT_SYMBOL_HDA(snd_hda_ctl_add); | |||
1537 | void snd_hda_ctls_clear(struct hda_codec *codec) | 1539 | void snd_hda_ctls_clear(struct hda_codec *codec) |
1538 | { | 1540 | { |
1539 | int i; | 1541 | int i; |
1540 | struct snd_kcontrol **kctls = codec->mixers.list; | 1542 | struct hda_nid_item *items = codec->mixers.list; |
1541 | for (i = 0; i < codec->mixers.used; i++) | 1543 | for (i = 0; i < codec->mixers.used; i++) |
1542 | snd_ctl_remove(codec->bus->card, kctls[i]); | 1544 | snd_ctl_remove(codec->bus->card, items[i].kctl); |
1543 | snd_array_free(&codec->mixers); | 1545 | snd_array_free(&codec->mixers); |
1544 | } | 1546 | } |
1545 | 1547 | ||
@@ -1645,7 +1647,7 @@ int snd_hda_add_vmaster(struct hda_codec *codec, char *name, | |||
1645 | kctl = snd_ctl_make_virtual_master(name, tlv); | 1647 | kctl = snd_ctl_make_virtual_master(name, tlv); |
1646 | if (!kctl) | 1648 | if (!kctl) |
1647 | return -ENOMEM; | 1649 | return -ENOMEM; |
1648 | err = snd_hda_ctl_add(codec, kctl); | 1650 | err = snd_hda_ctl_add(codec, 0, kctl); |
1649 | if (err < 0) | 1651 | if (err < 0) |
1650 | return err; | 1652 | return err; |
1651 | 1653 | ||
@@ -2139,7 +2141,7 @@ int snd_hda_create_spdif_out_ctls(struct hda_codec *codec, hda_nid_t nid) | |||
2139 | return -ENOMEM; | 2141 | return -ENOMEM; |
2140 | kctl->id.index = idx; | 2142 | kctl->id.index = idx; |
2141 | kctl->private_value = nid; | 2143 | kctl->private_value = nid; |
2142 | err = snd_hda_ctl_add(codec, kctl); | 2144 | err = snd_hda_ctl_add(codec, nid, kctl); |
2143 | if (err < 0) | 2145 | if (err < 0) |
2144 | return err; | 2146 | return err; |
2145 | } | 2147 | } |
@@ -2184,8 +2186,8 @@ int snd_hda_create_spdif_share_sw(struct hda_codec *codec, | |||
2184 | if (!mout->dig_out_nid) | 2186 | if (!mout->dig_out_nid) |
2185 | return 0; | 2187 | return 0; |
2186 | /* ATTENTION: here mout is passed as private_data, instead of codec */ | 2188 | /* ATTENTION: here mout is passed as private_data, instead of codec */ |
2187 | return snd_hda_ctl_add(codec, | 2189 | return snd_hda_ctl_add(codec, mout->dig_out_nid, |
2188 | snd_ctl_new1(&spdif_share_sw, mout)); | 2190 | snd_ctl_new1(&spdif_share_sw, mout)); |
2189 | } | 2191 | } |
2190 | EXPORT_SYMBOL_HDA(snd_hda_create_spdif_share_sw); | 2192 | EXPORT_SYMBOL_HDA(snd_hda_create_spdif_share_sw); |
2191 | 2193 | ||
@@ -2289,7 +2291,7 @@ int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid) | |||
2289 | if (!kctl) | 2291 | if (!kctl) |
2290 | return -ENOMEM; | 2292 | return -ENOMEM; |
2291 | kctl->private_value = nid; | 2293 | kctl->private_value = nid; |
2292 | err = snd_hda_ctl_add(codec, kctl); | 2294 | err = snd_hda_ctl_add(codec, nid, kctl); |
2293 | if (err < 0) | 2295 | if (err < 0) |
2294 | return err; | 2296 | return err; |
2295 | } | 2297 | } |
@@ -3165,7 +3167,7 @@ int snd_hda_add_new_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew) | |||
3165 | kctl = snd_ctl_new1(knew, codec); | 3167 | kctl = snd_ctl_new1(knew, codec); |
3166 | if (!kctl) | 3168 | if (!kctl) |
3167 | return -ENOMEM; | 3169 | return -ENOMEM; |
3168 | err = snd_hda_ctl_add(codec, kctl); | 3170 | err = snd_hda_ctl_add(codec, 0, kctl); |
3169 | if (err < 0) { | 3171 | if (err < 0) { |
3170 | if (!codec->addr) | 3172 | if (!codec->addr) |
3171 | return err; | 3173 | return err; |
@@ -3173,7 +3175,7 @@ int snd_hda_add_new_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew) | |||
3173 | if (!kctl) | 3175 | if (!kctl) |
3174 | return -ENOMEM; | 3176 | return -ENOMEM; |
3175 | kctl->id.device = codec->addr; | 3177 | kctl->id.device = codec->addr; |
3176 | err = snd_hda_ctl_add(codec, kctl); | 3178 | err = snd_hda_ctl_add(codec, 0, kctl); |
3177 | if (err < 0) | 3179 | if (err < 0) |
3178 | return err; | 3180 | return err; |
3179 | } | 3181 | } |