Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 1 | /* |
| 2 | * omap3pandora.c -- SoC audio for Pandora Handheld Console |
| 3 | * |
| 4 | * Author: GraÅžvydas Ignotas <notasas@gmail.com> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * version 2 as published by the Free Software Foundation. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 18 | * 02110-1301 USA |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | #include <linux/clk.h> |
| 23 | #include <linux/platform_device.h> |
| 24 | #include <linux/gpio.h> |
| 25 | #include <linux/delay.h> |
Grazvydas Ignotas | c50749d | 2010-02-05 16:29:53 +0200 | [diff] [blame] | 26 | #include <linux/regulator/consumer.h> |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 27 | |
| 28 | #include <sound/core.h> |
| 29 | #include <sound/pcm.h> |
| 30 | #include <sound/soc.h> |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 31 | |
| 32 | #include <asm/mach-types.h> |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 33 | #include <plat/mcbsp.h> |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 34 | |
| 35 | #include "omap-mcbsp.h" |
| 36 | #include "omap-pcm.h" |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 37 | |
| 38 | #define OMAP3_PANDORA_DAC_POWER_GPIO 118 |
| 39 | #define OMAP3_PANDORA_AMP_POWER_GPIO 14 |
| 40 | |
| 41 | #define PREFIX "ASoC omap3pandora: " |
| 42 | |
Grazvydas Ignotas | c50749d | 2010-02-05 16:29:53 +0200 | [diff] [blame] | 43 | static struct regulator *omap3pandora_dac_reg; |
| 44 | |
Grazvydas Ignotas | 4b94dba | 2010-06-17 16:45:28 +0300 | [diff] [blame] | 45 | static int omap3pandora_hw_params(struct snd_pcm_substream *substream, |
| 46 | struct snd_pcm_hw_params *params) |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 47 | { |
Jarkko Nikula | 9e5d86f | 2009-11-09 08:44:32 +0200 | [diff] [blame] | 48 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 49 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
| 50 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
Grazvydas Ignotas | 4b94dba | 2010-06-17 16:45:28 +0300 | [diff] [blame] | 51 | int fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | |
| 52 | SND_SOC_DAIFMT_CBS_CFS; |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 53 | int ret; |
| 54 | |
| 55 | /* Set codec DAI configuration */ |
| 56 | ret = snd_soc_dai_set_fmt(codec_dai, fmt); |
| 57 | if (ret < 0) { |
| 58 | pr_err(PREFIX "can't set codec DAI configuration\n"); |
| 59 | return ret; |
| 60 | } |
| 61 | |
| 62 | /* Set cpu DAI configuration */ |
| 63 | ret = snd_soc_dai_set_fmt(cpu_dai, fmt); |
| 64 | if (ret < 0) { |
| 65 | pr_err(PREFIX "can't set cpu DAI configuration\n"); |
| 66 | return ret; |
| 67 | } |
| 68 | |
| 69 | /* Set the codec system clock for DAC and ADC */ |
| 70 | ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000, |
| 71 | SND_SOC_CLOCK_IN); |
| 72 | if (ret < 0) { |
| 73 | pr_err(PREFIX "can't set codec system clock\n"); |
| 74 | return ret; |
| 75 | } |
| 76 | |
| 77 | /* Set McBSP clock to external */ |
Jarkko Nikula | 9e5d86f | 2009-11-09 08:44:32 +0200 | [diff] [blame] | 78 | ret = snd_soc_dai_set_sysclk(cpu_dai, OMAP_MCBSP_SYSCLK_CLKS_EXT, |
| 79 | 256 * params_rate(params), |
| 80 | SND_SOC_CLOCK_IN); |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 81 | if (ret < 0) { |
| 82 | pr_err(PREFIX "can't set cpu system clock\n"); |
| 83 | return ret; |
| 84 | } |
| 85 | |
| 86 | ret = snd_soc_dai_set_clkdiv(cpu_dai, OMAP_MCBSP_CLKGDV, 8); |
| 87 | if (ret < 0) { |
| 88 | pr_err(PREFIX "can't set SRG clock divider\n"); |
| 89 | return ret; |
| 90 | } |
| 91 | |
| 92 | return 0; |
| 93 | } |
| 94 | |
Grazvydas Ignotas | c50749d | 2010-02-05 16:29:53 +0200 | [diff] [blame] | 95 | static int omap3pandora_dac_event(struct snd_soc_dapm_widget *w, |
| 96 | struct snd_kcontrol *k, int event) |
| 97 | { |
| 98 | /* |
| 99 | * The PCM1773 DAC datasheet requires 1ms delay between switching |
| 100 | * VCC power on/off and /PD pin high/low |
| 101 | */ |
| 102 | if (SND_SOC_DAPM_EVENT_ON(event)) { |
| 103 | regulator_enable(omap3pandora_dac_reg); |
| 104 | mdelay(1); |
| 105 | gpio_set_value(OMAP3_PANDORA_DAC_POWER_GPIO, 1); |
| 106 | } else { |
| 107 | gpio_set_value(OMAP3_PANDORA_DAC_POWER_GPIO, 0); |
| 108 | mdelay(1); |
| 109 | regulator_disable(omap3pandora_dac_reg); |
| 110 | } |
| 111 | |
| 112 | return 0; |
| 113 | } |
| 114 | |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 115 | static int omap3pandora_hp_event(struct snd_soc_dapm_widget *w, |
| 116 | struct snd_kcontrol *k, int event) |
| 117 | { |
Grazvydas Ignotas | c50749d | 2010-02-05 16:29:53 +0200 | [diff] [blame] | 118 | if (SND_SOC_DAPM_EVENT_ON(event)) |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 119 | gpio_set_value(OMAP3_PANDORA_AMP_POWER_GPIO, 1); |
Grazvydas Ignotas | c50749d | 2010-02-05 16:29:53 +0200 | [diff] [blame] | 120 | else |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 121 | gpio_set_value(OMAP3_PANDORA_AMP_POWER_GPIO, 0); |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 122 | |
| 123 | return 0; |
| 124 | } |
| 125 | |
| 126 | /* |
| 127 | * Audio paths on Pandora board: |
| 128 | * |
| 129 | * |O| ---> PCM DAC +-> AMP -> Headphone Jack |
| 130 | * |M| A +--------> Line Out |
| 131 | * |A| <~~clk~~+ |
| 132 | * |P| <--- TWL4030 <--------- Line In and MICs |
| 133 | */ |
| 134 | static const struct snd_soc_dapm_widget omap3pandora_out_dapm_widgets[] = { |
Grazvydas Ignotas | c50749d | 2010-02-05 16:29:53 +0200 | [diff] [blame] | 135 | SND_SOC_DAPM_DAC_E("PCM DAC", "HiFi Playback", SND_SOC_NOPM, |
| 136 | 0, 0, omap3pandora_dac_event, |
| 137 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 138 | SND_SOC_DAPM_PGA_E("Headphone Amplifier", SND_SOC_NOPM, |
| 139 | 0, 0, NULL, 0, omap3pandora_hp_event, |
| 140 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), |
| 141 | SND_SOC_DAPM_HP("Headphone Jack", NULL), |
| 142 | SND_SOC_DAPM_LINE("Line Out", NULL), |
| 143 | }; |
| 144 | |
| 145 | static const struct snd_soc_dapm_widget omap3pandora_in_dapm_widgets[] = { |
Grazvydas Ignotas | 8f00806 | 2009-01-31 16:29:24 +0200 | [diff] [blame] | 146 | SND_SOC_DAPM_MIC("Mic (internal)", NULL), |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 147 | SND_SOC_DAPM_MIC("Mic (external)", NULL), |
| 148 | SND_SOC_DAPM_LINE("Line In", NULL), |
| 149 | }; |
| 150 | |
| 151 | static const struct snd_soc_dapm_route omap3pandora_out_map[] = { |
Grazvydas Ignotas | 3b9447f | 2010-02-05 00:55:33 +0200 | [diff] [blame] | 152 | {"PCM DAC", NULL, "APLL Enable"}, |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 153 | {"Headphone Amplifier", NULL, "PCM DAC"}, |
| 154 | {"Line Out", NULL, "PCM DAC"}, |
| 155 | {"Headphone Jack", NULL, "Headphone Amplifier"}, |
| 156 | }; |
| 157 | |
| 158 | static const struct snd_soc_dapm_route omap3pandora_in_map[] = { |
Grazvydas Ignotas | 8f00806 | 2009-01-31 16:29:24 +0200 | [diff] [blame] | 159 | {"AUXL", NULL, "Line In"}, |
| 160 | {"AUXR", NULL, "Line In"}, |
| 161 | |
| 162 | {"MAINMIC", NULL, "Mic Bias 1"}, |
| 163 | {"Mic Bias 1", NULL, "Mic (internal)"}, |
| 164 | |
| 165 | {"SUBMIC", NULL, "Mic Bias 2"}, |
| 166 | {"Mic Bias 2", NULL, "Mic (external)"}, |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 167 | }; |
| 168 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 169 | static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd) |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 170 | { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 171 | struct snd_soc_codec *codec = rtd->codec; |
Liam Girdwood | ce6120c | 2010-11-05 15:53:46 +0200 | [diff] [blame] | 172 | struct snd_soc_dapm_context *dapm = &codec->dapm; |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 173 | int ret; |
| 174 | |
Grazvydas Ignotas | 8f00806 | 2009-01-31 16:29:24 +0200 | [diff] [blame] | 175 | /* All TWL4030 output pins are floating */ |
Liam Girdwood | ce6120c | 2010-11-05 15:53:46 +0200 | [diff] [blame] | 176 | snd_soc_dapm_nc_pin(dapm, "EARPIECE"); |
| 177 | snd_soc_dapm_nc_pin(dapm, "PREDRIVEL"); |
| 178 | snd_soc_dapm_nc_pin(dapm, "PREDRIVER"); |
| 179 | snd_soc_dapm_nc_pin(dapm, "HSOL"); |
| 180 | snd_soc_dapm_nc_pin(dapm, "HSOR"); |
| 181 | snd_soc_dapm_nc_pin(dapm, "CARKITL"); |
| 182 | snd_soc_dapm_nc_pin(dapm, "CARKITR"); |
| 183 | snd_soc_dapm_nc_pin(dapm, "HFL"); |
| 184 | snd_soc_dapm_nc_pin(dapm, "HFR"); |
| 185 | snd_soc_dapm_nc_pin(dapm, "VIBRA"); |
Grazvydas Ignotas | 8f00806 | 2009-01-31 16:29:24 +0200 | [diff] [blame] | 186 | |
Liam Girdwood | ce6120c | 2010-11-05 15:53:46 +0200 | [diff] [blame] | 187 | ret = snd_soc_dapm_new_controls(dapm, omap3pandora_out_dapm_widgets, |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 188 | ARRAY_SIZE(omap3pandora_out_dapm_widgets)); |
| 189 | if (ret < 0) |
| 190 | return ret; |
| 191 | |
Liam Girdwood | ce6120c | 2010-11-05 15:53:46 +0200 | [diff] [blame] | 192 | snd_soc_dapm_add_routes(dapm, omap3pandora_out_map, |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 193 | ARRAY_SIZE(omap3pandora_out_map)); |
| 194 | |
Liam Girdwood | ce6120c | 2010-11-05 15:53:46 +0200 | [diff] [blame] | 195 | return snd_soc_dapm_sync(dapm); |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 196 | } |
| 197 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 198 | static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd) |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 199 | { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 200 | struct snd_soc_codec *codec = rtd->codec; |
Liam Girdwood | ce6120c | 2010-11-05 15:53:46 +0200 | [diff] [blame] | 201 | struct snd_soc_dapm_context *dapm = &codec->dapm; |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 202 | int ret; |
| 203 | |
Grazvydas Ignotas | 8f00806 | 2009-01-31 16:29:24 +0200 | [diff] [blame] | 204 | /* Not comnnected */ |
Liam Girdwood | ce6120c | 2010-11-05 15:53:46 +0200 | [diff] [blame] | 205 | snd_soc_dapm_nc_pin(dapm, "HSMIC"); |
| 206 | snd_soc_dapm_nc_pin(dapm, "CARKITMIC"); |
| 207 | snd_soc_dapm_nc_pin(dapm, "DIGIMIC0"); |
| 208 | snd_soc_dapm_nc_pin(dapm, "DIGIMIC1"); |
Grazvydas Ignotas | 7f18534 | 2008-12-23 12:04:48 +0200 | [diff] [blame] | 209 | |
Liam Girdwood | ce6120c | 2010-11-05 15:53:46 +0200 | [diff] [blame] | 210 | ret = snd_soc_dapm_new_controls(dapm, omap3pandora_in_dapm_widgets, |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 211 | ARRAY_SIZE(omap3pandora_in_dapm_widgets)); |
| 212 | if (ret < 0) |
| 213 | return ret; |
| 214 | |
Liam Girdwood | ce6120c | 2010-11-05 15:53:46 +0200 | [diff] [blame] | 215 | snd_soc_dapm_add_routes(dapm, omap3pandora_in_map, |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 216 | ARRAY_SIZE(omap3pandora_in_map)); |
| 217 | |
Liam Girdwood | ce6120c | 2010-11-05 15:53:46 +0200 | [diff] [blame] | 218 | return snd_soc_dapm_sync(dapm); |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 219 | } |
| 220 | |
Grazvydas Ignotas | 4b94dba | 2010-06-17 16:45:28 +0300 | [diff] [blame] | 221 | static struct snd_soc_ops omap3pandora_ops = { |
| 222 | .hw_params = omap3pandora_hw_params, |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 223 | }; |
| 224 | |
| 225 | /* Digital audio interface glue - connects codec <--> CPU */ |
| 226 | static struct snd_soc_dai_link omap3pandora_dai[] = { |
| 227 | { |
| 228 | .name = "PCM1773", |
| 229 | .stream_name = "HiFi Out", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 230 | .cpu_dai_name = "omap-mcbsp-dai.1", |
| 231 | .codec_dai_name = "twl4030-hifi", |
| 232 | .platform_name = "omap-pcm-audio", |
| 233 | .codec_name = "twl4030-codec", |
Grazvydas Ignotas | 4b94dba | 2010-06-17 16:45:28 +0300 | [diff] [blame] | 234 | .ops = &omap3pandora_ops, |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 235 | .init = omap3pandora_out_init, |
| 236 | }, { |
| 237 | .name = "TWL4030", |
| 238 | .stream_name = "Line/Mic In", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 239 | .cpu_dai_name = "omap-mcbsp-dai.3", |
| 240 | .codec_dai_name = "twl4030-hifi", |
| 241 | .platform_name = "omap-pcm-audio", |
| 242 | .codec_name = "twl4030-codec", |
Grazvydas Ignotas | 4b94dba | 2010-06-17 16:45:28 +0300 | [diff] [blame] | 243 | .ops = &omap3pandora_ops, |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 244 | .init = omap3pandora_in_init, |
| 245 | } |
| 246 | }; |
| 247 | |
| 248 | /* SoC card */ |
| 249 | static struct snd_soc_card snd_soc_card_omap3pandora = { |
| 250 | .name = "omap3pandora", |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 251 | .dai_link = omap3pandora_dai, |
| 252 | .num_links = ARRAY_SIZE(omap3pandora_dai), |
| 253 | }; |
| 254 | |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 255 | static struct platform_device *omap3pandora_snd_device; |
| 256 | |
| 257 | static int __init omap3pandora_soc_init(void) |
| 258 | { |
| 259 | int ret; |
| 260 | |
Grazvydas Ignotas | 8f00806 | 2009-01-31 16:29:24 +0200 | [diff] [blame] | 261 | if (!machine_is_omap3_pandora()) |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 262 | return -ENODEV; |
Grazvydas Ignotas | 8f00806 | 2009-01-31 16:29:24 +0200 | [diff] [blame] | 263 | |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 264 | pr_info("OMAP3 Pandora SoC init\n"); |
| 265 | |
| 266 | ret = gpio_request(OMAP3_PANDORA_DAC_POWER_GPIO, "dac_power"); |
| 267 | if (ret) { |
| 268 | pr_err(PREFIX "Failed to get DAC power GPIO\n"); |
| 269 | return ret; |
| 270 | } |
| 271 | |
| 272 | ret = gpio_direction_output(OMAP3_PANDORA_DAC_POWER_GPIO, 0); |
| 273 | if (ret) { |
| 274 | pr_err(PREFIX "Failed to set DAC power GPIO direction\n"); |
| 275 | goto fail0; |
| 276 | } |
| 277 | |
| 278 | ret = gpio_request(OMAP3_PANDORA_AMP_POWER_GPIO, "amp_power"); |
| 279 | if (ret) { |
| 280 | pr_err(PREFIX "Failed to get amp power GPIO\n"); |
| 281 | goto fail0; |
| 282 | } |
| 283 | |
| 284 | ret = gpio_direction_output(OMAP3_PANDORA_AMP_POWER_GPIO, 0); |
| 285 | if (ret) { |
| 286 | pr_err(PREFIX "Failed to set amp power GPIO direction\n"); |
| 287 | goto fail1; |
| 288 | } |
| 289 | |
| 290 | omap3pandora_snd_device = platform_device_alloc("soc-audio", -1); |
| 291 | if (omap3pandora_snd_device == NULL) { |
| 292 | pr_err(PREFIX "Platform device allocation failed\n"); |
| 293 | ret = -ENOMEM; |
| 294 | goto fail1; |
| 295 | } |
| 296 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 297 | platform_set_drvdata(omap3pandora_snd_device, &snd_soc_card_omap3pandora); |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 298 | |
| 299 | ret = platform_device_add(omap3pandora_snd_device); |
| 300 | if (ret) { |
| 301 | pr_err(PREFIX "Unable to add platform device\n"); |
| 302 | goto fail2; |
| 303 | } |
| 304 | |
Grazvydas Ignotas | c50749d | 2010-02-05 16:29:53 +0200 | [diff] [blame] | 305 | omap3pandora_dac_reg = regulator_get(&omap3pandora_snd_device->dev, "vcc"); |
| 306 | if (IS_ERR(omap3pandora_dac_reg)) { |
| 307 | pr_err(PREFIX "Failed to get DAC regulator from %s: %ld\n", |
| 308 | dev_name(&omap3pandora_snd_device->dev), |
| 309 | PTR_ERR(omap3pandora_dac_reg)); |
Axel Lin | 5c12d20 | 2010-11-24 15:20:48 +0800 | [diff] [blame] | 310 | ret = PTR_ERR(omap3pandora_dac_reg); |
Grazvydas Ignotas | c50749d | 2010-02-05 16:29:53 +0200 | [diff] [blame] | 311 | goto fail3; |
| 312 | } |
| 313 | |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 314 | return 0; |
| 315 | |
Grazvydas Ignotas | c50749d | 2010-02-05 16:29:53 +0200 | [diff] [blame] | 316 | fail3: |
| 317 | platform_device_del(omap3pandora_snd_device); |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 318 | fail2: |
| 319 | platform_device_put(omap3pandora_snd_device); |
| 320 | fail1: |
| 321 | gpio_free(OMAP3_PANDORA_AMP_POWER_GPIO); |
| 322 | fail0: |
| 323 | gpio_free(OMAP3_PANDORA_DAC_POWER_GPIO); |
| 324 | return ret; |
| 325 | } |
| 326 | module_init(omap3pandora_soc_init); |
| 327 | |
| 328 | static void __exit omap3pandora_soc_exit(void) |
| 329 | { |
Grazvydas Ignotas | c50749d | 2010-02-05 16:29:53 +0200 | [diff] [blame] | 330 | regulator_put(omap3pandora_dac_reg); |
Grazvydas Ignotas | 68fb740 | 2008-12-04 22:39:54 +0200 | [diff] [blame] | 331 | platform_device_unregister(omap3pandora_snd_device); |
| 332 | gpio_free(OMAP3_PANDORA_AMP_POWER_GPIO); |
| 333 | gpio_free(OMAP3_PANDORA_DAC_POWER_GPIO); |
| 334 | } |
| 335 | module_exit(omap3pandora_soc_exit); |
| 336 | |
| 337 | MODULE_AUTHOR("Grazvydas Ignotas <notasas@gmail.com>"); |
| 338 | MODULE_DESCRIPTION("ALSA SoC OMAP3 Pandora"); |
| 339 | MODULE_LICENSE("GPL"); |