Re: [alsa-devel] [PATCH] ASoC: AMD: make channel 1 dma as circular

2018-05-27 Thread kbuild test robot
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, Vijendar2018-04-17  @978  struct 
snd_soc_component *component = snd_soc_rtdcom_lookup(prtd,
13838c11 Mukunda, Vijendar2018-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 Agrawal2018-05-25   991  
acp_dma_start(rtd->acp_mmio, rtd->ch1);
695a41b3 Akshu Agrawal2018-05-25   992  
acp_dma_start(rtd->acp_mmio, rtd->ch2);
695a41b3 Akshu Agrawal2018-05-25   993  } else {
695a41b3 Akshu Agrawal2018-05-25   994  
acp_dma_start(rtd->acp_mmio, rtd->ch2);
695a41b3 Akshu Agrawal2018-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

Re: [alsa-devel] [PATCH] ASoC: AMD: make channel 1 dma as circular

2018-05-27 Thread kbuild test robot
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, Vijendar2018-04-17  @978  struct 
snd_soc_component *component = snd_soc_rtdcom_lookup(prtd,
13838c11 Mukunda, Vijendar2018-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 Agrawal2018-05-25   991  
acp_dma_start(rtd->acp_mmio, rtd->ch1);
695a41b3 Akshu Agrawal2018-05-25   992  
acp_dma_start(rtd->acp_mmio, rtd->ch2);
695a41b3 Akshu Agrawal2018-05-25   993  } else {
695a41b3 Akshu Agrawal2018-05-25   994  
acp_dma_start(rtd->acp_mmio, rtd->ch2);
695a41b3 Akshu Agrawal2018-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 

Re: [alsa-devel] [PATCH] ASoC: AMD: make channel 1 dma as circular

2018-05-27 Thread kbuild test robot
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, Vijendar2018-04-17  @978  struct 
snd_soc_component *component = snd_soc_rtdcom_lookup(prtd,
13838c11 Mukunda, Vijendar2018-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 Agrawal2018-05-25   991  
acp_dma_start(rtd->acp_mmio, rtd->ch1);
695a41b3 Akshu Agrawal2018-05-25   992  
acp_dma_start(rtd->acp_mmio, rtd->ch2);
695a41b3 Akshu Agrawal2018-05-25   993  } else {
695a41b3 Akshu Agrawal2018-05-25   994  
acp_dma_start(rtd->acp_mmio, rtd->ch2);
695a41b3 Akshu Agrawal2018-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

Re: [alsa-devel] [PATCH] ASoC: AMD: make channel 1 dma as circular

2018-05-27 Thread kbuild test robot
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, Vijendar2018-04-17  @978  struct 
snd_soc_component *component = snd_soc_rtdcom_lookup(prtd,
13838c11 Mukunda, Vijendar2018-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 Agrawal2018-05-25   991  
acp_dma_start(rtd->acp_mmio, rtd->ch1);
695a41b3 Akshu Agrawal2018-05-25   992  
acp_dma_start(rtd->acp_mmio, rtd->ch2);
695a41b3 Akshu Agrawal2018-05-25   993  } else {
695a41b3 Akshu Agrawal2018-05-25   994  
acp_dma_start(rtd->acp_mmio, rtd->ch2);
695a41b3 Akshu Agrawal2018-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 

Re: [PATCH] ASoC: AMD: make channel 1 dma as circular

2018-05-26 Thread Daniel Kurtz
On Fri, May 25, 2018 at 3:23 AM Akshu Agrawal  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 


Reviewed-by: Daniel Kurtz 
Tested-by: Daniel Kurtz 


> ---
>   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,
>

Re: [PATCH] ASoC: AMD: make channel 1 dma as circular

2018-05-26 Thread Daniel Kurtz
On Fri, May 25, 2018 at 3:23 AM Akshu Agrawal  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 


Reviewed-by: Daniel Kurtz 
Tested-by: Daniel Kurtz 


> ---
>   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 

[PATCH] ASoC: AMD: make channel 1 dma as circular

2018-05-25 Thread Akshu Agrawal
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 
---
 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
-  

[PATCH] ASoC: AMD: make channel 1 dma as circular

2018-05-25 Thread Akshu Agrawal
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 
---
 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
-