Skip to content

Commit

Permalink
ALSA: hda - Fix runtime PM
Browse files Browse the repository at this point in the history
Before commit 3b5b899 ("ALSA: hda: Make use of core codec functions
to sync power state"), hda_set_power_state() returned the response to
the Get Power State verb, a 32-bit unsigned integer whose expected value
is 0x233 after transitioning a codec to D3, and 0x0 after transitioning
it to D0.

The response value is significant because hda_codec_runtime_suspend()
does not clear the codec's bit in the codec_powered bitmask unless the
AC_PWRST_CLK_STOP_OK bit (0x200) is set in the response value.  That in
turn prevents the HDA controller from runtime suspending because
azx_runtime_idle() checks that the codec_powered bitmask is zero.

Since commit 3b5b899, hda_set_power_state() only returns 0x0 or
0x1, thereby breaking runtime PM for any HDA controller.  That's because
an inline function introduced by the commit returns a bool instead of a
32-bit unsigned int.  The change was likely erroneous and resulted from
copying and pasting snd_hda_check_power_state(), which is immediately
preceding the newly introduced inline function.  Fix it.

Link: https://bugs.freedesktop.org/show_bug.cgi?id=106597
Fixes: 3b5b899 ("ALSA: hda: Make use of core codec functions to sync power state")
Cc: Alex Deucher <[email protected]>
Cc: Abhijeet Kumar <[email protected]>
Reported-and-tested-by: Gunnar Krüger <[email protected]>
Signed-off-by: Lukas Wunner <[email protected]>
Acked-by: Alex Deucher <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
l1k authored and tiwai committed May 24, 2018
1 parent 3ae1809 commit 009f8c9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sound/pci/hda/hda_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,10 @@ snd_hda_check_power_state(struct hda_codec *codec, hda_nid_t nid,
{
return snd_hdac_check_power_state(&codec->core, nid, target_state);
}
static inline bool snd_hda_sync_power_state(struct hda_codec *codec,
hda_nid_t nid, unsigned int target_state)

static inline unsigned int snd_hda_sync_power_state(struct hda_codec *codec,
hda_nid_t nid,
unsigned int target_state)
{
return snd_hdac_sync_power_state(&codec->core, nid, target_state);
}
Expand Down

0 comments on commit 009f8c9

Please sign in to comment.