ASoC: core: Ignoring pmdown_time for playback stream power down
cover 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(-)
Signature · 1 line
1.7.7
RFC 1/2 ASoC: soc-pcm: Add flag to ignore pmdown_time at pcm_close
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.
--- include/sound/soc.h | 3 +++ sound/soc/soc-pcm.c | 15 +++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-)
include/sound/soc.h +3 -0
@@ -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);
sound/soc/soc-pcm.c +11 -4
@@ -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,
Signature · 1 line
1.7.7
Re: [RFC 1/2] ASoC: soc-pcm: Add flag to ignore pmdown_time at pcm_close
Quoted 4 lines · Peter Ujfalusi
With this flag machine drivers can indicate that it is desired to ignore the
pmdown_timefor 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?
Re: [RFC 1/2] ASoC: soc-pcm: Add flag to ignore pmdown_time at pcm_close
Quoted 8 lines · On Thursday 13 October 2011 15:00:03 Mark Brown wrote:
Quoted 4 lines · Peter Ujfalusi
With this flag machine drivers can indicate that it is desired to ignore the
pmdown_timefor 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
Re: [RFC 1/2] ASoC: soc-pcm: Add flag to ignore pmdown_time at pcm_close
Quoted 5 lines · P?ter Ujfalusi
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 (withinsnd_soc_codecstruct). 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.
Re: [RFC 1/2] ASoC: soc-pcm: Add flag to ignore pmdown_time at pcm_close
Quoted 3 lines · 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
RFC 2/2 ASoC: sdp4430: Request core to inline the DAPM sequence
In reply to Peter UjfalusiWe 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.
--- sound/soc/omap/sdp4430.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
sound/soc/omap/sdp4430.c +1 -0
@@ -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, };
Signature · 1 line
1.7.7