Commit 5e7b8e0d authored by Takashi Iwai's avatar Takashi Iwai

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: default avatarTakashi Iwai <tiwai@suse.de>
parent 346ff70f
...@@ -380,7 +380,8 @@ user_pin_configs:: ...@@ -380,7 +380,8 @@ user_pin_configs::
Shows the pin default config values to override the BIOS setup. Shows the pin default config values to override the BIOS setup.
Writing this (with two numbers, NID and value) appends the new Writing this (with two numbers, NID and value) appends the new
value. The given will be used instead of the initial BIOS value at value. The given will be used instead of the initial BIOS value at
the next reconfiguration time. the next reconfiguration time. Note that this config will override
even the driver pin configs, too.
reconfig:: reconfig::
Triggers the codec re-configuration. When any value is written to Triggers the codec re-configuration. When any value is written to
this file, the driver re-initialize and parses the codec tree this file, the driver re-initialize and parses the codec tree
......
...@@ -739,7 +739,9 @@ int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list, ...@@ -739,7 +739,9 @@ int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list,
hda_nid_t nid, unsigned int cfg) hda_nid_t nid, unsigned int cfg)
{ {
struct hda_pincfg *pin; struct hda_pincfg *pin;
unsigned int oldcfg;
oldcfg = snd_hda_codec_get_pincfg(codec, nid);
pin = look_up_pincfg(codec, list, nid); pin = look_up_pincfg(codec, list, nid);
if (!pin) { if (!pin) {
pin = snd_array_new(list); pin = snd_array_new(list);
...@@ -748,7 +750,13 @@ int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list, ...@@ -748,7 +750,13 @@ int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list,
pin->nid = nid; pin->nid = nid;
} }
pin->cfg = cfg; pin->cfg = cfg;
set_pincfg(codec, nid, cfg);
/* change only when needed; e.g. if the pincfg is already present
* in user_pins[], don't write it
*/
cfg = snd_hda_codec_get_pincfg(codec, nid);
if (oldcfg != cfg)
set_pincfg(codec, nid, cfg);
return 0; return 0;
} }
...@@ -764,14 +772,14 @@ unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid) ...@@ -764,14 +772,14 @@ unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid)
{ {
struct hda_pincfg *pin; struct hda_pincfg *pin;
pin = look_up_pincfg(codec, &codec->driver_pins, nid);
if (pin)
return pin->cfg;
#ifdef CONFIG_SND_HDA_HWDEP #ifdef CONFIG_SND_HDA_HWDEP
pin = look_up_pincfg(codec, &codec->user_pins, nid); pin = look_up_pincfg(codec, &codec->user_pins, nid);
if (pin) if (pin)
return pin->cfg; return pin->cfg;
#endif #endif
pin = look_up_pincfg(codec, &codec->driver_pins, nid);
if (pin)
return pin->cfg;
pin = look_up_pincfg(codec, &codec->init_pins, nid); pin = look_up_pincfg(codec, &codec->init_pins, nid);
if (pin) if (pin)
return pin->cfg; return pin->cfg;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment