Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 1 | /* |
| 2 | * ad1980.c -- ALSA Soc AD1980 codec support |
| 3 | * |
| 4 | * Copyright: Analog Device Inc. |
| 5 | * Author: Roy Huang <roy.huang@analog.com> |
| 6 | * Cliff Cai <cliff.cai@analog.com> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License as published by the |
| 10 | * Free Software Foundation; either version 2 of the License, or (at your |
| 11 | * option) any later version. |
| 12 | */ |
| 13 | |
Sonic Zhang | 2e2211a | 2010-08-07 12:06:07 -0400 | [diff] [blame] | 14 | /* |
| 15 | * WARNING: |
| 16 | * |
| 17 | * Because Analog Devices Inc. discontinued the ad1980 sound chip since |
| 18 | * Sep. 2009, this ad1980 driver is not maintained, tested and supported |
| 19 | * by ADI now. |
| 20 | */ |
| 21 | |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 22 | #include <linux/init.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 23 | #include <linux/slab.h> |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 24 | #include <linux/module.h> |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 25 | #include <linux/kernel.h> |
| 26 | #include <linux/device.h> |
| 27 | #include <sound/core.h> |
| 28 | #include <sound/pcm.h> |
| 29 | #include <sound/ac97_codec.h> |
| 30 | #include <sound/initval.h> |
| 31 | #include <sound/soc.h> |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 32 | |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 33 | /* |
| 34 | * AD1980 register cache |
| 35 | */ |
| 36 | static const u16 ad1980_reg[] = { |
| 37 | 0x0090, 0x8000, 0x8000, 0x8000, /* 0 - 6 */ |
| 38 | 0x0000, 0x0000, 0x8008, 0x8008, /* 8 - e */ |
| 39 | 0x8808, 0x8808, 0x0000, 0x8808, /* 10 - 16 */ |
| 40 | 0x8808, 0x0000, 0x8000, 0x0000, /* 18 - 1e */ |
| 41 | 0x0000, 0x0000, 0x0000, 0x0000, /* 20 - 26 */ |
| 42 | 0x03c7, 0x0000, 0xbb80, 0xbb80, /* 28 - 2e */ |
| 43 | 0xbb80, 0xbb80, 0x0000, 0x8080, /* 30 - 36 */ |
| 44 | 0x8080, 0x2000, 0x0000, 0x0000, /* 38 - 3e */ |
| 45 | 0x0000, 0x0000, 0x0000, 0x0000, /* reserved */ |
| 46 | 0x0000, 0x0000, 0x0000, 0x0000, /* reserved */ |
| 47 | 0x0000, 0x0000, 0x0000, 0x0000, /* reserved */ |
| 48 | 0x0000, 0x0000, 0x0000, 0x0000, /* reserved */ |
| 49 | 0x8080, 0x0000, 0x0000, 0x0000, /* 60 - 66 */ |
| 50 | 0x0000, 0x0000, 0x0000, 0x0000, /* reserved */ |
| 51 | 0x0000, 0x0000, 0x1001, 0x0000, /* 70 - 76 */ |
| 52 | 0x0000, 0x0000, 0x4144, 0x5370 /* 78 - 7e */ |
| 53 | }; |
| 54 | |
| 55 | static const char *ad1980_rec_sel[] = {"Mic", "CD", "NC", "AUX", "Line", |
| 56 | "Stereo Mix", "Mono Mix", "Phone"}; |
| 57 | |
Takashi Iwai | 901bb6c | 2014-02-18 09:56:40 +0100 | [diff] [blame] | 58 | static SOC_ENUM_DOUBLE_DECL(ad1980_cap_src, |
| 59 | AC97_REC_SEL, 8, 0, ad1980_rec_sel); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 60 | |
| 61 | static const struct snd_kcontrol_new ad1980_snd_ac97_controls[] = { |
| 62 | SOC_DOUBLE("Master Playback Volume", AC97_MASTER, 8, 0, 31, 1), |
| 63 | SOC_SINGLE("Master Playback Switch", AC97_MASTER, 15, 1, 1), |
| 64 | |
| 65 | SOC_DOUBLE("Headphone Playback Volume", AC97_HEADPHONE, 8, 0, 31, 1), |
| 66 | SOC_SINGLE("Headphone Playback Switch", AC97_HEADPHONE, 15, 1, 1), |
| 67 | |
| 68 | SOC_DOUBLE("PCM Playback Volume", AC97_PCM, 8, 0, 31, 1), |
| 69 | SOC_SINGLE("PCM Playback Switch", AC97_PCM, 15, 1, 1), |
| 70 | |
| 71 | SOC_DOUBLE("PCM Capture Volume", AC97_REC_GAIN, 8, 0, 31, 0), |
| 72 | SOC_SINGLE("PCM Capture Switch", AC97_REC_GAIN, 15, 1, 1), |
| 73 | |
| 74 | SOC_SINGLE("Mono Playback Volume", AC97_MASTER_MONO, 0, 31, 1), |
| 75 | SOC_SINGLE("Mono Playback Switch", AC97_MASTER_MONO, 15, 1, 1), |
| 76 | |
| 77 | SOC_SINGLE("Phone Capture Volume", AC97_PHONE, 0, 31, 1), |
| 78 | SOC_SINGLE("Phone Capture Switch", AC97_PHONE, 15, 1, 1), |
| 79 | |
| 80 | SOC_SINGLE("Mic Volume", AC97_MIC, 0, 31, 1), |
| 81 | SOC_SINGLE("Mic Switch", AC97_MIC, 15, 1, 1), |
| 82 | |
| 83 | SOC_SINGLE("Stereo Mic Switch", AC97_AD_MISC, 6, 1, 0), |
| 84 | SOC_DOUBLE("Line HP Swap Switch", AC97_AD_MISC, 10, 5, 1, 0), |
| 85 | |
| 86 | SOC_DOUBLE("Surround Playback Volume", AC97_SURROUND_MASTER, 8, 0, 31, 1), |
| 87 | SOC_DOUBLE("Surround Playback Switch", AC97_SURROUND_MASTER, 15, 7, 1, 1), |
| 88 | |
Cliff Cai | 9905ed3 | 2008-11-18 16:18:16 +0800 | [diff] [blame] | 89 | SOC_DOUBLE("Center/LFE Playback Volume", AC97_CENTER_LFE_MASTER, 8, 0, 31, 1), |
| 90 | SOC_DOUBLE("Center/LFE Playback Switch", AC97_CENTER_LFE_MASTER, 15, 7, 1, 1), |
| 91 | |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 92 | SOC_ENUM("Capture Source", ad1980_cap_src), |
| 93 | |
| 94 | SOC_SINGLE("Mic Boost Switch", AC97_MIC, 6, 1, 0), |
| 95 | }; |
| 96 | |
Mark Brown | 9e7e474 | 2013-08-06 23:51:12 +0100 | [diff] [blame] | 97 | static const struct snd_soc_dapm_widget ad1980_dapm_widgets[] = { |
| 98 | SND_SOC_DAPM_INPUT("MIC1"), |
| 99 | SND_SOC_DAPM_INPUT("MIC2"), |
| 100 | SND_SOC_DAPM_INPUT("CD_L"), |
| 101 | SND_SOC_DAPM_INPUT("CD_R"), |
| 102 | SND_SOC_DAPM_INPUT("AUX_L"), |
| 103 | SND_SOC_DAPM_INPUT("AUX_R"), |
| 104 | SND_SOC_DAPM_INPUT("LINE_IN_L"), |
| 105 | SND_SOC_DAPM_INPUT("LINE_IN_R"), |
| 106 | |
| 107 | SND_SOC_DAPM_OUTPUT("LFE_OUT"), |
| 108 | SND_SOC_DAPM_OUTPUT("CENTER_OUT"), |
| 109 | SND_SOC_DAPM_OUTPUT("LINE_OUT_L"), |
| 110 | SND_SOC_DAPM_OUTPUT("LINE_OUT_R"), |
| 111 | SND_SOC_DAPM_OUTPUT("MONO_OUT"), |
| 112 | SND_SOC_DAPM_OUTPUT("HP_OUT_L"), |
| 113 | SND_SOC_DAPM_OUTPUT("HP_OUT_R"), |
| 114 | }; |
| 115 | |
| 116 | static const struct snd_soc_dapm_route ad1980_dapm_routes[] = { |
| 117 | { "Capture", NULL, "MIC1" }, |
| 118 | { "Capture", NULL, "MIC2" }, |
| 119 | { "Capture", NULL, "CD_L" }, |
| 120 | { "Capture", NULL, "CD_R" }, |
| 121 | { "Capture", NULL, "AUX_L" }, |
| 122 | { "Capture", NULL, "AUX_R" }, |
| 123 | { "Capture", NULL, "LINE_IN_L" }, |
| 124 | { "Capture", NULL, "LINE_IN_R" }, |
| 125 | |
| 126 | { "LFE_OUT", NULL, "Playback" }, |
| 127 | { "CENTER_OUT", NULL, "Playback" }, |
| 128 | { "LINE_OUT_L", NULL, "Playback" }, |
| 129 | { "LINE_OUT_R", NULL, "Playback" }, |
| 130 | { "MONO_OUT", NULL, "Playback" }, |
| 131 | { "HP_OUT_L", NULL, "Playback" }, |
| 132 | { "HP_OUT_R", NULL, "Playback" }, |
| 133 | }; |
| 134 | |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 135 | static unsigned int ac97_read(struct snd_soc_codec *codec, |
| 136 | unsigned int reg) |
| 137 | { |
| 138 | u16 *cache = codec->reg_cache; |
| 139 | |
| 140 | switch (reg) { |
| 141 | case AC97_RESET: |
| 142 | case AC97_INT_PAGING: |
| 143 | case AC97_POWERDOWN: |
| 144 | case AC97_EXTENDED_STATUS: |
| 145 | case AC97_VENDOR_ID1: |
| 146 | case AC97_VENDOR_ID2: |
Mark Brown | b047e1c | 2013-06-26 12:45:59 +0100 | [diff] [blame] | 147 | return soc_ac97_ops->read(codec->ac97, reg); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 148 | default: |
| 149 | reg = reg >> 1; |
| 150 | |
Ian Molton | 91432e9 | 2009-01-17 17:44:23 +0000 | [diff] [blame] | 151 | if (reg >= ARRAY_SIZE(ad1980_reg)) |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 152 | return -EINVAL; |
| 153 | |
| 154 | return cache[reg]; |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | static int ac97_write(struct snd_soc_codec *codec, unsigned int reg, |
| 159 | unsigned int val) |
| 160 | { |
| 161 | u16 *cache = codec->reg_cache; |
| 162 | |
Mark Brown | b047e1c | 2013-06-26 12:45:59 +0100 | [diff] [blame] | 163 | soc_ac97_ops->write(codec->ac97, reg, val); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 164 | reg = reg >> 1; |
Ian Molton | 91432e9 | 2009-01-17 17:44:23 +0000 | [diff] [blame] | 165 | if (reg < ARRAY_SIZE(ad1980_reg)) |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 166 | cache[reg] = val; |
| 167 | |
| 168 | return 0; |
| 169 | } |
| 170 | |
Mark Brown | de535a5 | 2010-10-06 16:20:07 -0700 | [diff] [blame] | 171 | static struct snd_soc_dai_driver ad1980_dai = { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 172 | .name = "ad1980-hifi", |
Mark Brown | 67c9151 | 2008-11-24 17:45:26 +0000 | [diff] [blame] | 173 | .ac97_control = 1, |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 174 | .playback = { |
| 175 | .stream_name = "Playback", |
| 176 | .channels_min = 2, |
Cliff Cai | 9905ed3 | 2008-11-18 16:18:16 +0800 | [diff] [blame] | 177 | .channels_max = 6, |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 178 | .rates = SNDRV_PCM_RATE_48000, |
Mark Brown | 33f503c | 2009-05-02 12:24:55 +0100 | [diff] [blame] | 179 | .formats = SND_SOC_STD_AC97_FMTS, }, |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 180 | .capture = { |
| 181 | .stream_name = "Capture", |
| 182 | .channels_min = 2, |
| 183 | .channels_max = 2, |
| 184 | .rates = SNDRV_PCM_RATE_48000, |
Mark Brown | 33f503c | 2009-05-02 12:24:55 +0100 | [diff] [blame] | 185 | .formats = SND_SOC_STD_AC97_FMTS, }, |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 186 | }; |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 187 | |
| 188 | static int ad1980_reset(struct snd_soc_codec *codec, int try_warm) |
| 189 | { |
Lars-Peter Clausen | cf7b71f4 | 2014-05-20 14:23:10 +0200 | [diff] [blame] | 190 | unsigned int retry_cnt = 0; |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 191 | |
Lars-Peter Clausen | cf7b71f4 | 2014-05-20 14:23:10 +0200 | [diff] [blame] | 192 | do { |
| 193 | if (try_warm && soc_ac97_ops->warm_reset) { |
| 194 | soc_ac97_ops->warm_reset(codec->ac97); |
| 195 | if (ac97_read(codec, AC97_RESET) == 0x0090) |
| 196 | return 1; |
| 197 | } |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 198 | |
Lars-Peter Clausen | cf7b71f4 | 2014-05-20 14:23:10 +0200 | [diff] [blame] | 199 | soc_ac97_ops->reset(codec->ac97); |
| 200 | /* |
| 201 | * Set bit 16slot in register 74h, then every slot will has only |
| 202 | * 16 bits. This command is sent out in 20bit mode, in which |
| 203 | * case the first nibble of data is eaten by the addr. (Tag is |
| 204 | * always 16 bit) |
| 205 | */ |
| 206 | ac97_write(codec, AC97_AD_SERIAL_CFG, 0x9900); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 207 | |
Lars-Peter Clausen | cf7b71f4 | 2014-05-20 14:23:10 +0200 | [diff] [blame] | 208 | if (ac97_read(codec, AC97_RESET) == 0x0090) |
| 209 | return 0; |
| 210 | } while (retry_cnt++ < 10); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 211 | |
Lars-Peter Clausen | e5adb6c | 2014-10-30 21:00:59 +0100 | [diff] [blame^] | 212 | dev_err(codec->dev, "Failed to reset: AC97 link error\n"); |
| 213 | |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 214 | return -EIO; |
| 215 | } |
| 216 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 217 | static int ad1980_soc_probe(struct snd_soc_codec *codec) |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 218 | { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 219 | int ret; |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 220 | u16 vendor_id2; |
Cliff Cai | 9905ed3 | 2008-11-18 16:18:16 +0800 | [diff] [blame] | 221 | u16 ext_status; |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 222 | |
Mark Brown | b047e1c | 2013-06-26 12:45:59 +0100 | [diff] [blame] | 223 | ret = snd_soc_new_ac97_codec(codec, soc_ac97_ops, 0); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 224 | if (ret < 0) { |
Lars-Peter Clausen | e5adb6c | 2014-10-30 21:00:59 +0100 | [diff] [blame^] | 225 | dev_err(codec->dev, "Failed to register AC97 codec\n"); |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 226 | return ret; |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 227 | } |
| 228 | |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 229 | ret = ad1980_reset(codec, 0); |
Lars-Peter Clausen | e5adb6c | 2014-10-30 21:00:59 +0100 | [diff] [blame^] | 230 | if (ret < 0) |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 231 | goto reset_err; |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 232 | |
| 233 | /* Read out vendor ID to make sure it is ad1980 */ |
Axel Lin | 0f73644 | 2011-09-06 10:37:48 +0800 | [diff] [blame] | 234 | if (ac97_read(codec, AC97_VENDOR_ID1) != 0x4144) { |
| 235 | ret = -ENODEV; |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 236 | goto reset_err; |
Axel Lin | 0f73644 | 2011-09-06 10:37:48 +0800 | [diff] [blame] | 237 | } |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 238 | |
| 239 | vendor_id2 = ac97_read(codec, AC97_VENDOR_ID2); |
| 240 | |
| 241 | if (vendor_id2 != 0x5370) { |
Axel Lin | 0f73644 | 2011-09-06 10:37:48 +0800 | [diff] [blame] | 242 | if (vendor_id2 != 0x5374) { |
| 243 | ret = -ENODEV; |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 244 | goto reset_err; |
Axel Lin | 0f73644 | 2011-09-06 10:37:48 +0800 | [diff] [blame] | 245 | } else { |
Lars-Peter Clausen | e5adb6c | 2014-10-30 21:00:59 +0100 | [diff] [blame^] | 246 | dev_warn(codec->dev, |
| 247 | "Found AD1981 - only 2/2 IN/OUT Channels supported\n"); |
Axel Lin | 0f73644 | 2011-09-06 10:37:48 +0800 | [diff] [blame] | 248 | } |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 249 | } |
| 250 | |
Cliff Cai | 9905ed3 | 2008-11-18 16:18:16 +0800 | [diff] [blame] | 251 | /* unmute captures and playbacks volume */ |
| 252 | ac97_write(codec, AC97_MASTER, 0x0000); |
| 253 | ac97_write(codec, AC97_PCM, 0x0000); |
| 254 | ac97_write(codec, AC97_REC_GAIN, 0x0000); |
| 255 | ac97_write(codec, AC97_CENTER_LFE_MASTER, 0x0000); |
| 256 | ac97_write(codec, AC97_SURROUND_MASTER, 0x0000); |
| 257 | |
| 258 | /*power on LFE/CENTER/Surround DACs*/ |
| 259 | ext_status = ac97_read(codec, AC97_EXTENDED_STATUS); |
| 260 | ac97_write(codec, AC97_EXTENDED_STATUS, ext_status&~0x3800); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 261 | |
Liam Girdwood | 022658b | 2012-02-03 17:43:09 +0000 | [diff] [blame] | 262 | snd_soc_add_codec_controls(codec, ad1980_snd_ac97_controls, |
Ian Molton | 3e8e195 | 2009-01-09 00:23:21 +0000 | [diff] [blame] | 263 | ARRAY_SIZE(ad1980_snd_ac97_controls)); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 264 | |
| 265 | return 0; |
| 266 | |
| 267 | reset_err: |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 268 | snd_soc_free_ac97_codec(codec); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 269 | return ret; |
| 270 | } |
| 271 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 272 | static int ad1980_soc_remove(struct snd_soc_codec *codec) |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 273 | { |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 274 | snd_soc_free_ac97_codec(codec); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 275 | return 0; |
| 276 | } |
| 277 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 278 | static struct snd_soc_codec_driver soc_codec_dev_ad1980 = { |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 279 | .probe = ad1980_soc_probe, |
| 280 | .remove = ad1980_soc_remove, |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 281 | .reg_cache_size = ARRAY_SIZE(ad1980_reg), |
| 282 | .reg_word_size = sizeof(u16), |
Axel Lin | c7bad06 | 2010-09-09 17:50:56 +0800 | [diff] [blame] | 283 | .reg_cache_default = ad1980_reg, |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 284 | .reg_cache_step = 2, |
| 285 | .write = ac97_write, |
| 286 | .read = ac97_read, |
Mark Brown | 9e7e474 | 2013-08-06 23:51:12 +0100 | [diff] [blame] | 287 | |
| 288 | .dapm_widgets = ad1980_dapm_widgets, |
| 289 | .num_dapm_widgets = ARRAY_SIZE(ad1980_dapm_widgets), |
| 290 | .dapm_routes = ad1980_dapm_routes, |
| 291 | .num_dapm_routes = ARRAY_SIZE(ad1980_dapm_routes), |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 292 | }; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 293 | |
Bill Pemberton | 7a79e94 | 2012-12-07 09:26:37 -0500 | [diff] [blame] | 294 | static int ad1980_probe(struct platform_device *pdev) |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 295 | { |
| 296 | return snd_soc_register_codec(&pdev->dev, |
| 297 | &soc_codec_dev_ad1980, &ad1980_dai, 1); |
| 298 | } |
| 299 | |
Bill Pemberton | 7a79e94 | 2012-12-07 09:26:37 -0500 | [diff] [blame] | 300 | static int ad1980_remove(struct platform_device *pdev) |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 301 | { |
| 302 | snd_soc_unregister_codec(&pdev->dev); |
| 303 | return 0; |
| 304 | } |
| 305 | |
| 306 | static struct platform_driver ad1980_codec_driver = { |
| 307 | .driver = { |
Mike Frysinger | 1afa98b | 2011-03-27 00:44:13 -0400 | [diff] [blame] | 308 | .name = "ad1980", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 309 | .owner = THIS_MODULE, |
| 310 | }, |
| 311 | |
| 312 | .probe = ad1980_probe, |
Bill Pemberton | 7a79e94 | 2012-12-07 09:26:37 -0500 | [diff] [blame] | 313 | .remove = ad1980_remove, |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 314 | }; |
| 315 | |
Mark Brown | 5bbcc3c | 2011-11-23 22:52:08 +0000 | [diff] [blame] | 316 | module_platform_driver(ad1980_codec_driver); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 317 | |
Sonic Zhang | 2e2211a | 2010-08-07 12:06:07 -0400 | [diff] [blame] | 318 | MODULE_DESCRIPTION("ASoC ad1980 driver (Obsolete)"); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 319 | MODULE_AUTHOR("Roy Huang, Cliff Cai"); |
| 320 | MODULE_LICENSE("GPL"); |