aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/sound/alsa/HD-Audio.txt3
-rw-r--r--sound/pci/hda/hda_codec.c16
2 files changed, 14 insertions, 5 deletions
diff --git a/Documentation/sound/alsa/HD-Audio.txt b/Documentation/sound/alsa/HD-Audio.txt
index f590850c149f..a4e5ef87af6b 100644
--- a/Documentation/sound/alsa/HD-Audio.txt
+++ b/Documentation/sound/alsa/HD-Audio.txt
@@ -380,7 +380,8 @@ user_pin_configs::
380 Shows the pin default config values to override the BIOS setup. 380 Shows the pin default config values to override the BIOS setup.
381 Writing this (with two numbers, NID and value) appends the new 381 Writing this (with two numbers, NID and value) appends the new
382 value. The given will be used instead of the initial BIOS value at 382 value. The given will be used instead of the initial BIOS value at
383 the next reconfiguration time. 383 the next reconfiguration time. Note that this config will override
384 even the driver pin configs, too.
384reconfig:: 385reconfig::
385 Triggers the codec re-configuration. When any value is written to 386 Triggers the codec re-configuration. When any value is written to
386 this file, the driver re-initialize and parses the codec tree 387 this file, the driver re-initialize and parses the codec tree
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;