Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 1 | /* |
Frank Mandarino | 9f0ac6e | 2006-11-24 15:49:39 +0100 | [diff] [blame] | 2 | * eti_b1_wm8731 -- SoC audio for AT91RM9200-based Endrelia ETI_B1 board. |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 3 | * |
| 4 | * Author: Frank Mandarino <fmandarino@endrelia.com> |
| 5 | * Endrelia Technologies Inc. |
| 6 | * Created: Mar 29, 2006 |
| 7 | * |
| 8 | * Based on corgi.c by: |
| 9 | * |
| 10 | * Copyright 2005 Wolfson Microelectronics PLC. |
| 11 | * Copyright 2005 Openedhand Ltd. |
| 12 | * |
| 13 | * Authors: Liam Girdwood <liam.girdwood@wolfsonmicro.com> |
| 14 | * Richard Purdie <richard@openedhand.com> |
| 15 | * |
| 16 | * This program is free software; you can redistribute it and/or modify it |
| 17 | * under the terms of the GNU General Public License as published by the |
| 18 | * Free Software Foundation; either version 2 of the License, or (at your |
| 19 | * option) any later version. |
| 20 | * |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 21 | */ |
| 22 | |
| 23 | #include <linux/module.h> |
| 24 | #include <linux/moduleparam.h> |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 25 | #include <linux/kernel.h> |
| 26 | #include <linux/clk.h> |
| 27 | #include <linux/timer.h> |
| 28 | #include <linux/interrupt.h> |
| 29 | #include <linux/platform_device.h> |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 30 | #include <sound/core.h> |
| 31 | #include <sound/pcm.h> |
| 32 | #include <sound/soc.h> |
| 33 | #include <sound/soc-dapm.h> |
| 34 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 35 | #include <mach/hardware.h> |
| 36 | #include <mach/gpio.h> |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 37 | |
| 38 | #include "../codecs/wm8731.h" |
Frank Mandarino | 9f0ac6e | 2006-11-24 15:49:39 +0100 | [diff] [blame] | 39 | #include "at91-pcm.h" |
Frank Mandarino | eb831da | 2007-04-16 17:19:42 +0200 | [diff] [blame] | 40 | #include "at91-ssc.h" |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 41 | |
| 42 | #if 0 |
Frank Mandarino | c804427 | 2007-02-02 17:19:58 +0100 | [diff] [blame] | 43 | #define DBG(x...) printk(KERN_INFO "eti_b1_wm8731: " x) |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 44 | #else |
| 45 | #define DBG(x...) |
| 46 | #endif |
| 47 | |
| 48 | static struct clk *pck1_clk; |
| 49 | static struct clk *pllb_clk; |
| 50 | |
Frank Mandarino | c804427 | 2007-02-02 17:19:58 +0100 | [diff] [blame] | 51 | |
Frank Mandarino | 9f0ac6e | 2006-11-24 15:49:39 +0100 | [diff] [blame] | 52 | static int eti_b1_startup(struct snd_pcm_substream *substream) |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 53 | { |
Frank Mandarino | c804427 | 2007-02-02 17:19:58 +0100 | [diff] [blame] | 54 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
Liam Girdwood | d37ae53 | 2008-07-07 16:07:37 +0100 | [diff] [blame] | 55 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; |
| 56 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; |
Frank Mandarino | c804427 | 2007-02-02 17:19:58 +0100 | [diff] [blame] | 57 | int ret; |
| 58 | |
| 59 | /* cpu clock is the AT91 master clock sent to the SSC */ |
Liam Girdwood | 64105cf | 2008-07-08 13:19:18 +0100 | [diff] [blame] | 60 | ret = snd_soc_dai_set_sysclk(cpu_dai, AT91_SYSCLK_MCK, |
Frank Mandarino | c804427 | 2007-02-02 17:19:58 +0100 | [diff] [blame] | 61 | 60000000, SND_SOC_CLOCK_IN); |
| 62 | if (ret < 0) |
| 63 | return ret; |
| 64 | |
| 65 | /* codec system clock is supplied by PCK1, set to 12MHz */ |
Liam Girdwood | 64105cf | 2008-07-08 13:19:18 +0100 | [diff] [blame] | 66 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK, |
Frank Mandarino | c804427 | 2007-02-02 17:19:58 +0100 | [diff] [blame] | 67 | 12000000, SND_SOC_CLOCK_IN); |
| 68 | if (ret < 0) |
| 69 | return ret; |
| 70 | |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 71 | /* Start PCK1 clock. */ |
| 72 | clk_enable(pck1_clk); |
| 73 | DBG("pck1 started\n"); |
| 74 | |
| 75 | return 0; |
| 76 | } |
| 77 | |
Frank Mandarino | 9f0ac6e | 2006-11-24 15:49:39 +0100 | [diff] [blame] | 78 | static void eti_b1_shutdown(struct snd_pcm_substream *substream) |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 79 | { |
| 80 | /* Stop PCK1 clock. */ |
| 81 | clk_disable(pck1_clk); |
| 82 | DBG("pck1 stopped\n"); |
| 83 | } |
| 84 | |
Frank Mandarino | c804427 | 2007-02-02 17:19:58 +0100 | [diff] [blame] | 85 | static int eti_b1_hw_params(struct snd_pcm_substream *substream, |
| 86 | struct snd_pcm_hw_params *params) |
| 87 | { |
| 88 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
Liam Girdwood | d37ae53 | 2008-07-07 16:07:37 +0100 | [diff] [blame] | 89 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; |
| 90 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; |
Frank Mandarino | c804427 | 2007-02-02 17:19:58 +0100 | [diff] [blame] | 91 | int ret; |
| 92 | |
| 93 | #ifdef CONFIG_SND_AT91_SOC_ETI_SLAVE |
| 94 | unsigned int rate; |
| 95 | int cmr_div, period; |
| 96 | |
| 97 | /* set codec DAI configuration */ |
Liam Girdwood | 64105cf | 2008-07-08 13:19:18 +0100 | [diff] [blame] | 98 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | |
Frank Mandarino | c804427 | 2007-02-02 17:19:58 +0100 | [diff] [blame] | 99 | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); |
| 100 | if (ret < 0) |
| 101 | return ret; |
| 102 | |
| 103 | /* set cpu DAI configuration */ |
Liam Girdwood | 64105cf | 2008-07-08 13:19:18 +0100 | [diff] [blame] | 104 | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | |
Frank Mandarino | c804427 | 2007-02-02 17:19:58 +0100 | [diff] [blame] | 105 | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); |
| 106 | if (ret < 0) |
| 107 | return ret; |
| 108 | |
| 109 | /* |
| 110 | * The SSC clock dividers depend on the sample rate. The CMR.DIV |
| 111 | * field divides the system master clock MCK to drive the SSC TK |
| 112 | * signal which provides the codec BCLK. The TCMR.PERIOD and |
| 113 | * RCMR.PERIOD fields further divide the BCLK signal to drive |
| 114 | * the SSC TF and RF signals which provide the codec DACLRC and |
| 115 | * ADCLRC clocks. |
| 116 | * |
| 117 | * The dividers were determined through trial and error, where a |
| 118 | * CMR.DIV value is chosen such that the resulting BCLK value is |
| 119 | * divisible, or almost divisible, by (2 * sample rate), and then |
| 120 | * the TCMR.PERIOD or RCMR.PERIOD is BCLK / (2 * sample rate) - 1. |
| 121 | */ |
| 122 | rate = params_rate(params); |
| 123 | |
| 124 | switch (rate) { |
| 125 | case 8000: |
| 126 | cmr_div = 25; /* BCLK = 60MHz/(2*25) = 1.2MHz */ |
| 127 | period = 74; /* LRC = BCLK/(2*(74+1)) = 8000Hz */ |
| 128 | break; |
| 129 | case 32000: |
| 130 | cmr_div = 7; /* BCLK = 60MHz/(2*7) ~= 4.28571428MHz */ |
| 131 | period = 66; /* LRC = BCLK/(2*(66+1)) = 31982.942Hz */ |
| 132 | break; |
| 133 | case 48000: |
| 134 | cmr_div = 13; /* BCLK = 60MHz/(2*13) ~= 2.3076923MHz */ |
| 135 | period = 23; /* LRC = BCLK/(2*(23+1)) = 48076.923Hz */ |
| 136 | break; |
| 137 | default: |
| 138 | printk(KERN_WARNING "unsupported rate %d on ETI-B1 board\n", rate); |
| 139 | return -EINVAL; |
| 140 | } |
| 141 | |
| 142 | /* set the MCK divider for BCLK */ |
Liam Girdwood | 64105cf | 2008-07-08 13:19:18 +0100 | [diff] [blame] | 143 | ret = snd_soc_dai_set_clkdiv(cpu_dai, AT91SSC_CMR_DIV, cmr_div); |
Frank Mandarino | c804427 | 2007-02-02 17:19:58 +0100 | [diff] [blame] | 144 | if (ret < 0) |
| 145 | return ret; |
| 146 | |
| 147 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 148 | /* set the BCLK divider for DACLRC */ |
Liam Girdwood | 64105cf | 2008-07-08 13:19:18 +0100 | [diff] [blame] | 149 | ret = snd_soc_dai_set_clkdiv(cpu_dai, |
Frank Mandarino | c804427 | 2007-02-02 17:19:58 +0100 | [diff] [blame] | 150 | AT91SSC_TCMR_PERIOD, period); |
| 151 | } else { |
| 152 | /* set the BCLK divider for ADCLRC */ |
Liam Girdwood | 64105cf | 2008-07-08 13:19:18 +0100 | [diff] [blame] | 153 | ret = snd_soc_dai_set_clkdiv(cpu_dai, |
Frank Mandarino | c804427 | 2007-02-02 17:19:58 +0100 | [diff] [blame] | 154 | AT91SSC_RCMR_PERIOD, period); |
| 155 | } |
| 156 | if (ret < 0) |
| 157 | return ret; |
| 158 | |
| 159 | #else /* CONFIG_SND_AT91_SOC_ETI_SLAVE */ |
| 160 | /* |
| 161 | * Codec in Master Mode. |
| 162 | */ |
| 163 | |
| 164 | /* set codec DAI configuration */ |
Liam Girdwood | 64105cf | 2008-07-08 13:19:18 +0100 | [diff] [blame] | 165 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | |
Frank Mandarino | c804427 | 2007-02-02 17:19:58 +0100 | [diff] [blame] | 166 | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); |
| 167 | if (ret < 0) |
| 168 | return ret; |
| 169 | |
| 170 | /* set cpu DAI configuration */ |
Liam Girdwood | 64105cf | 2008-07-08 13:19:18 +0100 | [diff] [blame] | 171 | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | |
Frank Mandarino | c804427 | 2007-02-02 17:19:58 +0100 | [diff] [blame] | 172 | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); |
| 173 | if (ret < 0) |
| 174 | return ret; |
| 175 | |
| 176 | #endif /* CONFIG_SND_AT91_SOC_ETI_SLAVE */ |
| 177 | |
| 178 | return 0; |
| 179 | } |
| 180 | |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 181 | static struct snd_soc_ops eti_b1_ops = { |
| 182 | .startup = eti_b1_startup, |
Frank Mandarino | c804427 | 2007-02-02 17:19:58 +0100 | [diff] [blame] | 183 | .hw_params = eti_b1_hw_params, |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 184 | .shutdown = eti_b1_shutdown, |
| 185 | }; |
| 186 | |
| 187 | |
| 188 | static const struct snd_soc_dapm_widget eti_b1_dapm_widgets[] = { |
| 189 | SND_SOC_DAPM_MIC("Int Mic", NULL), |
| 190 | SND_SOC_DAPM_SPK("Ext Spk", NULL), |
| 191 | }; |
| 192 | |
Mark Brown | 51e6a84 | 2008-05-13 14:57:37 +0200 | [diff] [blame] | 193 | static const struct snd_soc_dapm_route intercon[] = { |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 194 | |
| 195 | /* speaker connected to LHPOUT */ |
| 196 | {"Ext Spk", NULL, "LHPOUT"}, |
| 197 | |
| 198 | /* mic is connected to Mic Jack, with WM8731 Mic Bias */ |
| 199 | {"MICIN", NULL, "Mic Bias"}, |
| 200 | {"Mic Bias", NULL, "Int Mic"}, |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 201 | }; |
| 202 | |
| 203 | /* |
| 204 | * Logic for a wm8731 as connected on a Endrelia ETI-B1 board. |
| 205 | */ |
| 206 | static int eti_b1_wm8731_init(struct snd_soc_codec *codec) |
| 207 | { |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 208 | DBG("eti_b1_wm8731_init() called\n"); |
| 209 | |
| 210 | /* Add specific widgets */ |
Mark Brown | 51e6a84 | 2008-05-13 14:57:37 +0200 | [diff] [blame] | 211 | snd_soc_dapm_new_controls(codec, eti_b1_dapm_widgets, |
| 212 | ARRAY_SIZE(eti_b1_dapm_widgets)); |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 213 | |
| 214 | /* Set up specific audio path interconnects */ |
Mark Brown | 51e6a84 | 2008-05-13 14:57:37 +0200 | [diff] [blame] | 215 | snd_soc_dapm_add_route(codec, intercon, ARRAY_SIZE(intercon)); |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 216 | |
| 217 | /* not connected */ |
Liam Girdwood | a530218 | 2008-07-07 13:35:17 +0100 | [diff] [blame] | 218 | snd_soc_dapm_disable_pin(codec, "RLINEIN"); |
| 219 | snd_soc_dapm_disable_pin(codec, "LLINEIN"); |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 220 | |
| 221 | /* always connected */ |
Liam Girdwood | a530218 | 2008-07-07 13:35:17 +0100 | [diff] [blame] | 222 | snd_soc_dapm_enable_pin(codec, "Int Mic"); |
| 223 | snd_soc_dapm_enable_pin(codec, "Ext Spk"); |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 224 | |
Liam Girdwood | a530218 | 2008-07-07 13:35:17 +0100 | [diff] [blame] | 225 | snd_soc_dapm_sync(codec); |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 226 | |
| 227 | return 0; |
| 228 | } |
| 229 | |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 230 | static struct snd_soc_dai_link eti_b1_dai = { |
| 231 | .name = "WM8731", |
Frank Mandarino | eb831da | 2007-04-16 17:19:42 +0200 | [diff] [blame] | 232 | .stream_name = "WM8731 PCM", |
| 233 | .cpu_dai = &at91_ssc_dai[1], |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 234 | .codec_dai = &wm8731_dai, |
| 235 | .init = eti_b1_wm8731_init, |
Frank Mandarino | c804427 | 2007-02-02 17:19:58 +0100 | [diff] [blame] | 236 | .ops = &eti_b1_ops, |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 237 | }; |
| 238 | |
| 239 | static struct snd_soc_machine snd_soc_machine_eti_b1 = { |
Frank Mandarino | eb831da | 2007-04-16 17:19:42 +0200 | [diff] [blame] | 240 | .name = "ETI_B1_WM8731", |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 241 | .dai_link = &eti_b1_dai, |
| 242 | .num_links = 1, |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 243 | }; |
| 244 | |
| 245 | static struct wm8731_setup_data eti_b1_wm8731_setup = { |
| 246 | .i2c_address = 0x1a, |
| 247 | }; |
| 248 | |
| 249 | static struct snd_soc_device eti_b1_snd_devdata = { |
| 250 | .machine = &snd_soc_machine_eti_b1, |
Frank Mandarino | 9f0ac6e | 2006-11-24 15:49:39 +0100 | [diff] [blame] | 251 | .platform = &at91_soc_platform, |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 252 | .codec_dev = &soc_codec_dev_wm8731, |
| 253 | .codec_data = &eti_b1_wm8731_setup, |
| 254 | }; |
| 255 | |
| 256 | static struct platform_device *eti_b1_snd_device; |
| 257 | |
| 258 | static int __init eti_b1_init(void) |
| 259 | { |
| 260 | int ret; |
Frank Mandarino | 9f0ac6e | 2006-11-24 15:49:39 +0100 | [diff] [blame] | 261 | struct at91_ssc_periph *ssc = eti_b1_dai.cpu_dai->private_data; |
| 262 | |
| 263 | if (!request_mem_region(AT91RM9200_BASE_SSC1, SZ_16K, "soc-audio")) { |
| 264 | DBG("SSC1 memory region is busy\n"); |
| 265 | return -EBUSY; |
| 266 | } |
| 267 | |
| 268 | ssc->base = ioremap(AT91RM9200_BASE_SSC1, SZ_16K); |
| 269 | if (!ssc->base) { |
| 270 | DBG("SSC1 memory ioremap failed\n"); |
| 271 | ret = -ENOMEM; |
| 272 | goto fail_release_mem; |
| 273 | } |
| 274 | |
| 275 | ssc->pid = AT91RM9200_ID_SSC1; |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 276 | |
| 277 | eti_b1_snd_device = platform_device_alloc("soc-audio", -1); |
Frank Mandarino | 9f0ac6e | 2006-11-24 15:49:39 +0100 | [diff] [blame] | 278 | if (!eti_b1_snd_device) { |
| 279 | DBG("platform device allocation failed\n"); |
| 280 | ret = -ENOMEM; |
| 281 | goto fail_io_unmap; |
| 282 | } |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 283 | |
| 284 | platform_set_drvdata(eti_b1_snd_device, &eti_b1_snd_devdata); |
| 285 | eti_b1_snd_devdata.dev = &eti_b1_snd_device->dev; |
| 286 | |
| 287 | ret = platform_device_add(eti_b1_snd_device); |
| 288 | if (ret) { |
Frank Mandarino | 9f0ac6e | 2006-11-24 15:49:39 +0100 | [diff] [blame] | 289 | DBG("platform device add failed\n"); |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 290 | platform_device_put(eti_b1_snd_device); |
Frank Mandarino | 9f0ac6e | 2006-11-24 15:49:39 +0100 | [diff] [blame] | 291 | goto fail_io_unmap; |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 292 | } |
| 293 | |
Andrew Victor | c21098e | 2008-04-08 21:33:07 +0100 | [diff] [blame] | 294 | at91_set_A_periph(AT91_PIN_PB6, 0); /* TF1 */ |
| 295 | at91_set_A_periph(AT91_PIN_PB7, 0); /* TK1 */ |
| 296 | at91_set_A_periph(AT91_PIN_PB8, 0); /* TD1 */ |
| 297 | at91_set_A_periph(AT91_PIN_PB9, 0); /* RD1 */ |
| 298 | /* at91_set_A_periph(AT91_PIN_PB10, 0);*/ /* RK1 */ |
| 299 | at91_set_A_periph(AT91_PIN_PB11, 0); /* RF1 */ |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 300 | |
| 301 | /* |
| 302 | * Set PCK1 parent to PLLB and its rate to 12 Mhz. |
| 303 | */ |
| 304 | pllb_clk = clk_get(NULL, "pllb"); |
| 305 | pck1_clk = clk_get(NULL, "pck1"); |
| 306 | |
| 307 | clk_set_parent(pck1_clk, pllb_clk); |
| 308 | clk_set_rate(pck1_clk, 12000000); |
| 309 | |
| 310 | DBG("MCLK rate %luHz\n", clk_get_rate(pck1_clk)); |
| 311 | |
| 312 | /* assign the GPIO pin to PCK1 */ |
| 313 | at91_set_B_periph(AT91_PIN_PA24, 0); |
| 314 | |
Frank Mandarino | c804427 | 2007-02-02 17:19:58 +0100 | [diff] [blame] | 315 | #ifdef CONFIG_SND_AT91_SOC_ETI_SLAVE |
| 316 | printk(KERN_INFO "eti_b1_wm8731: Codec in Slave Mode\n"); |
| 317 | #else |
| 318 | printk(KERN_INFO "eti_b1_wm8731: Codec in Master Mode\n"); |
| 319 | #endif |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 320 | return ret; |
Frank Mandarino | 9f0ac6e | 2006-11-24 15:49:39 +0100 | [diff] [blame] | 321 | |
| 322 | fail_io_unmap: |
| 323 | iounmap(ssc->base); |
| 324 | fail_release_mem: |
| 325 | release_mem_region(AT91RM9200_BASE_SSC1, SZ_16K); |
| 326 | return ret; |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 327 | } |
| 328 | |
| 329 | static void __exit eti_b1_exit(void) |
| 330 | { |
Frank Mandarino | 9f0ac6e | 2006-11-24 15:49:39 +0100 | [diff] [blame] | 331 | struct at91_ssc_periph *ssc = eti_b1_dai.cpu_dai->private_data; |
| 332 | |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 333 | clk_put(pck1_clk); |
| 334 | clk_put(pllb_clk); |
| 335 | |
| 336 | platform_device_unregister(eti_b1_snd_device); |
Frank Mandarino | 9f0ac6e | 2006-11-24 15:49:39 +0100 | [diff] [blame] | 337 | |
| 338 | iounmap(ssc->base); |
| 339 | release_mem_region(AT91RM9200_BASE_SSC1, SZ_16K); |
Frank Mandarino | b41bf38 | 2006-10-06 18:41:10 +0200 | [diff] [blame] | 340 | } |
| 341 | |
| 342 | module_init(eti_b1_init); |
| 343 | module_exit(eti_b1_exit); |
| 344 | |
| 345 | /* Module information */ |
| 346 | MODULE_AUTHOR("Frank Mandarino <fmandarino@endrelia.com>"); |
| 347 | MODULE_DESCRIPTION("ALSA SoC ETI-B1-WM8731"); |
| 348 | MODULE_LICENSE("GPL"); |