Commit 14418aa7 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/samsung', 'asoc/topic/sh',...

Merge remote-tracking branches 'asoc/topic/samsung', 'asoc/topic/sh', 'asoc/topic/ssm2518' and 'asoc/topic/sti' into asoc-next
...@@ -54,12 +54,13 @@ static int s3c64xx_i2s_cfg_gpio(struct platform_device *pdev) ...@@ -54,12 +54,13 @@ 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_filter = pl08x_filter_id,
.dma_playback = DMACH_I2S0_OUT,
.dma_capture = DMACH_I2S0_IN,
}; };
struct platform_device s3c64xx_device_iis0 = { struct platform_device s3c64xx_device_iis0 = {
...@@ -68,15 +69,20 @@ struct platform_device s3c64xx_device_iis0 = { ...@@ -68,15 +69,20 @@ 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_filter = pl08x_filter_id,
.dma_playback = DMACH_I2S1_OUT,
.dma_capture = DMACH_I2S1_IN,
}; };
struct platform_device s3c64xx_device_iis1 = { struct platform_device s3c64xx_device_iis1 = {
...@@ -85,19 +91,20 @@ struct platform_device s3c64xx_device_iis1 = { ...@@ -85,19 +91,20 @@ 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_filter = pl08x_filter_id,
.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 +149,13 @@ static int s3c64xx_pcm_cfg_gpio(struct platform_device *pdev) ...@@ -142,12 +149,13 @@ 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_filter = pl08x_filter_id,
.dma_capture = DMACH_PCM0_RX,
.dma_playback = DMACH_PCM0_TX,
}; };
struct platform_device s3c64xx_device_pcm0 = { struct platform_device s3c64xx_device_pcm0 = {
...@@ -163,12 +171,13 @@ EXPORT_SYMBOL(s3c64xx_device_pcm0); ...@@ -163,12 +171,13 @@ 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_filter = pl08x_filter_id,
.dma_playback = DMACH_PCM1_TX,
.dma_capture = DMACH_PCM1_RX,
}; };
struct platform_device s3c64xx_device_pcm1 = { struct platform_device s3c64xx_device_pcm1 = {
...@@ -196,13 +205,15 @@ static int s3c64xx_ac97_cfg_gpe(struct platform_device *pdev) ...@@ -196,13 +205,15 @@ 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_filter = pl08x_filter_id,
.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,15 @@ static u64 samsung_device_dma_mask = DMA_BIT_MASK(32); ...@@ -74,9 +75,15 @@ 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 = {
#ifdef CONFIG_S3C24XX_DMAC
.dma_filter = s3c24xx_dma_filter,
#endif
.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 +94,7 @@ struct platform_device s3c_device_ac97 = { ...@@ -87,6 +94,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 */
...@@ -566,6 +574,14 @@ static struct resource s3c_iis_resource[] = { ...@@ -566,6 +574,14 @@ static struct resource s3c_iis_resource[] = {
[0] = DEFINE_RES_MEM(S3C24XX_PA_IIS, S3C24XX_SZ_IIS), [0] = DEFINE_RES_MEM(S3C24XX_PA_IIS, S3C24XX_SZ_IIS),
}; };
static struct s3c_audio_pdata s3c_iis_platdata = {
#ifdef CONFIG_S3C24XX_DMAC
.dma_filter = s3c24xx_dma_filter,
#endif
.dma_playback = (void *)DMACH_I2S_OUT,
.dma_capture = (void *)DMACH_I2S_IN,
};
struct platform_device s3c_device_iis = { struct platform_device s3c_device_iis = {
.name = "s3c24xx-iis", .name = "s3c24xx-iis",
.id = -1, .id = -1,
...@@ -574,6 +590,7 @@ struct platform_device s3c_device_iis = { ...@@ -574,6 +590,7 @@ struct platform_device s3c_device_iis = {
.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_iis_platdata,
} }
}; };
#endif /* CONFIG_PLAT_S3C24XX */ #endif /* CONFIG_PLAT_S3C24XX */
......
...@@ -432,7 +432,7 @@ config STE_DMA40 ...@@ -432,7 +432,7 @@ config STE_DMA40
Support for ST-Ericsson DMA40 controller Support for ST-Ericsson DMA40 controller
config S3C24XX_DMAC config S3C24XX_DMAC
tristate "Samsung S3C24XX DMA support" bool "Samsung S3C24XX DMA support"
depends on ARCH_S3C24XX depends on ARCH_S3C24XX
select DMA_ENGINE select DMA_ENGINE
select DMA_VIRTUAL_CHANNELS select DMA_VIRTUAL_CHANNELS
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
*/ */
#define S3C64XX_AC97_GPD 0 #define S3C64XX_AC97_GPD 0
#define S3C64XX_AC97_GPE 1 #define S3C64XX_AC97_GPE 1
#include <linux/dmaengine.h>
extern void s3c64xx_ac97_setup_gpio(int); extern void s3c64xx_ac97_setup_gpio(int);
struct samsung_i2s { struct samsung_i2s {
...@@ -39,6 +42,11 @@ struct samsung_i2s { ...@@ -39,6 +42,11 @@ struct samsung_i2s {
*/ */
struct s3c_audio_pdata { struct s3c_audio_pdata {
int (*cfg_gpio)(struct platform_device *); int (*cfg_gpio)(struct platform_device *);
dma_filter_fn dma_filter;
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;
......
...@@ -309,7 +309,7 @@ static const struct snd_pcm_hw_constraint_list ssm2518_constraints_12288000 = { ...@@ -309,7 +309,7 @@ static const struct snd_pcm_hw_constraint_list ssm2518_constraints_12288000 = {
.count = ARRAY_SIZE(ssm2518_rates_12288000), .count = ARRAY_SIZE(ssm2518_rates_12288000),
}; };
static unsigned int ssm2518_lookup_mcs(struct ssm2518 *ssm2518, static int ssm2518_lookup_mcs(struct ssm2518 *ssm2518,
unsigned int rate) unsigned int rate)
{ {
const unsigned int *sysclks = NULL; const unsigned int *sysclks = NULL;
......
config SND_SOC_SAMSUNG config SND_SOC_SAMSUNG
tristate "ASoC support for Samsung" tristate "ASoC support for Samsung"
depends on (PLAT_SAMSUNG || ARCH_EXYNOS) depends on (PLAT_SAMSUNG || ARCH_EXYNOS)
depends on S3C64XX_PL080 || !ARCH_S3C64XX
depends on S3C24XX_DMAC || !ARCH_S3C24XX
select SND_SOC_GENERIC_DMAENGINE_PCM select SND_SOC_GENERIC_DMAENGINE_PCM
help help
Say Y or M if you want to add support for codecs attached to Say Y or M if you want to add support for codecs attached to
......
...@@ -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);
...@@ -406,7 +388,8 @@ static int s3c_ac97_probe(struct platform_device *pdev) ...@@ -406,7 +388,8 @@ static int s3c_ac97_probe(struct platform_device *pdev)
if (ret) if (ret)
goto err5; goto err5;
ret = samsung_asoc_dma_platform_register(&pdev->dev); ret = samsung_asoc_dma_platform_register(&pdev->dev,
ac97_pdata->dma_filter);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret); dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret);
goto err5; goto err5;
......
...@@ -13,9 +13,10 @@ ...@@ -13,9 +13,10 @@
#define _S3C_AUDIO_H #define _S3C_AUDIO_H
#include <sound/dmaengine_pcm.h> #include <sound/dmaengine_pcm.h>
#include <linux/dmaengine.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;
...@@ -25,6 +26,7 @@ struct s3c_dma_params { ...@@ -25,6 +26,7 @@ struct s3c_dma_params {
void samsung_asoc_init_dma_data(struct snd_soc_dai *dai, void samsung_asoc_init_dma_data(struct snd_soc_dai *dai,
struct s3c_dma_params *playback, struct s3c_dma_params *playback,
struct s3c_dma_params *capture); struct s3c_dma_params *capture);
int samsung_asoc_dma_platform_register(struct device *dev); int samsung_asoc_dma_platform_register(struct device *dev,
dma_filter_fn fn);
#endif #endif
...@@ -28,17 +28,8 @@ ...@@ -28,17 +28,8 @@
#include "dma.h" #include "dma.h"
#ifdef CONFIG_ARCH_S3C64XX static struct snd_dmaengine_pcm_config samsung_dmaengine_pcm_config = {
#define filter_fn pl08x_filter_id
#elif defined(CONFIG_ARCH_S3C24XX)
#define filter_fn s3c24xx_dma_filter
#else
#define filter_fn NULL
#endif
static const struct snd_dmaengine_pcm_config samsung_dmaengine_pcm_config = {
.prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
.compat_filter_fn = filter_fn,
}; };
void samsung_asoc_init_dma_data(struct snd_soc_dai *dai, void samsung_asoc_init_dma_data(struct snd_soc_dai *dai,
...@@ -50,14 +41,14 @@ void samsung_asoc_init_dma_data(struct snd_soc_dai *dai, ...@@ -50,14 +41,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;
...@@ -67,8 +58,11 @@ void samsung_asoc_init_dma_data(struct snd_soc_dai *dai, ...@@ -67,8 +58,11 @@ void samsung_asoc_init_dma_data(struct snd_soc_dai *dai,
} }
EXPORT_SYMBOL_GPL(samsung_asoc_init_dma_data); EXPORT_SYMBOL_GPL(samsung_asoc_init_dma_data);
int samsung_asoc_dma_platform_register(struct device *dev) int samsung_asoc_dma_platform_register(struct device *dev,
dma_filter_fn filter)
{ {
samsung_dmaengine_pcm_config.compat_filter_fn = filter;
return devm_snd_dmaengine_pcm_register(dev, return devm_snd_dmaengine_pcm_register(dev,
&samsung_dmaengine_pcm_config, &samsung_dmaengine_pcm_config,
SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME | SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME |
......
...@@ -89,6 +89,7 @@ struct i2s_dai { ...@@ -89,6 +89,7 @@ struct i2s_dai {
struct s3c_dma_params dma_playback; struct s3c_dma_params dma_playback;
struct s3c_dma_params dma_capture; struct s3c_dma_params dma_capture;
struct s3c_dma_params idma_playback; struct s3c_dma_params idma_playback;
dma_filter_fn filter;
u32 quirks; u32 quirks;
u32 suspend_i2smod; u32 suspend_i2smod;
u32 suspend_i2scon; u32 suspend_i2scon;
...@@ -1244,7 +1245,8 @@ static int samsung_i2s_probe(struct platform_device *pdev) ...@@ -1244,7 +1245,8 @@ static int samsung_i2s_probe(struct platform_device *pdev)
if (ret != 0) if (ret != 0)
return ret; return ret;
return samsung_asoc_dma_platform_register(&pdev->dev); return samsung_asoc_dma_platform_register(&pdev->dev,
sec_dai->filter);
} }
pri_dai = i2s_alloc_dai(pdev, false); pri_dai = i2s_alloc_dai(pdev, false);
...@@ -1257,27 +1259,15 @@ static int samsung_i2s_probe(struct platform_device *pdev) ...@@ -1257,27 +1259,15 @@ 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;
pri_dai->filter = i2s_pdata->dma_filter;
if (&i2s_pdata->type) if (&i2s_pdata->type)
i2s_cfg = &i2s_pdata->type.i2s; i2s_cfg = &i2s_pdata->type.i2s;
...@@ -1339,9 +1329,8 @@ static int samsung_i2s_probe(struct platform_device *pdev) ...@@ -1339,9 +1329,8 @@ static int samsung_i2s_probe(struct platform_device *pdev)
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->filter = i2s_pdata->dma_filter;
sec_dai->dma_playback.channel = res->start;
} }
sec_dai->dma_playback.dma_size = 4; sec_dai->dma_playback.dma_size = 4;
...@@ -1364,7 +1353,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) ...@@ -1364,7 +1353,7 @@ static int samsung_i2s_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
ret = samsung_asoc_dma_platform_register(&pdev->dev); ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter);
if (ret != 0) if (ret != 0)
return ret; return ret;
......
...@@ -486,8 +486,9 @@ static const struct snd_soc_component_driver s3c_pcm_component = { ...@@ -486,8 +486,9 @@ 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;
dma_filter_fn filter;
int ret; int ret;
/* Check for valid device index */ /* Check for valid device index */
...@@ -499,18 +500,6 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev) ...@@ -499,18 +500,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 +557,12 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev) ...@@ -568,8 +557,12 @@ 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; filter = NULL;
s3c_pcm_stereo_out[pdev->id].channel = dmatx_res->start; if (pcm_pdata) {
s3c_pcm_stereo_in[pdev->id].slave = pcm_pdata->dma_capture;
s3c_pcm_stereo_out[pdev->id].slave = pcm_pdata->dma_playback;
filter = pcm_pdata->dma_filter;
}
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];
...@@ -583,7 +576,7 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev) ...@@ -583,7 +576,7 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev)
goto err5; goto err5;
} }
ret = samsung_asoc_dma_platform_register(&pdev->dev); ret = samsung_asoc_dma_platform_register(&pdev->dev, filter);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret); dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret);
goto err5; goto err5;
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <sound/soc.h> #include <sound/soc.h>
#include <sound/pcm_params.h> #include <sound/pcm_params.h>
#include <mach/dma.h>
#include <mach/gpio-samsung.h> #include <mach/gpio-samsung.h>
#include <plat/gpio-cfg.h> #include <plat/gpio-cfg.h>
...@@ -33,14 +32,14 @@ ...@@ -33,14 +32,14 @@
#include "regs-i2s-v2.h" #include "regs-i2s-v2.h"
#include "s3c2412-i2s.h" #include "s3c2412-i2s.h"
#include <linux/platform_data/asoc-s3c.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,
.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,
.ch_name = "rx", .ch_name = "rx",
.dma_size = 4, .dma_size = 4,
}; };
...@@ -152,6 +151,12 @@ static int s3c2412_iis_dev_probe(struct platform_device *pdev) ...@@ -152,6 +151,12 @@ static int s3c2412_iis_dev_probe(struct platform_device *pdev)
{ {
int ret = 0; int ret = 0;
struct resource *res; struct resource *res;
struct s3c_audio_pdata *pdata = dev_get_platdata(&pdev->dev);
if (!pdata) {
dev_err(&pdev->dev, "missing platform data");
return -ENXIO;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
s3c2412_i2s.regs = devm_ioremap_resource(&pdev->dev, res); s3c2412_i2s.regs = devm_ioremap_resource(&pdev->dev, res);
...@@ -159,7 +164,9 @@ static int s3c2412_iis_dev_probe(struct platform_device *pdev) ...@@ -159,7 +164,9 @@ static int s3c2412_iis_dev_probe(struct platform_device *pdev)
return PTR_ERR(s3c2412_i2s.regs); return PTR_ERR(s3c2412_i2s.regs);
s3c2412_i2s_pcm_stereo_out.dma_addr = res->start + S3C2412_IISTXD; s3c2412_i2s_pcm_stereo_out.dma_addr = res->start + S3C2412_IISTXD;
s3c2412_i2s_pcm_stereo_out.slave = pdata->dma_playback;
s3c2412_i2s_pcm_stereo_in.dma_addr = res->start + S3C2412_IISRXD; s3c2412_i2s_pcm_stereo_in.dma_addr = res->start + S3C2412_IISRXD;
s3c2412_i2s_pcm_stereo_in.slave = pdata->dma_capture;
ret = s3c_i2sv2_register_component(&pdev->dev, -1, ret = s3c_i2sv2_register_component(&pdev->dev, -1,
&s3c2412_i2s_component, &s3c2412_i2s_component,
...@@ -169,7 +176,8 @@ static int s3c2412_iis_dev_probe(struct platform_device *pdev) ...@@ -169,7 +176,8 @@ static int s3c2412_iis_dev_probe(struct platform_device *pdev)
return ret; return ret;
} }
ret = samsung_asoc_dma_platform_register(&pdev->dev); ret = samsung_asoc_dma_platform_register(&pdev->dev,
pdata->dma_filter);
if (ret) if (ret)
pr_err("failed to register the DMA: %d\n", ret); pr_err("failed to register the DMA: %d\n", ret);
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <sound/soc.h> #include <sound/soc.h>
#include <sound/pcm_params.h> #include <sound/pcm_params.h>
#include <mach/dma.h>
#include <mach/gpio-samsung.h> #include <mach/gpio-samsung.h>
#include <plat/gpio-cfg.h> #include <plat/gpio-cfg.h>
#include "regs-iis.h" #include "regs-iis.h"
...@@ -31,14 +30,14 @@ ...@@ -31,14 +30,14 @@
#include "dma.h" #include "dma.h"
#include "s3c24xx-i2s.h" #include "s3c24xx-i2s.h"
#include <linux/platform_data/asoc-s3c.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,
.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,
.ch_name = "rx", .ch_name = "rx",
.dma_size = 2, .dma_size = 2,
}; };
...@@ -454,6 +453,12 @@ static int s3c24xx_iis_dev_probe(struct platform_device *pdev) ...@@ -454,6 +453,12 @@ static int s3c24xx_iis_dev_probe(struct platform_device *pdev)
{ {
int ret = 0; int ret = 0;
struct resource *res; struct resource *res;
struct s3c_audio_pdata *pdata = dev_get_platdata(&pdev->dev);
if (!pdata) {
dev_err(&pdev->dev, "missing platform data");
return -ENXIO;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) { if (!res) {
...@@ -465,7 +470,9 @@ static int s3c24xx_iis_dev_probe(struct platform_device *pdev) ...@@ -465,7 +470,9 @@ static int s3c24xx_iis_dev_probe(struct platform_device *pdev)
return PTR_ERR(s3c24xx_i2s.regs); return PTR_ERR(s3c24xx_i2s.regs);
s3c24xx_i2s_pcm_stereo_out.dma_addr = res->start + S3C2410_IISFIFO; s3c24xx_i2s_pcm_stereo_out.dma_addr = res->start + S3C2410_IISFIFO;
s3c24xx_i2s_pcm_stereo_out.slave = pdata->dma_playback;
s3c24xx_i2s_pcm_stereo_in.dma_addr = res->start + S3C2410_IISFIFO; s3c24xx_i2s_pcm_stereo_in.dma_addr = res->start + S3C2410_IISFIFO;
s3c24xx_i2s_pcm_stereo_in.slave = pdata->dma_capture;
ret = devm_snd_soc_register_component(&pdev->dev, ret = devm_snd_soc_register_component(&pdev->dev,
&s3c24xx_i2s_component, &s3c24xx_i2s_dai, 1); &s3c24xx_i2s_component, &s3c24xx_i2s_dai, 1);
...@@ -474,7 +481,8 @@ static int s3c24xx_iis_dev_probe(struct platform_device *pdev) ...@@ -474,7 +481,8 @@ static int s3c24xx_iis_dev_probe(struct platform_device *pdev)
return ret; return ret;
} }
ret = samsung_asoc_dma_platform_register(&pdev->dev); ret = samsung_asoc_dma_platform_register(&pdev->dev,
pdata->dma_filter);
if (ret) if (ret)
pr_err("failed to register the dma: %d\n", ret); pr_err("failed to register the dma: %d\n", ret);
......
...@@ -359,20 +359,15 @@ static const struct snd_soc_component_driver samsung_spdif_component = { ...@@ -359,20 +359,15 @@ 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;
dma_filter_fn filter;
int ret; int ret;
spdif_pdata = pdev->dev.platform_data; spdif_pdata = pdev->dev.platform_data;
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,11 +427,15 @@ static int spdif_probe(struct platform_device *pdev) ...@@ -432,11 +427,15 @@ 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; filter = NULL;
if (spdif_pdata) {
spdif_stereo_out.slave = spdif_pdata->dma_playback;
filter = spdif_pdata->dma_filter;
}
spdif->dma_playback = &spdif_stereo_out; spdif->dma_playback = &spdif_stereo_out;
ret = samsung_asoc_dma_platform_register(&pdev->dev); ret = samsung_asoc_dma_platform_register(&pdev->dev, filter);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to register DMA: %d\n", ret); dev_err(&pdev->dev, "failed to register DMA: %d\n", ret);
goto err4; goto err4;
......
...@@ -1362,15 +1362,18 @@ static int fsi_dma_push_start_stop(struct fsi_priv *fsi, struct fsi_stream *io, ...@@ -1362,15 +1362,18 @@ static int fsi_dma_push_start_stop(struct fsi_priv *fsi, struct fsi_stream *io,
static int fsi_dma_probe(struct fsi_priv *fsi, struct fsi_stream *io, struct device *dev) static int fsi_dma_probe(struct fsi_priv *fsi, struct fsi_stream *io, struct device *dev)
{ {
dma_cap_mask_t mask;
int is_play = fsi_stream_is_play(fsi, io); int is_play = fsi_stream_is_play(fsi, io);
#ifdef CONFIG_SUPERH
dma_cap_mask_t mask;
dma_cap_zero(mask); dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask); dma_cap_set(DMA_SLAVE, mask);
io->chan = dma_request_slave_channel_compat(mask, io->chan = dma_request_channel(mask, shdma_chan_filter,
shdma_chan_filter, (void *)io->dma_id, (void *)io->dma_id);
dev, is_play ? "tx" : "rx"); #else
io->chan = dma_request_slave_channel(dev, is_play ? "tx" : "rx");
#endif
if (io->chan) { if (io->chan) {
struct dma_slave_config cfg = {}; struct dma_slave_config cfg = {};
int ret; int ret;
......
...@@ -251,8 +251,7 @@ static void uni_player_set_channel_status(struct uniperif *player, ...@@ -251,8 +251,7 @@ static void uni_player_set_channel_status(struct uniperif *player,
* set one. * set one.
*/ */
mutex_lock(&player->ctrl_lock); mutex_lock(&player->ctrl_lock);
if (runtime && (player->stream_settings.iec958.status[3] if (runtime) {
== IEC958_AES3_CON_FS_NOTID)) {
switch (runtime->rate) { switch (runtime->rate) {
case 22050: case 22050:
player->stream_settings.iec958.status[3] = player->stream_settings.iec958.status[3] =
......
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