Skip to content

Commit

Permalink
ASoC: ux500: remove stedma40 references
Browse files Browse the repository at this point in the history
ux500_pcm_request_chan() is never called because the dma channels
are already set up from DT. Remove this, along with the
ux500_msp_dma_params structure.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230118161110.521504-4-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
arndb authored and broonie committed Jan 20, 2023
1 parent 1766ac5 commit aafe937
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 92 deletions.
4 changes: 2 additions & 2 deletions sound/soc/ux500/ux500_msp_dai.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,8 @@ static int ux500_msp_dai_of_probe(struct snd_soc_dai *dai)
if (!capture_dma_data)
return -ENOMEM;

playback_dma_data->addr = drvdata->msp->playback_dma_data.tx_rx_addr;
capture_dma_data->addr = drvdata->msp->capture_dma_data.tx_rx_addr;
playback_dma_data->addr = drvdata->msp->tx_rx_addr;
capture_dma_data->addr = drvdata->msp->tx_rx_addr;

playback_dma_data->maxburst = 4;
capture_dma_data->maxburst = 4;
Expand Down
41 changes: 1 addition & 40 deletions sound/soc/ux500/ux500_msp_i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,20 +360,6 @@ static int enable_msp(struct ux500_msp *msp, struct ux500_msp_config *config)
__func__, status);
}

/* Make sure the correct DMA-directions are configured */
if ((config->direction & MSP_DIR_RX) &&
!msp->capture_dma_data.dma_cfg) {
dev_err(msp->dev, "%s: ERROR: MSP RX-mode is not configured!",
__func__);
return -EINVAL;
}
if ((config->direction == MSP_DIR_TX) &&
!msp->playback_dma_data.dma_cfg) {
dev_err(msp->dev, "%s: ERROR: MSP TX-mode is not configured!",
__func__);
return -EINVAL;
}

reg_val_DMACR = readl(msp->registers + MSP_DMACR);
if (config->direction & MSP_DIR_RX)
reg_val_DMACR |= RX_DMA_ENABLE;
Expand Down Expand Up @@ -638,40 +624,17 @@ int ux500_msp_i2s_close(struct ux500_msp *msp, unsigned int dir)

}

static int ux500_msp_i2s_of_init_msp(struct platform_device *pdev,
struct ux500_msp *msp);
{
msp->playback_dma_data.dma_cfg = devm_kzalloc(&pdev->dev,
sizeof(struct stedma40_chan_cfg),
GFP_KERNEL);
if (!msp->playback_dma_data.dma_cfg)
return -ENOMEM;

msp->capture_dma_data.dma_cfg = devm_kzalloc(&pdev->dev,
sizeof(struct stedma40_chan_cfg),
GFP_KERNEL);
if (!msp->capture_dma_data.dma_cfg)
return -ENOMEM;

return 0;
}

int ux500_msp_i2s_init_msp(struct platform_device *pdev,
struct ux500_msp **msp_p)
{
struct resource *res = NULL;
struct ux500_msp *msp;
int ret;

*msp_p = devm_kzalloc(&pdev->dev, sizeof(struct ux500_msp), GFP_KERNEL);
msp = *msp_p;
if (!msp)
return -ENOMEM;

ret = ux500_msp_i2s_of_init_msp(pdev, msp);
if (ret)
return ret;

msp->dev = &pdev->dev;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
Expand All @@ -681,9 +644,7 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev,
return -ENOMEM;
}

msp->playback_dma_data.tx_rx_addr = res->start + MSP_DR;
msp->capture_dma_data.tx_rx_addr = res->start + MSP_DR;

msp->tx_rx_addr = res->start + MSP_DR;
msp->registers = devm_ioremap(&pdev->dev, res->start,
resource_size(res));
if (msp->registers == NULL) {
Expand Down
9 changes: 1 addition & 8 deletions sound/soc/ux500/ux500_msp_i2s.h
Original file line number Diff line number Diff line change
Expand Up @@ -462,18 +462,11 @@ struct ux500_msp_config {
unsigned int iodelay;
};

struct ux500_msp_dma_params {
unsigned int data_size;
dma_addr_t tx_rx_addr;
struct stedma40_chan_cfg *dma_cfg;
};

struct ux500_msp {
int id;
void __iomem *registers;
struct device *dev;
struct ux500_msp_dma_params playback_dma_data;
struct ux500_msp_dma_params capture_dma_data;
dma_addr_t tx_rx_addr;
enum msp_state msp_state;
int def_elem_len;
unsigned int dir_busy;
Expand Down
43 changes: 1 addition & 42 deletions sound/soc/ux500/ux500_pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <linux/dma-mapping.h>
#include <linux/dmaengine.h>
#include <linux/slab.h>
#include <linux/platform_data/dma-ste-dma40.h>

#include <sound/pcm.h>
#include <sound/pcm_params.h>
Expand All @@ -29,44 +28,6 @@
#define UX500_PLATFORM_PERIODS_MAX 48
#define UX500_PLATFORM_BUFFER_BYTES_MAX (2048 * PAGE_SIZE)

static struct dma_chan *ux500_pcm_request_chan(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_substream *substream)
{
struct snd_soc_dai *dai = asoc_rtd_to_cpu(rtd, 0);
u16 per_data_width, mem_data_width;
struct stedma40_chan_cfg *dma_cfg;
struct ux500_msp_dma_params *dma_params;

dma_params = snd_soc_dai_get_dma_data(dai, substream);
dma_cfg = dma_params->dma_cfg;

mem_data_width = DMA_SLAVE_BUSWIDTH_2_BYTES;

switch (dma_params->data_size) {
case 32:
per_data_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
break;
case 16:
per_data_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
break;
case 8:
per_data_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
break;
default:
per_data_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
}

if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
dma_cfg->src_info.data_width = mem_data_width;
dma_cfg->dst_info.data_width = per_data_width;
} else {
dma_cfg->src_info.data_width = per_data_width;
dma_cfg->dst_info.data_width = mem_data_width;
}

return snd_dmaengine_pcm_request_channel(stedma40_filter, dma_cfg);
}

static int ux500_pcm_prepare_slave_config(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct dma_slave_config *slave_config)
Expand Down Expand Up @@ -98,7 +59,6 @@ static int ux500_pcm_prepare_slave_config(struct snd_pcm_substream *substream,
}

static const struct snd_dmaengine_pcm_config ux500_dmaengine_of_pcm_config = {
.compat_request_channel = ux500_pcm_request_chan,
.prepare_slave_config = ux500_pcm_prepare_slave_config,
};

Expand All @@ -107,8 +67,7 @@ int ux500_pcm_register_platform(struct platform_device *pdev)
int ret;

ret = snd_dmaengine_pcm_register(&pdev->dev,
&ux500_dmaengine_of_pcm_config,
SND_DMAENGINE_PCM_FLAG_COMPAT);
&ux500_dmaengine_of_pcm_config, 0);
if (ret < 0) {
dev_err(&pdev->dev,
"%s: ERROR: Failed to register platform '%s' (%d)!\n",
Expand Down

0 comments on commit aafe937

Please sign in to comment.