Commit b9a1a743 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Mark Brown

ASoC: samsung: pass DMA channels as pointers

ARM64 allmodconfig produces a bunch of warnings when building the
samsung ASoC code:

sound/soc/samsung/dmaengine.c: In function 'samsung_asoc_init_dma_data':
sound/soc/samsung/dmaengine.c:53:32: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   playback_data->filter_data = (void *)playback->channel;
sound/soc/samsung/dmaengine.c:60:31: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   capture_data->filter_data = (void *)capture->channel;

We could easily shut up the warning by adding an intermediate cast,
but there is a bigger underlying problem: The use of IORESOURCE_DMA
to pass data from platform code to device drivers is dubious to start
with, as what we really want is a pointer that can be passed into
a filter function.

Note that on s3c64xx, the pl08x DMA data is already a pointer, but
gets cast to resource_size_t so we can pass it as a resource, and it
then gets converted back to a pointer. In contrast, the data we pass
for s3c24xx is an index into a device specific table, and we artificially
convert that into a pointer for the filter function.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Reviewed-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 8005c49d
...@@ -54,12 +54,12 @@ static int s3c64xx_i2s_cfg_gpio(struct platform_device *pdev) ...@@ -54,12 +54,12 @@ static int s3c64xx_i2s_cfg_gpio(struct platform_device *pdev)
static struct resource s3c64xx_iis0_resource[] = { static struct resource s3c64xx_iis0_resource[] = {
[0] = DEFINE_RES_MEM(S3C64XX_PA_IIS0, SZ_256), [0] = DEFINE_RES_MEM(S3C64XX_PA_IIS0, SZ_256),
[1] = DEFINE_RES_DMA(DMACH_I2S0_OUT),
[2] = DEFINE_RES_DMA(DMACH_I2S0_IN),
}; };
static struct s3c_audio_pdata i2sv3_pdata = { static struct s3c_audio_pdata i2s0_pdata = {
.cfg_gpio = s3c64xx_i2s_cfg_gpio, .cfg_gpio = s3c64xx_i2s_cfg_gpio,
.dma_playback = DMACH_I2S0_OUT,
.dma_capture = DMACH_I2S0_IN,
}; };
struct platform_device s3c64xx_device_iis0 = { struct platform_device s3c64xx_device_iis0 = {
...@@ -68,15 +68,19 @@ struct platform_device s3c64xx_device_iis0 = { ...@@ -68,15 +68,19 @@ struct platform_device s3c64xx_device_iis0 = {
.num_resources = ARRAY_SIZE(s3c64xx_iis0_resource), .num_resources = ARRAY_SIZE(s3c64xx_iis0_resource),
.resource = s3c64xx_iis0_resource, .resource = s3c64xx_iis0_resource,
.dev = { .dev = {
.platform_data = &i2sv3_pdata, .platform_data = &i2s0_pdata,
}, },
}; };
EXPORT_SYMBOL(s3c64xx_device_iis0); EXPORT_SYMBOL(s3c64xx_device_iis0);
static struct resource s3c64xx_iis1_resource[] = { static struct resource s3c64xx_iis1_resource[] = {
[0] = DEFINE_RES_MEM(S3C64XX_PA_IIS1, SZ_256), [0] = DEFINE_RES_MEM(S3C64XX_PA_IIS1, SZ_256),
[1] = DEFINE_RES_DMA(DMACH_I2S1_OUT), };
[2] = DEFINE_RES_DMA(DMACH_I2S1_IN),
static struct s3c_audio_pdata i2s1_pdata = {
.cfg_gpio = s3c64xx_i2s_cfg_gpio,
.dma_playback = DMACH_I2S1_OUT,
.dma_capture = DMACH_I2S1_IN,
}; };
struct platform_device s3c64xx_device_iis1 = { struct platform_device s3c64xx_device_iis1 = {
...@@ -85,19 +89,19 @@ struct platform_device s3c64xx_device_iis1 = { ...@@ -85,19 +89,19 @@ struct platform_device s3c64xx_device_iis1 = {
.num_resources = ARRAY_SIZE(s3c64xx_iis1_resource), .num_resources = ARRAY_SIZE(s3c64xx_iis1_resource),
.resource = s3c64xx_iis1_resource, .resource = s3c64xx_iis1_resource,
.dev = { .dev = {
.platform_data = &i2sv3_pdata, .platform_data = &i2s1_pdata,
}, },
}; };
EXPORT_SYMBOL(s3c64xx_device_iis1); EXPORT_SYMBOL(s3c64xx_device_iis1);
static struct resource s3c64xx_iisv4_resource[] = { static struct resource s3c64xx_iisv4_resource[] = {
[0] = DEFINE_RES_MEM(S3C64XX_PA_IISV4, SZ_256), [0] = DEFINE_RES_MEM(S3C64XX_PA_IISV4, SZ_256),
[1] = DEFINE_RES_DMA(DMACH_HSI_I2SV40_TX),
[2] = DEFINE_RES_DMA(DMACH_HSI_I2SV40_RX),
}; };
static struct s3c_audio_pdata i2sv4_pdata = { static struct s3c_audio_pdata i2sv4_pdata = {
.cfg_gpio = s3c64xx_i2s_cfg_gpio, .cfg_gpio = s3c64xx_i2s_cfg_gpio,
.dma_playback = DMACH_HSI_I2SV40_TX,
.dma_capture = DMACH_HSI_I2SV40_RX,
.type = { .type = {
.i2s = { .i2s = {
.quirks = QUIRK_PRI_6CHAN, .quirks = QUIRK_PRI_6CHAN,
...@@ -142,12 +146,12 @@ static int s3c64xx_pcm_cfg_gpio(struct platform_device *pdev) ...@@ -142,12 +146,12 @@ static int s3c64xx_pcm_cfg_gpio(struct platform_device *pdev)
static struct resource s3c64xx_pcm0_resource[] = { static struct resource s3c64xx_pcm0_resource[] = {
[0] = DEFINE_RES_MEM(S3C64XX_PA_PCM0, SZ_256), [0] = DEFINE_RES_MEM(S3C64XX_PA_PCM0, SZ_256),
[1] = DEFINE_RES_DMA(DMACH_PCM0_TX),
[2] = DEFINE_RES_DMA(DMACH_PCM0_RX),
}; };
static struct s3c_audio_pdata s3c_pcm0_pdata = { static struct s3c_audio_pdata s3c_pcm0_pdata = {
.cfg_gpio = s3c64xx_pcm_cfg_gpio, .cfg_gpio = s3c64xx_pcm_cfg_gpio,
.dma_capture = DMACH_PCM0_RX,
.dma_playback = DMACH_PCM0_TX,
}; };
struct platform_device s3c64xx_device_pcm0 = { struct platform_device s3c64xx_device_pcm0 = {
...@@ -163,12 +167,12 @@ EXPORT_SYMBOL(s3c64xx_device_pcm0); ...@@ -163,12 +167,12 @@ EXPORT_SYMBOL(s3c64xx_device_pcm0);
static struct resource s3c64xx_pcm1_resource[] = { static struct resource s3c64xx_pcm1_resource[] = {
[0] = DEFINE_RES_MEM(S3C64XX_PA_PCM1, SZ_256), [0] = DEFINE_RES_MEM(S3C64XX_PA_PCM1, SZ_256),
[1] = DEFINE_RES_DMA(DMACH_PCM1_TX),
[2] = DEFINE_RES_DMA(DMACH_PCM1_RX),
}; };
static struct s3c_audio_pdata s3c_pcm1_pdata = { static struct s3c_audio_pdata s3c_pcm1_pdata = {
.cfg_gpio = s3c64xx_pcm_cfg_gpio, .cfg_gpio = s3c64xx_pcm_cfg_gpio,
.dma_playback = DMACH_PCM1_TX,
.dma_capture = DMACH_PCM1_RX,
}; };
struct platform_device s3c64xx_device_pcm1 = { struct platform_device s3c64xx_device_pcm1 = {
...@@ -196,13 +200,14 @@ static int s3c64xx_ac97_cfg_gpe(struct platform_device *pdev) ...@@ -196,13 +200,14 @@ static int s3c64xx_ac97_cfg_gpe(struct platform_device *pdev)
static struct resource s3c64xx_ac97_resource[] = { static struct resource s3c64xx_ac97_resource[] = {
[0] = DEFINE_RES_MEM(S3C64XX_PA_AC97, SZ_256), [0] = DEFINE_RES_MEM(S3C64XX_PA_AC97, SZ_256),
[1] = DEFINE_RES_DMA(DMACH_AC97_PCMOUT), [1] = DEFINE_RES_IRQ(IRQ_AC97),
[2] = DEFINE_RES_DMA(DMACH_AC97_PCMIN),
[3] = DEFINE_RES_DMA(DMACH_AC97_MICIN),
[4] = DEFINE_RES_IRQ(IRQ_AC97),
}; };
static struct s3c_audio_pdata s3c_ac97_pdata; static struct s3c_audio_pdata s3c_ac97_pdata = {
.dma_playback = DMACH_AC97_PCMOUT,
.dma_capture = DMACH_AC97_PCMIN,
.dma_capture_mic = DMACH_AC97_MICIN,
};
static u64 s3c64xx_ac97_dmamask = DMA_BIT_MASK(32); static u64 s3c64xx_ac97_dmamask = DMA_BIT_MASK(32);
......
...@@ -14,38 +14,38 @@ ...@@ -14,38 +14,38 @@
#define S3C64XX_DMA_CHAN(name) ((unsigned long)(name)) #define S3C64XX_DMA_CHAN(name) ((unsigned long)(name))
/* DMA0/SDMA0 */ /* DMA0/SDMA0 */
#define DMACH_UART0 S3C64XX_DMA_CHAN("uart0_tx") #define DMACH_UART0 "uart0_tx"
#define DMACH_UART0_SRC2 S3C64XX_DMA_CHAN("uart0_rx") #define DMACH_UART0_SRC2 "uart0_rx"
#define DMACH_UART1 S3C64XX_DMA_CHAN("uart1_tx") #define DMACH_UART1 "uart1_tx"
#define DMACH_UART1_SRC2 S3C64XX_DMA_CHAN("uart1_rx") #define DMACH_UART1_SRC2 "uart1_rx"
#define DMACH_UART2 S3C64XX_DMA_CHAN("uart2_tx") #define DMACH_UART2 "uart2_tx"
#define DMACH_UART2_SRC2 S3C64XX_DMA_CHAN("uart2_rx") #define DMACH_UART2_SRC2 "uart2_rx"
#define DMACH_UART3 S3C64XX_DMA_CHAN("uart3_tx") #define DMACH_UART3 "uart3_tx"
#define DMACH_UART3_SRC2 S3C64XX_DMA_CHAN("uart3_rx") #define DMACH_UART3_SRC2 "uart3_rx"
#define DMACH_PCM0_TX S3C64XX_DMA_CHAN("pcm0_tx") #define DMACH_PCM0_TX "pcm0_tx"
#define DMACH_PCM0_RX S3C64XX_DMA_CHAN("pcm0_rx") #define DMACH_PCM0_RX "pcm0_rx"
#define DMACH_I2S0_OUT S3C64XX_DMA_CHAN("i2s0_tx") #define DMACH_I2S0_OUT "i2s0_tx"
#define DMACH_I2S0_IN S3C64XX_DMA_CHAN("i2s0_rx") #define DMACH_I2S0_IN "i2s0_rx"
#define DMACH_SPI0_TX S3C64XX_DMA_CHAN("spi0_tx") #define DMACH_SPI0_TX S3C64XX_DMA_CHAN("spi0_tx")
#define DMACH_SPI0_RX S3C64XX_DMA_CHAN("spi0_rx") #define DMACH_SPI0_RX S3C64XX_DMA_CHAN("spi0_rx")
#define DMACH_HSI_I2SV40_TX S3C64XX_DMA_CHAN("i2s2_tx") #define DMACH_HSI_I2SV40_TX "i2s2_tx"
#define DMACH_HSI_I2SV40_RX S3C64XX_DMA_CHAN("i2s2_rx") #define DMACH_HSI_I2SV40_RX "i2s2_rx"
/* DMA1/SDMA1 */ /* DMA1/SDMA1 */
#define DMACH_PCM1_TX S3C64XX_DMA_CHAN("pcm1_tx") #define DMACH_PCM1_TX "pcm1_tx"
#define DMACH_PCM1_RX S3C64XX_DMA_CHAN("pcm1_rx") #define DMACH_PCM1_RX "pcm1_rx"
#define DMACH_I2S1_OUT S3C64XX_DMA_CHAN("i2s1_tx") #define DMACH_I2S1_OUT "i2s1_tx"
#define DMACH_I2S1_IN S3C64XX_DMA_CHAN("i2s1_rx") #define DMACH_I2S1_IN "i2s1_rx"
#define DMACH_SPI1_TX S3C64XX_DMA_CHAN("spi1_tx") #define DMACH_SPI1_TX S3C64XX_DMA_CHAN("spi1_tx")
#define DMACH_SPI1_RX S3C64XX_DMA_CHAN("spi1_rx") #define DMACH_SPI1_RX S3C64XX_DMA_CHAN("spi1_rx")
#define DMACH_AC97_PCMOUT S3C64XX_DMA_CHAN("ac97_out") #define DMACH_AC97_PCMOUT "ac97_out"
#define DMACH_AC97_PCMIN S3C64XX_DMA_CHAN("ac97_in") #define DMACH_AC97_PCMIN "ac97_in"
#define DMACH_AC97_MICIN S3C64XX_DMA_CHAN("ac97_mic") #define DMACH_AC97_MICIN "ac97_mic"
#define DMACH_PWM S3C64XX_DMA_CHAN("pwm") #define DMACH_PWM "pwm"
#define DMACH_IRDA S3C64XX_DMA_CHAN("irda") #define DMACH_IRDA "irda"
#define DMACH_EXTERNAL S3C64XX_DMA_CHAN("external") #define DMACH_EXTERNAL "external"
#define DMACH_SECURITY_RX S3C64XX_DMA_CHAN("sec_rx") #define DMACH_SECURITY_RX "sec_rx"
#define DMACH_SECURITY_TX S3C64XX_DMA_CHAN("sec_tx") #define DMACH_SECURITY_TX "sec_tx"
enum dma_ch { enum dma_ch {
DMACH_MAX = 32 DMACH_MAX = 32
......
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
#include <linux/platform_data/usb-ohci-s3c2410.h> #include <linux/platform_data/usb-ohci-s3c2410.h>
#include <plat/usb-phy.h> #include <plat/usb-phy.h>
#include <plat/regs-spi.h> #include <plat/regs-spi.h>
#include <linux/platform_data/asoc-s3c.h>
#include <linux/platform_data/spi-s3c64xx.h> #include <linux/platform_data/spi-s3c64xx.h>
static u64 samsung_device_dma_mask = DMA_BIT_MASK(32); static u64 samsung_device_dma_mask = DMA_BIT_MASK(32);
...@@ -74,9 +75,12 @@ static u64 samsung_device_dma_mask = DMA_BIT_MASK(32); ...@@ -74,9 +75,12 @@ static u64 samsung_device_dma_mask = DMA_BIT_MASK(32);
static struct resource s3c_ac97_resource[] = { static struct resource s3c_ac97_resource[] = {
[0] = DEFINE_RES_MEM(S3C2440_PA_AC97, S3C2440_SZ_AC97), [0] = DEFINE_RES_MEM(S3C2440_PA_AC97, S3C2440_SZ_AC97),
[1] = DEFINE_RES_IRQ(IRQ_S3C244X_AC97), [1] = DEFINE_RES_IRQ(IRQ_S3C244X_AC97),
[2] = DEFINE_RES_DMA_NAMED(DMACH_PCM_OUT, "PCM out"), };
[3] = DEFINE_RES_DMA_NAMED(DMACH_PCM_IN, "PCM in"),
[4] = DEFINE_RES_DMA_NAMED(DMACH_MIC_IN, "Mic in"), static struct s3c_audio_pdata s3c_ac97_pdata = {
.dma_playback = (void *)DMACH_PCM_OUT,
.dma_capture = (void *)DMACH_PCM_IN,
.dma_capture_mic = (void *)DMACH_MIC_IN,
}; };
struct platform_device s3c_device_ac97 = { struct platform_device s3c_device_ac97 = {
...@@ -87,6 +91,7 @@ struct platform_device s3c_device_ac97 = { ...@@ -87,6 +91,7 @@ struct platform_device s3c_device_ac97 = {
.dev = { .dev = {
.dma_mask = &samsung_device_dma_mask, .dma_mask = &samsung_device_dma_mask,
.coherent_dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32),
.platform_data = &s3c_ac97_pdata,
} }
}; };
#endif /* CONFIG_CPU_S3C2440 */ #endif /* CONFIG_CPU_S3C2440 */
......
...@@ -39,6 +39,10 @@ struct samsung_i2s { ...@@ -39,6 +39,10 @@ struct samsung_i2s {
*/ */
struct s3c_audio_pdata { struct s3c_audio_pdata {
int (*cfg_gpio)(struct platform_device *); int (*cfg_gpio)(struct platform_device *);
void *dma_playback;
void *dma_capture;
void *dma_play_sec;
void *dma_capture_mic;
union { union {
struct samsung_i2s i2s; struct samsung_i2s i2s;
} type; } type;
......
...@@ -324,7 +324,7 @@ static const struct snd_soc_component_driver s3c_ac97_component = { ...@@ -324,7 +324,7 @@ static const struct snd_soc_component_driver s3c_ac97_component = {
static int s3c_ac97_probe(struct platform_device *pdev) static int s3c_ac97_probe(struct platform_device *pdev)
{ {
struct resource *mem_res, *dmatx_res, *dmarx_res, *dmamic_res, *irq_res; struct resource *mem_res, *irq_res;
struct s3c_audio_pdata *ac97_pdata; struct s3c_audio_pdata *ac97_pdata;
int ret; int ret;
...@@ -335,24 +335,6 @@ static int s3c_ac97_probe(struct platform_device *pdev) ...@@ -335,24 +335,6 @@ static int s3c_ac97_probe(struct platform_device *pdev)
} }
/* Check for availability of necessary resource */ /* Check for availability of necessary resource */
dmatx_res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
if (!dmatx_res) {
dev_err(&pdev->dev, "Unable to get AC97-TX dma resource\n");
return -ENXIO;
}
dmarx_res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
if (!dmarx_res) {
dev_err(&pdev->dev, "Unable to get AC97-RX dma resource\n");
return -ENXIO;
}
dmamic_res = platform_get_resource(pdev, IORESOURCE_DMA, 2);
if (!dmamic_res) {
dev_err(&pdev->dev, "Unable to get AC97-MIC dma resource\n");
return -ENXIO;
}
irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!irq_res) { if (!irq_res) {
dev_err(&pdev->dev, "AC97 IRQ not provided!\n"); dev_err(&pdev->dev, "AC97 IRQ not provided!\n");
...@@ -364,11 +346,11 @@ static int s3c_ac97_probe(struct platform_device *pdev) ...@@ -364,11 +346,11 @@ static int s3c_ac97_probe(struct platform_device *pdev)
if (IS_ERR(s3c_ac97.regs)) if (IS_ERR(s3c_ac97.regs))
return PTR_ERR(s3c_ac97.regs); return PTR_ERR(s3c_ac97.regs);
s3c_ac97_pcm_out.channel = dmatx_res->start; s3c_ac97_pcm_out.slave = ac97_pdata->dma_playback;
s3c_ac97_pcm_out.dma_addr = mem_res->start + S3C_AC97_PCM_DATA; s3c_ac97_pcm_out.dma_addr = mem_res->start + S3C_AC97_PCM_DATA;
s3c_ac97_pcm_in.channel = dmarx_res->start; s3c_ac97_pcm_in.slave = ac97_pdata->dma_capture;
s3c_ac97_pcm_in.dma_addr = mem_res->start + S3C_AC97_PCM_DATA; s3c_ac97_pcm_in.dma_addr = mem_res->start + S3C_AC97_PCM_DATA;
s3c_ac97_mic_in.channel = dmamic_res->start; s3c_ac97_mic_in.slave = ac97_pdata->dma_capture_mic;
s3c_ac97_mic_in.dma_addr = mem_res->start + S3C_AC97_MIC_DATA; s3c_ac97_mic_in.dma_addr = mem_res->start + S3C_AC97_MIC_DATA;
init_completion(&s3c_ac97.done); init_completion(&s3c_ac97.done);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <sound/dmaengine_pcm.h> #include <sound/dmaengine_pcm.h>
struct s3c_dma_params { struct s3c_dma_params {
int channel; /* Channel ID */ void *slave; /* Channel ID */
dma_addr_t dma_addr; dma_addr_t dma_addr;
int dma_size; /* Size of the DMA transfer */ int dma_size; /* Size of the DMA transfer */
char *ch_name; char *ch_name;
......
...@@ -50,14 +50,14 @@ void samsung_asoc_init_dma_data(struct snd_soc_dai *dai, ...@@ -50,14 +50,14 @@ void samsung_asoc_init_dma_data(struct snd_soc_dai *dai,
if (playback) { if (playback) {
playback_data = &playback->dma_data; playback_data = &playback->dma_data;
playback_data->filter_data = (void *)playback->channel; playback_data->filter_data = playback->slave;
playback_data->chan_name = playback->ch_name; playback_data->chan_name = playback->ch_name;
playback_data->addr = playback->dma_addr; playback_data->addr = playback->dma_addr;
playback_data->addr_width = playback->dma_size; playback_data->addr_width = playback->dma_size;
} }
if (capture) { if (capture) {
capture_data = &capture->dma_data; capture_data = &capture->dma_data;
capture_data->filter_data = (void *)capture->channel; capture_data->filter_data = capture->slave;
capture_data->chan_name = capture->ch_name; capture_data->chan_name = capture->ch_name;
capture_data->addr = capture->dma_addr; capture_data->addr = capture->dma_addr;
capture_data->addr_width = capture->dma_size; capture_data->addr_width = capture->dma_size;
......
...@@ -1257,27 +1257,14 @@ static int samsung_i2s_probe(struct platform_device *pdev) ...@@ -1257,27 +1257,14 @@ static int samsung_i2s_probe(struct platform_device *pdev)
pri_dai->lock = &pri_dai->spinlock; pri_dai->lock = &pri_dai->spinlock;
if (!np) { if (!np) {
res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
if (!res) {
dev_err(&pdev->dev,
"Unable to get I2S-TX dma resource\n");
return -ENXIO;
}
pri_dai->dma_playback.channel = res->start;
res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
if (!res) {
dev_err(&pdev->dev,
"Unable to get I2S-RX dma resource\n");
return -ENXIO;
}
pri_dai->dma_capture.channel = res->start;
if (i2s_pdata == NULL) { if (i2s_pdata == NULL) {
dev_err(&pdev->dev, "Can't work without s3c_audio_pdata\n"); dev_err(&pdev->dev, "Can't work without s3c_audio_pdata\n");
return -EINVAL; return -EINVAL;
} }
pri_dai->dma_playback.slave = i2s_pdata->dma_playback;
pri_dai->dma_capture.slave = i2s_pdata->dma_capture;
if (&i2s_pdata->type) if (&i2s_pdata->type)
i2s_cfg = &i2s_pdata->type.i2s; i2s_cfg = &i2s_pdata->type.i2s;
...@@ -1338,11 +1325,8 @@ static int samsung_i2s_probe(struct platform_device *pdev) ...@@ -1338,11 +1325,8 @@ static int samsung_i2s_probe(struct platform_device *pdev)
sec_dai->dma_playback.dma_addr = regs_base + I2STXDS; sec_dai->dma_playback.dma_addr = regs_base + I2STXDS;
sec_dai->dma_playback.ch_name = "tx-sec"; sec_dai->dma_playback.ch_name = "tx-sec";
if (!np) { if (!np)
res = platform_get_resource(pdev, IORESOURCE_DMA, 2); sec_dai->dma_playback.slave = i2s_pdata->dma_play_sec;
if (res)
sec_dai->dma_playback.channel = res->start;
}
sec_dai->dma_playback.dma_size = 4; sec_dai->dma_playback.dma_size = 4;
sec_dai->addr = pri_dai->addr; sec_dai->addr = pri_dai->addr;
......
...@@ -486,7 +486,7 @@ static const struct snd_soc_component_driver s3c_pcm_component = { ...@@ -486,7 +486,7 @@ static const struct snd_soc_component_driver s3c_pcm_component = {
static int s3c_pcm_dev_probe(struct platform_device *pdev) static int s3c_pcm_dev_probe(struct platform_device *pdev)
{ {
struct s3c_pcm_info *pcm; struct s3c_pcm_info *pcm;
struct resource *mem_res, *dmatx_res, *dmarx_res; struct resource *mem_res;
struct s3c_audio_pdata *pcm_pdata; struct s3c_audio_pdata *pcm_pdata;
int ret; int ret;
...@@ -499,18 +499,6 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev) ...@@ -499,18 +499,6 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev)
pcm_pdata = pdev->dev.platform_data; pcm_pdata = pdev->dev.platform_data;
/* Check for availability of necessary resource */ /* Check for availability of necessary resource */
dmatx_res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
if (!dmatx_res) {
dev_err(&pdev->dev, "Unable to get PCM-TX dma resource\n");
return -ENXIO;
}
dmarx_res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
if (!dmarx_res) {
dev_err(&pdev->dev, "Unable to get PCM-RX dma resource\n");
return -ENXIO;
}
mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mem_res) { if (!mem_res) {
dev_err(&pdev->dev, "Unable to get register resource\n"); dev_err(&pdev->dev, "Unable to get register resource\n");
...@@ -568,8 +556,10 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev) ...@@ -568,8 +556,10 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev)
s3c_pcm_stereo_out[pdev->id].dma_addr = mem_res->start s3c_pcm_stereo_out[pdev->id].dma_addr = mem_res->start
+ S3C_PCM_TXFIFO; + S3C_PCM_TXFIFO;
s3c_pcm_stereo_in[pdev->id].channel = dmarx_res->start; if (pcm_pdata) {
s3c_pcm_stereo_out[pdev->id].channel = dmatx_res->start; s3c_pcm_stereo_in[pdev->id].slave = pcm_pdata->dma_capture;
s3c_pcm_stereo_out[pdev->id].slave = pcm_pdata->dma_playback;
}
pcm->dma_capture = &s3c_pcm_stereo_in[pdev->id]; pcm->dma_capture = &s3c_pcm_stereo_in[pdev->id];
pcm->dma_playback = &s3c_pcm_stereo_out[pdev->id]; pcm->dma_playback = &s3c_pcm_stereo_out[pdev->id];
......
...@@ -34,13 +34,13 @@ ...@@ -34,13 +34,13 @@
#include "s3c2412-i2s.h" #include "s3c2412-i2s.h"
static struct s3c_dma_params s3c2412_i2s_pcm_stereo_out = { static struct s3c_dma_params s3c2412_i2s_pcm_stereo_out = {
.channel = DMACH_I2S_OUT, .slave = (void *)(uintptr_t)DMACH_I2S_OUT,
.ch_name = "tx", .ch_name = "tx",
.dma_size = 4, .dma_size = 4,
}; };
static struct s3c_dma_params s3c2412_i2s_pcm_stereo_in = { static struct s3c_dma_params s3c2412_i2s_pcm_stereo_in = {
.channel = DMACH_I2S_IN, .slave = (void *)(uintptr_t)DMACH_I2S_IN,
.ch_name = "rx", .ch_name = "rx",
.dma_size = 4, .dma_size = 4,
}; };
......
...@@ -32,13 +32,13 @@ ...@@ -32,13 +32,13 @@
#include "s3c24xx-i2s.h" #include "s3c24xx-i2s.h"
static struct s3c_dma_params s3c24xx_i2s_pcm_stereo_out = { static struct s3c_dma_params s3c24xx_i2s_pcm_stereo_out = {
.channel = DMACH_I2S_OUT, .slave = (void *)(uintptr_t)DMACH_I2S_OUT,
.ch_name = "tx", .ch_name = "tx",
.dma_size = 2, .dma_size = 2,
}; };
static struct s3c_dma_params s3c24xx_i2s_pcm_stereo_in = { static struct s3c_dma_params s3c24xx_i2s_pcm_stereo_in = {
.channel = DMACH_I2S_IN, .slave = (void *)(uintptr_t)DMACH_I2S_IN,
.ch_name = "rx", .ch_name = "rx",
.dma_size = 2, .dma_size = 2,
}; };
......
...@@ -359,7 +359,7 @@ static const struct snd_soc_component_driver samsung_spdif_component = { ...@@ -359,7 +359,7 @@ static const struct snd_soc_component_driver samsung_spdif_component = {
static int spdif_probe(struct platform_device *pdev) static int spdif_probe(struct platform_device *pdev)
{ {
struct s3c_audio_pdata *spdif_pdata; struct s3c_audio_pdata *spdif_pdata;
struct resource *mem_res, *dma_res; struct resource *mem_res;
struct samsung_spdif_info *spdif; struct samsung_spdif_info *spdif;
int ret; int ret;
...@@ -367,12 +367,6 @@ static int spdif_probe(struct platform_device *pdev) ...@@ -367,12 +367,6 @@ static int spdif_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "Entered %s\n", __func__); dev_dbg(&pdev->dev, "Entered %s\n", __func__);
dma_res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
if (!dma_res) {
dev_err(&pdev->dev, "Unable to get dma resource.\n");
return -ENXIO;
}
mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mem_res) { if (!mem_res) {
dev_err(&pdev->dev, "Unable to get register resource.\n"); dev_err(&pdev->dev, "Unable to get register resource.\n");
...@@ -432,7 +426,7 @@ static int spdif_probe(struct platform_device *pdev) ...@@ -432,7 +426,7 @@ static int spdif_probe(struct platform_device *pdev)
spdif_stereo_out.dma_size = 2; spdif_stereo_out.dma_size = 2;
spdif_stereo_out.dma_addr = mem_res->start + DATA_OUTBUF; spdif_stereo_out.dma_addr = mem_res->start + DATA_OUTBUF;
spdif_stereo_out.channel = dma_res->start; spdif_stereo_out.slave = spdif_pdata ? spdif_pdata->dma_playback : NULL;
spdif->dma_playback = &spdif_stereo_out; spdif->dma_playback = &spdif_stereo_out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment