Message ID | 1527240163-9804-1-git-send-email-akshu.agrawal@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, May 25, 2018 at 3:23 AM Akshu Agrawal <akshu.agrawal@amd.com> wrote: > channel 1: SYSMEM<->ACP > channel 2: ACP<->I2S > Instead of waiting on period interrupt of ch 2 and then starting > dma on ch1, we make ch1 dma as circular. > This removes dependency of period granularity on hw pointer. > Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Tested-by: Daniel Kurtz <djkurtz@chromium.org> > --- > sound/soc/amd/acp-pcm-dma.c | 72 +++++++-------------------------------------- > 1 file changed, 10 insertions(+), 62 deletions(-) > diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c > index ac32dea..f1d8678 100644 > --- a/sound/soc/amd/acp-pcm-dma.c > +++ b/sound/soc/amd/acp-pcm-dma.c > @@ -337,8 +337,7 @@ static void config_acp_dma(void __iomem *acp_mmio, > } > /* Start a given DMA channel transfer */ > -static void acp_dma_start(void __iomem *acp_mmio, > - u16 ch_num, bool is_circular) > +static void acp_dma_start(void __iomem *acp_mmio, u16 ch_num) > { > u32 dma_ctrl; > @@ -369,11 +368,8 @@ static void acp_dma_start(void __iomem *acp_mmio, > break; > } > - /* enable for ACP SRAM to/from I2S DMA channel */ > - if (is_circular == true) > - dma_ctrl |= ACP_DMA_CNTL_0__Circular_DMA_En_MASK; > - else > - dma_ctrl &= ~ACP_DMA_CNTL_0__Circular_DMA_En_MASK; > + /* circular for both DMA channel */ > + dma_ctrl |= ACP_DMA_CNTL_0__Circular_DMA_En_MASK; > acp_reg_write(dma_ctrl, acp_mmio, mmACP_DMA_CNTL_0 + ch_num); > } > @@ -617,7 +613,6 @@ static int acp_deinit(void __iomem *acp_mmio) > /* ACP DMA irq handler routine for playback, capture usecases */ > static irqreturn_t dma_irq_handler(int irq, void *arg) > { > - u16 dscr_idx; > u32 intr_flag, ext_intr_status; > struct audio_drv_data *irq_data; > void __iomem *acp_mmio; > @@ -634,33 +629,13 @@ static irqreturn_t dma_irq_handler(int irq, void *arg) > if ((intr_flag & BIT(ACP_TO_I2S_DMA_CH_NUM)) != 0) { > valid_irq = true; > - if (acp_reg_read(acp_mmio, mmACP_DMA_CUR_DSCR_13) == > - PLAYBACK_START_DMA_DESCR_CH13) > - dscr_idx = PLAYBACK_END_DMA_DESCR_CH12; > - else > - dscr_idx = PLAYBACK_START_DMA_DESCR_CH12; > - config_acp_dma_channel(acp_mmio, SYSRAM_TO_ACP_CH_NUM, dscr_idx, > - 1, 0); > - acp_dma_start(acp_mmio, SYSRAM_TO_ACP_CH_NUM, false); > - > snd_pcm_period_elapsed(irq_data->play_i2ssp_stream); > - > acp_reg_write((intr_flag & BIT(ACP_TO_I2S_DMA_CH_NUM)) << 16, > acp_mmio, mmACP_EXTERNAL_INTR_STAT); > } > if ((intr_flag & BIT(ACP_TO_I2S_DMA_BT_INSTANCE_CH_NUM)) != 0) { > valid_irq = true; > - if (acp_reg_read(acp_mmio, mmACP_DMA_CUR_DSCR_9) == > - PLAYBACK_START_DMA_DESCR_CH9) > - dscr_idx = PLAYBACK_END_DMA_DESCR_CH8; > - else > - dscr_idx = PLAYBACK_START_DMA_DESCR_CH8; > - config_acp_dma_channel(acp_mmio, > - SYSRAM_TO_ACP_BT_INSTANCE_CH_NUM, > - dscr_idx, 1, 0); > - acp_dma_start(acp_mmio, SYSRAM_TO_ACP_BT_INSTANCE_CH_NUM, > - false); > snd_pcm_period_elapsed(irq_data->play_i2sbt_stream); > acp_reg_write((intr_flag & > BIT(ACP_TO_I2S_DMA_BT_INSTANCE_CH_NUM)) << 16, > @@ -669,38 +644,20 @@ static irqreturn_t dma_irq_handler(int irq, void *arg) > if ((intr_flag & BIT(I2S_TO_ACP_DMA_CH_NUM)) != 0) { > valid_irq = true; > - if (acp_reg_read(acp_mmio, mmACP_DMA_CUR_DSCR_15) == > - CAPTURE_START_DMA_DESCR_CH15) > - dscr_idx = CAPTURE_END_DMA_DESCR_CH14; > - else > - dscr_idx = CAPTURE_START_DMA_DESCR_CH14; > - config_acp_dma_channel(acp_mmio, ACP_TO_SYSRAM_CH_NUM, dscr_idx, > - 1, 0); > - acp_dma_start(acp_mmio, ACP_TO_SYSRAM_CH_NUM, false); > - > + snd_pcm_period_elapsed(irq_data->capture_i2ssp_stream); > acp_reg_write((intr_flag & BIT(I2S_TO_ACP_DMA_CH_NUM)) << 16, > acp_mmio, mmACP_EXTERNAL_INTR_STAT); > } > if ((intr_flag & BIT(ACP_TO_SYSRAM_CH_NUM)) != 0) { > valid_irq = true; > - snd_pcm_period_elapsed(irq_data->capture_i2ssp_stream); > acp_reg_write((intr_flag & BIT(ACP_TO_SYSRAM_CH_NUM)) << 16, > acp_mmio, mmACP_EXTERNAL_INTR_STAT); > } > if ((intr_flag & BIT(I2S_TO_ACP_DMA_BT_INSTANCE_CH_NUM)) != 0) { > valid_irq = true; > - if (acp_reg_read(acp_mmio, mmACP_DMA_CUR_DSCR_11) == > - CAPTURE_START_DMA_DESCR_CH11) > - dscr_idx = CAPTURE_END_DMA_DESCR_CH10; > - else > - dscr_idx = CAPTURE_START_DMA_DESCR_CH10; > - config_acp_dma_channel(acp_mmio, > - ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM, > - dscr_idx, 1, 0); > - acp_dma_start(acp_mmio, ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM, > - false); > + snd_pcm_period_elapsed(irq_data->capture_i2sbt_stream); > acp_reg_write((intr_flag & > BIT(I2S_TO_ACP_DMA_BT_INSTANCE_CH_NUM)) << 16, > acp_mmio, mmACP_EXTERNAL_INTR_STAT); > @@ -708,7 +665,6 @@ static irqreturn_t dma_irq_handler(int irq, void *arg) > if ((intr_flag & BIT(ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM)) != 0) { > valid_irq = true; > - snd_pcm_period_elapsed(irq_data->capture_i2sbt_stream); > acp_reg_write((intr_flag & > BIT(ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM)) << 16, > acp_mmio, mmACP_EXTERNAL_INTR_STAT); > @@ -1015,11 +971,9 @@ static int acp_dma_prepare(struct snd_pcm_substream *substream) > static int acp_dma_trigger(struct snd_pcm_substream *substream, int cmd) > { > int ret; > - u32 loops = 4000; > u64 bytescount = 0; > struct snd_pcm_runtime *runtime = substream->runtime; > - struct snd_soc_pcm_runtime *prtd = substream->private_data; > struct audio_substream_data *rtd = runtime->private_data; > struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd, DRV_NAME); > @@ -1034,18 +988,12 @@ static int acp_dma_trigger(struct snd_pcm_substream *substream, int cmd) > if (rtd->bytescount == 0) > rtd->bytescount = bytescount; > if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { > - acp_dma_start(rtd->acp_mmio, rtd->ch1, false); > - while (acp_reg_read(rtd->acp_mmio, mmACP_DMA_CH_STS) & > - BIT(rtd->ch1)) { > - if (!loops--) { > - dev_err(component->dev, > - "acp dma start timeout\n"); > - return -ETIMEDOUT; > - } > - cpu_relax(); > - } > + acp_dma_start(rtd->acp_mmio, rtd->ch1); > + acp_dma_start(rtd->acp_mmio, rtd->ch2); > + } else { > + acp_dma_start(rtd->acp_mmio, rtd->ch2); > + acp_dma_start(rtd->acp_mmio, rtd->ch1); > } > - acp_dma_start(rtd->acp_mmio, rtd->ch2, true); > ret = 0; > break; > case SNDRV_PCM_TRIGGER_STOP: > -- > 1.9.1
Hi Akshu,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on asoc/for-next]
[cannot apply to v4.17-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Akshu-Agrawal/ASoC-AMD-make-channel-1-dma-as-circular/20180527-170008
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: x86_64-randconfig-x014-201821 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
sound/soc//amd/acp-pcm-dma.c: In function 'acp_dma_trigger':
>> sound/soc//amd/acp-pcm-dma.c:978:62: error: 'prtd' undeclared (first use in this function); did you mean 'rtd'?
struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd,
^~~~
rtd
sound/soc//amd/acp-pcm-dma.c:978:62: note: each undeclared identifier is reported only once for each function it appears in
sound/soc//amd/acp-pcm-dma.c:978:28: warning: unused variable 'component' [-Wunused-variable]
struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd,
^~~~~~~~~
vim +978 sound/soc//amd/acp-pcm-dma.c
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 970
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 971 static int acp_dma_trigger(struct snd_pcm_substream *substream, int cmd)
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 972 {
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 973 int ret;
61add814 Vijendar Mukunda 2017-11-03 974 u64 bytescount = 0;
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 975
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 976 struct snd_pcm_runtime *runtime = substream->runtime;
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 977 struct audio_substream_data *rtd = runtime->private_data;
13838c11 Mukunda, Vijendar 2018-04-17 @978 struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd,
13838c11 Mukunda, Vijendar 2018-04-17 979 DRV_NAME);
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 980
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 981 if (!rtd)
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 982 return -EINVAL;
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 983 switch (cmd) {
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 984 case SNDRV_PCM_TRIGGER_START:
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 985 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 986 case SNDRV_PCM_TRIGGER_RESUME:
7f004847 Vijendar Mukunda 2018-05-08 987 bytescount = acp_get_byte_count(rtd);
9af8937e Vijendar Mukunda 2018-05-08 988 if (rtd->bytescount == 0)
9af8937e Vijendar Mukunda 2018-05-08 989 rtd->bytescount = bytescount;
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 990 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
695a41b3 Akshu Agrawal 2018-05-25 991 acp_dma_start(rtd->acp_mmio, rtd->ch1);
695a41b3 Akshu Agrawal 2018-05-25 992 acp_dma_start(rtd->acp_mmio, rtd->ch2);
695a41b3 Akshu Agrawal 2018-05-25 993 } else {
695a41b3 Akshu Agrawal 2018-05-25 994 acp_dma_start(rtd->acp_mmio, rtd->ch2);
695a41b3 Akshu Agrawal 2018-05-25 995 acp_dma_start(rtd->acp_mmio, rtd->ch1);
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 996 }
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 997 ret = 0;
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 998 break;
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 999 case SNDRV_PCM_TRIGGER_STOP:
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 1000 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 1001 case SNDRV_PCM_TRIGGER_SUSPEND:
8769bb55 Vijendar Mukunda 2018-05-08 1002 /* For playback, non circular dma should be stopped first
8769bb55 Vijendar Mukunda 2018-05-08 1003 * i.e Sysram to acp dma transfer channel(rtd->ch1) should be
8769bb55 Vijendar Mukunda 2018-05-08 1004 * stopped before stopping cirular dma which is acp sram to i2s
8769bb55 Vijendar Mukunda 2018-05-08 1005 * fifo dma transfer channel(rtd->ch2). Where as in Capture
8769bb55 Vijendar Mukunda 2018-05-08 1006 * scenario, i2s fifo to acp sram dma channel(rtd->ch2) stopped
8769bb55 Vijendar Mukunda 2018-05-08 1007 * first before stopping acp sram to sysram which is circular
8769bb55 Vijendar Mukunda 2018-05-08 1008 * dma(rtd->ch1).
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 1009 */
61add814 Vijendar Mukunda 2017-11-03 1010 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
8769bb55 Vijendar Mukunda 2018-05-08 1011 acp_dma_stop(rtd->acp_mmio, rtd->ch1);
8769bb55 Vijendar Mukunda 2018-05-08 1012 ret = acp_dma_stop(rtd->acp_mmio, rtd->ch2);
61add814 Vijendar Mukunda 2017-11-03 1013 } else {
8769bb55 Vijendar Mukunda 2018-05-08 1014 acp_dma_stop(rtd->acp_mmio, rtd->ch2);
8769bb55 Vijendar Mukunda 2018-05-08 1015 ret = acp_dma_stop(rtd->acp_mmio, rtd->ch1);
61add814 Vijendar Mukunda 2017-11-03 1016 }
9af8937e Vijendar Mukunda 2018-05-08 1017 rtd->bytescount = 0;
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 1018 break;
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 1019 default:
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 1020 ret = -EINVAL;
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 1021 }
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 1022 return ret;
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 1023 }
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 1024
:::::: The code at line 978 was first introduced by commit
:::::: 13838c11c31e764d8143fdfcccea47691afd5ff2 ASoC: amd: fixed checkpatch pl warnings
:::::: TO: Mukunda, Vijendar <Vijendar.Mukunda@amd.com>
:::::: CC: Mark Brown <broonie@kernel.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi Akshu,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on asoc/for-next]
[cannot apply to v4.17-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Akshu-Agrawal/ASoC-AMD-make-channel-1-dma-as-circular/20180527-170008
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: i386-randconfig-s0-201821 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
sound/soc/amd/acp-pcm-dma.c: In function 'acp_dma_trigger':
>> sound/soc/amd/acp-pcm-dma.c:978:62: error: 'prtd' undeclared (first use in this function)
struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd,
^~~~
sound/soc/amd/acp-pcm-dma.c:978:62: note: each undeclared identifier is reported only once for each function it appears in
sound/soc/amd/acp-pcm-dma.c:978:28: warning: unused variable 'component' [-Wunused-variable]
struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd,
^~~~~~~~~
vim +/prtd +978 sound/soc/amd/acp-pcm-dma.c
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 970
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 971 static int acp_dma_trigger(struct snd_pcm_substream *substream, int cmd)
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 972 {
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 973 int ret;
61add814 Vijendar Mukunda 2017-11-03 974 u64 bytescount = 0;
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 975
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 976 struct snd_pcm_runtime *runtime = substream->runtime;
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 977 struct audio_substream_data *rtd = runtime->private_data;
13838c11 Mukunda, Vijendar 2018-04-17 @978 struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd,
13838c11 Mukunda, Vijendar 2018-04-17 979 DRV_NAME);
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 980
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 981 if (!rtd)
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 982 return -EINVAL;
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 983 switch (cmd) {
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 984 case SNDRV_PCM_TRIGGER_START:
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 985 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 986 case SNDRV_PCM_TRIGGER_RESUME:
7f004847 Vijendar Mukunda 2018-05-08 987 bytescount = acp_get_byte_count(rtd);
9af8937e Vijendar Mukunda 2018-05-08 988 if (rtd->bytescount == 0)
9af8937e Vijendar Mukunda 2018-05-08 989 rtd->bytescount = bytescount;
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 990 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
695a41b3 Akshu Agrawal 2018-05-25 991 acp_dma_start(rtd->acp_mmio, rtd->ch1);
695a41b3 Akshu Agrawal 2018-05-25 992 acp_dma_start(rtd->acp_mmio, rtd->ch2);
695a41b3 Akshu Agrawal 2018-05-25 993 } else {
695a41b3 Akshu Agrawal 2018-05-25 994 acp_dma_start(rtd->acp_mmio, rtd->ch2);
695a41b3 Akshu Agrawal 2018-05-25 995 acp_dma_start(rtd->acp_mmio, rtd->ch1);
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 996 }
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 997 ret = 0;
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 998 break;
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 999 case SNDRV_PCM_TRIGGER_STOP:
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 1000 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 1001 case SNDRV_PCM_TRIGGER_SUSPEND:
8769bb55 Vijendar Mukunda 2018-05-08 1002 /* For playback, non circular dma should be stopped first
8769bb55 Vijendar Mukunda 2018-05-08 1003 * i.e Sysram to acp dma transfer channel(rtd->ch1) should be
8769bb55 Vijendar Mukunda 2018-05-08 1004 * stopped before stopping cirular dma which is acp sram to i2s
8769bb55 Vijendar Mukunda 2018-05-08 1005 * fifo dma transfer channel(rtd->ch2). Where as in Capture
8769bb55 Vijendar Mukunda 2018-05-08 1006 * scenario, i2s fifo to acp sram dma channel(rtd->ch2) stopped
8769bb55 Vijendar Mukunda 2018-05-08 1007 * first before stopping acp sram to sysram which is circular
8769bb55 Vijendar Mukunda 2018-05-08 1008 * dma(rtd->ch1).
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 1009 */
61add814 Vijendar Mukunda 2017-11-03 1010 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
8769bb55 Vijendar Mukunda 2018-05-08 1011 acp_dma_stop(rtd->acp_mmio, rtd->ch1);
8769bb55 Vijendar Mukunda 2018-05-08 1012 ret = acp_dma_stop(rtd->acp_mmio, rtd->ch2);
61add814 Vijendar Mukunda 2017-11-03 1013 } else {
8769bb55 Vijendar Mukunda 2018-05-08 1014 acp_dma_stop(rtd->acp_mmio, rtd->ch2);
8769bb55 Vijendar Mukunda 2018-05-08 1015 ret = acp_dma_stop(rtd->acp_mmio, rtd->ch1);
61add814 Vijendar Mukunda 2017-11-03 1016 }
9af8937e Vijendar Mukunda 2018-05-08 1017 rtd->bytescount = 0;
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 1018 break;
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 1019 default:
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 1020 ret = -EINVAL;
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 1021 }
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 1022 return ret;
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 1023 }
7c31335a Maruthi Srinivas Bayyavarapu 2016-01-08 1024
:::::: The code at line 978 was first introduced by commit
:::::: 13838c11c31e764d8143fdfcccea47691afd5ff2 ASoC: amd: fixed checkpatch pl warnings
:::::: TO: Mukunda, Vijendar <Vijendar.Mukunda@amd.com>
:::::: CC: Mark Brown <broonie@kernel.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index ac32dea..f1d8678 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -337,8 +337,7 @@ static void config_acp_dma(void __iomem *acp_mmio, } /* Start a given DMA channel transfer */ -static void acp_dma_start(void __iomem *acp_mmio, - u16 ch_num, bool is_circular) +static void acp_dma_start(void __iomem *acp_mmio, u16 ch_num) { u32 dma_ctrl; @@ -369,11 +368,8 @@ static void acp_dma_start(void __iomem *acp_mmio, break; } - /* enable for ACP SRAM to/from I2S DMA channel */ - if (is_circular == true) - dma_ctrl |= ACP_DMA_CNTL_0__Circular_DMA_En_MASK; - else - dma_ctrl &= ~ACP_DMA_CNTL_0__Circular_DMA_En_MASK; + /* circular for both DMA channel */ + dma_ctrl |= ACP_DMA_CNTL_0__Circular_DMA_En_MASK; acp_reg_write(dma_ctrl, acp_mmio, mmACP_DMA_CNTL_0 + ch_num); } @@ -617,7 +613,6 @@ static int acp_deinit(void __iomem *acp_mmio) /* ACP DMA irq handler routine for playback, capture usecases */ static irqreturn_t dma_irq_handler(int irq, void *arg) { - u16 dscr_idx; u32 intr_flag, ext_intr_status; struct audio_drv_data *irq_data; void __iomem *acp_mmio; @@ -634,33 +629,13 @@ static irqreturn_t dma_irq_handler(int irq, void *arg) if ((intr_flag & BIT(ACP_TO_I2S_DMA_CH_NUM)) != 0) { valid_irq = true; - if (acp_reg_read(acp_mmio, mmACP_DMA_CUR_DSCR_13) == - PLAYBACK_START_DMA_DESCR_CH13) - dscr_idx = PLAYBACK_END_DMA_DESCR_CH12; - else - dscr_idx = PLAYBACK_START_DMA_DESCR_CH12; - config_acp_dma_channel(acp_mmio, SYSRAM_TO_ACP_CH_NUM, dscr_idx, - 1, 0); - acp_dma_start(acp_mmio, SYSRAM_TO_ACP_CH_NUM, false); - snd_pcm_period_elapsed(irq_data->play_i2ssp_stream); - acp_reg_write((intr_flag & BIT(ACP_TO_I2S_DMA_CH_NUM)) << 16, acp_mmio, mmACP_EXTERNAL_INTR_STAT); } if ((intr_flag & BIT(ACP_TO_I2S_DMA_BT_INSTANCE_CH_NUM)) != 0) { valid_irq = true; - if (acp_reg_read(acp_mmio, mmACP_DMA_CUR_DSCR_9) == - PLAYBACK_START_DMA_DESCR_CH9) - dscr_idx = PLAYBACK_END_DMA_DESCR_CH8; - else - dscr_idx = PLAYBACK_START_DMA_DESCR_CH8; - config_acp_dma_channel(acp_mmio, - SYSRAM_TO_ACP_BT_INSTANCE_CH_NUM, - dscr_idx, 1, 0); - acp_dma_start(acp_mmio, SYSRAM_TO_ACP_BT_INSTANCE_CH_NUM, - false); snd_pcm_period_elapsed(irq_data->play_i2sbt_stream); acp_reg_write((intr_flag & BIT(ACP_TO_I2S_DMA_BT_INSTANCE_CH_NUM)) << 16, @@ -669,38 +644,20 @@ static irqreturn_t dma_irq_handler(int irq, void *arg) if ((intr_flag & BIT(I2S_TO_ACP_DMA_CH_NUM)) != 0) { valid_irq = true; - if (acp_reg_read(acp_mmio, mmACP_DMA_CUR_DSCR_15) == - CAPTURE_START_DMA_DESCR_CH15) - dscr_idx = CAPTURE_END_DMA_DESCR_CH14; - else - dscr_idx = CAPTURE_START_DMA_DESCR_CH14; - config_acp_dma_channel(acp_mmio, ACP_TO_SYSRAM_CH_NUM, dscr_idx, - 1, 0); - acp_dma_start(acp_mmio, ACP_TO_SYSRAM_CH_NUM, false); - + snd_pcm_period_elapsed(irq_data->capture_i2ssp_stream); acp_reg_write((intr_flag & BIT(I2S_TO_ACP_DMA_CH_NUM)) << 16, acp_mmio, mmACP_EXTERNAL_INTR_STAT); } if ((intr_flag & BIT(ACP_TO_SYSRAM_CH_NUM)) != 0) { valid_irq = true; - snd_pcm_period_elapsed(irq_data->capture_i2ssp_stream); acp_reg_write((intr_flag & BIT(ACP_TO_SYSRAM_CH_NUM)) << 16, acp_mmio, mmACP_EXTERNAL_INTR_STAT); } if ((intr_flag & BIT(I2S_TO_ACP_DMA_BT_INSTANCE_CH_NUM)) != 0) { valid_irq = true; - if (acp_reg_read(acp_mmio, mmACP_DMA_CUR_DSCR_11) == - CAPTURE_START_DMA_DESCR_CH11) - dscr_idx = CAPTURE_END_DMA_DESCR_CH10; - else - dscr_idx = CAPTURE_START_DMA_DESCR_CH10; - config_acp_dma_channel(acp_mmio, - ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM, - dscr_idx, 1, 0); - acp_dma_start(acp_mmio, ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM, - false); + snd_pcm_period_elapsed(irq_data->capture_i2sbt_stream); acp_reg_write((intr_flag & BIT(I2S_TO_ACP_DMA_BT_INSTANCE_CH_NUM)) << 16, acp_mmio, mmACP_EXTERNAL_INTR_STAT); @@ -708,7 +665,6 @@ static irqreturn_t dma_irq_handler(int irq, void *arg) if ((intr_flag & BIT(ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM)) != 0) { valid_irq = true; - snd_pcm_period_elapsed(irq_data->capture_i2sbt_stream); acp_reg_write((intr_flag & BIT(ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM)) << 16, acp_mmio, mmACP_EXTERNAL_INTR_STAT); @@ -1015,11 +971,9 @@ static int acp_dma_prepare(struct snd_pcm_substream *substream) static int acp_dma_trigger(struct snd_pcm_substream *substream, int cmd) { int ret; - u32 loops = 4000; u64 bytescount = 0; struct snd_pcm_runtime *runtime = substream->runtime; - struct snd_soc_pcm_runtime *prtd = substream->private_data; struct audio_substream_data *rtd = runtime->private_data; struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd, DRV_NAME); @@ -1034,18 +988,12 @@ static int acp_dma_trigger(struct snd_pcm_substream *substream, int cmd) if (rtd->bytescount == 0) rtd->bytescount = bytescount; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - acp_dma_start(rtd->acp_mmio, rtd->ch1, false); - while (acp_reg_read(rtd->acp_mmio, mmACP_DMA_CH_STS) & - BIT(rtd->ch1)) { - if (!loops--) { - dev_err(component->dev, - "acp dma start timeout\n"); - return -ETIMEDOUT; - } - cpu_relax(); - } + acp_dma_start(rtd->acp_mmio, rtd->ch1); + acp_dma_start(rtd->acp_mmio, rtd->ch2); + } else { + acp_dma_start(rtd->acp_mmio, rtd->ch2); + acp_dma_start(rtd->acp_mmio, rtd->ch1); } - acp_dma_start(rtd->acp_mmio, rtd->ch2, true); ret = 0; break; case SNDRV_PCM_TRIGGER_STOP:
channel 1: SYSMEM<->ACP channel 2: ACP<->I2S Instead of waiting on period interrupt of ch 2 and then starting dma on ch1, we make ch1 dma as circular. This removes dependency of period granularity on hw pointer. Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> --- sound/soc/amd/acp-pcm-dma.c | 72 +++++++-------------------------------------- 1 file changed, 10 insertions(+), 62 deletions(-)