aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-02-23 03:45:59 -0500
committerTakashi Iwai <tiwai@suse.de>2009-02-23 03:45:59 -0500
commit5e7b8e0d87091ae21b291588817b5359a5e00795 (patch)
tree07bf1dd225eee4f6d3717738c454dd93481afd19 /sound/pci
parent346ff70fdbe9093947b9494fe714c89cafcceade (diff)
ALSA: hda - Make user_pin overriding the driver setup
Make user_pin overriding even the driver pincfg, e.g. the static / fixed pin config table in patch_sigmatel.c. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_codec.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index df9453d0122e..a13480fa8e74 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -739,7 +739,9 @@ int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list,
739 hda_nid_t nid, unsigned int cfg) 739 hda_nid_t nid, unsigned int cfg)
740{ 740{
741 struct hda_pincfg *pin; 741 struct hda_pincfg *pin;
742 unsigned int oldcfg;
742 743
744 oldcfg = snd_hda_codec_get_pincfg(codec, nid);
743 pin = look_up_pincfg(codec, list, nid); 745 pin = look_up_pincfg(codec, list, nid);
744 if (!pin) { 746 if (!pin) {
745 pin = snd_array_new(list); 747 pin = snd_array_new(list);
@@ -748,7 +750,13 @@ int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list,
748 pin->nid = nid; 750 pin->nid = nid;
749 } 751 }
750 pin->cfg = cfg; 752 pin->cfg = cfg;
751 set_pincfg(codec, nid, cfg); 753
754 /* change only when needed; e.g. if the pincfg is already present
755 * in user_pins[], don't write it
756 */
757 cfg = snd_hda_codec_get_pincfg(codec, nid);
758 if (oldcfg != cfg)
759 set_pincfg(codec, nid, cfg);
752 return 0; 760 return 0;
753} 761}
754 762
@@ -764,14 +772,14 @@ unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid)
764{ 772{
765 struct hda_pincfg *pin; 773 struct hda_pincfg *pin;
766 774
767 pin = look_up_pincfg(codec, &codec->driver_pins, nid);
768 if (pin)
769 return pin->cfg;
770#ifdef CONFIG_SND_HDA_HWDEP 775#ifdef CONFIG_SND_HDA_HWDEP
771 pin = look_up_pincfg(codec, &codec->user_pins, nid); 776 pin = look_up_pincfg(codec, &codec->user_pins, nid);
772 if (pin) 777 if (pin)
773 return pin->cfg; 778 return pin->cfg;
774#endif 779#endif
780 pin = look_up_pincfg(codec, &codec->driver_pins, nid);
781 if (pin)
782 return pin->cfg;
775 pin = look_up_pincfg(codec, &codec->init_pins, nid); 783 pin = look_up_pincfg(codec, &codec->init_pins, nid);
776 if (pin) 784 if (pin)
777 return pin->cfg; 785 return pin->cfg;