ALSA: hda - add new function snd_hda_bus_reset() for codec communitation error
PATCH 1/3 ALSA: hda - add new function snd_hda_bus_reset() for codec communitation error
From: Mengdong Lin <[email protected]>
A new function snd_hda_bus_reset() is defined to suspend and resume all codecs on the hda bus. It will be called by bus reset ops azx_bus_reset() as a rescue of codec communitation error.
snd_hda_suspend & snd_hda_resume will no longer be called by azx_bus_reset. So snd_hda_resume will only be used in system resume and may delay resuming a codec.
sound/pci/hda/hda_codec.c +20 -0
@@ -5523,6 +5523,26 @@ int snd_hda_resume(struct hda_bus *bus) return 0; }EXPORT_SYMBOL_HDA (snd_hda_resume); + +/** +* snd_hda_bus_reset - reset the codecs, i.e. suspend and resume the codecs +* @bus: the HDA bus +* +* Returns 0 if successful. +*/ +int snd_hda_bus_reset (struct hda_bus *bus) +{ +struct hda_codec *codec; + +list_for_each_entry (codec, &bus->codec_list, list) { +cancel_delayed_work_sync (&codec->jackpoll_work); +if (hda_codec_is_power_on (codec)) +hda_call_codec_suspend (codec, false); +hda_call_codec_resume (codec); + } +return 0 ; +} +EXPORT_SYMBOL_HDA (snd_hda_bus_reset);#endif /* CONFIG_PM */ /*
sound/pci/hda/hda_codec.h +1 -0
@@ -1076,6 +1076,7 @@ void snd_hda_unlock_devices(struct hda_bus *bus);#ifdef CONFIG_PM int snd_hda_suspend (struct hda_bus *bus);int snd_hda_resume (struct hda_bus *bus); +int snd_hda_bus_reset (struct hda_bus *bus);#endif static inline
sound/pci/hda/hda_intel.c +1 -2
@@ -1659,8 +1659,7 @@ static void azx_bus_reset(struct hda_bus *bus)struct azx_pcm *p;list_for_each_entry (p, &chip->pcm_list, list)snd_pcm_suspend_all (p->pcm); -snd_hda_suspend (chip->bus); - snd_hda_resume(chip->bus); + snd_hda_bus_reset(chip->bus); }#endif bus->in_reset =0 ;
Signature · 1 line
1.7.10.4
At Mon, 8 Apr 2013 13:53:44 -0400,
Quoted 5 lines · [email protected] wrote:
From: Mengdong Lin <[email protected]>
A new function
snd_hda_bus_reset()is defined to suspend and resume all codecs on the hda bus.
You mixed up the result and the purpose in the description :)
The purpose of snd_hda_bus_reset() is to reset the codecs on the bus, and eventually this is implemented as temporary suspend-and-resume calls as an ad hoc solution.
Quoted 6 lines
It will be called by bus reset ops
azx_bus_reset()as a rescue of codec communitation error.
snd_hda_suspend&snd_hda_resumewill no longer be called byazx_bus_reset. Sosnd_hda_resumewill only be used in system resume and may delay resuming a codec.
And write why this movement is needed.
Takashi
Quoted 62 lines
Signed-off-by Mengdong Lin <[email protected]>sound/pci/hda/hda_codec.c +20
-0@@ -5523,6 +5523,26 @@ int snd_hda_resume(struct hda_bus *bus) return 0; }EXPORT_SYMBOL_HDA (snd_hda_resume); + +/** +* snd_hda_bus_reset - reset the codecs, i.e. suspend and resume the codecs +* @bus: the HDA bus +* +* Returns 0 if successful. +*/ +int snd_hda_bus_reset (struct hda_bus *bus) +{ +struct hda_codec *codec; + +list_for_each_entry (codec, &bus->codec_list, list) { +cancel_delayed_work_sync (&codec->jackpoll_work); +if (hda_codec_is_power_on (codec)) +hda_call_codec_suspend (codec, false); +hda_call_codec_resume (codec); + } +return 0 ; +} +EXPORT_SYMBOL_HDA (snd_hda_bus_reset);#endif /* CONFIG_PM */ /* sound/pci/hda/hda_codec.h +1
-0@@ -1076,6 +1076,7 @@ void snd_hda_unlock_devices(struct hda_bus *bus);#ifdef CONFIG_PM int snd_hda_suspend (struct hda_bus *bus);int snd_hda_resume (struct hda_bus *bus); +int snd_hda_bus_reset (struct hda_bus *bus);#endif static inlinesound/pci/hda/hda_intel.c +1
-2@@ -1659,8 +1659,7 @@ static void azx_bus_reset(struct hda_bus *bus)struct azx_pcm *p;list_for_each_entry (p, &chip->pcm_list, list)snd_pcm_suspend_all (p->pcm); -snd_hda_suspend (chip->bus); - snd_hda_resume(chip->bus); + snd_hda_bus_reset(chip->bus); }#endif bus->in_reset =0 ;Signature · 1 line
1.7.10.4