Commit d545a57c authored by Takashi Iwai's avatar Takashi Iwai

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: default avatarHui Wang <hui.wang@canonical.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 664bc5c5
...@@ -202,4 +202,16 @@ snd_hdac_regmap_update_amp_stereo(struct hdac_device *codec, hda_nid_t nid, ...@@ -202,4 +202,16 @@ snd_hdac_regmap_update_amp_stereo(struct hdac_device *codec, hda_nid_t nid,
return snd_hdac_regmap_update_raw(codec, cmd, mask, val); return snd_hdac_regmap_update_raw(codec, cmd, mask, val);
} }
/**
* snd_hdac_regmap_sync_node - sync the widget node attributes
* @codec: HD-audio codec
* @nid: NID to sync
*/
static inline void
snd_hdac_regmap_sync_node(struct hdac_device *codec, hda_nid_t nid)
{
regcache_mark_dirty(codec->regmap);
regcache_sync_region(codec->regmap, nid << 20, ((nid + 1) << 20) - 1);
}
#endif /* __SOUND_HDA_REGMAP_H */ #endif /* __SOUND_HDA_REGMAP_H */
...@@ -842,10 +842,8 @@ static hda_nid_t path_power_update(struct hda_codec *codec, ...@@ -842,10 +842,8 @@ static hda_nid_t path_power_update(struct hda_codec *codec,
snd_hda_codec_write(codec, nid, 0, snd_hda_codec_write(codec, nid, 0,
AC_VERB_SET_POWER_STATE, state); AC_VERB_SET_POWER_STATE, state);
changed = nid; changed = nid;
/* here we assume that widget attributes (e.g. amp, if (state == AC_PWRST_D0)
* pinctl connection) don't change with local power snd_hdac_regmap_sync_node(&codec->core, nid);
* state change. If not, need to sync the cache.
*/
} }
} }
return changed; return changed;
......
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