Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9bdca822 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Mark Brown
Browse files

ASoC: samsung: pass filter function as pointer



As we are now passing the filter data as pointers to the drivers,
we can take the final step and also pass the filter function the
same way. I'm keeping this change separate, as there it's less
obvious that this is a net win.

Upsides of this are:

- The ASoC drivers are completely independent from the DMA engine
  implementation, which simplifies the Kconfig logic and in theory
  allows the same sound drivers to be built in a kernel that supports
  different kinds of dmaengine drivers.

- Consistency with other subsystems and drivers

On the other hand, we have a few downsides:

- The s3c24xx-dma driver now needs to be built-in for the ac97 platform
  device to be instantiated on s3c2440.

- samsung_dmaengine_pcm_config cannot be marked 'const' any more
  because the filter function pointer needs to be set at runtime.
  This is safe as long we don't have multiple different DMA engines
  in thet same system at runtime, but is nonetheless ugly.

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 359fdfa6
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ static struct resource s3c64xx_iis0_resource[] = {

static struct s3c_audio_pdata i2s0_pdata = {
	.cfg_gpio = s3c64xx_i2s_cfg_gpio,
	.dma_filter = pl08x_filter_id,
	.dma_playback = DMACH_I2S0_OUT,
	.dma_capture = DMACH_I2S0_IN,
};
@@ -79,6 +80,7 @@ static struct resource s3c64xx_iis1_resource[] = {

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,
};
@@ -100,6 +102,7 @@ static struct resource s3c64xx_iisv4_resource[] = {

static struct s3c_audio_pdata i2sv4_pdata = {
	.cfg_gpio = s3c64xx_i2s_cfg_gpio,
	.dma_filter = pl08x_filter_id,
	.dma_playback = DMACH_HSI_I2SV40_TX,
	.dma_capture = DMACH_HSI_I2SV40_RX,
	.type = {
@@ -150,6 +153,7 @@ static struct resource s3c64xx_pcm0_resource[] = {

static struct s3c_audio_pdata s3c_pcm0_pdata = {
	.cfg_gpio = s3c64xx_pcm_cfg_gpio,
	.dma_filter = pl08x_filter_id,
	.dma_capture = DMACH_PCM0_RX,
	.dma_playback = DMACH_PCM0_TX,
};
@@ -171,6 +175,7 @@ static struct resource s3c64xx_pcm1_resource[] = {

static struct s3c_audio_pdata s3c_pcm1_pdata = {
	.cfg_gpio = s3c64xx_pcm_cfg_gpio,
	.dma_filter = pl08x_filter_id,
	.dma_playback = DMACH_PCM1_TX,
	.dma_capture = DMACH_PCM1_RX,
};
@@ -205,6 +210,7 @@ static struct resource s3c64xx_ac97_resource[] = {

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,
};
+6 −0
Original line number Diff line number Diff line
@@ -78,6 +78,9 @@ static struct resource s3c_ac97_resource[] = {
};

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,
@@ -572,6 +575,9 @@ static struct resource s3c_iis_resource[] = {
};

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,
};
+1 −1
Original line number Diff line number Diff line
@@ -432,7 +432,7 @@ config STE_DMA40
	  Support for ST-Ericsson DMA40 controller

config S3C24XX_DMAC
	tristate "Samsung S3C24XX DMA support"
	bool "Samsung S3C24XX DMA support"
	depends on ARCH_S3C24XX
	select DMA_ENGINE
	select DMA_VIRTUAL_CHANNELS
+4 −0
Original line number Diff line number Diff line
@@ -13,6 +13,9 @@
 */
#define S3C64XX_AC97_GPD  0
#define S3C64XX_AC97_GPE  1

#include <linux/dmaengine.h>

extern void s3c64xx_ac97_setup_gpio(int);

struct samsung_i2s {
@@ -39,6 +42,7 @@ struct samsung_i2s {
 */
struct s3c_audio_pdata {
	int (*cfg_gpio)(struct platform_device *);
	dma_filter_fn dma_filter;
	void *dma_playback;
	void *dma_capture;
	void *dma_play_sec;
+0 −2
Original line number Diff line number Diff line
config SND_SOC_SAMSUNG
	tristate "ASoC support for Samsung"
	depends on (PLAT_SAMSUNG || ARCH_EXYNOS)
	depends on S3C64XX_PL080 || !ARCH_S3C64XX
	depends on S3C24XX_DMAC || !ARCH_S3C24XX
	select SND_SOC_GENERIC_DMAENGINE_PCM
	help
	  Say Y or M if you want to add support for codecs attached to
Loading