Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 1 | /* |
| 2 | * n810.c -- SoC audio for Nokia N810 |
| 3 | * |
| 4 | * Copyright (C) 2008 Nokia Corporation |
| 5 | * |
| 6 | * Contact: Jarkko Nikula <jarkko.nikula@nokia.com> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License |
| 10 | * version 2 as published by the Free Software Foundation. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 20 | * 02110-1301 USA |
| 21 | * |
| 22 | */ |
| 23 | |
| 24 | #include <linux/clk.h> |
| 25 | #include <linux/platform_device.h> |
| 26 | #include <sound/core.h> |
| 27 | #include <sound/pcm.h> |
| 28 | #include <sound/soc.h> |
| 29 | #include <sound/soc-dapm.h> |
| 30 | |
| 31 | #include <asm/mach-types.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 32 | #include <mach/hardware.h> |
Jarkko Nikula | f99a633 | 2008-05-15 11:01:36 +0200 | [diff] [blame] | 33 | #include <linux/gpio.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 34 | #include <mach/mcbsp.h> |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 35 | |
| 36 | #include "omap-mcbsp.h" |
| 37 | #include "omap-pcm.h" |
| 38 | #include "../codecs/tlv320aic3x.h" |
| 39 | |
Jarkko Nikula | f99a633 | 2008-05-15 11:01:36 +0200 | [diff] [blame] | 40 | #define N810_HEADSET_AMP_GPIO 10 |
| 41 | #define N810_SPEAKER_AMP_GPIO 101 |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 42 | |
| 43 | static struct clk *sys_clkout2; |
| 44 | static struct clk *sys_clkout2_src; |
| 45 | static struct clk *func96m_clk; |
| 46 | |
| 47 | static int n810_spk_func; |
| 48 | static int n810_jack_func; |
Jarkko Nikula | 90b9e47 | 2008-06-25 14:58:47 +0300 | [diff] [blame] | 49 | static int n810_dmic_func; |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 50 | |
| 51 | static void n810_ext_control(struct snd_soc_codec *codec) |
| 52 | { |
Liam Girdwood | a530218 | 2008-07-07 13:35:17 +0100 | [diff] [blame] | 53 | if (n810_spk_func) |
| 54 | snd_soc_dapm_enable_pin(codec, "Ext Spk"); |
| 55 | else |
| 56 | snd_soc_dapm_disable_pin(codec, "Ext Spk"); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 57 | |
Liam Girdwood | a530218 | 2008-07-07 13:35:17 +0100 | [diff] [blame] | 58 | if (n810_jack_func) |
| 59 | snd_soc_dapm_enable_pin(codec, "Headphone Jack"); |
| 60 | else |
| 61 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); |
| 62 | |
| 63 | if (n810_dmic_func) |
| 64 | snd_soc_dapm_enable_pin(codec, "DMic"); |
| 65 | else |
Liam Girdwood | ac8615b | 2008-07-08 13:20:39 +0100 | [diff] [blame] | 66 | snd_soc_dapm_disable_pin(codec, "DMic"); |
Liam Girdwood | a530218 | 2008-07-07 13:35:17 +0100 | [diff] [blame] | 67 | |
| 68 | snd_soc_dapm_sync(codec); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | static int n810_startup(struct snd_pcm_substream *substream) |
| 72 | { |
| 73 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 74 | struct snd_soc_codec *codec = rtd->socdev->codec; |
| 75 | |
| 76 | n810_ext_control(codec); |
| 77 | return clk_enable(sys_clkout2); |
| 78 | } |
| 79 | |
| 80 | static void n810_shutdown(struct snd_pcm_substream *substream) |
| 81 | { |
| 82 | clk_disable(sys_clkout2); |
| 83 | } |
| 84 | |
| 85 | static int n810_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 | 8687eb8 | 2008-07-07 16:08:07 +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; |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 91 | int err; |
| 92 | |
| 93 | /* Set codec DAI configuration */ |
Liam Girdwood | 64105cf | 2008-07-08 13:19:18 +0100 | [diff] [blame] | 94 | err = snd_soc_dai_set_fmt(codec_dai, |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 95 | SND_SOC_DAIFMT_I2S | |
| 96 | SND_SOC_DAIFMT_NB_NF | |
| 97 | SND_SOC_DAIFMT_CBM_CFM); |
| 98 | if (err < 0) |
| 99 | return err; |
| 100 | |
| 101 | /* Set cpu DAI configuration */ |
Liam Girdwood | 64105cf | 2008-07-08 13:19:18 +0100 | [diff] [blame] | 102 | err = snd_soc_dai_set_fmt(cpu_dai, |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 103 | SND_SOC_DAIFMT_I2S | |
| 104 | SND_SOC_DAIFMT_NB_NF | |
| 105 | SND_SOC_DAIFMT_CBM_CFM); |
| 106 | if (err < 0) |
| 107 | return err; |
| 108 | |
| 109 | /* Set the codec system clock for DAC and ADC */ |
Liam Girdwood | 64105cf | 2008-07-08 13:19:18 +0100 | [diff] [blame] | 110 | err = snd_soc_dai_set_sysclk(codec_dai, 0, 12000000, |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 111 | SND_SOC_CLOCK_IN); |
| 112 | |
| 113 | return err; |
| 114 | } |
| 115 | |
| 116 | static struct snd_soc_ops n810_ops = { |
| 117 | .startup = n810_startup, |
| 118 | .hw_params = n810_hw_params, |
| 119 | .shutdown = n810_shutdown, |
| 120 | }; |
| 121 | |
| 122 | static int n810_get_spk(struct snd_kcontrol *kcontrol, |
| 123 | struct snd_ctl_elem_value *ucontrol) |
| 124 | { |
| 125 | ucontrol->value.integer.value[0] = n810_spk_func; |
| 126 | |
| 127 | return 0; |
| 128 | } |
| 129 | |
| 130 | static int n810_set_spk(struct snd_kcontrol *kcontrol, |
| 131 | struct snd_ctl_elem_value *ucontrol) |
| 132 | { |
| 133 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
| 134 | |
| 135 | if (n810_spk_func == ucontrol->value.integer.value[0]) |
| 136 | return 0; |
| 137 | |
| 138 | n810_spk_func = ucontrol->value.integer.value[0]; |
| 139 | n810_ext_control(codec); |
| 140 | |
| 141 | return 1; |
| 142 | } |
| 143 | |
| 144 | static int n810_get_jack(struct snd_kcontrol *kcontrol, |
| 145 | struct snd_ctl_elem_value *ucontrol) |
| 146 | { |
| 147 | ucontrol->value.integer.value[0] = n810_jack_func; |
| 148 | |
| 149 | return 0; |
| 150 | } |
| 151 | |
| 152 | static int n810_set_jack(struct snd_kcontrol *kcontrol, |
| 153 | struct snd_ctl_elem_value *ucontrol) |
| 154 | { |
| 155 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
| 156 | |
| 157 | if (n810_jack_func == ucontrol->value.integer.value[0]) |
| 158 | return 0; |
| 159 | |
| 160 | n810_jack_func = ucontrol->value.integer.value[0]; |
| 161 | n810_ext_control(codec); |
| 162 | |
| 163 | return 1; |
| 164 | } |
| 165 | |
Jarkko Nikula | 90b9e47 | 2008-06-25 14:58:47 +0300 | [diff] [blame] | 166 | static int n810_get_input(struct snd_kcontrol *kcontrol, |
| 167 | struct snd_ctl_elem_value *ucontrol) |
| 168 | { |
| 169 | ucontrol->value.integer.value[0] = n810_dmic_func; |
| 170 | |
| 171 | return 0; |
| 172 | } |
| 173 | |
| 174 | static int n810_set_input(struct snd_kcontrol *kcontrol, |
| 175 | struct snd_ctl_elem_value *ucontrol) |
| 176 | { |
| 177 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
| 178 | |
| 179 | if (n810_dmic_func == ucontrol->value.integer.value[0]) |
| 180 | return 0; |
| 181 | |
| 182 | n810_dmic_func = ucontrol->value.integer.value[0]; |
| 183 | n810_ext_control(codec); |
| 184 | |
| 185 | return 1; |
| 186 | } |
| 187 | |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 188 | static int n810_spk_event(struct snd_soc_dapm_widget *w, |
| 189 | struct snd_kcontrol *k, int event) |
| 190 | { |
| 191 | if (SND_SOC_DAPM_EVENT_ON(event)) |
Jarkko Nikula | f99a633 | 2008-05-15 11:01:36 +0200 | [diff] [blame] | 192 | gpio_set_value(N810_SPEAKER_AMP_GPIO, 1); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 193 | else |
Jarkko Nikula | f99a633 | 2008-05-15 11:01:36 +0200 | [diff] [blame] | 194 | gpio_set_value(N810_SPEAKER_AMP_GPIO, 0); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 195 | |
| 196 | return 0; |
| 197 | } |
| 198 | |
| 199 | static int n810_jack_event(struct snd_soc_dapm_widget *w, |
| 200 | struct snd_kcontrol *k, int event) |
| 201 | { |
| 202 | if (SND_SOC_DAPM_EVENT_ON(event)) |
Jarkko Nikula | f99a633 | 2008-05-15 11:01:36 +0200 | [diff] [blame] | 203 | gpio_set_value(N810_HEADSET_AMP_GPIO, 1); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 204 | else |
Jarkko Nikula | f99a633 | 2008-05-15 11:01:36 +0200 | [diff] [blame] | 205 | gpio_set_value(N810_HEADSET_AMP_GPIO, 0); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 206 | |
| 207 | return 0; |
| 208 | } |
| 209 | |
| 210 | static const struct snd_soc_dapm_widget aic33_dapm_widgets[] = { |
| 211 | SND_SOC_DAPM_SPK("Ext Spk", n810_spk_event), |
| 212 | SND_SOC_DAPM_HP("Headphone Jack", n810_jack_event), |
Jarkko Nikula | 90b9e47 | 2008-06-25 14:58:47 +0300 | [diff] [blame] | 213 | SND_SOC_DAPM_MIC("DMic", NULL), |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 214 | }; |
| 215 | |
Mark Brown | 1a25059 | 2008-05-13 14:58:57 +0200 | [diff] [blame] | 216 | static const struct snd_soc_dapm_route audio_map[] = { |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 217 | {"Headphone Jack", NULL, "HPLOUT"}, |
| 218 | {"Headphone Jack", NULL, "HPROUT"}, |
| 219 | |
| 220 | {"Ext Spk", NULL, "LLOUT"}, |
| 221 | {"Ext Spk", NULL, "RLOUT"}, |
Jarkko Nikula | 90b9e47 | 2008-06-25 14:58:47 +0300 | [diff] [blame] | 222 | |
| 223 | {"DMic Rate 64", NULL, "Mic Bias 2V"}, |
| 224 | {"Mic Bias 2V", NULL, "DMic"}, |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 225 | }; |
| 226 | |
| 227 | static const char *spk_function[] = {"Off", "On"}; |
| 228 | static const char *jack_function[] = {"Off", "Headphone"}; |
Jarkko Nikula | 90b9e47 | 2008-06-25 14:58:47 +0300 | [diff] [blame] | 229 | static const char *input_function[] = {"ADC", "Digital Mic"}; |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 230 | static const struct soc_enum n810_enum[] = { |
Jarkko Nikula | 3c17279 | 2008-05-13 16:02:04 +0200 | [diff] [blame] | 231 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(spk_function), spk_function), |
| 232 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(jack_function), jack_function), |
Jarkko Nikula | 90b9e47 | 2008-06-25 14:58:47 +0300 | [diff] [blame] | 233 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(input_function), input_function), |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 234 | }; |
| 235 | |
| 236 | static const struct snd_kcontrol_new aic33_n810_controls[] = { |
| 237 | SOC_ENUM_EXT("Speaker Function", n810_enum[0], |
| 238 | n810_get_spk, n810_set_spk), |
| 239 | SOC_ENUM_EXT("Jack Function", n810_enum[1], |
| 240 | n810_get_jack, n810_set_jack), |
Jarkko Nikula | 90b9e47 | 2008-06-25 14:58:47 +0300 | [diff] [blame] | 241 | SOC_ENUM_EXT("Input Select", n810_enum[2], |
| 242 | n810_get_input, n810_set_input), |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 243 | }; |
| 244 | |
| 245 | static int n810_aic33_init(struct snd_soc_codec *codec) |
| 246 | { |
| 247 | int i, err; |
| 248 | |
| 249 | /* Not connected */ |
Liam Girdwood | a530218 | 2008-07-07 13:35:17 +0100 | [diff] [blame] | 250 | snd_soc_dapm_disable_pin(codec, "MONO_LOUT"); |
| 251 | snd_soc_dapm_disable_pin(codec, "HPLCOM"); |
| 252 | snd_soc_dapm_disable_pin(codec, "HPRCOM"); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 253 | |
| 254 | /* Add N810 specific controls */ |
| 255 | for (i = 0; i < ARRAY_SIZE(aic33_n810_controls); i++) { |
| 256 | err = snd_ctl_add(codec->card, |
| 257 | snd_soc_cnew(&aic33_n810_controls[i], codec, NULL)); |
| 258 | if (err < 0) |
| 259 | return err; |
| 260 | } |
| 261 | |
| 262 | /* Add N810 specific widgets */ |
Mark Brown | 1a25059 | 2008-05-13 14:58:57 +0200 | [diff] [blame] | 263 | snd_soc_dapm_new_controls(codec, aic33_dapm_widgets, |
| 264 | ARRAY_SIZE(aic33_dapm_widgets)); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 265 | |
| 266 | /* Set up N810 specific audio path audio_map */ |
Mark Brown | 1a25059 | 2008-05-13 14:58:57 +0200 | [diff] [blame] | 267 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 268 | |
Liam Girdwood | a530218 | 2008-07-07 13:35:17 +0100 | [diff] [blame] | 269 | snd_soc_dapm_sync(codec); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 270 | |
| 271 | return 0; |
| 272 | } |
| 273 | |
| 274 | /* Digital audio interface glue - connects codec <--> CPU */ |
| 275 | static struct snd_soc_dai_link n810_dai = { |
| 276 | .name = "TLV320AIC33", |
| 277 | .stream_name = "AIC33", |
| 278 | .cpu_dai = &omap_mcbsp_dai[0], |
| 279 | .codec_dai = &aic3x_dai, |
| 280 | .init = n810_aic33_init, |
| 281 | .ops = &n810_ops, |
| 282 | }; |
| 283 | |
| 284 | /* Audio machine driver */ |
| 285 | static struct snd_soc_machine snd_soc_machine_n810 = { |
| 286 | .name = "N810", |
| 287 | .dai_link = &n810_dai, |
| 288 | .num_links = 1, |
| 289 | }; |
| 290 | |
| 291 | /* Audio private data */ |
| 292 | static struct aic3x_setup_data n810_aic33_setup = { |
| 293 | .i2c_address = 0x18, |
Jarkko Nikula | 90b9e47 | 2008-06-25 14:58:47 +0300 | [diff] [blame] | 294 | .gpio_func[0] = AIC3X_GPIO1_FUNC_DISABLED, |
| 295 | .gpio_func[1] = AIC3X_GPIO2_FUNC_DIGITAL_MIC_INPUT, |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 296 | }; |
| 297 | |
| 298 | /* Audio subsystem */ |
| 299 | static struct snd_soc_device n810_snd_devdata = { |
| 300 | .machine = &snd_soc_machine_n810, |
| 301 | .platform = &omap_soc_platform, |
| 302 | .codec_dev = &soc_codec_dev_aic3x, |
| 303 | .codec_data = &n810_aic33_setup, |
| 304 | }; |
| 305 | |
| 306 | static struct platform_device *n810_snd_device; |
| 307 | |
| 308 | static int __init n810_soc_init(void) |
| 309 | { |
| 310 | int err; |
| 311 | struct device *dev; |
| 312 | |
Jarkko Nikula | 6e132fa | 2008-06-11 13:47:15 +0100 | [diff] [blame] | 313 | if (!(machine_is_nokia_n810() || machine_is_nokia_n810_wimax())) |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 314 | return -ENODEV; |
| 315 | |
| 316 | n810_snd_device = platform_device_alloc("soc-audio", -1); |
| 317 | if (!n810_snd_device) |
| 318 | return -ENOMEM; |
| 319 | |
| 320 | platform_set_drvdata(n810_snd_device, &n810_snd_devdata); |
| 321 | n810_snd_devdata.dev = &n810_snd_device->dev; |
| 322 | *(unsigned int *)n810_dai.cpu_dai->private_data = 1; /* McBSP2 */ |
| 323 | err = platform_device_add(n810_snd_device); |
| 324 | if (err) |
| 325 | goto err1; |
| 326 | |
| 327 | dev = &n810_snd_device->dev; |
| 328 | |
| 329 | sys_clkout2_src = clk_get(dev, "sys_clkout2_src"); |
| 330 | if (IS_ERR(sys_clkout2_src)) { |
| 331 | dev_err(dev, "Could not get sys_clkout2_src clock\n"); |
Jarkko Nikula | e784539 | 2008-08-26 13:32:57 +0300 | [diff] [blame] | 332 | err = PTR_ERR(sys_clkout2_src); |
| 333 | goto err2; |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 334 | } |
| 335 | sys_clkout2 = clk_get(dev, "sys_clkout2"); |
| 336 | if (IS_ERR(sys_clkout2)) { |
| 337 | dev_err(dev, "Could not get sys_clkout2\n"); |
Jarkko Nikula | e784539 | 2008-08-26 13:32:57 +0300 | [diff] [blame] | 338 | err = PTR_ERR(sys_clkout2); |
| 339 | goto err3; |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 340 | } |
| 341 | /* |
| 342 | * Configure 12 MHz output on SYS_CLKOUT2. Therefore we must use |
| 343 | * 96 MHz as its parent in order to get 12 MHz |
| 344 | */ |
| 345 | func96m_clk = clk_get(dev, "func_96m_ck"); |
| 346 | if (IS_ERR(func96m_clk)) { |
| 347 | dev_err(dev, "Could not get func 96M clock\n"); |
Jarkko Nikula | e784539 | 2008-08-26 13:32:57 +0300 | [diff] [blame] | 348 | err = PTR_ERR(func96m_clk); |
| 349 | goto err4; |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 350 | } |
| 351 | clk_set_parent(sys_clkout2_src, func96m_clk); |
| 352 | clk_set_rate(sys_clkout2, 12000000); |
| 353 | |
Jarkko Nikula | f99a633 | 2008-05-15 11:01:36 +0200 | [diff] [blame] | 354 | if (gpio_request(N810_HEADSET_AMP_GPIO, "hs_amp") < 0) |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 355 | BUG(); |
Jarkko Nikula | f99a633 | 2008-05-15 11:01:36 +0200 | [diff] [blame] | 356 | if (gpio_request(N810_SPEAKER_AMP_GPIO, "spk_amp") < 0) |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 357 | BUG(); |
Jarkko Nikula | f99a633 | 2008-05-15 11:01:36 +0200 | [diff] [blame] | 358 | gpio_direction_output(N810_HEADSET_AMP_GPIO, 0); |
| 359 | gpio_direction_output(N810_SPEAKER_AMP_GPIO, 0); |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 360 | |
| 361 | return 0; |
Jarkko Nikula | e784539 | 2008-08-26 13:32:57 +0300 | [diff] [blame] | 362 | err4: |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 363 | clk_put(sys_clkout2); |
Jarkko Nikula | e784539 | 2008-08-26 13:32:57 +0300 | [diff] [blame] | 364 | err3: |
| 365 | clk_put(sys_clkout2_src); |
| 366 | err2: |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 367 | platform_device_del(n810_snd_device); |
| 368 | err1: |
| 369 | platform_device_put(n810_snd_device); |
| 370 | |
| 371 | return err; |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 372 | } |
| 373 | |
| 374 | static void __exit n810_soc_exit(void) |
| 375 | { |
Jarkko Nikula | f99a633 | 2008-05-15 11:01:36 +0200 | [diff] [blame] | 376 | gpio_free(N810_SPEAKER_AMP_GPIO); |
| 377 | gpio_free(N810_HEADSET_AMP_GPIO); |
Jarkko Nikula | e784539 | 2008-08-26 13:32:57 +0300 | [diff] [blame] | 378 | clk_put(sys_clkout2_src); |
| 379 | clk_put(sys_clkout2); |
| 380 | clk_put(func96m_clk); |
Jarkko Nikula | f99a633 | 2008-05-15 11:01:36 +0200 | [diff] [blame] | 381 | |
Jarkko Nikula | 2e74796 | 2008-04-25 13:55:19 +0200 | [diff] [blame] | 382 | platform_device_unregister(n810_snd_device); |
| 383 | } |
| 384 | |
| 385 | module_init(n810_soc_init); |
| 386 | module_exit(n810_soc_exit); |
| 387 | |
| 388 | MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@nokia.com>"); |
| 389 | MODULE_DESCRIPTION("ALSA SoC Nokia N810"); |
| 390 | MODULE_LICENSE("GPL"); |