Patch "ASoC: samsung: pass DMA channels as pointers" has been added to the 4.4-stable tree
Subsystems (7)
This is a note to let you know that I've just added the patch titled
ASoC: samsung: pass DMA channels as pointers
to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
asoc-samsung-pass-dma-channels-as-pointers.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
b9a1a743818ea3265abf98f9431623afa8c50c86Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <[email protected]>
Date: Wed, 18 Nov 2015 15:25:23 +0100
Subject: ASoC: samsung: pass DMA channels as pointers
From: Arnd Bergmann <[email protected]>
commit b9a1a743818ea3265abf98f9431623afa8c50c86 upstream.
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.
--- arch/arm/mach-s3c64xx/dev-audio.c | 41 +++++++++++++----------- arch/arm/mach-s3c64xx/include/mach/dma.h | 52 +++++++++++++++---------------- arch/arm/plat-samsung/devs.c | 11 ++++-- include/linux/platform_data/asoc-s3c.h | 4 ++ sound/soc/samsung/ac97.c | 26 ++------------- sound/soc/samsung/dma.h | 2 - sound/soc/samsung/dmaengine.c | 4 +- sound/soc/samsung/i2s.c | 26 ++------------- sound/soc/samsung/pcm.c | 20 ++--------- sound/soc/samsung/s3c2412-i2s.c | 4 +- sound/soc/samsung/s3c24xx-i2s.c | 4 +- sound/soc/samsung/spdif.c | 10 +---- 12 files changed, 84 insertions(+), 120 deletions(-)
arch/arm/mach-s3c64xx/dev-audio.c +23 -18
@@ -54,12 +54,12 @@ static int s3c64xx_i2s_cfg_gpio(struct pstatic struct resource s3c64xx_iis0_resource[] = { [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, + .dma_playback =DMACH_I2S0_OUT , + .dma_capture =DMACH_I2S0_IN , };struct platform_device s3c64xx_device_iis0 = {
@@ -68,15 +68,19 @@ struct platform_device s3c64xx_device_ii .num_resources = ARRAY_SIZE(s3c64xx_iis0_resource), .resource = s3c64xx_iis0_resource, .dev = { - .platform_data = &i2sv3_pdata, + .platform_data = &i2s0_pdata, }, };EXPORT_SYMBOL (s3c64xx_device_iis0);static struct resource s3c64xx_iis1_resource[] = { [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 = {
@@ -85,19 +89,19 @@ struct platform_device s3c64xx_device_ii .num_resources = ARRAY_SIZE(s3c64xx_iis1_resource), .resource = s3c64xx_iis1_resource, .dev = { - .platform_data = &i2sv3_pdata, + .platform_data = &i2s1_pdata, }, };EXPORT_SYMBOL (s3c64xx_device_iis1);static struct resource s3c64xx_iisv4_resource[] = { [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 = { .cfg_gpio = s3c64xx_i2s_cfg_gpio, + .dma_playback =DMACH_HSI_I2SV40_TX , + .dma_capture =DMACH_HSI_I2SV40_RX , .type = { .i2s = { .quirks =QUIRK_PRI_6CHAN ,
@@ -142,12 +146,12 @@ static int s3c64xx_pcm_cfg_gpio(struct pstatic struct resource s3c64xx_pcm0_resource[] = { [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 = { .cfg_gpio = s3c64xx_pcm_cfg_gpio, + .dma_capture =DMACH_PCM0_RX , + .dma_playback =DMACH_PCM0_TX , };struct platform_device s3c64xx_device_pcm0 = {
@@ -163,12 +167,12 @@ EXPORT_SYMBOL(s3c64xx_device_pcm0);static struct resource s3c64xx_pcm1_resource[] = { [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 = { .cfg_gpio = s3c64xx_pcm_cfg_gpio, + .dma_playback =DMACH_PCM1_TX , + .dma_capture =DMACH_PCM1_RX , };struct platform_device s3c64xx_device_pcm1 = {
@@ -196,13 +200,14 @@ static int s3c64xx_ac97_cfg_gpe(struct pstatic struct resource s3c64xx_ac97_resource[] = { [0 ] =DEFINE_RES_MEM (S3C64XX_PA_AC97 ,SZ_256 ), - [1 ] =DEFINE_RES_DMA (DMACH_AC97_PCMOUT ), - [2 ] =DEFINE_RES_DMA (DMACH_AC97_PCMIN ), - [3 ] =DEFINE_RES_DMA (DMACH_AC97_MICIN ), - [4 ] =DEFINE_RES_IRQ (IRQ_AC97 ), + [1 ] =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 );
arch/arm/mach-s3c64xx/include/mach/dma.h +26 -26
64 lines not on this page · raw message
arch/arm/plat-samsung/devs.c +8 -3
@@ -65,6 +65,7 @@#include <linux/platform_data/usb-ohci-s3c2410.h> #include <plat/usb-phy.h> #include <plat/regs-spi.h> +#include <linux/platform_data/asoc-s3c.h> #include <linux/platform_data/spi-s3c64xx.h> static u64 samsung_device_dma_mask =DMA_BIT_MASK (32 );
@@ -74,9 +75,12 @@ static u64 samsung_device_dma_mask = DMAstatic struct resource s3c_ac97_resource[] = { [0 ] =DEFINE_RES_MEM (S3C2440_PA_AC97 ,S3C2440_SZ_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 = {
@@ -87,6 +91,7 @@ struct platform_device s3c_device_ac97 = .dev = { .dma_mask = &samsung_device_dma_mask, .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = &s3c_ac97_pdata, } };#endif /* CONFIG_CPU_S3C2440 */
include/linux/platform_data/asoc-s3c.h +4 -0
@@ -39,6 +39,10 @@ struct samsung_i2s {*/ struct s3c_audio_pdata {int (*cfg_gpio)(struct platform_device *); +void *dma_playback; +void *dma_capture; +void *dma_play_sec; +void *dma_capture_mic;union {struct samsung_i2s i2s; } type;
sound/soc/samsung/ac97.c +4 -22
@@ -324,7 +324,7 @@ static const struct snd_soc_component_drstatic 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;int ret;
@@ -335,24 +335,6 @@ static int s3c_ac97_probe(struct platfor }/* 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 );if (!irq_res) {dev_err (&pdev->dev,"AC97 IRQ not provided!\n" );
@@ -364,11 +346,11 @@ static int s3c_ac97_probe(struct platforif (IS_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_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_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 ;init_completion (&s3c_ac97.done);
sound/soc/samsung/dma.h +1 -1
@@ -15,7 +15,7 @@#include <sound/dmaengine_pcm.h> struct s3c_dma_params { -int channel;/* Channel ID */ +void *slave;/* Channel ID */ dma_addr_t dma_addr;int dma_size;/* Size of the DMA transfer */ char *ch_name;
sound/soc/samsung/dmaengine.c +2 -2
@@ -50,14 +50,14 @@ void samsung_asoc_init_dma_data(struct sif (playback) { 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->addr = playback->dma_addr; playback_data->addr_width = playback->dma_size; }if (capture) { 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->addr = capture->dma_addr; capture_data->addr_width = capture->dma_size;
sound/soc/samsung/i2s.c +5 -21
@@ -1260,27 +1260,14 @@ static int samsung_i2s_probe(struct plat pri_dai->lock = &pri_dai->spinlock;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 ) {dev_err (&pdev->dev,"Can't work without s3c_audio_pdata\n" );return -EINVAL ; } + pri_dai->dma_playback.slave = i2s_pdata->dma_playback; + pri_dai->dma_capture.slave = i2s_pdata->dma_capture; +if (&i2s_pdata->type) i2s_cfg = &i2s_pdata->type.i2s;
@@ -1341,11 +1328,8 @@ static int samsung_i2s_probe(struct plat sec_dai->dma_playback.dma_addr = regs_base +I2STXDS ; sec_dai->dma_playback.ch_name ="tx-sec" ; -if (!np) { - res =platform_get_resource (pdev,IORESOURCE_DMA ,2 ); -if (res) - sec_dai->dma_playback.channel = res->start; - } +if (!np) + sec_dai->dma_playback.slave = i2s_pdata->dma_play_sec; sec_dai->dma_playback.dma_size =4 ; sec_dai->addr = pri_dai->addr;
sound/soc/samsung/pcm.c +5 -15
@@ -486,7 +486,7 @@ static const struct snd_soc_component_drstatic int s3c_pcm_dev_probe (struct platform_device *pdev) {struct s3c_pcm_info *pcm; -struct resource *mem_res, *dmatx_res, *dmarx_res; +struct resource *mem_res;struct s3c_audio_pdata *pcm_pdata;int ret;
@@ -499,18 +499,6 @@ static int s3c_pcm_dev_probe(struct plat pcm_pdata = pdev->dev.platform_data;/* 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 );if (!mem_res) {dev_err (&pdev->dev,"Unable to get register resource\n" );
@@ -568,8 +556,10 @@ static int s3c_pcm_dev_probe(struct plat s3c_pcm_stereo_out[pdev->id].dma_addr = mem_res->start +S3C_PCM_TXFIFO ; - s3c_pcm_stereo_in[pdev->id].channel = dmarx_res->start; - 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; + } pcm->dma_capture = &s3c_pcm_stereo_in[pdev->id]; pcm->dma_playback = &s3c_pcm_stereo_out[pdev->id];
sound/soc/samsung/s3c2412-i2s.c +2 -2
@@ -34,13 +34,13 @@#include "s3c2412-i2s.h" static struct s3c_dma_params s3c2412_i2s_pcm_stereo_out = { - .channel =DMACH_I2S_OUT , + .slave = (void *)(uintptr_t )DMACH_I2S_OUT , .ch_name ="tx" , .dma_size =4 , };static struct s3c_dma_params s3c2412_i2s_pcm_stereo_in = { - .channel =DMACH_I2S_IN , + .slave = (void *)(uintptr_t )DMACH_I2S_IN , .ch_name ="rx" , .dma_size =4 , };
sound/soc/samsung/s3c24xx-i2s.c +2 -2
@@ -32,13 +32,13 @@#include "s3c24xx-i2s.h" static struct s3c_dma_params s3c24xx_i2s_pcm_stereo_out = { - .channel =DMACH_I2S_OUT , + .slave = (void *)(uintptr_t )DMACH_I2S_OUT , .ch_name ="tx" , .dma_size =2 , };static struct s3c_dma_params s3c24xx_i2s_pcm_stereo_in = { - .channel =DMACH_I2S_IN , + .slave = (void *)(uintptr_t )DMACH_I2S_IN , .ch_name ="rx" , .dma_size =2 , };
sound/soc/samsung/spdif.c +2 -8
@@ -359,7 +359,7 @@ static const struct snd_soc_component_drstatic int spdif_probe (struct platform_device *pdev) {struct s3c_audio_pdata *spdif_pdata; -struct resource *mem_res, *dma_res; +struct resource *mem_res;struct samsung_spdif_info *spdif;int ret;
@@ -367,12 +367,6 @@ static int spdif_probe(struct platform_ddev_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 );if (!mem_res) {dev_err (&pdev->dev,"Unable to get register resource.\n" );
@@ -432,7 +426,7 @@ static int spdif_probe(struct platform_d spdif_stereo_out.dma_size =2 ; 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;
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/regulator-core-avoid-unused-variable-warning.patch queue-4.4/asoc-samsung-pass-dma-channels-as-pointers.patch queue-4.4/mmc-sh_mmcif-rework-dma-channel-handling.patch queue-4.4/regulator-core-fix-nested-locking-of-supplies.patch queue-4.4/mmc-sh_mmcif-correct-tx-dma-channel-allocation.patch