Skip to content

Commit

Permalink
ASoC: rockchip: Use generic dmaengine code
Browse files Browse the repository at this point in the history
This reverts commit 75b3119.

The original purpose of customized pcm was to config prealloc buffer size
flexibly. but, we can do the same thing by soc-generic-dmaengine-pcm.

And the generic one can generated the better config by querying DMA
capabilities from dmaengine driver rather than the Hard-Coded one.

e.g.

the customized one:

  static const struct snd_pcm_hardware snd_rockchip_hardware = {
         .info                   = SNDRV_PCM_INFO_MMAP |
                                   SNDRV_PCM_INFO_MMAP_VALID |
                                   SNDRV_PCM_INFO_PAUSE |
                                   SNDRV_PCM_INFO_RESUME |
                                   SNDRV_PCM_INFO_INTERLEAVED,
  ...

the generic one:

  ret = dma_get_slave_caps(chan, &dma_caps);
  if (ret == 0) {
          if (dma_caps.cmd_pause && dma_caps.cmd_resume)
                  hw.info |= SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME;
          if (dma_caps.residue_granularity <= DMA_RESIDUE_GRANULARITY_SEGMENT)
                  hw.info |= SNDRV_PCM_INFO_BATCH;
  ...

So, let's revert back to use the generic dmaengine pcm.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Reviewed-by: John Keeping <john@metanate.com>
Link: https://lore.kernel.org/r/1632792957-80428-1-git-send-email-sugar.zhang@rock-chips.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Sugar Zhang authored and Mark Brown committed Oct 20, 2021

Unverified

No user is associated with the committer email.
1 parent 4ca239f commit 5ba8ecf
Showing 4 changed files with 2 additions and 59 deletions.
3 changes: 1 addition & 2 deletions sound/soc/rockchip/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# SPDX-License-Identifier: GPL-2.0
# ROCKCHIP Platform Support
snd-soc-rockchip-i2s-objs := rockchip_i2s.o
snd-soc-rockchip-pcm-objs := rockchip_pcm.o
snd-soc-rockchip-pdm-objs := rockchip_pdm.o
snd-soc-rockchip-spdif-objs := rockchip_spdif.o

obj-$(CONFIG_SND_SOC_ROCKCHIP_I2S) += snd-soc-rockchip-i2s.o snd-soc-rockchip-pcm.o
obj-$(CONFIG_SND_SOC_ROCKCHIP_I2S) += snd-soc-rockchip-i2s.o
obj-$(CONFIG_SND_SOC_ROCKCHIP_PDM) += snd-soc-rockchip-pdm.o
obj-$(CONFIG_SND_SOC_ROCKCHIP_SPDIF) += snd-soc-rockchip-spdif.o

3 changes: 1 addition & 2 deletions sound/soc/rockchip/rockchip_i2s.c
Original file line number Diff line number Diff line change
@@ -20,7 +20,6 @@
#include <sound/dmaengine_pcm.h>

#include "rockchip_i2s.h"
#include "rockchip_pcm.h"

#define DRV_NAME "rockchip-i2s"

@@ -756,7 +755,7 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
goto err_suspend;
}

ret = rockchip_pcm_platform_register(&pdev->dev);
ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
if (ret) {
dev_err(&pdev->dev, "Could not register PCM\n");
goto err_suspend;
44 changes: 0 additions & 44 deletions sound/soc/rockchip/rockchip_pcm.c

This file was deleted.

11 changes: 0 additions & 11 deletions sound/soc/rockchip/rockchip_pcm.h

This file was deleted.

0 comments on commit 5ba8ecf

Please sign in to comment.