Skip to content

Commit d545a57

Browse files
committed
ALSA: hda - Sync node attributes at resume from widget power saving
So far we assumed that the node attributes like amp values remain during the power state transition of the node itself. While this is true for IDT/STAC codecs I've tested, but some other codecs don't seem behaving in that way. This patch implements a partial sync mechanism specific to the given widget node. Now we've merged the regmap support, and it can be easily written with regcache_sync_region(). Tested-by: Hui Wang <hui.wang@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 664bc5c commit d545a57

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

include/sound/hda_regmap.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,16 @@ snd_hdac_regmap_update_amp_stereo(struct hdac_device *codec, hda_nid_t nid,
202202
return snd_hdac_regmap_update_raw(codec, cmd, mask, val);
203203
}
204204

205+
/**
206+
* snd_hdac_regmap_sync_node - sync the widget node attributes
207+
* @codec: HD-audio codec
208+
* @nid: NID to sync
209+
*/
210+
static inline void
211+
snd_hdac_regmap_sync_node(struct hdac_device *codec, hda_nid_t nid)
212+
{
213+
regcache_mark_dirty(codec->regmap);
214+
regcache_sync_region(codec->regmap, nid << 20, ((nid + 1) << 20) - 1);
215+
}
216+
205217
#endif /* __SOUND_HDA_REGMAP_H */

sound/pci/hda/hda_generic.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -842,10 +842,8 @@ static hda_nid_t path_power_update(struct hda_codec *codec,
842842
snd_hda_codec_write(codec, nid, 0,
843843
AC_VERB_SET_POWER_STATE, state);
844844
changed = nid;
845-
/* here we assume that widget attributes (e.g. amp,
846-
* pinctl connection) don't change with local power
847-
* state change. If not, need to sync the cache.
848-
*/
845+
if (state == AC_PWRST_D0)
846+
snd_hdac_regmap_sync_node(&codec->core, nid);
849847
}
850848
}
851849
return changed;

0 commit comments

Comments
 (0)