ALSA: hda: Retry codec read on first time failure
PATCH v2 1/1 ALSA: hda: Retry codec read on first time failure
From: Vani Ganji <[email protected]>
Sometimes HDMI audio fails while fast switching
between HDMI and Speaker due to codec Get Power state verb read failure.
Verb is codec driver to access codec HW. Since issue scenario involves fast switching between HDMI and speaker, there might be chance to fail read from HW and same happened in the error scenario.
Based on Display/Graphics architect suggestion, added a retry mechanism for failure on first attempt.
Changes from v1:
-Corrected missing braces.
--- sound/hda/hdac_device.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
sound/hda/hdac_device.c +11 -4
@@ -984,10 +984,17 @@ static unsigned int codec_read(struct hdac_device *hdac, hda_nid_t nid, {unsigned int cmd =snd_hdac_make_cmd (hdac, nid, verb, parm);unsigned int res; - -if (snd_hdac_exec_verb (hdac, cmd, flags, &res)) -return -1 ; - +unsigned int count; + +/* Retry verb once more if it fails first time */ +/* recommended to retry since it is HW related */ +for (count =0 ; count <=1 ; count++) { +if (snd_hdac_exec_verb (hdac, cmd, flags, &res)) { +if (count ==1 ) +return -1 ; + }else +break ; + }return res; }
Signature · 1 line
2.17.1
Quoted 10 lines · On Fri, 30 Aug 2019 07:23:18 +0200, [email protected] wrote:
From: Vani Ganji <[email protected]>
Sometimes HDMI audio fails while fast switching
between HDMI and Speaker due to codec Get Power state verb read failure.Verb is codec driver to access codec HW. Since issue scenario involves fast switching between HDMI and speaker, there might be chance to fail read from HW and same happened in the error scenario.
Quoted 7 lines
Based on Display/Graphics architect suggestion, added a retry mechanism for failure on first attempt.
Changes from v1:
-Corrected missing braces.Signed-off-by Vani Ganji <[email protected]>
Do you still need this even with the very latest upstream code? As mentioned, the recent change to use the sync-write should reduce such errors.
If it's about the SOF/SST, you can try to set the hdac_bus.sync_write flag in the corresponding drivers, too.
thanks,
Takashi
Quoted 38 lines
--- sound/hda/hdac_device.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)sound/hda/hdac_device.c +11
-4@@ -984,10 +984,17 @@ static unsigned int codec_read(struct hdac_device *hdac, hda_nid_t nid, {unsigned int cmd =snd_hdac_make_cmd (hdac, nid, verb, parm);unsigned int res; - -if (snd_hdac_exec_verb (hdac, cmd, flags, &res)) -return -1 ; - +unsigned int count; + +/* Retry verb once more if it fails first time */ +/* recommended to retry since it is HW related */ +for (count =0 ; count <=1 ; count++) { +if (snd_hdac_exec_verb (hdac, cmd, flags, &res)) { +if (count ==1 ) +return -1 ; + }else +break ; + }return res; }Signature · 6 lines
2.17.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel