[alsa-devel] [RFC 0/2] ASoC: core: Ignoring pmdown_time for playback stream power down
Hello Mark,
Add support in core to ignore the pmdown_time when stopping the playback stream. This will inline the DAPM stream stop event, so it is going to be executed without delay at stream close time (for playback stream).
Backround: with the McPDM protocol we are sendning not only the pure audio stream, but OMAP McPDM also transmits additional information (for example offset cancellation). If McPDM is stopped prior to the DAC this information will be not sent to the codec, which can result noise rendered by the twl6040 codec.
Is this something that you were suggesting?
Regards, Peter --- Peter Ujfalusi (2): ASoC: soc-pcm: Add flag to ignore pmdown_time at pcm_close ASoC: sdp4430: Request core to inline the DAPM sequence
include/sound/soc.h | 3 +++ sound/soc/omap/sdp4430.c | 1 + sound/soc/soc-pcm.c | 15 +++++++++++---- 3 files changed, 15 insertions(+), 4 deletions(-)
With this flag machine drivers can indicate that it is desired to ignore the pmdown_time for DAPM shutdown sequence when playback stream is stopped. The DAPM sequence will be executed without delay in this case.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- include/sound/soc.h | 3 +++ sound/soc/soc-pcm.c | 15 +++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h index 858291d..7b75b68 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -717,6 +717,9 @@ struct snd_soc_dai_link { /* Symmetry requirements */ unsigned int symmetric_rates:1;
+ /* Will ingore the pmdown_time for playback stream */ + unsigned int ignore_pmdown_time:1; + /* codec/machine specific init - e.g. add machine controls */ int (*init)(struct snd_soc_pcm_runtime *rtd);
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 8eb0f07..faac256 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -319,10 +319,17 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) cpu_dai->runtime = NULL;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - /* start delayed pop wq here for playback streams */ - codec_dai->pop_wait = 1; - schedule_delayed_work(&rtd->delayed_work, - msecs_to_jiffies(rtd->pmdown_time)); + if (unlikely(rtd->dai_link->ignore_pmdown_time)) { + /* powered down playback stream now */ + snd_soc_dapm_stream_event(rtd, + codec_dai->driver->playback.stream_name, + SND_SOC_DAPM_STREAM_STOP); + } else { + /* start delayed pop wq here for playback streams */ + codec_dai->pop_wait = 1; + schedule_delayed_work(&rtd->delayed_work, + msecs_to_jiffies(rtd->pmdown_time)); + } } else { /* capture streams can be powered down now */ snd_soc_dapm_stream_event(rtd,
On Thu, Oct 13, 2011 at 04:23:34PM +0300, Peter Ujfalusi wrote:
With this flag machine drivers can indicate that it is desired to ignore the pmdown_time for DAPM shutdown sequence when playback stream is stopped. The DAPM sequence will be executed without delay in this case.
Why make this a per-machine control? This seems like it'd be a property of the CODEC or possibly other chips rather than a machine specific thing?
On Thursday 13 October 2011 15:00:03 Mark Brown wrote:
On Thu, Oct 13, 2011 at 04:23:34PM +0300, Peter Ujfalusi wrote:
With this flag machine drivers can indicate that it is desired to ignore the pmdown_time for DAPM shutdown sequence when playback stream is stopped. The DAPM sequence will be executed without delay in this case.
Why make this a per-machine control? This seems like it'd be a property of the CODEC or possibly other chips rather than a machine specific thing?
I thought that depending on the environment we might need this or not for the same component, and the best place for this is to be able to define it per dai link. However I can move the flag as per codec configuration (within snd_soc_codec struct). Would that be better?
-- Péter
On Fri, Oct 14, 2011 at 12:24:01PM +0300, P?ter Ujfalusi wrote:
I thought that depending on the environment we might need this or not for the same component, and the best place for this is to be able to define it per dai link. However I can move the flag as per codec configuration (within snd_soc_codec struct). Would that be better?
I'd expect that it's likely to follow the device a lot of the time - for example, in the case that motivated this it seems that every system using twl6040 is going to need to work around the DC servo issue.
On Friday 14 October 2011 10:38:41 Mark Brown wrote:
I'd expect that it's likely to follow the device a lot of the time - for example, in the case that motivated this it seems that every system using twl6040 is going to need to work around the DC servo issue.
Fair enough. I'll move the flag to snd_soc_codec.
-- Péter
We need to have as less time between OMAP McPDM shutdown, and power down of the DAC on the twl6040 codec as possible. Request core to ignore the pmdown_time for the playback stream. Backround: with the McPDM protocol we are sendning not only the pure audio stream, but OMAP McPDM also transmits additional information (for example offset cancellation). If McPDM is stopped prior to the DAC this information will be not sent to the codec, which can result noise rendered by the twl6040 codec.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- sound/soc/omap/sdp4430.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c index cc3d792..e2f93e8 100644 --- a/sound/soc/omap/sdp4430.c +++ b/sound/soc/omap/sdp4430.c @@ -155,6 +155,7 @@ static struct snd_soc_dai_link sdp4430_dai = { .codec_dai_name = "twl6040-legacy", .platform_name = "omap-pcm-audio", .codec_name = "twl6040-codec", + .ignore_pmdown_time = 1, .init = sdp4430_twl6040_init, .ops = &sdp4430_ops, };
participants (2)
-
Mark Brown
-
Peter Ujfalusi