Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 1 | /* |
| 2 | * omap-mcbsp.c -- OMAP ALSA SoC DAI driver using McBSP port |
| 3 | * |
| 4 | * Copyright (C) 2008 Nokia Corporation |
| 5 | * |
Jarkko Nikula | 7ec41ee | 2011-08-11 15:44:57 +0300 | [diff] [blame] | 6 | * Contact: Jarkko Nikula <jarkko.nikula@bitmer.com> |
Peter Ujfalusi | 56a8742 | 2011-05-03 18:14:06 +0300 | [diff] [blame] | 7 | * Peter Ujfalusi <peter.ujfalusi@ti.com> |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License |
| 11 | * version 2 as published by the Free Software Foundation. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, but |
| 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | * General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 21 | * 02110-1301 USA |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | #include <linux/init.h> |
| 26 | #include <linux/module.h> |
| 27 | #include <linux/device.h> |
Peter Ujfalusi | 2ee6595 | 2012-02-14 14:52:42 +0200 | [diff] [blame] | 28 | #include <linux/pm_runtime.h> |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 29 | #include <sound/core.h> |
| 30 | #include <sound/pcm.h> |
| 31 | #include <sound/pcm_params.h> |
| 32 | #include <sound/initval.h> |
| 33 | #include <sound/soc.h> |
| 34 | |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 35 | #include <plat/dma.h> |
| 36 | #include <plat/mcbsp.h> |
Peter Ujfalusi | 219f431 | 2012-02-03 13:11:47 +0200 | [diff] [blame] | 37 | #include "mcbsp.h" |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 38 | #include "omap-mcbsp.h" |
| 39 | #include "omap-pcm.h" |
| 40 | |
Jarkko Nikula | 0b60485 | 2008-11-12 17:05:51 +0200 | [diff] [blame] | 41 | #define OMAP_MCBSP_RATES (SNDRV_PCM_RATE_8000_96000) |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 42 | |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 43 | #define OMAP_MCBSP_SOC_SINGLE_S16_EXT(xname, xmin, xmax, \ |
| 44 | xhandler_get, xhandler_put) \ |
| 45 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
| 46 | .info = omap_mcbsp_st_info_volsw, \ |
| 47 | .get = xhandler_get, .put = xhandler_put, \ |
| 48 | .private_value = (unsigned long) &(struct soc_mixer_control) \ |
| 49 | {.min = xmin, .max = xmax} } |
| 50 | |
Peter Ujfalusi | 219f431 | 2012-02-03 13:11:47 +0200 | [diff] [blame] | 51 | enum { |
| 52 | OMAP_MCBSP_WORD_8 = 0, |
| 53 | OMAP_MCBSP_WORD_12, |
| 54 | OMAP_MCBSP_WORD_16, |
| 55 | OMAP_MCBSP_WORD_20, |
| 56 | OMAP_MCBSP_WORD_24, |
| 57 | OMAP_MCBSP_WORD_32, |
| 58 | }; |
| 59 | |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 60 | /* |
| 61 | * Stream DMA parameters. DMA request line and port address are set runtime |
| 62 | * since they are different between OMAP1 and later OMAPs |
| 63 | */ |
Eduardo Valentin | caebc0c | 2009-08-20 16:18:25 +0300 | [diff] [blame] | 64 | static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream) |
| 65 | { |
| 66 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 67 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 68 | struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); |
Peter Ujfalusi | cf80e15 | 2010-07-29 09:51:27 +0300 | [diff] [blame] | 69 | struct omap_pcm_dma_data *dma_data; |
Peter Ujfalusi | 3f02403 | 2010-06-03 07:39:35 +0300 | [diff] [blame] | 70 | int words; |
Eduardo Valentin | a0a499c | 2009-08-20 16:18:26 +0300 | [diff] [blame] | 71 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 72 | dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
Peter Ujfalusi | cf80e15 | 2010-07-29 09:51:27 +0300 | [diff] [blame] | 73 | |
Eduardo Valentin | a0a499c | 2009-08-20 16:18:26 +0300 | [diff] [blame] | 74 | /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */ |
Peter Ujfalusi | cb40b63 | 2012-02-13 16:26:54 +0200 | [diff] [blame] | 75 | if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) |
Peter Ujfalusi | cf80e15 | 2010-07-29 09:51:27 +0300 | [diff] [blame] | 76 | /* |
| 77 | * Configure McBSP threshold based on either: |
| 78 | * packet_size, when the sDMA is in packet mode, or |
| 79 | * based on the period size. |
| 80 | */ |
| 81 | if (dma_data->packet_size) |
| 82 | words = dma_data->packet_size; |
| 83 | else |
| 84 | words = snd_pcm_lib_period_bytes(substream) / |
Peter Ujfalusi | 256d9c2 | 2012-02-14 15:23:15 +0200 | [diff] [blame] | 85 | (mcbsp->wlen / 8); |
Eduardo Valentin | a0a499c | 2009-08-20 16:18:26 +0300 | [diff] [blame] | 86 | else |
Peter Ujfalusi | 3f02403 | 2010-06-03 07:39:35 +0300 | [diff] [blame] | 87 | words = 1; |
Eduardo Valentin | caebc0c | 2009-08-20 16:18:25 +0300 | [diff] [blame] | 88 | |
| 89 | /* Configure McBSP internal buffer usage */ |
| 90 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 91 | omap_mcbsp_set_tx_threshold(mcbsp, words); |
Eduardo Valentin | caebc0c | 2009-08-20 16:18:25 +0300 | [diff] [blame] | 92 | else |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 93 | omap_mcbsp_set_rx_threshold(mcbsp, words); |
Eduardo Valentin | caebc0c | 2009-08-20 16:18:25 +0300 | [diff] [blame] | 94 | } |
| 95 | |
Peter Ujfalusi | ddc29b0 | 2010-06-03 07:39:36 +0300 | [diff] [blame] | 96 | static int omap_mcbsp_hwrule_min_buffersize(struct snd_pcm_hw_params *params, |
| 97 | struct snd_pcm_hw_rule *rule) |
| 98 | { |
| 99 | struct snd_interval *buffer_size = hw_param_interval(params, |
| 100 | SNDRV_PCM_HW_PARAM_BUFFER_SIZE); |
| 101 | struct snd_interval *channels = hw_param_interval(params, |
| 102 | SNDRV_PCM_HW_PARAM_CHANNELS); |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 103 | struct omap_mcbsp *mcbsp = rule->private; |
Peter Ujfalusi | ddc29b0 | 2010-06-03 07:39:36 +0300 | [diff] [blame] | 104 | struct snd_interval frames; |
| 105 | int size; |
| 106 | |
| 107 | snd_interval_any(&frames); |
Peter Ujfalusi | cb40b63 | 2012-02-13 16:26:54 +0200 | [diff] [blame] | 108 | size = mcbsp->pdata->buffer_size; |
Peter Ujfalusi | ddc29b0 | 2010-06-03 07:39:36 +0300 | [diff] [blame] | 109 | |
| 110 | frames.min = size / channels->min; |
| 111 | frames.integer = 1; |
| 112 | return snd_interval_refine(buffer_size, &frames); |
| 113 | } |
| 114 | |
Mark Brown | dee89c4 | 2008-11-18 22:11:38 +0000 | [diff] [blame] | 115 | static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream, |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 116 | struct snd_soc_dai *cpu_dai) |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 117 | { |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 118 | struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 119 | int err = 0; |
| 120 | |
Eduardo Valentin | caebc0c | 2009-08-20 16:18:25 +0300 | [diff] [blame] | 121 | if (!cpu_dai->active) |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 122 | err = omap_mcbsp_request(mcbsp); |
Eduardo Valentin | caebc0c | 2009-08-20 16:18:25 +0300 | [diff] [blame] | 123 | |
Peter Ujfalusi | ddc29b0 | 2010-06-03 07:39:36 +0300 | [diff] [blame] | 124 | /* |
| 125 | * OMAP3 McBSP FIFO is word structured. |
| 126 | * McBSP2 has 1024 + 256 = 1280 word long buffer, |
| 127 | * McBSP1,3,4,5 has 128 word long buffer |
| 128 | * This means that the size of the FIFO depends on the sample format. |
| 129 | * For example on McBSP3: |
| 130 | * 16bit samples: size is 128 * 2 = 256 bytes |
| 131 | * 32bit samples: size is 128 * 4 = 512 bytes |
| 132 | * It is simpler to place constraint for buffer and period based on |
| 133 | * channels. |
| 134 | * McBSP3 as example again (16 or 32 bit samples): |
| 135 | * 1 channel (mono): size is 128 frames (128 words) |
| 136 | * 2 channels (stereo): size is 128 / 2 = 64 frames (2 * 64 words) |
| 137 | * 4 channels: size is 128 / 4 = 32 frames (4 * 32 words) |
| 138 | */ |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 139 | if (mcbsp->pdata->buffer_size) { |
Jarkko Nikula | 6984992 | 2009-03-27 15:32:01 +0200 | [diff] [blame] | 140 | /* |
Peter Ujfalusi | 998a8a6 | 2010-07-29 09:51:28 +0300 | [diff] [blame] | 141 | * Rule for the buffer size. We should not allow |
Peter Ujfalusi | ddc29b0 | 2010-06-03 07:39:36 +0300 | [diff] [blame] | 142 | * smaller buffer than the FIFO size to avoid underruns |
| 143 | */ |
| 144 | snd_pcm_hw_rule_add(substream->runtime, 0, |
Grazvydas Ignotas | 94a504c | 2012-03-09 01:19:15 +0200 | [diff] [blame] | 145 | SNDRV_PCM_HW_PARAM_BUFFER_SIZE, |
Peter Ujfalusi | ddc29b0 | 2010-06-03 07:39:36 +0300 | [diff] [blame] | 146 | omap_mcbsp_hwrule_min_buffersize, |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 147 | mcbsp, |
Grazvydas Ignotas | 94a504c | 2012-03-09 01:19:15 +0200 | [diff] [blame] | 148 | SNDRV_PCM_HW_PARAM_CHANNELS, -1); |
Peter Ujfalusi | ddc29b0 | 2010-06-03 07:39:36 +0300 | [diff] [blame] | 149 | |
Peter Ujfalusi | 998a8a6 | 2010-07-29 09:51:28 +0300 | [diff] [blame] | 150 | /* Make sure, that the period size is always even */ |
| 151 | snd_pcm_hw_constraint_step(substream->runtime, 0, |
| 152 | SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 2); |
Eduardo Valentin | caebc0c | 2009-08-20 16:18:25 +0300 | [diff] [blame] | 153 | } |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 154 | |
| 155 | return err; |
| 156 | } |
| 157 | |
Mark Brown | dee89c4 | 2008-11-18 22:11:38 +0000 | [diff] [blame] | 158 | static void omap_mcbsp_dai_shutdown(struct snd_pcm_substream *substream, |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 159 | struct snd_soc_dai *cpu_dai) |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 160 | { |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 161 | struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 162 | |
| 163 | if (!cpu_dai->active) { |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 164 | omap_mcbsp_free(mcbsp); |
Peter Ujfalusi | 256d9c2 | 2012-02-14 15:23:15 +0200 | [diff] [blame] | 165 | mcbsp->configured = 0; |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 166 | } |
| 167 | } |
| 168 | |
Mark Brown | dee89c4 | 2008-11-18 22:11:38 +0000 | [diff] [blame] | 169 | static int omap_mcbsp_dai_trigger(struct snd_pcm_substream *substream, int cmd, |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 170 | struct snd_soc_dai *cpu_dai) |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 171 | { |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 172 | struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); |
Jarkko Nikula | c12abc0 | 2009-08-07 09:59:47 +0300 | [diff] [blame] | 173 | int err = 0, play = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 174 | |
| 175 | switch (cmd) { |
| 176 | case SNDRV_PCM_TRIGGER_START: |
| 177 | case SNDRV_PCM_TRIGGER_RESUME: |
| 178 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
Peter Ujfalusi | 256d9c2 | 2012-02-14 15:23:15 +0200 | [diff] [blame] | 179 | mcbsp->active++; |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 180 | omap_mcbsp_start(mcbsp, play, !play); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 181 | break; |
| 182 | |
| 183 | case SNDRV_PCM_TRIGGER_STOP: |
| 184 | case SNDRV_PCM_TRIGGER_SUSPEND: |
| 185 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 186 | omap_mcbsp_stop(mcbsp, play, !play); |
Peter Ujfalusi | 256d9c2 | 2012-02-14 15:23:15 +0200 | [diff] [blame] | 187 | mcbsp->active--; |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 188 | break; |
| 189 | default: |
| 190 | err = -EINVAL; |
| 191 | } |
| 192 | |
| 193 | return err; |
| 194 | } |
| 195 | |
Peter Ujfalusi | 75581d2 | 2010-03-03 15:08:09 +0200 | [diff] [blame] | 196 | static snd_pcm_sframes_t omap_mcbsp_dai_delay( |
| 197 | struct snd_pcm_substream *substream, |
| 198 | struct snd_soc_dai *dai) |
| 199 | { |
| 200 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 201 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 202 | struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); |
Peter Ujfalusi | 75581d2 | 2010-03-03 15:08:09 +0200 | [diff] [blame] | 203 | u16 fifo_use; |
| 204 | snd_pcm_sframes_t delay; |
| 205 | |
| 206 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 207 | fifo_use = omap_mcbsp_get_tx_delay(mcbsp); |
Peter Ujfalusi | 75581d2 | 2010-03-03 15:08:09 +0200 | [diff] [blame] | 208 | else |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 209 | fifo_use = omap_mcbsp_get_rx_delay(mcbsp); |
Peter Ujfalusi | 75581d2 | 2010-03-03 15:08:09 +0200 | [diff] [blame] | 210 | |
| 211 | /* |
| 212 | * Divide the used locations with the channel count to get the |
| 213 | * FIFO usage in samples (don't care about partial samples in the |
| 214 | * buffer). |
| 215 | */ |
| 216 | delay = fifo_use / substream->runtime->channels; |
| 217 | |
| 218 | return delay; |
| 219 | } |
| 220 | |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 221 | static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, |
Mark Brown | dee89c4 | 2008-11-18 22:11:38 +0000 | [diff] [blame] | 222 | struct snd_pcm_hw_params *params, |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 223 | struct snd_soc_dai *cpu_dai) |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 224 | { |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 225 | struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); |
Peter Ujfalusi | 256d9c2 | 2012-02-14 15:23:15 +0200 | [diff] [blame] | 226 | struct omap_mcbsp_reg_cfg *regs = &mcbsp->cfg_regs; |
Peter Ujfalusi | 81ec027 | 2010-07-29 09:51:26 +0300 | [diff] [blame] | 227 | struct omap_pcm_dma_data *dma_data; |
Eduardo Valentin | caebc0c | 2009-08-20 16:18:25 +0300 | [diff] [blame] | 228 | int wlen, channels, wpf, sync_mode = OMAP_DMA_SYNC_ELEMENT; |
Peter Ujfalusi | cf80e15 | 2010-07-29 09:51:27 +0300 | [diff] [blame] | 229 | int pkt_size = 0; |
Graeme Gregory | 5f63ef9 | 2009-11-09 19:02:15 +0000 | [diff] [blame] | 230 | unsigned int format, div, framesize, master; |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 231 | |
Peter Ujfalusi | 256d9c2 | 2012-02-14 15:23:15 +0200 | [diff] [blame] | 232 | dma_data = &mcbsp->dma_data[substream->stream]; |
Kishon Vijay Abraham I | 2686e07 | 2011-02-24 15:16:56 +0530 | [diff] [blame] | 233 | |
Sergey Lapin | d98508a | 2010-05-13 19:48:16 +0400 | [diff] [blame] | 234 | switch (params_format(params)) { |
| 235 | case SNDRV_PCM_FORMAT_S16_LE: |
Peter Ujfalusi | 81ec027 | 2010-07-29 09:51:26 +0300 | [diff] [blame] | 236 | dma_data->data_type = OMAP_DMA_DATA_TYPE_S16; |
Peter Ujfalusi | cf80e15 | 2010-07-29 09:51:27 +0300 | [diff] [blame] | 237 | wlen = 16; |
Sergey Lapin | d98508a | 2010-05-13 19:48:16 +0400 | [diff] [blame] | 238 | break; |
| 239 | case SNDRV_PCM_FORMAT_S32_LE: |
Peter Ujfalusi | 81ec027 | 2010-07-29 09:51:26 +0300 | [diff] [blame] | 240 | dma_data->data_type = OMAP_DMA_DATA_TYPE_S32; |
Peter Ujfalusi | cf80e15 | 2010-07-29 09:51:27 +0300 | [diff] [blame] | 241 | wlen = 32; |
Sergey Lapin | d98508a | 2010-05-13 19:48:16 +0400 | [diff] [blame] | 242 | break; |
| 243 | default: |
| 244 | return -EINVAL; |
| 245 | } |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 246 | if (mcbsp->pdata->buffer_size) { |
Peter Ujfalusi | 15d0143 | 2010-07-29 09:51:25 +0300 | [diff] [blame] | 247 | dma_data->set_threshold = omap_mcbsp_set_threshold; |
| 248 | /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */ |
Peter Ujfalusi | cb40b63 | 2012-02-13 16:26:54 +0200 | [diff] [blame] | 249 | if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) { |
Peter Ujfalusi | cf80e15 | 2010-07-29 09:51:27 +0300 | [diff] [blame] | 250 | int period_words, max_thrsh; |
| 251 | |
| 252 | period_words = params_period_bytes(params) / (wlen / 8); |
| 253 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
Peter Ujfalusi | cb40b63 | 2012-02-13 16:26:54 +0200 | [diff] [blame] | 254 | max_thrsh = mcbsp->max_tx_thres; |
Peter Ujfalusi | cf80e15 | 2010-07-29 09:51:27 +0300 | [diff] [blame] | 255 | else |
Peter Ujfalusi | cb40b63 | 2012-02-13 16:26:54 +0200 | [diff] [blame] | 256 | max_thrsh = mcbsp->max_rx_thres; |
Peter Ujfalusi | cf80e15 | 2010-07-29 09:51:27 +0300 | [diff] [blame] | 257 | /* |
| 258 | * If the period contains less or equal number of words, |
| 259 | * we are using the original threshold mode setup: |
| 260 | * McBSP threshold = sDMA frame size = period_size |
| 261 | * Otherwise we switch to sDMA packet mode: |
| 262 | * McBSP threshold = sDMA packet size |
| 263 | * sDMA frame size = period size |
| 264 | */ |
| 265 | if (period_words > max_thrsh) { |
| 266 | int divider = 0; |
| 267 | |
| 268 | /* |
| 269 | * Look for the biggest threshold value, which |
| 270 | * divides the period size evenly. |
| 271 | */ |
| 272 | divider = period_words / max_thrsh; |
| 273 | if (period_words % max_thrsh) |
| 274 | divider++; |
| 275 | while (period_words % divider && |
| 276 | divider < period_words) |
| 277 | divider++; |
| 278 | if (divider == period_words) |
| 279 | return -EINVAL; |
| 280 | |
| 281 | pkt_size = period_words / divider; |
| 282 | sync_mode = OMAP_DMA_SYNC_PACKET; |
| 283 | } else { |
| 284 | sync_mode = OMAP_DMA_SYNC_FRAME; |
| 285 | } |
| 286 | } |
Peter Ujfalusi | 15d0143 | 2010-07-29 09:51:25 +0300 | [diff] [blame] | 287 | } |
| 288 | |
Peter Ujfalusi | 15d0143 | 2010-07-29 09:51:25 +0300 | [diff] [blame] | 289 | dma_data->sync_mode = sync_mode; |
Peter Ujfalusi | cf80e15 | 2010-07-29 09:51:27 +0300 | [diff] [blame] | 290 | dma_data->packet_size = pkt_size; |
Daniel Mack | fd23b7d | 2010-03-19 14:52:55 +0000 | [diff] [blame] | 291 | |
Peter Ujfalusi | 81ec027 | 2010-07-29 09:51:26 +0300 | [diff] [blame] | 292 | snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 293 | |
Peter Ujfalusi | 256d9c2 | 2012-02-14 15:23:15 +0200 | [diff] [blame] | 294 | if (mcbsp->configured) { |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 295 | /* McBSP already configured by another stream */ |
| 296 | return 0; |
| 297 | } |
| 298 | |
Jarkko Nikula | 4dd0417 | 2011-09-30 16:07:44 +0300 | [diff] [blame] | 299 | regs->rcr2 &= ~(RPHASE | RFRLEN2(0x7f) | RWDLEN2(7)); |
| 300 | regs->xcr2 &= ~(RPHASE | XFRLEN2(0x7f) | XWDLEN2(7)); |
| 301 | regs->rcr1 &= ~(RFRLEN1(0x7f) | RWDLEN1(7)); |
| 302 | regs->xcr1 &= ~(XFRLEN1(0x7f) | XWDLEN1(7)); |
Peter Ujfalusi | 256d9c2 | 2012-02-14 15:23:15 +0200 | [diff] [blame] | 303 | format = mcbsp->fmt & SND_SOC_DAIFMT_FORMAT_MASK; |
Peter Ujfalusi | c29b206 | 2009-04-15 15:38:55 +0300 | [diff] [blame] | 304 | wpf = channels = params_channels(params); |
Peter Ujfalusi | 299a151 | 2010-03-19 12:27:31 +0200 | [diff] [blame] | 305 | if (channels == 2 && (format == SND_SOC_DAIFMT_I2S || |
| 306 | format == SND_SOC_DAIFMT_LEFT_J)) { |
Graeme Gregory | 5f63ef9 | 2009-11-09 19:02:15 +0000 | [diff] [blame] | 307 | /* Use dual-phase frames */ |
| 308 | regs->rcr2 |= RPHASE; |
| 309 | regs->xcr2 |= XPHASE; |
| 310 | /* Set 1 word per (McBSP) frame for phase1 and phase2 */ |
| 311 | wpf--; |
| 312 | regs->rcr2 |= RFRLEN2(wpf - 1); |
| 313 | regs->xcr2 |= XFRLEN2(wpf - 1); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 314 | } |
| 315 | |
Graeme Gregory | 5f63ef9 | 2009-11-09 19:02:15 +0000 | [diff] [blame] | 316 | regs->rcr1 |= RFRLEN1(wpf - 1); |
| 317 | regs->xcr1 |= XFRLEN1(wpf - 1); |
| 318 | |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 319 | switch (params_format(params)) { |
| 320 | case SNDRV_PCM_FORMAT_S16_LE: |
| 321 | /* Set word lengths */ |
| 322 | regs->rcr2 |= RWDLEN2(OMAP_MCBSP_WORD_16); |
| 323 | regs->rcr1 |= RWDLEN1(OMAP_MCBSP_WORD_16); |
| 324 | regs->xcr2 |= XWDLEN2(OMAP_MCBSP_WORD_16); |
| 325 | regs->xcr1 |= XWDLEN1(OMAP_MCBSP_WORD_16); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 326 | break; |
Sergey Lapin | d98508a | 2010-05-13 19:48:16 +0400 | [diff] [blame] | 327 | case SNDRV_PCM_FORMAT_S32_LE: |
| 328 | /* Set word lengths */ |
Sergey Lapin | d98508a | 2010-05-13 19:48:16 +0400 | [diff] [blame] | 329 | regs->rcr2 |= RWDLEN2(OMAP_MCBSP_WORD_32); |
| 330 | regs->rcr1 |= RWDLEN1(OMAP_MCBSP_WORD_32); |
| 331 | regs->xcr2 |= XWDLEN2(OMAP_MCBSP_WORD_32); |
| 332 | regs->xcr1 |= XWDLEN1(OMAP_MCBSP_WORD_32); |
| 333 | break; |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 334 | default: |
| 335 | /* Unsupported PCM format */ |
| 336 | return -EINVAL; |
| 337 | } |
| 338 | |
Graeme Gregory | 5f63ef9 | 2009-11-09 19:02:15 +0000 | [diff] [blame] | 339 | /* In McBSP master modes, FRAME (i.e. sample rate) is generated |
| 340 | * by _counting_ BCLKs. Calculate frame size in BCLKs */ |
Peter Ujfalusi | 256d9c2 | 2012-02-14 15:23:15 +0200 | [diff] [blame] | 341 | master = mcbsp->fmt & SND_SOC_DAIFMT_MASTER_MASK; |
Graeme Gregory | 5f63ef9 | 2009-11-09 19:02:15 +0000 | [diff] [blame] | 342 | if (master == SND_SOC_DAIFMT_CBS_CFS) { |
Peter Ujfalusi | 256d9c2 | 2012-02-14 15:23:15 +0200 | [diff] [blame] | 343 | div = mcbsp->clk_div ? mcbsp->clk_div : 1; |
| 344 | framesize = (mcbsp->in_freq / div) / params_rate(params); |
Graeme Gregory | 5f63ef9 | 2009-11-09 19:02:15 +0000 | [diff] [blame] | 345 | |
| 346 | if (framesize < wlen * channels) { |
| 347 | printk(KERN_ERR "%s: not enough bandwidth for desired rate and " |
| 348 | "channels\n", __func__); |
| 349 | return -EINVAL; |
| 350 | } |
| 351 | } else |
| 352 | framesize = wlen * channels; |
| 353 | |
Jarkko Nikula | ba9d0fd | 2008-10-20 15:29:59 +0300 | [diff] [blame] | 354 | /* Set FS period and length in terms of bit clock periods */ |
Jarkko Nikula | 4dd0417 | 2011-09-30 16:07:44 +0300 | [diff] [blame] | 355 | regs->srgr2 &= ~FPER(0xfff); |
| 356 | regs->srgr1 &= ~FWID(0xff); |
Peter Ujfalusi | c29b206 | 2009-04-15 15:38:55 +0300 | [diff] [blame] | 357 | switch (format) { |
Jarkko Nikula | ba9d0fd | 2008-10-20 15:29:59 +0300 | [diff] [blame] | 358 | case SND_SOC_DAIFMT_I2S: |
Peter Ujfalusi | 299a151 | 2010-03-19 12:27:31 +0200 | [diff] [blame] | 359 | case SND_SOC_DAIFMT_LEFT_J: |
Graeme Gregory | 5f63ef9 | 2009-11-09 19:02:15 +0000 | [diff] [blame] | 360 | regs->srgr2 |= FPER(framesize - 1); |
| 361 | regs->srgr1 |= FWID((framesize >> 1) - 1); |
Jarkko Nikula | ba9d0fd | 2008-10-20 15:29:59 +0300 | [diff] [blame] | 362 | break; |
Peter Ujfalusi | 3ba191c | 2009-04-15 15:38:56 +0300 | [diff] [blame] | 363 | case SND_SOC_DAIFMT_DSP_A: |
Jarkko Nikula | bd25867 | 2008-12-22 10:21:36 +0200 | [diff] [blame] | 364 | case SND_SOC_DAIFMT_DSP_B: |
Graeme Gregory | 5f63ef9 | 2009-11-09 19:02:15 +0000 | [diff] [blame] | 365 | regs->srgr2 |= FPER(framesize - 1); |
Jarkko Nikula | 36ce858 | 2009-04-15 13:48:16 +0300 | [diff] [blame] | 366 | regs->srgr1 |= FWID(0); |
Jarkko Nikula | ba9d0fd | 2008-10-20 15:29:59 +0300 | [diff] [blame] | 367 | break; |
| 368 | } |
| 369 | |
Peter Ujfalusi | 256d9c2 | 2012-02-14 15:23:15 +0200 | [diff] [blame] | 370 | omap_mcbsp_config(mcbsp, &mcbsp->cfg_regs); |
| 371 | mcbsp->wlen = wlen; |
| 372 | mcbsp->configured = 1; |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 373 | |
| 374 | return 0; |
| 375 | } |
| 376 | |
| 377 | /* |
| 378 | * This must be called before _set_clkdiv and _set_sysclk since McBSP register |
| 379 | * cache is initialized here |
| 380 | */ |
Liam Girdwood | 8687eb8 | 2008-07-07 16:08:07 +0100 | [diff] [blame] | 381 | static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 382 | unsigned int fmt) |
| 383 | { |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 384 | struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); |
Peter Ujfalusi | 256d9c2 | 2012-02-14 15:23:15 +0200 | [diff] [blame] | 385 | struct omap_mcbsp_reg_cfg *regs = &mcbsp->cfg_regs; |
Jarkko Nikula | 91a18ae | 2011-09-30 10:55:32 +0300 | [diff] [blame] | 386 | bool inv_fs = false; |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 387 | |
Peter Ujfalusi | 256d9c2 | 2012-02-14 15:23:15 +0200 | [diff] [blame] | 388 | if (mcbsp->configured) |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 389 | return 0; |
| 390 | |
Peter Ujfalusi | 256d9c2 | 2012-02-14 15:23:15 +0200 | [diff] [blame] | 391 | mcbsp->fmt = fmt; |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 392 | memset(regs, 0, sizeof(*regs)); |
| 393 | /* Generic McBSP register settings */ |
| 394 | regs->spcr2 |= XINTM(3) | FREE; |
| 395 | regs->spcr1 |= RINTM(3); |
Eero Nurkkala | c721bbd | 2009-08-20 16:18:23 +0300 | [diff] [blame] | 396 | /* RFIG and XFIG are not defined in 34xx */ |
Jorge Eduardo Candelaria | d4686c6 | 2010-12-20 11:32:47 -0600 | [diff] [blame] | 397 | if (!cpu_is_omap34xx() && !cpu_is_omap44xx()) { |
Eero Nurkkala | c721bbd | 2009-08-20 16:18:23 +0300 | [diff] [blame] | 398 | regs->rcr2 |= RFIG; |
| 399 | regs->xcr2 |= XFIG; |
| 400 | } |
Jorge Eduardo Candelaria | d4686c6 | 2010-12-20 11:32:47 -0600 | [diff] [blame] | 401 | if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) { |
Jarkko Nikula | 32080af | 2009-08-23 12:24:26 +0300 | [diff] [blame] | 402 | regs->xccr = DXENDLY(1) | XDMAEN | XDISABLE; |
| 403 | regs->rccr = RFULL_CYCLE | RDMAEN | RDISABLE; |
Misael Lopez Cruz | ef390c0 | 2009-01-29 13:29:46 +0200 | [diff] [blame] | 404 | } |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 405 | |
| 406 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
| 407 | case SND_SOC_DAIFMT_I2S: |
| 408 | /* 1-bit data delay */ |
| 409 | regs->rcr2 |= RDATDLY(1); |
| 410 | regs->xcr2 |= XDATDLY(1); |
| 411 | break; |
Peter Ujfalusi | 299a151 | 2010-03-19 12:27:31 +0200 | [diff] [blame] | 412 | case SND_SOC_DAIFMT_LEFT_J: |
| 413 | /* 0-bit data delay */ |
| 414 | regs->rcr2 |= RDATDLY(0); |
| 415 | regs->xcr2 |= XDATDLY(0); |
| 416 | regs->spcr1 |= RJUST(2); |
| 417 | /* Invert FS polarity configuration */ |
Jarkko Nikula | 91a18ae | 2011-09-30 10:55:32 +0300 | [diff] [blame] | 418 | inv_fs = true; |
Peter Ujfalusi | 299a151 | 2010-03-19 12:27:31 +0200 | [diff] [blame] | 419 | break; |
Peter Ujfalusi | 3ba191c | 2009-04-15 15:38:56 +0300 | [diff] [blame] | 420 | case SND_SOC_DAIFMT_DSP_A: |
| 421 | /* 1-bit data delay */ |
| 422 | regs->rcr2 |= RDATDLY(1); |
| 423 | regs->xcr2 |= XDATDLY(1); |
| 424 | /* Invert FS polarity configuration */ |
Jarkko Nikula | 91a18ae | 2011-09-30 10:55:32 +0300 | [diff] [blame] | 425 | inv_fs = true; |
Peter Ujfalusi | 3ba191c | 2009-04-15 15:38:56 +0300 | [diff] [blame] | 426 | break; |
Jarkko Nikula | bd25867 | 2008-12-22 10:21:36 +0200 | [diff] [blame] | 427 | case SND_SOC_DAIFMT_DSP_B: |
Arun KS | 3336c5b | 2008-10-02 15:07:06 +0530 | [diff] [blame] | 428 | /* 0-bit data delay */ |
| 429 | regs->rcr2 |= RDATDLY(0); |
| 430 | regs->xcr2 |= XDATDLY(0); |
Jarkko Nikula | 36ce858 | 2009-04-15 13:48:16 +0300 | [diff] [blame] | 431 | /* Invert FS polarity configuration */ |
Jarkko Nikula | 91a18ae | 2011-09-30 10:55:32 +0300 | [diff] [blame] | 432 | inv_fs = true; |
Arun KS | 3336c5b | 2008-10-02 15:07:06 +0530 | [diff] [blame] | 433 | break; |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 434 | default: |
| 435 | /* Unsupported data format */ |
| 436 | return -EINVAL; |
| 437 | } |
| 438 | |
| 439 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
| 440 | case SND_SOC_DAIFMT_CBS_CFS: |
| 441 | /* McBSP master. Set FS and bit clocks as outputs */ |
| 442 | regs->pcr0 |= FSXM | FSRM | |
| 443 | CLKXM | CLKRM; |
| 444 | /* Sample rate generator drives the FS */ |
| 445 | regs->srgr2 |= FSGM; |
| 446 | break; |
| 447 | case SND_SOC_DAIFMT_CBM_CFM: |
| 448 | /* McBSP slave */ |
| 449 | break; |
| 450 | default: |
| 451 | /* Unsupported master/slave configuration */ |
| 452 | return -EINVAL; |
| 453 | } |
| 454 | |
| 455 | /* Set bit clock (CLKX/CLKR) and FS polarities */ |
Jarkko Nikula | 91a18ae | 2011-09-30 10:55:32 +0300 | [diff] [blame] | 456 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 457 | case SND_SOC_DAIFMT_NB_NF: |
| 458 | /* |
| 459 | * Normal BCLK + FS. |
| 460 | * FS active low. TX data driven on falling edge of bit clock |
| 461 | * and RX data sampled on rising edge of bit clock. |
| 462 | */ |
| 463 | regs->pcr0 |= FSXP | FSRP | |
| 464 | CLKXP | CLKRP; |
| 465 | break; |
| 466 | case SND_SOC_DAIFMT_NB_IF: |
| 467 | regs->pcr0 |= CLKXP | CLKRP; |
| 468 | break; |
| 469 | case SND_SOC_DAIFMT_IB_NF: |
| 470 | regs->pcr0 |= FSXP | FSRP; |
| 471 | break; |
| 472 | case SND_SOC_DAIFMT_IB_IF: |
| 473 | break; |
| 474 | default: |
| 475 | return -EINVAL; |
| 476 | } |
Jarkko Nikula | 91a18ae | 2011-09-30 10:55:32 +0300 | [diff] [blame] | 477 | if (inv_fs == true) |
| 478 | regs->pcr0 ^= FSXP | FSRP; |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 479 | |
| 480 | return 0; |
| 481 | } |
| 482 | |
Liam Girdwood | 8687eb8 | 2008-07-07 16:08:07 +0100 | [diff] [blame] | 483 | static int omap_mcbsp_dai_set_clkdiv(struct snd_soc_dai *cpu_dai, |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 484 | int div_id, int div) |
| 485 | { |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 486 | struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); |
Peter Ujfalusi | 256d9c2 | 2012-02-14 15:23:15 +0200 | [diff] [blame] | 487 | struct omap_mcbsp_reg_cfg *regs = &mcbsp->cfg_regs; |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 488 | |
| 489 | if (div_id != OMAP_MCBSP_CLKGDV) |
| 490 | return -ENODEV; |
| 491 | |
Peter Ujfalusi | 256d9c2 | 2012-02-14 15:23:15 +0200 | [diff] [blame] | 492 | mcbsp->clk_div = div; |
Jarkko Nikula | 4dd0417 | 2011-09-30 16:07:44 +0300 | [diff] [blame] | 493 | regs->srgr1 &= ~CLKGDV(0xff); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 494 | regs->srgr1 |= CLKGDV(div - 1); |
| 495 | |
| 496 | return 0; |
| 497 | } |
| 498 | |
Liam Girdwood | 8687eb8 | 2008-07-07 16:08:07 +0100 | [diff] [blame] | 499 | static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai, |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 500 | int clk_id, unsigned int freq, |
| 501 | int dir) |
| 502 | { |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 503 | struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); |
Peter Ujfalusi | 256d9c2 | 2012-02-14 15:23:15 +0200 | [diff] [blame] | 504 | struct omap_mcbsp_reg_cfg *regs = &mcbsp->cfg_regs; |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 505 | int err = 0; |
| 506 | |
Peter Ujfalusi | 256d9c2 | 2012-02-14 15:23:15 +0200 | [diff] [blame] | 507 | if (mcbsp->active) { |
| 508 | if (freq == mcbsp->in_freq) |
Jarkko Nikula | 34c8698 | 2011-09-23 11:19:13 +0300 | [diff] [blame] | 509 | return 0; |
| 510 | else |
| 511 | return -EBUSY; |
Peter Ujfalusi | 141947e | 2011-09-26 10:56:42 +0300 | [diff] [blame] | 512 | } |
Jarkko Nikula | 34c8698 | 2011-09-23 11:19:13 +0300 | [diff] [blame] | 513 | |
Peter Ujfalusi | 5788c62 | 2012-03-08 13:34:16 +0200 | [diff] [blame] | 514 | if (clk_id == OMAP_MCBSP_SYSCLK_CLK || |
| 515 | clk_id == OMAP_MCBSP_SYSCLK_CLKS_FCLK || |
| 516 | clk_id == OMAP_MCBSP_SYSCLK_CLKS_EXT || |
| 517 | clk_id == OMAP_MCBSP_SYSCLK_CLKX_EXT || |
| 518 | clk_id == OMAP_MCBSP_SYSCLK_CLKR_EXT) { |
| 519 | mcbsp->in_freq = freq; |
| 520 | regs->srgr2 &= ~CLKSM; |
| 521 | regs->pcr0 &= ~SCLKME; |
| 522 | } else if (cpu_class_is_omap1()) { |
| 523 | /* |
| 524 | * McBSP CLKR/FSR signal muxing functions are only available on |
| 525 | * OMAP2 or newer versions |
| 526 | */ |
| 527 | return -EINVAL; |
| 528 | } |
Graeme Gregory | 5f63ef9 | 2009-11-09 19:02:15 +0000 | [diff] [blame] | 529 | |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 530 | switch (clk_id) { |
| 531 | case OMAP_MCBSP_SYSCLK_CLK: |
| 532 | regs->srgr2 |= CLKSM; |
| 533 | break; |
| 534 | case OMAP_MCBSP_SYSCLK_CLKS_FCLK: |
Paul Walmsley | d1358657 | 2010-10-08 11:40:19 -0600 | [diff] [blame] | 535 | if (cpu_class_is_omap1()) { |
| 536 | err = -EINVAL; |
| 537 | break; |
| 538 | } |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 539 | err = omap2_mcbsp_set_clks_src(mcbsp, |
Paul Walmsley | d1358657 | 2010-10-08 11:40:19 -0600 | [diff] [blame] | 540 | MCBSP_CLKS_PRCM_SRC); |
| 541 | break; |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 542 | case OMAP_MCBSP_SYSCLK_CLKS_EXT: |
Paul Walmsley | d1358657 | 2010-10-08 11:40:19 -0600 | [diff] [blame] | 543 | if (cpu_class_is_omap1()) { |
| 544 | err = 0; |
| 545 | break; |
| 546 | } |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 547 | err = omap2_mcbsp_set_clks_src(mcbsp, |
Paul Walmsley | d1358657 | 2010-10-08 11:40:19 -0600 | [diff] [blame] | 548 | MCBSP_CLKS_PAD_SRC); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 549 | break; |
| 550 | |
| 551 | case OMAP_MCBSP_SYSCLK_CLKX_EXT: |
| 552 | regs->srgr2 |= CLKSM; |
| 553 | case OMAP_MCBSP_SYSCLK_CLKR_EXT: |
| 554 | regs->pcr0 |= SCLKME; |
| 555 | break; |
Jarkko Nikula | d2c0bda | 2009-08-28 15:35:35 +0300 | [diff] [blame] | 556 | |
Paul Walmsley | cf4c87a | 2010-10-08 11:40:19 -0600 | [diff] [blame] | 557 | |
Jarkko Nikula | d2c0bda | 2009-08-28 15:35:35 +0300 | [diff] [blame] | 558 | case OMAP_MCBSP_CLKR_SRC_CLKR: |
Peter Ujfalusi | cd1f08c | 2012-03-08 11:01:37 +0200 | [diff] [blame] | 559 | err = omap_mcbsp_6pin_src_mux(mcbsp, CLKR_SRC_CLKR); |
Paul Walmsley | cf4c87a | 2010-10-08 11:40:19 -0600 | [diff] [blame] | 560 | break; |
Jarkko Nikula | d2c0bda | 2009-08-28 15:35:35 +0300 | [diff] [blame] | 561 | case OMAP_MCBSP_CLKR_SRC_CLKX: |
Peter Ujfalusi | cd1f08c | 2012-03-08 11:01:37 +0200 | [diff] [blame] | 562 | err = omap_mcbsp_6pin_src_mux(mcbsp, CLKR_SRC_CLKX); |
Paul Walmsley | cf4c87a | 2010-10-08 11:40:19 -0600 | [diff] [blame] | 563 | break; |
Jarkko Nikula | d2c0bda | 2009-08-28 15:35:35 +0300 | [diff] [blame] | 564 | case OMAP_MCBSP_FSR_SRC_FSR: |
Peter Ujfalusi | cd1f08c | 2012-03-08 11:01:37 +0200 | [diff] [blame] | 565 | err = omap_mcbsp_6pin_src_mux(mcbsp, FSR_SRC_FSR); |
Paul Walmsley | cf4c87a | 2010-10-08 11:40:19 -0600 | [diff] [blame] | 566 | break; |
Jarkko Nikula | d2c0bda | 2009-08-28 15:35:35 +0300 | [diff] [blame] | 567 | case OMAP_MCBSP_FSR_SRC_FSX: |
Peter Ujfalusi | cd1f08c | 2012-03-08 11:01:37 +0200 | [diff] [blame] | 568 | err = omap_mcbsp_6pin_src_mux(mcbsp, FSR_SRC_FSX); |
Jarkko Nikula | d2c0bda | 2009-08-28 15:35:35 +0300 | [diff] [blame] | 569 | break; |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 570 | default: |
| 571 | err = -ENODEV; |
| 572 | } |
| 573 | |
| 574 | return err; |
| 575 | } |
| 576 | |
Lars-Peter Clausen | 85e7652 | 2011-11-23 11:40:40 +0100 | [diff] [blame] | 577 | static const struct snd_soc_dai_ops mcbsp_dai_ops = { |
Eric Miao | 6335d05 | 2009-03-03 09:41:00 +0800 | [diff] [blame] | 578 | .startup = omap_mcbsp_dai_startup, |
| 579 | .shutdown = omap_mcbsp_dai_shutdown, |
| 580 | .trigger = omap_mcbsp_dai_trigger, |
Peter Ujfalusi | 75581d2 | 2010-03-03 15:08:09 +0200 | [diff] [blame] | 581 | .delay = omap_mcbsp_dai_delay, |
Eric Miao | 6335d05 | 2009-03-03 09:41:00 +0800 | [diff] [blame] | 582 | .hw_params = omap_mcbsp_dai_hw_params, |
| 583 | .set_fmt = omap_mcbsp_dai_set_dai_fmt, |
| 584 | .set_clkdiv = omap_mcbsp_dai_set_clkdiv, |
| 585 | .set_sysclk = omap_mcbsp_dai_set_dai_sysclk, |
| 586 | }; |
| 587 | |
Peter Ujfalusi | 2ee6595 | 2012-02-14 14:52:42 +0200 | [diff] [blame] | 588 | static int omap_mcbsp_probe(struct snd_soc_dai *dai) |
| 589 | { |
| 590 | struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(dai); |
| 591 | |
| 592 | pm_runtime_enable(mcbsp->dev); |
| 593 | |
| 594 | return 0; |
| 595 | } |
| 596 | |
| 597 | static int omap_mcbsp_remove(struct snd_soc_dai *dai) |
| 598 | { |
| 599 | struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(dai); |
| 600 | |
| 601 | pm_runtime_disable(mcbsp->dev); |
| 602 | |
| 603 | return 0; |
| 604 | } |
| 605 | |
Michael Opdenacker | 6179b77 | 2011-10-10 07:07:08 +0200 | [diff] [blame] | 606 | static struct snd_soc_dai_driver omap_mcbsp_dai = { |
Peter Ujfalusi | 2ee6595 | 2012-02-14 14:52:42 +0200 | [diff] [blame] | 607 | .probe = omap_mcbsp_probe, |
| 608 | .remove = omap_mcbsp_remove, |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 609 | .playback = { |
| 610 | .channels_min = 1, |
| 611 | .channels_max = 16, |
| 612 | .rates = OMAP_MCBSP_RATES, |
| 613 | .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE, |
| 614 | }, |
| 615 | .capture = { |
| 616 | .channels_min = 1, |
| 617 | .channels_max = 16, |
| 618 | .rates = OMAP_MCBSP_RATES, |
| 619 | .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE, |
| 620 | }, |
| 621 | .ops = &mcbsp_dai_ops, |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 622 | }; |
Jarkko Nikula | 8def464 | 2008-10-09 15:57:22 +0300 | [diff] [blame] | 623 | |
G, Manjunath Kondaiah | 3484457 | 2010-09-08 08:53:43 +0530 | [diff] [blame] | 624 | static int omap_mcbsp_st_info_volsw(struct snd_kcontrol *kcontrol, |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 625 | struct snd_ctl_elem_info *uinfo) |
| 626 | { |
| 627 | struct soc_mixer_control *mc = |
| 628 | (struct soc_mixer_control *)kcontrol->private_value; |
| 629 | int max = mc->max; |
| 630 | int min = mc->min; |
| 631 | |
| 632 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
| 633 | uinfo->count = 1; |
| 634 | uinfo->value.integer.min = min; |
| 635 | uinfo->value.integer.max = max; |
| 636 | return 0; |
| 637 | } |
| 638 | |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 639 | #define OMAP_MCBSP_ST_SET_CHANNEL_VOLUME(channel) \ |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 640 | static int \ |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 641 | omap_mcbsp_set_st_ch##channel##_volume(struct snd_kcontrol *kc, \ |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 642 | struct snd_ctl_elem_value *uc) \ |
| 643 | { \ |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 644 | struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kc); \ |
| 645 | struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); \ |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 646 | struct soc_mixer_control *mc = \ |
| 647 | (struct soc_mixer_control *)kc->private_value; \ |
| 648 | int max = mc->max; \ |
| 649 | int min = mc->min; \ |
| 650 | int val = uc->value.integer.value[0]; \ |
| 651 | \ |
| 652 | if (val < min || val > max) \ |
| 653 | return -EINVAL; \ |
| 654 | \ |
| 655 | /* OMAP McBSP implementation uses index values 0..4 */ \ |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 656 | return omap_st_set_chgain(mcbsp, channel, val); \ |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 657 | } |
| 658 | |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 659 | #define OMAP_MCBSP_ST_GET_CHANNEL_VOLUME(channel) \ |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 660 | static int \ |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 661 | omap_mcbsp_get_st_ch##channel##_volume(struct snd_kcontrol *kc, \ |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 662 | struct snd_ctl_elem_value *uc) \ |
| 663 | { \ |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 664 | struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kc); \ |
| 665 | struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); \ |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 666 | s16 chgain; \ |
| 667 | \ |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 668 | if (omap_st_get_chgain(mcbsp, channel, &chgain)) \ |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 669 | return -EAGAIN; \ |
| 670 | \ |
| 671 | uc->value.integer.value[0] = chgain; \ |
| 672 | return 0; \ |
| 673 | } |
| 674 | |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 675 | OMAP_MCBSP_ST_SET_CHANNEL_VOLUME(0) |
| 676 | OMAP_MCBSP_ST_SET_CHANNEL_VOLUME(1) |
| 677 | OMAP_MCBSP_ST_GET_CHANNEL_VOLUME(0) |
| 678 | OMAP_MCBSP_ST_GET_CHANNEL_VOLUME(1) |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 679 | |
| 680 | static int omap_mcbsp_st_put_mode(struct snd_kcontrol *kcontrol, |
| 681 | struct snd_ctl_elem_value *ucontrol) |
| 682 | { |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 683 | struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol); |
| 684 | struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 685 | u8 value = ucontrol->value.integer.value[0]; |
| 686 | |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 687 | if (value == omap_st_is_enabled(mcbsp)) |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 688 | return 0; |
| 689 | |
| 690 | if (value) |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 691 | omap_st_enable(mcbsp); |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 692 | else |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 693 | omap_st_disable(mcbsp); |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 694 | |
| 695 | return 1; |
| 696 | } |
| 697 | |
| 698 | static int omap_mcbsp_st_get_mode(struct snd_kcontrol *kcontrol, |
| 699 | struct snd_ctl_elem_value *ucontrol) |
| 700 | { |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 701 | struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol); |
| 702 | struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 703 | |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 704 | ucontrol->value.integer.value[0] = omap_st_is_enabled(mcbsp); |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 705 | return 0; |
| 706 | } |
| 707 | |
| 708 | static const struct snd_kcontrol_new omap_mcbsp2_st_controls[] = { |
| 709 | SOC_SINGLE_EXT("McBSP2 Sidetone Switch", 1, 0, 1, 0, |
| 710 | omap_mcbsp_st_get_mode, omap_mcbsp_st_put_mode), |
| 711 | OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP2 Sidetone Channel 0 Volume", |
| 712 | -32768, 32767, |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 713 | omap_mcbsp_get_st_ch0_volume, |
| 714 | omap_mcbsp_set_st_ch0_volume), |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 715 | OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP2 Sidetone Channel 1 Volume", |
| 716 | -32768, 32767, |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 717 | omap_mcbsp_get_st_ch1_volume, |
| 718 | omap_mcbsp_set_st_ch1_volume), |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 719 | }; |
| 720 | |
| 721 | static const struct snd_kcontrol_new omap_mcbsp3_st_controls[] = { |
| 722 | SOC_SINGLE_EXT("McBSP3 Sidetone Switch", 2, 0, 1, 0, |
| 723 | omap_mcbsp_st_get_mode, omap_mcbsp_st_put_mode), |
| 724 | OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP3 Sidetone Channel 0 Volume", |
| 725 | -32768, 32767, |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 726 | omap_mcbsp_get_st_ch0_volume, |
| 727 | omap_mcbsp_set_st_ch0_volume), |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 728 | OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP3 Sidetone Channel 1 Volume", |
| 729 | -32768, 32767, |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 730 | omap_mcbsp_get_st_ch1_volume, |
| 731 | omap_mcbsp_set_st_ch1_volume), |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 732 | }; |
| 733 | |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 734 | int omap_mcbsp_st_add_controls(struct snd_soc_pcm_runtime *rtd) |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 735 | { |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 736 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
| 737 | struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); |
| 738 | |
| 739 | if (!mcbsp->st_data) |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 740 | return -ENODEV; |
| 741 | |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 742 | switch (cpu_dai->id) { |
| 743 | case 2: /* McBSP 2 */ |
| 744 | return snd_soc_add_dai_controls(cpu_dai, |
| 745 | omap_mcbsp2_st_controls, |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 746 | ARRAY_SIZE(omap_mcbsp2_st_controls)); |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 747 | case 3: /* McBSP 3 */ |
| 748 | return snd_soc_add_dai_controls(cpu_dai, |
| 749 | omap_mcbsp3_st_controls, |
Ilkka Koskinen | 83905c1 | 2010-02-22 12:21:12 +0000 | [diff] [blame] | 750 | ARRAY_SIZE(omap_mcbsp3_st_controls)); |
| 751 | default: |
| 752 | break; |
| 753 | } |
| 754 | |
| 755 | return -EINVAL; |
| 756 | } |
| 757 | EXPORT_SYMBOL_GPL(omap_mcbsp_st_add_controls); |
| 758 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 759 | static __devinit int asoc_mcbsp_probe(struct platform_device *pdev) |
| 760 | { |
Peter Ujfalusi | 2ee6595 | 2012-02-14 14:52:42 +0200 | [diff] [blame] | 761 | struct omap_mcbsp_platform_data *pdata = dev_get_platdata(&pdev->dev); |
| 762 | struct omap_mcbsp *mcbsp; |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 763 | int ret; |
| 764 | |
Peter Ujfalusi | 2ee6595 | 2012-02-14 14:52:42 +0200 | [diff] [blame] | 765 | if (!pdata) { |
| 766 | dev_err(&pdev->dev, "missing platform data.\n"); |
| 767 | return -EINVAL; |
| 768 | } |
| 769 | mcbsp = devm_kzalloc(&pdev->dev, sizeof(struct omap_mcbsp), GFP_KERNEL); |
| 770 | if (!mcbsp) |
| 771 | return -ENOMEM; |
| 772 | |
| 773 | mcbsp->id = pdev->id; |
| 774 | mcbsp->pdata = pdata; |
| 775 | mcbsp->dev = &pdev->dev; |
| 776 | platform_set_drvdata(pdev, mcbsp); |
| 777 | |
| 778 | ret = omap_mcbsp_init(pdev); |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 779 | if (!ret) |
| 780 | return snd_soc_register_dai(&pdev->dev, &omap_mcbsp_dai); |
| 781 | |
| 782 | return ret; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 783 | } |
| 784 | |
| 785 | static int __devexit asoc_mcbsp_remove(struct platform_device *pdev) |
| 786 | { |
Peter Ujfalusi | 2ee6595 | 2012-02-14 14:52:42 +0200 | [diff] [blame] | 787 | struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev); |
| 788 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 789 | snd_soc_unregister_dai(&pdev->dev); |
Peter Ujfalusi | 2ee6595 | 2012-02-14 14:52:42 +0200 | [diff] [blame] | 790 | |
| 791 | if (mcbsp->pdata->ops && mcbsp->pdata->ops->free) |
| 792 | mcbsp->pdata->ops->free(mcbsp->id); |
| 793 | |
| 794 | omap_mcbsp_sysfs_remove(mcbsp); |
| 795 | |
| 796 | clk_put(mcbsp->fclk); |
| 797 | |
| 798 | platform_set_drvdata(pdev, NULL); |
| 799 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 800 | return 0; |
| 801 | } |
| 802 | |
| 803 | static struct platform_driver asoc_mcbsp_driver = { |
| 804 | .driver = { |
Peter Ujfalusi | 45656b4 | 2012-02-14 18:20:58 +0200 | [diff] [blame] | 805 | .name = "omap-mcbsp", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 806 | .owner = THIS_MODULE, |
| 807 | }, |
| 808 | |
| 809 | .probe = asoc_mcbsp_probe, |
| 810 | .remove = __devexit_p(asoc_mcbsp_remove), |
| 811 | }; |
| 812 | |
Axel Lin | beda5bf5 | 2011-11-25 10:12:16 +0800 | [diff] [blame] | 813 | module_platform_driver(asoc_mcbsp_driver); |
Mark Brown | 3f4b783 | 2008-12-03 19:26:35 +0000 | [diff] [blame] | 814 | |
Jarkko Nikula | 7ec41ee | 2011-08-11 15:44:57 +0300 | [diff] [blame] | 815 | MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@bitmer.com>"); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 816 | MODULE_DESCRIPTION("OMAP I2S SoC Interface"); |
| 817 | MODULE_LICENSE("GPL"); |