forked from Minki/linux
ASoC: tegra: Use common DAI DMA data struct
Use the common DAI DMA data struct for tegra, this allows us to use the common helper function to configure the DMA slave config based on the DAI DMA data. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
09ae3aaf3c
commit
3489d5067a
@ -35,6 +35,7 @@
|
|||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
|
#include <sound/dmaengine_pcm.h>
|
||||||
|
|
||||||
#include "tegra_asoc_utils.h"
|
#include "tegra_asoc_utils.h"
|
||||||
#include "tegra20_ac97.h"
|
#include "tegra20_ac97.h"
|
||||||
@ -389,14 +390,14 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ac97->capture_dma_data.addr = mem->start + TEGRA20_AC97_FIFO_RX1;
|
ac97->capture_dma_data.addr = mem->start + TEGRA20_AC97_FIFO_RX1;
|
||||||
ac97->capture_dma_data.wrap = 4;
|
ac97->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
|
||||||
ac97->capture_dma_data.width = 32;
|
ac97->capture_dma_data.maxburst = 4;
|
||||||
ac97->capture_dma_data.req_sel = of_dma[1];
|
ac97->capture_dma_data.slave_id = of_dma[1];
|
||||||
|
|
||||||
ac97->playback_dma_data.addr = mem->start + TEGRA20_AC97_FIFO_TX1;
|
ac97->playback_dma_data.addr = mem->start + TEGRA20_AC97_FIFO_TX1;
|
||||||
ac97->playback_dma_data.wrap = 4;
|
ac97->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
|
||||||
ac97->playback_dma_data.width = 32;
|
ac97->capture_dma_data.maxburst = 4;
|
||||||
ac97->playback_dma_data.req_sel = of_dma[1];
|
ac97->capture_dma_data.slave_id = of_dma[0];
|
||||||
|
|
||||||
ret = snd_soc_register_dais(&pdev->dev, &tegra20_ac97_dai, 1);
|
ret = snd_soc_register_dais(&pdev->dev, &tegra20_ac97_dai, 1);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -85,8 +85,8 @@
|
|||||||
|
|
||||||
struct tegra20_ac97 {
|
struct tegra20_ac97 {
|
||||||
struct clk *clk_ac97;
|
struct clk *clk_ac97;
|
||||||
struct tegra_pcm_dma_params capture_dma_data;
|
struct snd_dmaengine_dai_dma_data capture_dma_data;
|
||||||
struct tegra_pcm_dma_params playback_dma_data;
|
struct snd_dmaengine_dai_dma_data playback_dma_data;
|
||||||
struct regmap *regmap;
|
struct regmap *regmap;
|
||||||
int reset_gpio;
|
int reset_gpio;
|
||||||
int sync_gpio;
|
int sync_gpio;
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
|
#include <sound/dmaengine_pcm.h>
|
||||||
|
|
||||||
#include "tegra20_i2s.h"
|
#include "tegra20_i2s.h"
|
||||||
|
|
||||||
@ -403,14 +404,14 @@ static int tegra20_i2s_platform_probe(struct platform_device *pdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
i2s->capture_dma_data.addr = mem->start + TEGRA20_I2S_FIFO2;
|
i2s->capture_dma_data.addr = mem->start + TEGRA20_I2S_FIFO2;
|
||||||
i2s->capture_dma_data.wrap = 4;
|
i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
|
||||||
i2s->capture_dma_data.width = 32;
|
i2s->capture_dma_data.maxburst = 4;
|
||||||
i2s->capture_dma_data.req_sel = dma_ch;
|
i2s->capture_dma_data.slave_id = dma_ch;
|
||||||
|
|
||||||
i2s->playback_dma_data.addr = mem->start + TEGRA20_I2S_FIFO1;
|
i2s->playback_dma_data.addr = mem->start + TEGRA20_I2S_FIFO1;
|
||||||
i2s->playback_dma_data.wrap = 4;
|
i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
|
||||||
i2s->playback_dma_data.width = 32;
|
i2s->playback_dma_data.maxburst = 4;
|
||||||
i2s->playback_dma_data.req_sel = dma_ch;
|
i2s->playback_dma_data.slave_id = dma_ch;
|
||||||
|
|
||||||
pm_runtime_enable(&pdev->dev);
|
pm_runtime_enable(&pdev->dev);
|
||||||
if (!pm_runtime_enabled(&pdev->dev)) {
|
if (!pm_runtime_enabled(&pdev->dev)) {
|
||||||
|
@ -155,8 +155,8 @@
|
|||||||
struct tegra20_i2s {
|
struct tegra20_i2s {
|
||||||
struct snd_soc_dai_driver dai;
|
struct snd_soc_dai_driver dai;
|
||||||
struct clk *clk_i2s;
|
struct clk *clk_i2s;
|
||||||
struct tegra_pcm_dma_params capture_dma_data;
|
struct snd_dmaengine_dai_dma_data capture_dma_data;
|
||||||
struct tegra_pcm_dma_params playback_dma_data;
|
struct snd_dmaengine_dai_dma_data playback_dma_data;
|
||||||
struct regmap *regmap;
|
struct regmap *regmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
|
#include <sound/dmaengine_pcm.h>
|
||||||
|
|
||||||
#include "tegra20_spdif.h"
|
#include "tegra20_spdif.h"
|
||||||
|
|
||||||
@ -318,9 +319,9 @@ static int tegra20_spdif_platform_probe(struct platform_device *pdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
spdif->playback_dma_data.addr = mem->start + TEGRA20_SPDIF_DATA_OUT;
|
spdif->playback_dma_data.addr = mem->start + TEGRA20_SPDIF_DATA_OUT;
|
||||||
spdif->playback_dma_data.wrap = 4;
|
spdif->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
|
||||||
spdif->playback_dma_data.width = 32;
|
spdif->capture_dma_data.maxburst = 4;
|
||||||
spdif->playback_dma_data.req_sel = dmareq->start;
|
spdif->playback_dma_data.slave_id = dmareq->start;
|
||||||
|
|
||||||
pm_runtime_enable(&pdev->dev);
|
pm_runtime_enable(&pdev->dev);
|
||||||
if (!pm_runtime_enabled(&pdev->dev)) {
|
if (!pm_runtime_enabled(&pdev->dev)) {
|
||||||
|
@ -462,8 +462,8 @@
|
|||||||
|
|
||||||
struct tegra20_spdif {
|
struct tegra20_spdif {
|
||||||
struct clk *clk_spdif_out;
|
struct clk *clk_spdif_out;
|
||||||
struct tegra_pcm_dma_params capture_dma_data;
|
struct snd_dmaengine_dai_dma_data capture_dma_data;
|
||||||
struct tegra_pcm_dma_params playback_dma_data;
|
struct snd_dmaengine_dai_dma_data playback_dma_data;
|
||||||
struct regmap *regmap;
|
struct regmap *regmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -95,8 +95,8 @@ static int tegra30_ahub_runtime_resume(struct device *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif,
|
int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif,
|
||||||
unsigned long *fiforeg,
|
dma_addr_t *fiforeg,
|
||||||
unsigned long *reqsel)
|
unsigned int *reqsel)
|
||||||
{
|
{
|
||||||
int channel;
|
int channel;
|
||||||
u32 reg, val;
|
u32 reg, val;
|
||||||
@ -178,8 +178,8 @@ int tegra30_ahub_free_rx_fifo(enum tegra30_ahub_rxcif rxcif)
|
|||||||
EXPORT_SYMBOL_GPL(tegra30_ahub_free_rx_fifo);
|
EXPORT_SYMBOL_GPL(tegra30_ahub_free_rx_fifo);
|
||||||
|
|
||||||
int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif,
|
int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif,
|
||||||
unsigned long *fiforeg,
|
dma_addr_t *fiforeg,
|
||||||
unsigned long *reqsel)
|
unsigned int *reqsel)
|
||||||
{
|
{
|
||||||
int channel;
|
int channel;
|
||||||
u32 reg, val;
|
u32 reg, val;
|
||||||
|
@ -451,15 +451,15 @@ enum tegra30_ahub_rxcif {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif,
|
extern int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif,
|
||||||
unsigned long *fiforeg,
|
dma_addr_t *fiforeg,
|
||||||
unsigned long *reqsel);
|
unsigned int *reqsel);
|
||||||
extern int tegra30_ahub_enable_rx_fifo(enum tegra30_ahub_rxcif rxcif);
|
extern int tegra30_ahub_enable_rx_fifo(enum tegra30_ahub_rxcif rxcif);
|
||||||
extern int tegra30_ahub_disable_rx_fifo(enum tegra30_ahub_rxcif rxcif);
|
extern int tegra30_ahub_disable_rx_fifo(enum tegra30_ahub_rxcif rxcif);
|
||||||
extern int tegra30_ahub_free_rx_fifo(enum tegra30_ahub_rxcif rxcif);
|
extern int tegra30_ahub_free_rx_fifo(enum tegra30_ahub_rxcif rxcif);
|
||||||
|
|
||||||
extern int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif,
|
extern int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif,
|
||||||
unsigned long *fiforeg,
|
dma_addr_t *fiforeg,
|
||||||
unsigned long *reqsel);
|
unsigned int *reqsel);
|
||||||
extern int tegra30_ahub_enable_tx_fifo(enum tegra30_ahub_txcif txcif);
|
extern int tegra30_ahub_enable_tx_fifo(enum tegra30_ahub_txcif txcif);
|
||||||
extern int tegra30_ahub_disable_tx_fifo(enum tegra30_ahub_txcif txcif);
|
extern int tegra30_ahub_disable_tx_fifo(enum tegra30_ahub_txcif txcif);
|
||||||
extern int tegra30_ahub_free_tx_fifo(enum tegra30_ahub_txcif txcif);
|
extern int tegra30_ahub_free_tx_fifo(enum tegra30_ahub_txcif txcif);
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
|
#include <sound/dmaengine_pcm.h>
|
||||||
|
|
||||||
#include "tegra30_ahub.h"
|
#include "tegra30_ahub.h"
|
||||||
#include "tegra30_i2s.h"
|
#include "tegra30_i2s.h"
|
||||||
@ -80,17 +81,17 @@ static int tegra30_i2s_startup(struct snd_pcm_substream *substream,
|
|||||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
|
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
|
||||||
ret = tegra30_ahub_allocate_tx_fifo(&i2s->playback_fifo_cif,
|
ret = tegra30_ahub_allocate_tx_fifo(&i2s->playback_fifo_cif,
|
||||||
&i2s->playback_dma_data.addr,
|
&i2s->playback_dma_data.addr,
|
||||||
&i2s->playback_dma_data.req_sel);
|
&i2s->playback_dma_data.slave_id);
|
||||||
i2s->playback_dma_data.wrap = 4;
|
i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
|
||||||
i2s->playback_dma_data.width = 32;
|
i2s->playback_dma_data.maxburst = 4;
|
||||||
tegra30_ahub_set_rx_cif_source(i2s->playback_i2s_cif,
|
tegra30_ahub_set_rx_cif_source(i2s->playback_i2s_cif,
|
||||||
i2s->playback_fifo_cif);
|
i2s->playback_fifo_cif);
|
||||||
} else {
|
} else {
|
||||||
ret = tegra30_ahub_allocate_rx_fifo(&i2s->capture_fifo_cif,
|
ret = tegra30_ahub_allocate_rx_fifo(&i2s->capture_fifo_cif,
|
||||||
&i2s->capture_dma_data.addr,
|
&i2s->capture_dma_data.addr,
|
||||||
&i2s->capture_dma_data.req_sel);
|
&i2s->capture_dma_data.slave_id);
|
||||||
i2s->capture_dma_data.wrap = 4;
|
i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
|
||||||
i2s->capture_dma_data.width = 32;
|
i2s->capture_dma_data.maxburst = 4;
|
||||||
tegra30_ahub_set_rx_cif_source(i2s->capture_fifo_cif,
|
tegra30_ahub_set_rx_cif_source(i2s->capture_fifo_cif,
|
||||||
i2s->capture_i2s_cif);
|
i2s->capture_i2s_cif);
|
||||||
}
|
}
|
||||||
|
@ -231,10 +231,10 @@ struct tegra30_i2s {
|
|||||||
struct clk *clk_i2s;
|
struct clk *clk_i2s;
|
||||||
enum tegra30_ahub_txcif capture_i2s_cif;
|
enum tegra30_ahub_txcif capture_i2s_cif;
|
||||||
enum tegra30_ahub_rxcif capture_fifo_cif;
|
enum tegra30_ahub_rxcif capture_fifo_cif;
|
||||||
struct tegra_pcm_dma_params capture_dma_data;
|
struct snd_dmaengine_dai_dma_data capture_dma_data;
|
||||||
enum tegra30_ahub_rxcif playback_i2s_cif;
|
enum tegra30_ahub_rxcif playback_i2s_cif;
|
||||||
enum tegra30_ahub_txcif playback_fifo_cif;
|
enum tegra30_ahub_txcif playback_fifo_cif;
|
||||||
struct tegra_pcm_dma_params playback_dma_data;
|
struct snd_dmaengine_dai_dma_data playback_dma_data;
|
||||||
struct regmap *regmap;
|
struct regmap *regmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -81,12 +81,9 @@ static int tegra_pcm_hw_params(struct snd_pcm_substream *substream,
|
|||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||||
struct device *dev = rtd->platform->dev;
|
struct device *dev = rtd->platform->dev;
|
||||||
struct dma_chan *chan = snd_dmaengine_pcm_get_chan(substream);
|
struct dma_chan *chan = snd_dmaengine_pcm_get_chan(substream);
|
||||||
struct tegra_pcm_dma_params *dmap;
|
|
||||||
struct dma_slave_config slave_config;
|
struct dma_slave_config slave_config;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
dmap = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
|
|
||||||
|
|
||||||
ret = snd_hwparams_to_dma_slave_config(substream, params,
|
ret = snd_hwparams_to_dma_slave_config(substream, params,
|
||||||
&slave_config);
|
&slave_config);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
@ -94,16 +91,9 @@ static int tegra_pcm_hw_params(struct snd_pcm_substream *substream,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
|
snd_dmaengine_pcm_set_config_from_dai_data(substream,
|
||||||
slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
|
snd_soc_dai_get_dma_data(rtd->cpu_dai, substream),
|
||||||
slave_config.dst_addr = dmap->addr;
|
&slave_config);
|
||||||
slave_config.dst_maxburst = 4;
|
|
||||||
} else {
|
|
||||||
slave_config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
|
|
||||||
slave_config.src_addr = dmap->addr;
|
|
||||||
slave_config.src_maxburst = 4;
|
|
||||||
}
|
|
||||||
slave_config.slave_id = dmap->req_sel;
|
|
||||||
|
|
||||||
ret = dmaengine_slave_config(chan, &slave_config);
|
ret = dmaengine_slave_config(chan, &slave_config);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
@ -31,13 +31,6 @@
|
|||||||
#ifndef __TEGRA_PCM_H__
|
#ifndef __TEGRA_PCM_H__
|
||||||
#define __TEGRA_PCM_H__
|
#define __TEGRA_PCM_H__
|
||||||
|
|
||||||
struct tegra_pcm_dma_params {
|
|
||||||
unsigned long addr;
|
|
||||||
unsigned long wrap;
|
|
||||||
unsigned long width;
|
|
||||||
unsigned long req_sel;
|
|
||||||
};
|
|
||||||
|
|
||||||
int tegra_pcm_platform_register(struct device *dev);
|
int tegra_pcm_platform_register(struct device *dev);
|
||||||
void tegra_pcm_platform_unregister(struct device *dev);
|
void tegra_pcm_platform_unregister(struct device *dev);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user