diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-04-12 08:57:04 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-04-12 08:57:04 -0400 |
commit | 38e8c895d33b0642dc341f83cce0adde4cffbc82 (patch) | |
tree | 3657c043986d5c944f971c9685ae4a68f5a5b035 /sound/soc/ux500 | |
parent | d66e065c5b8b64b03a9d9b8a7c5d674c7dfa2e3d (diff) | |
parent | 69b6f19622ce0aef41df884b75e3f789c64b89c0 (diff) |
Merge remote-tracking branch 'asoc/topic/dma' into asoc-next
Diffstat (limited to 'sound/soc/ux500')
-rw-r--r-- | sound/soc/ux500/ux500_pcm.c | 76 | ||||
-rw-r--r-- | sound/soc/ux500/ux500_pcm.h | 14 |
2 files changed, 16 insertions, 74 deletions
diff --git a/sound/soc/ux500/ux500_pcm.c b/sound/soc/ux500/ux500_pcm.c index 846fa82a58d0..09b5364e5095 100644 --- a/sound/soc/ux500/ux500_pcm.c +++ b/sound/soc/ux500/ux500_pcm.c | |||
@@ -28,28 +28,19 @@ | |||
28 | #include "ux500_msp_i2s.h" | 28 | #include "ux500_msp_i2s.h" |
29 | #include "ux500_pcm.h" | 29 | #include "ux500_pcm.h" |
30 | 30 | ||
31 | static struct snd_pcm_hardware ux500_pcm_hw_playback = { | 31 | #define UX500_PLATFORM_MIN_RATE 8000 |
32 | .info = SNDRV_PCM_INFO_INTERLEAVED | | 32 | #define UX500_PLATFORM_MAX_RATE 48000 |
33 | SNDRV_PCM_INFO_MMAP | | 33 | |
34 | SNDRV_PCM_INFO_RESUME | | 34 | #define UX500_PLATFORM_MIN_CHANNELS 1 |
35 | SNDRV_PCM_INFO_PAUSE, | 35 | #define UX500_PLATFORM_MAX_CHANNELS 8 |
36 | .formats = SNDRV_PCM_FMTBIT_S16_LE | | ||
37 | SNDRV_PCM_FMTBIT_U16_LE | | ||
38 | SNDRV_PCM_FMTBIT_S16_BE | | ||
39 | SNDRV_PCM_FMTBIT_U16_BE, | ||
40 | .rates = SNDRV_PCM_RATE_KNOT, | ||
41 | .rate_min = UX500_PLATFORM_MIN_RATE_PLAYBACK, | ||
42 | .rate_max = UX500_PLATFORM_MAX_RATE_PLAYBACK, | ||
43 | .channels_min = UX500_PLATFORM_MIN_CHANNELS, | ||
44 | .channels_max = UX500_PLATFORM_MAX_CHANNELS, | ||
45 | .buffer_bytes_max = UX500_PLATFORM_BUFFER_BYTES_MAX, | ||
46 | .period_bytes_min = UX500_PLATFORM_PERIODS_BYTES_MIN, | ||
47 | .period_bytes_max = UX500_PLATFORM_PERIODS_BYTES_MAX, | ||
48 | .periods_min = UX500_PLATFORM_PERIODS_MIN, | ||
49 | .periods_max = UX500_PLATFORM_PERIODS_MAX, | ||
50 | }; | ||
51 | 36 | ||
52 | static struct snd_pcm_hardware ux500_pcm_hw_capture = { | 37 | #define UX500_PLATFORM_PERIODS_BYTES_MIN 128 |
38 | #define UX500_PLATFORM_PERIODS_BYTES_MAX (64 * PAGE_SIZE) | ||
39 | #define UX500_PLATFORM_PERIODS_MIN 2 | ||
40 | #define UX500_PLATFORM_PERIODS_MAX 48 | ||
41 | #define UX500_PLATFORM_BUFFER_BYTES_MAX (2048 * PAGE_SIZE) | ||
42 | |||
43 | static struct snd_pcm_hardware ux500_pcm_hw = { | ||
53 | .info = SNDRV_PCM_INFO_INTERLEAVED | | 44 | .info = SNDRV_PCM_INFO_INTERLEAVED | |
54 | SNDRV_PCM_INFO_MMAP | | 45 | SNDRV_PCM_INFO_MMAP | |
55 | SNDRV_PCM_INFO_RESUME | | 46 | SNDRV_PCM_INFO_RESUME | |
@@ -59,8 +50,8 @@ static struct snd_pcm_hardware ux500_pcm_hw_capture = { | |||
59 | SNDRV_PCM_FMTBIT_S16_BE | | 50 | SNDRV_PCM_FMTBIT_S16_BE | |
60 | SNDRV_PCM_FMTBIT_U16_BE, | 51 | SNDRV_PCM_FMTBIT_U16_BE, |
61 | .rates = SNDRV_PCM_RATE_KNOT, | 52 | .rates = SNDRV_PCM_RATE_KNOT, |
62 | .rate_min = UX500_PLATFORM_MIN_RATE_CAPTURE, | 53 | .rate_min = UX500_PLATFORM_MIN_RATE, |
63 | .rate_max = UX500_PLATFORM_MAX_RATE_CAPTURE, | 54 | .rate_max = UX500_PLATFORM_MAX_RATE, |
64 | .channels_min = UX500_PLATFORM_MIN_CHANNELS, | 55 | .channels_min = UX500_PLATFORM_MIN_CHANNELS, |
65 | .channels_max = UX500_PLATFORM_MAX_CHANNELS, | 56 | .channels_max = UX500_PLATFORM_MAX_CHANNELS, |
66 | .buffer_bytes_max = UX500_PLATFORM_BUFFER_BYTES_MAX, | 57 | .buffer_bytes_max = UX500_PLATFORM_BUFFER_BYTES_MAX, |
@@ -90,8 +81,6 @@ static void ux500_pcm_dma_hw_free(struct device *dev, | |||
90 | 81 | ||
91 | static int ux500_pcm_open(struct snd_pcm_substream *substream) | 82 | static int ux500_pcm_open(struct snd_pcm_substream *substream) |
92 | { | 83 | { |
93 | int stream_id = substream->pstr->stream; | ||
94 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
95 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 84 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
96 | struct snd_soc_dai *dai = rtd->cpu_dai; | 85 | struct snd_soc_dai *dai = rtd->cpu_dai; |
97 | struct device *dev = dai->dev; | 86 | struct device *dev = dai->dev; |
@@ -104,26 +93,7 @@ static int ux500_pcm_open(struct snd_pcm_substream *substream) | |||
104 | snd_pcm_stream_str(substream)); | 93 | snd_pcm_stream_str(substream)); |
105 | 94 | ||
106 | dev_dbg(dev, "%s: Set runtime hwparams.\n", __func__); | 95 | dev_dbg(dev, "%s: Set runtime hwparams.\n", __func__); |
107 | if (stream_id == SNDRV_PCM_STREAM_PLAYBACK) | 96 | snd_soc_set_runtime_hwparams(substream, &ux500_pcm_hw); |
108 | snd_soc_set_runtime_hwparams(substream, | ||
109 | &ux500_pcm_hw_playback); | ||
110 | else | ||
111 | snd_soc_set_runtime_hwparams(substream, | ||
112 | &ux500_pcm_hw_capture); | ||
113 | |||
114 | /* ensure that buffer size is a multiple of period size */ | ||
115 | ret = snd_pcm_hw_constraint_integer(runtime, | ||
116 | SNDRV_PCM_HW_PARAM_PERIODS); | ||
117 | if (ret < 0) { | ||
118 | dev_err(dev, "%s: Error: snd_pcm_hw_constraints failed (%d)\n", | ||
119 | __func__, ret); | ||
120 | return ret; | ||
121 | } | ||
122 | |||
123 | dev_dbg(dev, "%s: Set hw-struct for %s.\n", __func__, | ||
124 | snd_pcm_stream_str(substream)); | ||
125 | runtime->hw = (stream_id == SNDRV_PCM_STREAM_PLAYBACK) ? | ||
126 | ux500_pcm_hw_playback : ux500_pcm_hw_capture; | ||
127 | 97 | ||
128 | mem_data_width = STEDMA40_HALFWORD_WIDTH; | 98 | mem_data_width = STEDMA40_HALFWORD_WIDTH; |
129 | 99 | ||
@@ -164,20 +134,6 @@ static int ux500_pcm_open(struct snd_pcm_substream *substream) | |||
164 | return ret; | 134 | return ret; |
165 | } | 135 | } |
166 | 136 | ||
167 | snd_dmaengine_pcm_set_data(substream, dma_cfg); | ||
168 | |||
169 | return 0; | ||
170 | } | ||
171 | |||
172 | static int ux500_pcm_close(struct snd_pcm_substream *substream) | ||
173 | { | ||
174 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
175 | struct snd_soc_dai *dai = rtd->cpu_dai; | ||
176 | |||
177 | dev_dbg(dai->dev, "%s: Enter\n", __func__); | ||
178 | |||
179 | snd_dmaengine_pcm_close(substream); | ||
180 | |||
181 | return 0; | 137 | return 0; |
182 | } | 138 | } |
183 | 139 | ||
@@ -255,7 +211,7 @@ static int ux500_pcm_mmap(struct snd_pcm_substream *substream, | |||
255 | 211 | ||
256 | static struct snd_pcm_ops ux500_pcm_ops = { | 212 | static struct snd_pcm_ops ux500_pcm_ops = { |
257 | .open = ux500_pcm_open, | 213 | .open = ux500_pcm_open, |
258 | .close = ux500_pcm_close, | 214 | .close = snd_dmaengine_pcm_close, |
259 | .ioctl = snd_pcm_lib_ioctl, | 215 | .ioctl = snd_pcm_lib_ioctl, |
260 | .hw_params = ux500_pcm_hw_params, | 216 | .hw_params = ux500_pcm_hw_params, |
261 | .hw_free = ux500_pcm_hw_free, | 217 | .hw_free = ux500_pcm_hw_free, |
diff --git a/sound/soc/ux500/ux500_pcm.h b/sound/soc/ux500/ux500_pcm.h index 76d344476afc..d76e1aff6458 100644 --- a/sound/soc/ux500/ux500_pcm.h +++ b/sound/soc/ux500/ux500_pcm.h | |||
@@ -18,20 +18,6 @@ | |||
18 | 18 | ||
19 | #include <linux/workqueue.h> | 19 | #include <linux/workqueue.h> |
20 | 20 | ||
21 | #define UX500_PLATFORM_MIN_RATE_PLAYBACK 8000 | ||
22 | #define UX500_PLATFORM_MAX_RATE_PLAYBACK 48000 | ||
23 | #define UX500_PLATFORM_MIN_RATE_CAPTURE 8000 | ||
24 | #define UX500_PLATFORM_MAX_RATE_CAPTURE 48000 | ||
25 | |||
26 | #define UX500_PLATFORM_MIN_CHANNELS 1 | ||
27 | #define UX500_PLATFORM_MAX_CHANNELS 8 | ||
28 | |||
29 | #define UX500_PLATFORM_PERIODS_BYTES_MIN 128 | ||
30 | #define UX500_PLATFORM_PERIODS_BYTES_MAX (64 * PAGE_SIZE) | ||
31 | #define UX500_PLATFORM_PERIODS_MIN 2 | ||
32 | #define UX500_PLATFORM_PERIODS_MAX 48 | ||
33 | #define UX500_PLATFORM_BUFFER_BYTES_MAX (2048 * PAGE_SIZE) | ||
34 | |||
35 | int ux500_pcm_register_platform(struct platform_device *pdev); | 21 | int ux500_pcm_register_platform(struct platform_device *pdev); |
36 | int ux500_pcm_unregister_platform(struct platform_device *pdev); | 22 | int ux500_pcm_unregister_platform(struct platform_device *pdev); |
37 | 23 | ||