[PATCH 1/2] ASoC: dwc: add a quirk DW_I2S_QUIRK_STOP_ON_SHUTDOWN to dwc driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For CZ/StoneyRidge platforms, ACP DMA between ACP SRAM and
I2S FIFO should be stopped before stopping I2S Controller DMA.

When DMA is progressing and stop request received, while DMA transfer
ongoing between ACP SRAM and I2S FIFO, Stopping I2S DMA prior to ACP DMA
stop resulting DMA Channel stop failure.

This issue can't be fixed in ACP DMA driver due to design constraint.

Add a quirk DW_I2S_QUIRK_STOP_ON_SHUTDOWN in dwc driver to fix DMA stop
failure by invoking i2s_stop() sequence in shutdown() callback.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@xxxxxxx>
---
 include/sound/designware_i2s.h | 1 +
 sound/soc/dwc/dwc-i2s.c        | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/sound/designware_i2s.h b/include/sound/designware_i2s.h
index 80d275b..a700d20 100644
--- a/include/sound/designware_i2s.h
+++ b/include/sound/designware_i2s.h
@@ -34,6 +34,7 @@ struct i2s_platform_data {
 	#define DW_I2S_QUIRK_COMP_REG_OFFSET	(1 << 0)
 	#define DW_I2S_QUIRK_COMP_PARAM1	(1 << 1)
 	#define DW_I2S_QUIRK_16BIT_IDX_OVERRIDE (1 << 2)
+	#define DW_I2S_QUIRK_STOP_ON_SHUTDOWN   (1 << 3)
 	unsigned int quirks;
 	unsigned int i2s_reg_comp1;
 	unsigned int i2s_reg_comp2;
diff --git a/sound/soc/dwc/dwc-i2s.c b/sound/soc/dwc/dwc-i2s.c
index fd41602..f3a681f 100644
--- a/sound/soc/dwc/dwc-i2s.c
+++ b/sound/soc/dwc/dwc-i2s.c
@@ -308,6 +308,10 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream,
 static void dw_i2s_shutdown(struct snd_pcm_substream *substream,
 		struct snd_soc_dai *dai)
 {
+	struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
+
+	if (dev->quirks & DW_I2S_QUIRK_STOP_ON_SHUTDOWN)
+		i2s_stop(dev, substream);
 	snd_soc_dai_set_dma_data(dai, substream, NULL);
 }
 
@@ -342,7 +346,8 @@ static int dw_i2s_trigger(struct snd_pcm_substream *substream,
 	case SNDRV_PCM_TRIGGER_SUSPEND:
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
 		dev->active--;
-		i2s_stop(dev, substream);
+		if (!(dev->quirks & DW_I2S_QUIRK_STOP_ON_SHUTDOWN))
+			i2s_stop(dev, substream);
 		break;
 	default:
 		ret = -EINVAL;
-- 
2.7.4




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux