Mark Brown | 9b8dc66 | 2011-04-12 17:24:39 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Speyside audio support |
| 3 | * |
| 4 | * Copyright 2011 Wolfson Microelectronics |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU General Public License as published by the |
| 8 | * Free Software Foundation; either version 2 of the License, or (at your |
| 9 | * option) any later version. |
| 10 | */ |
| 11 | |
| 12 | #include <sound/soc.h> |
| 13 | #include <sound/soc-dapm.h> |
Mark Brown | 68688e7 | 2011-04-12 00:00:36 -0700 | [diff] [blame] | 14 | #include <sound/jack.h> |
| 15 | #include <linux/gpio.h> |
Paul Gortmaker | da155d5 | 2011-07-15 12:38:28 -0400 | [diff] [blame] | 16 | #include <linux/module.h> |
Mark Brown | 9b8dc66 | 2011-04-12 17:24:39 -0700 | [diff] [blame] | 17 | |
Mark Brown | a9ba615 | 2011-06-24 12:10:44 +0100 | [diff] [blame] | 18 | #include "../codecs/wm8996.h" |
Mark Brown | ea3e98e | 2011-04-11 23:42:25 -0700 | [diff] [blame] | 19 | #include "../codecs/wm9081.h" |
Mark Brown | 9b8dc66 | 2011-04-12 17:24:39 -0700 | [diff] [blame] | 20 | |
Mark Brown | a9ba615 | 2011-06-24 12:10:44 +0100 | [diff] [blame] | 21 | #define WM8996_HPSEL_GPIO 214 |
Mark Brown | 3628137 | 2011-12-11 11:31:22 +0800 | [diff] [blame] | 22 | #define MCLK_AUDIO_RATE (512 * 48000) |
Mark Brown | 68688e7 | 2011-04-12 00:00:36 -0700 | [diff] [blame] | 23 | |
Mark Brown | ea0a591 | 2011-04-11 23:32:03 -0700 | [diff] [blame] | 24 | static int speyside_set_bias_level(struct snd_soc_card *card, |
Mark Brown | d4c6005 | 2011-06-06 19:13:23 +0100 | [diff] [blame] | 25 | struct snd_soc_dapm_context *dapm, |
Mark Brown | ea0a591 | 2011-04-11 23:32:03 -0700 | [diff] [blame] | 26 | enum snd_soc_bias_level level) |
| 27 | { |
| 28 | struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; |
| 29 | int ret; |
| 30 | |
Mark Brown | d4c6005 | 2011-06-06 19:13:23 +0100 | [diff] [blame] | 31 | if (dapm->dev != codec_dai->dev) |
| 32 | return 0; |
| 33 | |
Mark Brown | ea0a591 | 2011-04-11 23:32:03 -0700 | [diff] [blame] | 34 | switch (level) { |
| 35 | case SND_SOC_BIAS_STANDBY: |
Mark Brown | a9ba615 | 2011-06-24 12:10:44 +0100 | [diff] [blame] | 36 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8996_SYSCLK_MCLK2, |
Mark Brown | ea0a591 | 2011-04-11 23:32:03 -0700 | [diff] [blame] | 37 | 32768, SND_SOC_CLOCK_IN); |
| 38 | if (ret < 0) |
| 39 | return ret; |
| 40 | |
Mark Brown | a9ba615 | 2011-06-24 12:10:44 +0100 | [diff] [blame] | 41 | ret = snd_soc_dai_set_pll(codec_dai, WM8996_FLL_MCLK2, |
Mark Brown | ea0a591 | 2011-04-11 23:32:03 -0700 | [diff] [blame] | 42 | 0, 0, 0); |
| 43 | if (ret < 0) { |
| 44 | pr_err("Failed to stop FLL\n"); |
| 45 | return ret; |
| 46 | } |
Mark Brown | 85e9e76 | 2011-06-06 19:12:44 +0100 | [diff] [blame] | 47 | break; |
Mark Brown | ea0a591 | 2011-04-11 23:32:03 -0700 | [diff] [blame] | 48 | |
| 49 | default: |
| 50 | break; |
| 51 | } |
| 52 | |
| 53 | return 0; |
| 54 | } |
| 55 | |
Mark Brown | 85e9e76 | 2011-06-06 19:12:44 +0100 | [diff] [blame] | 56 | static int speyside_set_bias_level_post(struct snd_soc_card *card, |
| 57 | struct snd_soc_dapm_context *dapm, |
| 58 | enum snd_soc_bias_level level) |
| 59 | { |
| 60 | struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; |
| 61 | int ret; |
| 62 | |
| 63 | if (dapm->dev != codec_dai->dev) |
| 64 | return 0; |
| 65 | |
| 66 | switch (level) { |
| 67 | case SND_SOC_BIAS_PREPARE: |
| 68 | if (card->dapm.bias_level == SND_SOC_BIAS_STANDBY) { |
| 69 | ret = snd_soc_dai_set_pll(codec_dai, 0, |
Mark Brown | a9ba615 | 2011-06-24 12:10:44 +0100 | [diff] [blame] | 70 | WM8996_FLL_MCLK2, |
Mark Brown | 3628137 | 2011-12-11 11:31:22 +0800 | [diff] [blame] | 71 | 32768, MCLK_AUDIO_RATE); |
Mark Brown | 85e9e76 | 2011-06-06 19:12:44 +0100 | [diff] [blame] | 72 | if (ret < 0) { |
| 73 | pr_err("Failed to start FLL\n"); |
| 74 | return ret; |
| 75 | } |
| 76 | |
| 77 | ret = snd_soc_dai_set_sysclk(codec_dai, |
Mark Brown | a9ba615 | 2011-06-24 12:10:44 +0100 | [diff] [blame] | 78 | WM8996_SYSCLK_FLL, |
Mark Brown | 3628137 | 2011-12-11 11:31:22 +0800 | [diff] [blame] | 79 | MCLK_AUDIO_RATE, |
Mark Brown | 85e9e76 | 2011-06-06 19:12:44 +0100 | [diff] [blame] | 80 | SND_SOC_CLOCK_IN); |
| 81 | if (ret < 0) |
| 82 | return ret; |
| 83 | } |
| 84 | break; |
| 85 | |
| 86 | default: |
| 87 | break; |
| 88 | } |
| 89 | |
| 90 | card->dapm.bias_level = level; |
| 91 | |
| 92 | return 0; |
| 93 | } |
| 94 | |
Mark Brown | 9b8dc66 | 2011-04-12 17:24:39 -0700 | [diff] [blame] | 95 | static int speyside_hw_params(struct snd_pcm_substream *substream, |
| 96 | struct snd_pcm_hw_params *params) |
| 97 | { |
| 98 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 99 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
| 100 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
| 101 | int ret; |
| 102 | |
| 103 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
| 104 | | SND_SOC_DAIFMT_NB_NF |
| 105 | | SND_SOC_DAIFMT_CBM_CFM); |
| 106 | if (ret < 0) |
| 107 | return ret; |
| 108 | |
| 109 | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
| 110 | | SND_SOC_DAIFMT_NB_NF |
| 111 | | SND_SOC_DAIFMT_CBM_CFM); |
| 112 | if (ret < 0) |
| 113 | return ret; |
| 114 | |
Mark Brown | 9b8dc66 | 2011-04-12 17:24:39 -0700 | [diff] [blame] | 115 | return 0; |
| 116 | } |
| 117 | |
| 118 | static struct snd_soc_ops speyside_ops = { |
| 119 | .hw_params = speyside_hw_params, |
| 120 | }; |
| 121 | |
Mark Brown | 68688e7 | 2011-04-12 00:00:36 -0700 | [diff] [blame] | 122 | static struct snd_soc_jack speyside_headset; |
| 123 | |
| 124 | /* Headset jack detection DAPM pins */ |
| 125 | static struct snd_soc_jack_pin speyside_headset_pins[] = { |
| 126 | { |
| 127 | .pin = "Headset Mic", |
| 128 | .mask = SND_JACK_MICROPHONE, |
| 129 | }, |
Mark Brown | 68688e7 | 2011-04-12 00:00:36 -0700 | [diff] [blame] | 130 | }; |
| 131 | |
| 132 | /* Default the headphone selection to active high */ |
| 133 | static int speyside_jack_polarity; |
| 134 | |
| 135 | static int speyside_get_micbias(struct snd_soc_dapm_widget *source, |
| 136 | struct snd_soc_dapm_widget *sink) |
| 137 | { |
| 138 | if (speyside_jack_polarity && (strcmp(source->name, "MICB1") == 0)) |
| 139 | return 1; |
| 140 | if (!speyside_jack_polarity && (strcmp(source->name, "MICB2") == 0)) |
| 141 | return 1; |
| 142 | |
| 143 | return 0; |
| 144 | } |
| 145 | |
| 146 | static void speyside_set_polarity(struct snd_soc_codec *codec, |
| 147 | int polarity) |
| 148 | { |
| 149 | speyside_jack_polarity = !polarity; |
Mark Brown | a9ba615 | 2011-06-24 12:10:44 +0100 | [diff] [blame] | 150 | gpio_direction_output(WM8996_HPSEL_GPIO, speyside_jack_polarity); |
Mark Brown | 68688e7 | 2011-04-12 00:00:36 -0700 | [diff] [blame] | 151 | |
| 152 | /* Re-run DAPM to make sure we're using the correct mic bias */ |
| 153 | snd_soc_dapm_sync(&codec->dapm); |
| 154 | } |
| 155 | |
Mark Brown | a9ba615 | 2011-06-24 12:10:44 +0100 | [diff] [blame] | 156 | static int speyside_wm8996_init(struct snd_soc_pcm_runtime *rtd) |
Mark Brown | ea0a591 | 2011-04-11 23:32:03 -0700 | [diff] [blame] | 157 | { |
| 158 | struct snd_soc_dai *dai = rtd->codec_dai; |
Mark Brown | 68688e7 | 2011-04-12 00:00:36 -0700 | [diff] [blame] | 159 | struct snd_soc_codec *codec = rtd->codec; |
| 160 | int ret; |
Mark Brown | ea0a591 | 2011-04-11 23:32:03 -0700 | [diff] [blame] | 161 | |
Mark Brown | a9ba615 | 2011-06-24 12:10:44 +0100 | [diff] [blame] | 162 | ret = snd_soc_dai_set_sysclk(dai, WM8996_SYSCLK_MCLK2, 32768, 0); |
Mark Brown | 68688e7 | 2011-04-12 00:00:36 -0700 | [diff] [blame] | 163 | if (ret < 0) |
| 164 | return ret; |
| 165 | |
Mark Brown | a9ba615 | 2011-06-24 12:10:44 +0100 | [diff] [blame] | 166 | ret = gpio_request(WM8996_HPSEL_GPIO, "HP_SEL"); |
Mark Brown | 68688e7 | 2011-04-12 00:00:36 -0700 | [diff] [blame] | 167 | if (ret != 0) |
| 168 | pr_err("Failed to request HP_SEL GPIO: %d\n", ret); |
Mark Brown | a9ba615 | 2011-06-24 12:10:44 +0100 | [diff] [blame] | 169 | gpio_direction_output(WM8996_HPSEL_GPIO, speyside_jack_polarity); |
Mark Brown | 68688e7 | 2011-04-12 00:00:36 -0700 | [diff] [blame] | 170 | |
| 171 | ret = snd_soc_jack_new(codec, "Headset", |
Mark Brown | 45cf367 | 2011-09-04 07:54:55 -0700 | [diff] [blame] | 172 | SND_JACK_LINEOUT | SND_JACK_HEADSET | |
| 173 | SND_JACK_BTN_0, |
Mark Brown | 68688e7 | 2011-04-12 00:00:36 -0700 | [diff] [blame] | 174 | &speyside_headset); |
| 175 | if (ret) |
| 176 | return ret; |
| 177 | |
| 178 | ret = snd_soc_jack_add_pins(&speyside_headset, |
| 179 | ARRAY_SIZE(speyside_headset_pins), |
| 180 | speyside_headset_pins); |
| 181 | if (ret) |
| 182 | return ret; |
| 183 | |
Mark Brown | a9ba615 | 2011-06-24 12:10:44 +0100 | [diff] [blame] | 184 | wm8996_detect(codec, &speyside_headset, speyside_set_polarity); |
Mark Brown | 68688e7 | 2011-04-12 00:00:36 -0700 | [diff] [blame] | 185 | |
| 186 | return 0; |
Mark Brown | ea0a591 | 2011-04-11 23:32:03 -0700 | [diff] [blame] | 187 | } |
| 188 | |
Mark Brown | b7a5d14 | 2011-04-12 17:37:52 -0700 | [diff] [blame] | 189 | static int speyside_late_probe(struct snd_soc_card *card) |
| 190 | { |
| 191 | snd_soc_dapm_ignore_suspend(&card->dapm, "Headphone"); |
| 192 | snd_soc_dapm_ignore_suspend(&card->dapm, "Headset Mic"); |
| 193 | snd_soc_dapm_ignore_suspend(&card->dapm, "Main AMIC"); |
| 194 | snd_soc_dapm_ignore_suspend(&card->dapm, "Main DMIC"); |
Mark Brown | 5b895ee | 2011-11-27 15:54:49 +0000 | [diff] [blame] | 195 | snd_soc_dapm_ignore_suspend(&card->dapm, "Main Speaker"); |
Mark Brown | b7a5d14 | 2011-04-12 17:37:52 -0700 | [diff] [blame] | 196 | snd_soc_dapm_ignore_suspend(&card->dapm, "WM1250 Output"); |
| 197 | snd_soc_dapm_ignore_suspend(&card->dapm, "WM1250 Input"); |
| 198 | |
| 199 | return 0; |
| 200 | } |
| 201 | |
Mark Brown | 9b8dc66 | 2011-04-12 17:24:39 -0700 | [diff] [blame] | 202 | static struct snd_soc_dai_link speyside_dai[] = { |
| 203 | { |
| 204 | .name = "CPU", |
| 205 | .stream_name = "CPU", |
| 206 | .cpu_dai_name = "samsung-i2s.0", |
Mark Brown | a9ba615 | 2011-06-24 12:10:44 +0100 | [diff] [blame] | 207 | .codec_dai_name = "wm8996-aif1", |
Mark Brown | 9b8dc66 | 2011-04-12 17:24:39 -0700 | [diff] [blame] | 208 | .platform_name = "samsung-audio", |
Mark Brown | a9ba615 | 2011-06-24 12:10:44 +0100 | [diff] [blame] | 209 | .codec_name = "wm8996.1-001a", |
| 210 | .init = speyside_wm8996_init, |
Mark Brown | 9b8dc66 | 2011-04-12 17:24:39 -0700 | [diff] [blame] | 211 | .ops = &speyside_ops, |
| 212 | }, |
Mark Brown | 556e4fb | 2011-04-12 14:15:10 -0700 | [diff] [blame] | 213 | { |
| 214 | .name = "Baseband", |
| 215 | .stream_name = "Baseband", |
Mark Brown | a9ba615 | 2011-06-24 12:10:44 +0100 | [diff] [blame] | 216 | .cpu_dai_name = "wm8996-aif2", |
Mark Brown | 556e4fb | 2011-04-12 14:15:10 -0700 | [diff] [blame] | 217 | .codec_dai_name = "wm1250-ev1", |
| 218 | .codec_name = "wm1250-ev1.1-0027", |
Mark Brown | 556e4fb | 2011-04-12 14:15:10 -0700 | [diff] [blame] | 219 | .ops = &speyside_ops, |
Mark Brown | b7a5d14 | 2011-04-12 17:37:52 -0700 | [diff] [blame] | 220 | .ignore_suspend = 1, |
Mark Brown | 556e4fb | 2011-04-12 14:15:10 -0700 | [diff] [blame] | 221 | }, |
Mark Brown | 9b8dc66 | 2011-04-12 17:24:39 -0700 | [diff] [blame] | 222 | }; |
| 223 | |
Mark Brown | ea3e98e | 2011-04-11 23:42:25 -0700 | [diff] [blame] | 224 | static int speyside_wm9081_init(struct snd_soc_dapm_context *dapm) |
| 225 | { |
Mark Brown | ea3e98e | 2011-04-11 23:42:25 -0700 | [diff] [blame] | 226 | /* At any time the WM9081 is active it will have this clock */ |
Mark Brown | da1c6ea | 2011-08-24 20:09:01 +0100 | [diff] [blame] | 227 | return snd_soc_codec_set_sysclk(dapm->codec, WM9081_SYSCLK_MCLK, 0, |
Mark Brown | 3628137 | 2011-12-11 11:31:22 +0800 | [diff] [blame] | 228 | MCLK_AUDIO_RATE, 0); |
Mark Brown | ea3e98e | 2011-04-11 23:42:25 -0700 | [diff] [blame] | 229 | } |
| 230 | |
| 231 | static struct snd_soc_aux_dev speyside_aux_dev[] = { |
| 232 | { |
| 233 | .name = "wm9081", |
| 234 | .codec_name = "wm9081.1-006c", |
| 235 | .init = speyside_wm9081_init, |
| 236 | }, |
| 237 | }; |
| 238 | |
| 239 | static struct snd_soc_codec_conf speyside_codec_conf[] = { |
| 240 | { |
| 241 | .dev_name = "wm9081.1-006c", |
| 242 | .name_prefix = "Sub", |
| 243 | }, |
| 244 | }; |
| 245 | |
Mark Brown | ea0e60d | 2011-04-12 00:09:53 -0700 | [diff] [blame] | 246 | static const struct snd_kcontrol_new controls[] = { |
| 247 | SOC_DAPM_PIN_SWITCH("Main Speaker"), |
| 248 | SOC_DAPM_PIN_SWITCH("Main DMIC"), |
| 249 | SOC_DAPM_PIN_SWITCH("Main AMIC"), |
Mark Brown | 556e4fb | 2011-04-12 14:15:10 -0700 | [diff] [blame] | 250 | SOC_DAPM_PIN_SWITCH("WM1250 Input"), |
| 251 | SOC_DAPM_PIN_SWITCH("WM1250 Output"), |
Mark Brown | 68d5a59 | 2011-08-04 18:13:45 +0900 | [diff] [blame] | 252 | SOC_DAPM_PIN_SWITCH("Headphone"), |
Mark Brown | ea0e60d | 2011-04-12 00:09:53 -0700 | [diff] [blame] | 253 | }; |
| 254 | |
Mark Brown | ecfb1ad | 2011-04-11 23:09:15 -0700 | [diff] [blame] | 255 | static struct snd_soc_dapm_widget widgets[] = { |
| 256 | SND_SOC_DAPM_HP("Headphone", NULL), |
Mark Brown | 68688e7 | 2011-04-12 00:00:36 -0700 | [diff] [blame] | 257 | SND_SOC_DAPM_MIC("Headset Mic", NULL), |
Mark Brown | ecfb1ad | 2011-04-11 23:09:15 -0700 | [diff] [blame] | 258 | |
| 259 | SND_SOC_DAPM_SPK("Main Speaker", NULL), |
| 260 | |
| 261 | SND_SOC_DAPM_MIC("Main AMIC", NULL), |
| 262 | SND_SOC_DAPM_MIC("Main DMIC", NULL), |
| 263 | }; |
| 264 | |
| 265 | static struct snd_soc_dapm_route audio_paths[] = { |
Mark Brown | 68688e7 | 2011-04-12 00:00:36 -0700 | [diff] [blame] | 266 | { "IN1RN", NULL, "MICB1" }, |
| 267 | { "IN1RP", NULL, "MICB1" }, |
| 268 | { "IN1RN", NULL, "MICB2" }, |
| 269 | { "IN1RP", NULL, "MICB2" }, |
| 270 | { "MICB1", NULL, "Headset Mic", speyside_get_micbias }, |
| 271 | { "MICB2", NULL, "Headset Mic", speyside_get_micbias }, |
| 272 | |
Mark Brown | ecfb1ad | 2011-04-11 23:09:15 -0700 | [diff] [blame] | 273 | { "IN1LP", NULL, "MICB2" }, |
Mark Brown | 68688e7 | 2011-04-12 00:00:36 -0700 | [diff] [blame] | 274 | { "IN1RN", NULL, "MICB1" }, |
Mark Brown | ecfb1ad | 2011-04-11 23:09:15 -0700 | [diff] [blame] | 275 | { "MICB2", NULL, "Main AMIC" }, |
| 276 | |
| 277 | { "DMIC1DAT", NULL, "MICB1" }, |
| 278 | { "DMIC2DAT", NULL, "MICB1" }, |
| 279 | { "MICB1", NULL, "Main DMIC" }, |
| 280 | |
| 281 | { "Headphone", NULL, "HPOUT1L" }, |
| 282 | { "Headphone", NULL, "HPOUT1R" }, |
| 283 | |
Mark Brown | ea3e98e | 2011-04-11 23:42:25 -0700 | [diff] [blame] | 284 | { "Sub IN1", NULL, "HPOUT2L" }, |
| 285 | { "Sub IN2", NULL, "HPOUT2R" }, |
| 286 | |
| 287 | { "Main Speaker", NULL, "Sub SPKN" }, |
| 288 | { "Main Speaker", NULL, "Sub SPKP" }, |
Mark Brown | ecfb1ad | 2011-04-11 23:09:15 -0700 | [diff] [blame] | 289 | { "Main Speaker", NULL, "SPKDAT" }, |
| 290 | }; |
| 291 | |
Mark Brown | 9b8dc66 | 2011-04-12 17:24:39 -0700 | [diff] [blame] | 292 | static struct snd_soc_card speyside = { |
| 293 | .name = "Speyside", |
Axel Lin | 095d79d | 2011-12-22 10:53:15 +0800 | [diff] [blame^] | 294 | .owner = THIS_MODULE, |
Mark Brown | 9b8dc66 | 2011-04-12 17:24:39 -0700 | [diff] [blame] | 295 | .dai_link = speyside_dai, |
| 296 | .num_links = ARRAY_SIZE(speyside_dai), |
Mark Brown | ea3e98e | 2011-04-11 23:42:25 -0700 | [diff] [blame] | 297 | .aux_dev = speyside_aux_dev, |
| 298 | .num_aux_devs = ARRAY_SIZE(speyside_aux_dev), |
| 299 | .codec_conf = speyside_codec_conf, |
| 300 | .num_configs = ARRAY_SIZE(speyside_codec_conf), |
Mark Brown | ecfb1ad | 2011-04-11 23:09:15 -0700 | [diff] [blame] | 301 | |
Mark Brown | ea0a591 | 2011-04-11 23:32:03 -0700 | [diff] [blame] | 302 | .set_bias_level = speyside_set_bias_level, |
Mark Brown | 995e54f | 2011-06-08 16:11:18 +0100 | [diff] [blame] | 303 | .set_bias_level_post = speyside_set_bias_level_post, |
Mark Brown | ea0a591 | 2011-04-11 23:32:03 -0700 | [diff] [blame] | 304 | |
Mark Brown | ea0e60d | 2011-04-12 00:09:53 -0700 | [diff] [blame] | 305 | .controls = controls, |
| 306 | .num_controls = ARRAY_SIZE(controls), |
Mark Brown | ecfb1ad | 2011-04-11 23:09:15 -0700 | [diff] [blame] | 307 | .dapm_widgets = widgets, |
| 308 | .num_dapm_widgets = ARRAY_SIZE(widgets), |
| 309 | .dapm_routes = audio_paths, |
| 310 | .num_dapm_routes = ARRAY_SIZE(audio_paths), |
Mark Brown | 39afd66 | 2011-11-23 21:33:07 +0000 | [diff] [blame] | 311 | .fully_routed = true, |
Mark Brown | b7a5d14 | 2011-04-12 17:37:52 -0700 | [diff] [blame] | 312 | |
| 313 | .late_probe = speyside_late_probe, |
Mark Brown | 9b8dc66 | 2011-04-12 17:24:39 -0700 | [diff] [blame] | 314 | }; |
| 315 | |
| 316 | static __devinit int speyside_probe(struct platform_device *pdev) |
| 317 | { |
| 318 | struct snd_soc_card *card = &speyside; |
| 319 | int ret; |
| 320 | |
| 321 | card->dev = &pdev->dev; |
| 322 | |
| 323 | ret = snd_soc_register_card(card); |
| 324 | if (ret) { |
| 325 | dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", |
| 326 | ret); |
| 327 | return ret; |
| 328 | } |
| 329 | |
| 330 | return 0; |
| 331 | } |
| 332 | |
| 333 | static int __devexit speyside_remove(struct platform_device *pdev) |
| 334 | { |
| 335 | struct snd_soc_card *card = platform_get_drvdata(pdev); |
| 336 | |
| 337 | snd_soc_unregister_card(card); |
| 338 | |
| 339 | return 0; |
| 340 | } |
| 341 | |
| 342 | static struct platform_driver speyside_driver = { |
| 343 | .driver = { |
| 344 | .name = "speyside", |
| 345 | .owner = THIS_MODULE, |
| 346 | .pm = &snd_soc_pm_ops, |
| 347 | }, |
| 348 | .probe = speyside_probe, |
| 349 | .remove = __devexit_p(speyside_remove), |
| 350 | }; |
| 351 | |
Mark Brown | e00c3f5 | 2011-11-23 15:20:13 +0000 | [diff] [blame] | 352 | module_platform_driver(speyside_driver); |
Mark Brown | 9b8dc66 | 2011-04-12 17:24:39 -0700 | [diff] [blame] | 353 | |
| 354 | MODULE_DESCRIPTION("Speyside audio support"); |
| 355 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); |
| 356 | MODULE_LICENSE("GPL"); |
| 357 | MODULE_ALIAS("platform:speyside"); |