ALSA: hda - Check all inputs for is_active_nid_for_any()
PATCH 1/2 ALSA: hda - Check all inputs for is_active_nid_for_any()
The is_active_nid_for_any() function in the generic parser is supposed to check all connections from/to the given widget, but the current code checks only the first input connection (index = 0).
This patch corrects the code to check all inputs by passing -1 to index argument.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=102521
--- sound/pci/hda/hda_generic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/pci/hda/hda_generic.c +3 -2
@@ -671,7 +671,8 @@ static bool is_active_nid(struct hda_codec *codec, hda_nid_t nid, }for (i =0 ; i < path->depth; i++) {if (path->path[i] == nid) { -if (dir ==HDA_OUTPUT || path->idx[i] == idx) +if (dir ==HDA_OUTPUT || idx ==-1 || + path->idx[i] == idx)return true;break ; }
@@ -682,7 +683,7 @@ static bool is_active_nid(struct hda_codec *codec, hda_nid_t nid,/* check whether the NID is referred by any active paths */ #define is_active_nid_for_any (codec, nid) \ - is_active_nid(codec, nid, HDA_OUTPUT, 0) + is_active_nid(codec, nid, HDA_OUTPUT, -1)/* get the default amp value for the target state */ static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t nid,
Signature · 1 line
2.5.0
PATCH 2/2 ALSA: hda - Fix path power activation
The widget power-saving code tries to turn up/down the power of each widget in the I/O paths that are modified at each jack plug/unplug. The recent report revealed that the power activation leaves some widgets unpowered after plugging. This is because snd_hda_activate_path() turns on path->active flag at the end of the function while the path power management is done before that. Then it's regarded as if nothing is active, and the driver turns off the power.
The fix is simply to set the flag at the beginning of the function, before trying to power up.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=102521
--- sound/pci/hda/hda_generic.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
sound/pci/hda/hda_generic.c +1 -5
@@ -884,8 +884,7 @@ void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path,struct hda_gen_spec *spec = codec->spec;int i; -if (!enable) - path->active = false; + path->active = enable;/* make sure the widget is powered up */ if (enable && (spec->power_down_unused || codec->power_save_node))
@@ -903,9 +902,6 @@ void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path,if (has_amp_out (codec, path, i))activate_amp_out (codec, path, i, enable); } - -if (enable) - path->active = true; }EXPORT_SYMBOL_GPL (snd_hda_activate_path);
Signature · 1 line
2.5.0