ASoC: qcom: Fix playback recover problem in suspend resume
Subsystems (4)
PATCH v3 1/1 ASoC: qcom: Fix playback recover problem in suspend resume
To support playback continuation after hard suspend(bypass powerd)
and resume:
Prepare device in platform trigger callback.
Make I2s and DMA control registers as non volatile.
---
Changes Since v1 and v2:
-- Subject lines changed
sound/soc/qcom/lpass-cpu.c | 8 ++------ sound/soc/qcom/lpass-platform.c | 5 +++-- 2 files changed, 5 insertions(+), 8 deletions(-)
sound/soc/qcom/lpass-cpu.c +2 -6
@@ -454,20 +454,16 @@ static bool lpass_cpu_regmap_volatile(struct device *dev, unsigned int reg)struct lpass_variant *v = drvdata->variant;int i; -for (i =0 ; i < v->i2s_ports; ++i) -if (reg ==LPAIF_I2SCTL_REG (v, i)) -return true;for (i =0 ; i < v->irq_ports; ++i)if (reg ==LPAIF_IRQSTAT_REG (v, i))return true;for (i =0 ; i < v->rdma_channels; ++i) -if (reg ==LPAIF_RDMACURR_REG (v, i) || reg ==LPAIF_RDMACTL_REG (v, i)) +if (reg ==LPAIF_RDMACURR_REG (v, i))return true;for (i =0 ; i < v->wrdma_channels; ++i) -if (reg ==LPAIF_WRDMACURR_REG (v, i + v->wrdma_channel_start) || - reg ==LPAIF_WRDMACTL_REG (v, i + v->wrdma_channel_start)) +if (reg ==LPAIF_WRDMACURR_REG (v, i + v->wrdma_channel_start))return true;return false;
sound/soc/qcom/lpass-platform.c +3 -2
@@ -481,8 +481,9 @@ static int lpass_platform_pcmops_trigger(struct snd_soc_component *component,return -ENOTRECOVERABLE ; }switch (cmd) { -case SNDRV_PCM_TRIGGER_START :case SNDRV_PCM_TRIGGER_RESUME : +lpass_platform_pcmops_prepare (component, substream); +case SNDRV_PCM_TRIGGER_START :case SNDRV_PCM_TRIGGER_PAUSE_RELEASE : ret =regmap_fields_write (dmactl->enable, id,LPAIF_DMACTL_ENABLE_ON );
@@ -592,7 +593,7 @@ static int lpass_platform_pcmops_trigger(struct snd_soc_component *component,break ; } -return 0 ; +return ret; } static snd_pcm_uframes_t lpass_platform_pcmops_pointer(
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
Quoted 4 lines · Srinivasa Rao Mandadapu
To support playback continuation after hard suspend(bypass powerd)
and resume:
Prepare device in platform trigger callback.
Make I2s and DMA control registers as non volatile.
Looks like there are two changes here, One is fixing the volatile registers!
Other is preparing device after suspend!
Consider splitting them!
Quoted 1 line
Fixes tag is missing here?
Quoted 42 lines
Signed-off-by V Sujith Kumar Reddy <[email protected]>Signed-off-by Srinivasa Rao Mandadapu <[email protected]>---
Changes Since v1 and v2:
-- Subject lines changedsound/soc/qcom/lpass-cpu.c | 8 ++------ sound/soc/qcom/lpass-platform.c | 5 +++-- 2 files changed, 5 insertions(+), 8 deletions(-)sound/soc/qcom/lpass-cpu.c +2
-6@@ -454,20 +454,16 @@ static bool lpass_cpu_regmap_volatile(struct device *dev, unsigned int reg)struct lpass_variant *v = drvdata->variant;int i; -for (i =0 ; i < v->i2s_ports; ++i) -if (reg ==LPAIF_I2SCTL_REG (v, i)) -return true;for (i =0 ; i < v->irq_ports; ++i)if (reg ==LPAIF_IRQSTAT_REG (v, i))return true;for (i =0 ; i < v->rdma_channels; ++i) -if (reg ==LPAIF_RDMACURR_REG (v, i) || reg ==LPAIF_RDMACTL_REG (v, i)) +if (reg ==LPAIF_RDMACURR_REG (v, i))return true;for (i =0 ; i < v->wrdma_channels; ++i) -if (reg ==LPAIF_WRDMACURR_REG (v, i + v->wrdma_channel_start) || - reg ==LPAIF_WRDMACTL_REG (v, i + v->wrdma_channel_start)) +if (reg ==LPAIF_WRDMACURR_REG (v, i + v->wrdma_channel_start))return true;return false;sound/soc/qcom/lpass-platform.c +0
-0
sound/soc/qcom/lpass-platform.c static int lpass_platform_pcmops_trigger(struct snd_soc_component *component, · line 485
Quoted 6 lines
sound/soc/qcom/lpass-platform.c +1
-1@@ -481,8 +481,9 @@ static int lpass_platform_pcmops_trigger(struct snd_soc_component *component,return -ENOTRECOVERABLE ; }switch (cmd) { -case SNDRV_PCM_TRIGGER_START :case SNDRV_PCM_TRIGGER_RESUME : +lpass_platform_pcmops_prepare (component, substream);
Can you elaborate the actual issue here?
Are any other registers needs to re-programmed??
Does it make sense to useregcache_mark_dirty()regcache_sync() in pm suspend resume path,
instead of calling prepare explicitly?
--srini
Quoted 14 lines
sound/soc/qcom/lpass-platform.c +2
-1+case SNDRV_PCM_TRIGGER_START :case SNDRV_PCM_TRIGGER_PAUSE_RELEASE : ret =regmap_fields_write (dmactl->enable, id,LPAIF_DMACTL_ENABLE_ON );@@ -592,7 +593,7 @@ static int lpass_platform_pcmops_trigger(struct snd_soc_component *component,break ; } -return 0 ; +return ret; } static snd_pcm_uframes_t lpass_platform_pcmops_pointer(
Thanks a lot Srinivas for your valuable review comments and for your time!!!
Quoted 7 lines · Srinivas Kandagatla
Quoted 4 lines · Srinivasa Rao Mandadapu
To support playback continuation after hard suspend(bypass powerd) and resume:
Prepare device in platform trigger callback.
Make I2s and DMA control registers as non volatile.
Quoted 7 lines
Looks like there are two changes here, One is fixing the volatile registers!
Other is preparing device after suspend!
Consider splitting them!
Okay will split and share.
Quoted 4 lines
Quoted 1 line
Fixes tag is missing here?
Actually fixing volatile registers is just partial reversal of commit b1824968221c ("ASoC: qcom: Fix enabling BCLK and LRCLK in LPAIF invalid state")
Will revert and share the patch separately.
Quoted 53 lines
Quoted 46 lines
Signed-off-by V Sujith Kumar Reddy <[email protected]>Signed-off-by Srinivasa Rao Mandadapu <[email protected]>---
Changes Since v1 and v2:
-- Subject lines changedsound/soc/qcom/lpass-cpu.c | 8 ++------
sound/soc/qcom/lpass-platform.c| 5 +++--2 files changed, 5 insertions(+), 8 deletions(-)sound/soc/qcom/lpass-cpu.c +1
-4@@ -454,20 +454,16 @@ static bool lpass_cpu_regmap_volatile(struct device *dev, unsigned int reg) struct lpass_variant *v = drvdata->variant; int i; - for (i = 0; i < v->i2s_ports; ++i) - if (reg == LPAIF_I2SCTL_REG(v, i)) - return true; for (i = 0; i < v->irq_ports; ++i) if (reg == LPAIF_IRQSTAT_REG(v, i)) return true; for (i = 0; i < v->rdma_channels; ++i) - if (reg == LPAIF_RDMACURR_REG(v, i) || reg == LPAIF_RDMACTL_REG(v, i)) + if (reg == LPAIF_RDMACURR_REG(v, i)) return true; for (i = 0; i < v->wrdma_channels; ++i) - if (reg == LPAIF_WRDMACURR_REG(v, i +
v->wrdma_channel_start) ||
- reg ==LPAIF_WRDMACTL_REG(v, i + v->wrdma_channel_start)) + if (reg ==LPAIF_WRDMACURR_REG(v, i + v->wrdma_channel_start)) return true;
return false;sound/soc/qcom/lpass-platform.c +0
-1@@ -481,8 +481,9 @@ static int lpass_platform_pcmops_trigger(structsnd_soc_component *component, return -ENOTRECOVERABLE; } switch (cmd) { - case SNDRV_PCM_TRIGGER_START:Quoted 2 lines
case
SNDRV_PCM_TRIGGER_RESUME:
+lpass_platform_pcmops_prepare(component, substream);Can you elaborate the actual issue here?
Are any other registers needs to re-programmed??
Quoted 8 lines
Does it make sense to use
regcache_mark_dirty()regcache_sync()in pm suspend resume path,
instead of calling prepare explicitly?--srini
Yes it's working fine with regcache APIs. will update the patch.
Quoted 14 lines
Quoted 14 lines
+ case
SNDRV_PCM_TRIGGER_START:
caseSNDRV_PCM_TRIGGER_PAUSE_RELEASE:
ret =regmap_fields_write(dmactl->enable, id, LPAIF_DMACTL_ENABLE_ON);sound/soc/qcom/lpass-platform.c +1
-0@@ -592,7 +593,7 @@ static int lpass_platform_pcmops_trigger(structsnd_soc_component *component, break; } - return 0; + return ret; }static
snd_pcm_uframes_tlpass_platform_pcmops_pointer(
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.