ASoC: omap-mcbsp: Add PM QoS support for McBSP to prevent glitches
PATCH v6 1/1 ASoC: omap-mcbsp: Add PM QoS support for McBSP to prevent glitches
We can get audio errors if hitting deeper idle states on omaps:
[alsa.c:230] error: Fatal problem with alsa output, error -5. [audio.c:614] error: Error in writing audio (Input/output error?)!
This seems to happen with off mode idle enabled as power for the whole SoC may get cut off between filling the McBSP fifo using DMA. While active DMA blocks deeper idle states in hardware, McBSP activity does not seem to do so.
Basing the QoS latency calculation on the FIFO size, threshold, sample rate, and channels.
Based on the original patch by Tony Lindgren
---
Changes from v1:
* add calculations for latency per number of FIFO locations
Changes from v2:
* add missing mcbsp.h header change
Changes from v3:
* base the latency calculations on threshold, buffer size, sample rate, and channels
Changes from v4:
* using Peter Ujfalusi's suggestions for restoring a higher latency on audio stream completion, or if not applicable remove the QoS request
Changes from v5:
* clean up latency checking logic
* move logic to .prepare and .shutdown to avoid functions that can sleep
Changes from v6:
* move QoS removal to asoc_mcbsp_remove from omap_mcbsp_cleanup
sound/soc/omap/mcbsp.c | 1 + sound/soc/omap/mcbsp.h | 3 +++ sound/soc/omap/omap-mcbsp.c | 47 ++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 50 insertions(+), 1 deletion(-)
sound/soc/omap/mcbsp.c +1 -0
@@ -25,6 +25,7 @@#include <linux/io.h> #include <linux/slab.h> #include <linux/pm_runtime.h> +#include <linux/pm_qos.h> #include <linux/platform_data/asoc-ti-mcbsp.h>
sound/soc/omap/mcbsp.h +3 -0
@@ -323,8 +323,11 @@ struct omap_mcbsp {unsigned int fmt;unsigned int in_freq; +unsigned int latency[2 ];int clk_div;int wlen; + +struct pm_qos_request pm_qos_req; }; void omap_mcbsp_config(struct omap_mcbsp *mcbsp,
sound/soc/omap/omap-mcbsp.c +46 -1
89 lines not on this page · raw message
Signature · 1 line
2.10.2
Quoted 34 lines · Matt Ranostay
We can get audio errors if hitting deeper idle states on omaps:
[alsa.c:230] error: Fatal problem with alsa output, error -5. [audio.c:614] error: Error in writing audio (Input/output error?)!
This seems to happen with off mode idle enabled as power for the whole SoC may get cut off between filling the McBSP fifo using DMA. While active DMA blocks deeper idle states in hardware, McBSP activity does not seem to do so.
Basing the QoS latency calculation on the FIFO size, threshold, sample rate, and channels.
Based on the original patch by Tony Lindgren
Cc Tony Lindgren <[email protected]>Cc Peter Ujfalusi <[email protected]>Signed-off-by Matt Ranostay <[email protected]>---
Changes from v1:
* add calculations for latency per number of FIFO locationsChanges from v2:
* add missingmcbsp.hheader changeChanges from v3:
* base the latency calculations on threshold, buffer size, sample rate, and channelsChanges from v4:
* using Peter Ujfalusi's suggestions for restoring a higher latency on audio stream completion, or if not applicable remove the QoS request
Quoted 6 lines
Changes from v5:
* clean up latency checking logic
* move logic to .prepare and .shutdown to avoid functions that can sleepChanges from v6:
* move QoS removal toasoc_mcbsp_removefromomap_mcbsp_cleanup
Looks good.
You can add my
to v7...
Quoted 11 lines
sound/soc/omap/mcbsp.c | 1 + sound/soc/omap/mcbsp.h | 3 +++ sound/soc/omap/omap-mcbsp.c | 47 ++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 50 insertions(+), 1 deletion(-)sound/soc/omap/mcbsp.c +0
-0
sound/soc/omap/mcbsp.c line 28
Quoted 4 lines
sound/soc/omap/mcbsp.c +1
-0@@ -25,6 +25,7 @@#include <linux/io.h> #include <linux/slab.h> #include <linux/pm_runtime.h> +#include <linux/pm_qos.h>
Which would not add this include line ;)
Quoted 3 lines
sound/soc/omap/mcbsp.c +0
-0#include <linux/platform_data/asoc-ti-mcbsp.h>
Signature · 1 line
Péter
Quoted 42 lines · Peter Ujfalusi
Quoted 34 lines · Matt Ranostay
We can get audio errors if hitting deeper idle states on omaps:
[alsa.c:230] error: Fatal problem with alsa output, error -5. [audio.c:614] error: Error in writing audio (Input/output error?)!
This seems to happen with off mode idle enabled as power for the whole SoC may get cut off between filling the McBSP fifo using DMA. While active DMA blocks deeper idle states in hardware, McBSP activity does not seem to do so.
Basing the QoS latency calculation on the FIFO size, threshold, sample rate, and channels.
Based on the original patch by Tony Lindgren
Cc Tony Lindgren <[email protected]>Cc Peter Ujfalusi <[email protected]>Signed-off-by Matt Ranostay <[email protected]>---
Changes from v1:
* add calculations for latency per number of FIFO locationsChanges from v2:
* add missingmcbsp.hheader changeChanges from v3:
* base the latency calculations on threshold, buffer size, sample rate, and channelsChanges from v4:
* using Peter Ujfalusi's suggestions for restoring a higher latency on audio stream completion, or if not applicable remove the QoS requestQuoted 6 lines
Changes from v5:
* clean up latency checking logic
* move logic to .prepare and .shutdown to avoid functions that can sleepChanges from v6:
* move QoS removal toasoc_mcbsp_removefromomap_mcbsp_cleanup
Quoted 6 lines
Looks good.
You can add my
Acked-by Peter Ujfalusi <[email protected]>to v7...
Will do.
Quoted 7 lines
Quoted 7 lines
sound/soc/omap/mcbsp.c | 1 + sound/soc/omap/mcbsp.h | 3 +++ sound/soc/omap/omap-mcbsp.c | 47 ++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 50 insertions(+), 1 deletion(-)
Quoted 12 lines
sound/soc/omap/mcbsp.c line 28
Quoted 9 lines
sound/soc/omap/mcbsp.c +1
-0@@ -25,6 +25,7 @@#include <linux/io.h> #include <linux/slab.h> #include <linux/pm_runtime.h> +#include <linux/pm_qos.h> Which would not add this include line ;)
Good god how did I miss that? **facepalm** Will fix in the final v7 :)
Quoted 6 lines
sound/soc/omap/mcbsp.c line 31
Quoted 3 lines
sound/soc/omap/mcbsp.c +0
-0#include <linux/platform_data/asoc-ti-mcbsp.h> --
Péter
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel