Date: | 2013-03-22 14:12:10 (11 years 6 days ago) |
---|---|
Author: | Lars C. |
Commit: | cb7b9da5ec137ac9c4b0c5c569d09dddec980209 |
Message: | ASoC: ep93xx: Use ep93xx_dma_params instead of ep93xx_pcm_dma_params Currently the ep93xx_dma_params struct which is passed to the dmaengine driver is constructed at runtime from the ep93xx_pcm_dma_params that gets passed to the ep93xx PCM driver from one of the ep93xx DAI drivers. The ep93xx_pcm_dma_params struct is almost identical to the ep93xx_dma_params struct. The only missing field is the 'direction' field, which is computed at runtime in the PCM driver based on the current substream. Since we know in advance which ep93xx_pcm_dma_params struct is being used for which substream at compile time, we also already know which direction to use at compile time. So we can easily replace all instances of ep93xx_pcm_dma_params with their ep93xx_dma_params counterpart. This allows us to simplify the code in the ep93xx pcm driver quite a bit. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Reviewed-by: Ryan Mallon <rmallon@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> |
Files: |
sound/soc/cirrus/edb93xx.c (1 diff) sound/soc/cirrus/ep93xx-ac97.c (3 diffs) sound/soc/cirrus/ep93xx-i2s.c (4 diffs) sound/soc/cirrus/ep93xx-pcm.c (3 diffs) sound/soc/cirrus/ep93xx-pcm.h (1 diff) sound/soc/cirrus/simone.c (1 diff) sound/soc/cirrus/snappercl15.c (1 diff) |
Change Details
sound/soc/cirrus/edb93xx.c | ||
---|---|---|
27 | 27 | #include <sound/soc.h> |
28 | 28 | #include <asm/mach-types.h> |
29 | 29 | #include <mach/hardware.h> |
30 | #include "ep93xx-pcm.h" | |
31 | 30 | |
32 | 31 | static int edb93xx_hw_params(struct snd_pcm_substream *substream, |
33 | 32 | struct snd_pcm_hw_params *params) |
sound/soc/cirrus/ep93xx-ac97.c | ||
---|---|---|
23 | 23 | #include <sound/soc.h> |
24 | 24 | |
25 | 25 | #include <linux/platform_data/dma-ep93xx.h> |
26 | #include "ep93xx-pcm.h" | |
27 | 26 | |
28 | 27 | /* |
29 | 28 | * Per channel (1-4) registers. |
... | ... | |
101 | 100 | /* currently ALSA only supports a single AC97 device */ |
102 | 101 | static struct ep93xx_ac97_info *ep93xx_ac97_info; |
103 | 102 | |
104 | static struct ep93xx_pcm_dma_params ep93xx_ac97_pcm_out = { | |
103 | static struct ep93xx_dma_data ep93xx_ac97_pcm_out = { | |
105 | 104 | .name = "ac97-pcm-out", |
106 | 105 | .dma_port = EP93XX_DMA_AAC1, |
106 | .direction = DMA_MEM_TO_DEV, | |
107 | 107 | }; |
108 | 108 | |
109 | static struct ep93xx_pcm_dma_params ep93xx_ac97_pcm_in = { | |
109 | static struct ep93xx_dma_data ep93xx_ac97_pcm_in = { | |
110 | 110 | .name = "ac97-pcm-in", |
111 | 111 | .dma_port = EP93XX_DMA_AAC1, |
112 | .direction = DMA_DEV_TO_MEM, | |
112 | 113 | }; |
113 | 114 | |
114 | 115 | static inline unsigned ep93xx_ac97_read_reg(struct ep93xx_ac97_info *info, |
... | ... | |
316 | 317 | static int ep93xx_ac97_startup(struct snd_pcm_substream *substream, |
317 | 318 | struct snd_soc_dai *dai) |
318 | 319 | { |
319 | struct ep93xx_pcm_dma_params *dma_data; | |
320 | struct ep93xx_dma_data *dma_data; | |
320 | 321 | |
321 | 322 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
322 | 323 | dma_data = &ep93xx_ac97_pcm_out; |
sound/soc/cirrus/ep93xx-i2s.c | ||
---|---|---|
30 | 30 | #include <mach/ep93xx-regs.h> |
31 | 31 | #include <linux/platform_data/dma-ep93xx.h> |
32 | 32 | |
33 | #include "ep93xx-pcm.h" | |
34 | ||
35 | 33 | #define EP93XX_I2S_TXCLKCFG 0x00 |
36 | 34 | #define EP93XX_I2S_RXCLKCFG 0x04 |
37 | 35 | #define EP93XX_I2S_GLCTRL 0x0C |
... | ... | |
62 | 60 | struct clk *mclk; |
63 | 61 | struct clk *sclk; |
64 | 62 | struct clk *lrclk; |
65 | struct ep93xx_pcm_dma_params *dma_params; | |
63 | struct ep93xx_dma_data *dma_data; | |
66 | 64 | void __iomem *regs; |
67 | 65 | }; |
68 | 66 | |
69 | struct ep93xx_pcm_dma_params ep93xx_i2s_dma_params[] = { | |
67 | struct ep93xx_dma_data ep93xx_i2s_dma_data[] = { | |
70 | 68 | [SNDRV_PCM_STREAM_PLAYBACK] = { |
71 | 69 | .name = "i2s-pcm-out", |
72 | 70 | .dma_port = EP93XX_DMA_I2S1, |
71 | .direction = DMA_MEM_TO_DEV, | |
73 | 72 | }, |
74 | 73 | [SNDRV_PCM_STREAM_CAPTURE] = { |
75 | 74 | .name = "i2s-pcm-in", |
76 | 75 | .dma_port = EP93XX_DMA_I2S1, |
76 | .direction = DMA_DEV_TO_MEM, | |
77 | 77 | }, |
78 | 78 | }; |
79 | 79 | |
... | ... | |
147 | 147 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
148 | 148 | |
149 | 149 | snd_soc_dai_set_dma_data(cpu_dai, substream, |
150 | &info->dma_params[substream->stream]); | |
150 | &info->dma_data[substream->stream]); | |
151 | 151 | return 0; |
152 | 152 | } |
153 | 153 | |
... | ... | |
403 | 403 | } |
404 | 404 | |
405 | 405 | dev_set_drvdata(&pdev->dev, info); |
406 | info->dma_params = ep93xx_i2s_dma_params; | |
406 | info->dma_data = ep93xx_i2s_dma_data; | |
407 | 407 | |
408 | 408 | err = snd_soc_register_dai(&pdev->dev, &ep93xx_i2s_dai); |
409 | 409 | if (err) |
sound/soc/cirrus/ep93xx-pcm.c | ||
---|---|---|
29 | 29 | #include <mach/hardware.h> |
30 | 30 | #include <mach/ep93xx-regs.h> |
31 | 31 | |
32 | #include "ep93xx-pcm.h" | |
33 | ||
34 | 32 | static const struct snd_pcm_hardware ep93xx_pcm_hardware = { |
35 | 33 | .info = (SNDRV_PCM_INFO_MMAP | |
36 | 34 | SNDRV_PCM_INFO_MMAP_VALID | |
... | ... | |
68 | 66 | static int ep93xx_pcm_open(struct snd_pcm_substream *substream) |
69 | 67 | { |
70 | 68 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
71 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | |
72 | struct ep93xx_pcm_dma_params *dma_params; | |
73 | struct ep93xx_dma_data *dma_data; | |
74 | int ret; | |
75 | 69 | |
76 | 70 | snd_soc_set_runtime_hwparams(substream, &ep93xx_pcm_hardware); |
77 | 71 | |
78 | dma_data = kmalloc(sizeof(*dma_data), GFP_KERNEL); | |
79 | if (!dma_data) | |
80 | return -ENOMEM; | |
81 | ||
82 | dma_params = snd_soc_dai_get_dma_data(cpu_dai, substream); | |
83 | dma_data->port = dma_params->dma_port; | |
84 | dma_data->name = dma_params->name; | |
85 | dma_data->direction = snd_pcm_substream_to_dma_direction(substream); | |
86 | ||
87 | ret = snd_dmaengine_pcm_open(substream, ep93xx_pcm_dma_filter, dma_data); | |
88 | if (ret) { | |
89 | kfree(dma_data); | |
90 | return ret; | |
91 | } | |
92 | ||
93 | snd_dmaengine_pcm_set_data(substream, dma_data); | |
94 | ||
95 | return 0; | |
96 | } | |
97 | ||
98 | static int ep93xx_pcm_close(struct snd_pcm_substream *substream) | |
99 | { | |
100 | struct dma_data *dma_data = snd_dmaengine_pcm_get_data(substream); | |
101 | ||
102 | snd_dmaengine_pcm_close(substream); | |
103 | kfree(dma_data); | |
104 | return 0; | |
72 | return snd_dmaengine_pcm_open(substream, ep93xx_pcm_dma_filter, | |
73 | snd_soc_dai_get_dma_data(rtd->cpu_dai, substream)); | |
105 | 74 | } |
106 | 75 | |
107 | 76 | static int ep93xx_pcm_hw_params(struct snd_pcm_substream *substream, |
... | ... | |
131 | 100 | |
132 | 101 | static struct snd_pcm_ops ep93xx_pcm_ops = { |
133 | 102 | .open = ep93xx_pcm_open, |
134 | .close = ep93xx_pcm_close, | |
103 | .close = snd_dmaengine_pcm_close, | |
135 | 104 | .ioctl = snd_pcm_lib_ioctl, |
136 | 105 | .hw_params = ep93xx_pcm_hw_params, |
137 | 106 | .hw_free = ep93xx_pcm_hw_free, |
sound/soc/cirrus/ep93xx-pcm.h | ||
---|---|---|
1 | /* | |
2 | * sound/soc/ep93xx/ep93xx-pcm.h - EP93xx ALSA PCM interface | |
3 | * | |
4 | * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> | |
5 | * Copyright (C) 2006 Applied Data Systems | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License version 2 as | |
9 | * published by the Free Software Foundation. | |
10 | */ | |
11 | ||
12 | #ifndef _EP93XX_SND_SOC_PCM_H | |
13 | #define _EP93XX_SND_SOC_PCM_H | |
14 | ||
15 | struct ep93xx_pcm_dma_params { | |
16 | char *name; | |
17 | int dma_port; | |
18 | }; | |
19 | ||
20 | #endif /* _EP93XX_SND_SOC_PCM_H */ |
sound/soc/cirrus/simone.c | ||
---|---|---|
21 | 21 | #include <asm/mach-types.h> |
22 | 22 | #include <mach/hardware.h> |
23 | 23 | |
24 | #include "ep93xx-pcm.h" | |
25 | ||
26 | 24 | static struct snd_soc_dai_link simone_dai = { |
27 | 25 | .name = "AC97", |
28 | 26 | .stream_name = "AC97 HiFi", |
sound/soc/cirrus/snappercl15.c | ||
---|---|---|
21 | 21 | #include <mach/hardware.h> |
22 | 22 | |
23 | 23 | #include "../codecs/tlv320aic23.h" |
24 | #include "ep93xx-pcm.h" | |
25 | 24 | |
26 | 25 | #define CODEC_CLOCK 5644800 |
27 | 26 |
Branches:
ben-wpan
ben-wpan-stefan
5396a9238205f20f811ea57898980d3ca82df0b6
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9