Thomas Gleixner | 2874c5f | 2019-05-27 08:55:01 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 2 | /* |
| 3 | * ad1980.c -- ALSA Soc AD1980 codec support |
| 4 | * |
| 5 | * Copyright: Analog Device Inc. |
| 6 | * Author: Roy Huang <roy.huang@analog.com> |
| 7 | * Cliff Cai <cliff.cai@analog.com> |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 8 | */ |
| 9 | |
Sonic Zhang | 2e2211a | 2010-08-07 12:06:07 -0400 | [diff] [blame] | 10 | /* |
| 11 | * WARNING: |
| 12 | * |
| 13 | * Because Analog Devices Inc. discontinued the ad1980 sound chip since |
| 14 | * Sep. 2009, this ad1980 driver is not maintained, tested and supported |
| 15 | * by ADI now. |
| 16 | */ |
| 17 | |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 18 | #include <linux/init.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 19 | #include <linux/slab.h> |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 20 | #include <linux/module.h> |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 21 | #include <linux/kernel.h> |
| 22 | #include <linux/device.h> |
Lars-Peter Clausen | 82d1463 | 2014-11-18 19:45:53 +0100 | [diff] [blame] | 23 | #include <linux/regmap.h> |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 24 | #include <sound/core.h> |
| 25 | #include <sound/pcm.h> |
| 26 | #include <sound/ac97_codec.h> |
| 27 | #include <sound/initval.h> |
| 28 | #include <sound/soc.h> |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 29 | |
Lars-Peter Clausen | 82d1463 | 2014-11-18 19:45:53 +0100 | [diff] [blame] | 30 | static const struct reg_default ad1980_reg_defaults[] = { |
| 31 | { 0x02, 0x8000 }, |
| 32 | { 0x04, 0x8000 }, |
| 33 | { 0x06, 0x8000 }, |
| 34 | { 0x0c, 0x8008 }, |
| 35 | { 0x0e, 0x8008 }, |
| 36 | { 0x10, 0x8808 }, |
| 37 | { 0x12, 0x8808 }, |
| 38 | { 0x16, 0x8808 }, |
| 39 | { 0x18, 0x8808 }, |
| 40 | { 0x1a, 0x0000 }, |
| 41 | { 0x1c, 0x8000 }, |
| 42 | { 0x20, 0x0000 }, |
| 43 | { 0x28, 0x03c7 }, |
| 44 | { 0x2c, 0xbb80 }, |
| 45 | { 0x2e, 0xbb80 }, |
| 46 | { 0x30, 0xbb80 }, |
| 47 | { 0x32, 0xbb80 }, |
| 48 | { 0x36, 0x8080 }, |
| 49 | { 0x38, 0x8080 }, |
| 50 | { 0x3a, 0x2000 }, |
| 51 | { 0x60, 0x0000 }, |
| 52 | { 0x62, 0x0000 }, |
| 53 | { 0x72, 0x0000 }, |
| 54 | { 0x74, 0x1001 }, |
| 55 | { 0x76, 0x0000 }, |
| 56 | }; |
| 57 | |
| 58 | static bool ad1980_readable_reg(struct device *dev, unsigned int reg) |
| 59 | { |
| 60 | switch (reg) { |
| 61 | case AC97_RESET ... AC97_MASTER_MONO: |
| 62 | case AC97_PHONE ... AC97_CD: |
| 63 | case AC97_AUX ... AC97_GENERAL_PURPOSE: |
| 64 | case AC97_POWERDOWN ... AC97_PCM_LR_ADC_RATE: |
| 65 | case AC97_SPDIF: |
| 66 | case AC97_CODEC_CLASS_REV: |
| 67 | case AC97_PCI_SVID: |
| 68 | case AC97_AD_CODEC_CFG: |
| 69 | case AC97_AD_JACK_SPDIF: |
| 70 | case AC97_AD_SERIAL_CFG: |
| 71 | case AC97_VENDOR_ID1: |
| 72 | case AC97_VENDOR_ID2: |
| 73 | return true; |
| 74 | default: |
| 75 | return false; |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | static bool ad1980_writeable_reg(struct device *dev, unsigned int reg) |
| 80 | { |
| 81 | switch (reg) { |
| 82 | case AC97_VENDOR_ID1: |
| 83 | case AC97_VENDOR_ID2: |
| 84 | return false; |
| 85 | default: |
| 86 | return ad1980_readable_reg(dev, reg); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | static const struct regmap_config ad1980_regmap_config = { |
| 91 | .reg_bits = 16, |
| 92 | .reg_stride = 2, |
| 93 | .val_bits = 16, |
| 94 | .max_register = 0x7e, |
| 95 | .cache_type = REGCACHE_RBTREE, |
| 96 | |
| 97 | .volatile_reg = regmap_ac97_default_volatile, |
| 98 | .readable_reg = ad1980_readable_reg, |
| 99 | .writeable_reg = ad1980_writeable_reg, |
| 100 | |
| 101 | .reg_defaults = ad1980_reg_defaults, |
| 102 | .num_reg_defaults = ARRAY_SIZE(ad1980_reg_defaults), |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 103 | }; |
| 104 | |
| 105 | static const char *ad1980_rec_sel[] = {"Mic", "CD", "NC", "AUX", "Line", |
| 106 | "Stereo Mix", "Mono Mix", "Phone"}; |
| 107 | |
Takashi Iwai | 901bb6c | 2014-02-18 09:56:40 +0100 | [diff] [blame] | 108 | static SOC_ENUM_DOUBLE_DECL(ad1980_cap_src, |
| 109 | AC97_REC_SEL, 8, 0, ad1980_rec_sel); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 110 | |
| 111 | static const struct snd_kcontrol_new ad1980_snd_ac97_controls[] = { |
| 112 | SOC_DOUBLE("Master Playback Volume", AC97_MASTER, 8, 0, 31, 1), |
| 113 | SOC_SINGLE("Master Playback Switch", AC97_MASTER, 15, 1, 1), |
| 114 | |
| 115 | SOC_DOUBLE("Headphone Playback Volume", AC97_HEADPHONE, 8, 0, 31, 1), |
| 116 | SOC_SINGLE("Headphone Playback Switch", AC97_HEADPHONE, 15, 1, 1), |
| 117 | |
| 118 | SOC_DOUBLE("PCM Playback Volume", AC97_PCM, 8, 0, 31, 1), |
| 119 | SOC_SINGLE("PCM Playback Switch", AC97_PCM, 15, 1, 1), |
| 120 | |
| 121 | SOC_DOUBLE("PCM Capture Volume", AC97_REC_GAIN, 8, 0, 31, 0), |
| 122 | SOC_SINGLE("PCM Capture Switch", AC97_REC_GAIN, 15, 1, 1), |
| 123 | |
| 124 | SOC_SINGLE("Mono Playback Volume", AC97_MASTER_MONO, 0, 31, 1), |
| 125 | SOC_SINGLE("Mono Playback Switch", AC97_MASTER_MONO, 15, 1, 1), |
| 126 | |
| 127 | SOC_SINGLE("Phone Capture Volume", AC97_PHONE, 0, 31, 1), |
| 128 | SOC_SINGLE("Phone Capture Switch", AC97_PHONE, 15, 1, 1), |
| 129 | |
| 130 | SOC_SINGLE("Mic Volume", AC97_MIC, 0, 31, 1), |
| 131 | SOC_SINGLE("Mic Switch", AC97_MIC, 15, 1, 1), |
| 132 | |
| 133 | SOC_SINGLE("Stereo Mic Switch", AC97_AD_MISC, 6, 1, 0), |
| 134 | SOC_DOUBLE("Line HP Swap Switch", AC97_AD_MISC, 10, 5, 1, 0), |
| 135 | |
| 136 | SOC_DOUBLE("Surround Playback Volume", AC97_SURROUND_MASTER, 8, 0, 31, 1), |
| 137 | SOC_DOUBLE("Surround Playback Switch", AC97_SURROUND_MASTER, 15, 7, 1, 1), |
| 138 | |
Cliff Cai | 9905ed3 | 2008-11-18 16:18:16 +0800 | [diff] [blame] | 139 | SOC_DOUBLE("Center/LFE Playback Volume", AC97_CENTER_LFE_MASTER, 8, 0, 31, 1), |
| 140 | SOC_DOUBLE("Center/LFE Playback Switch", AC97_CENTER_LFE_MASTER, 15, 7, 1, 1), |
| 141 | |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 142 | SOC_ENUM("Capture Source", ad1980_cap_src), |
| 143 | |
| 144 | SOC_SINGLE("Mic Boost Switch", AC97_MIC, 6, 1, 0), |
| 145 | }; |
| 146 | |
Mark Brown | 9e7e474 | 2013-08-06 23:51:12 +0100 | [diff] [blame] | 147 | static const struct snd_soc_dapm_widget ad1980_dapm_widgets[] = { |
| 148 | SND_SOC_DAPM_INPUT("MIC1"), |
| 149 | SND_SOC_DAPM_INPUT("MIC2"), |
| 150 | SND_SOC_DAPM_INPUT("CD_L"), |
| 151 | SND_SOC_DAPM_INPUT("CD_R"), |
| 152 | SND_SOC_DAPM_INPUT("AUX_L"), |
| 153 | SND_SOC_DAPM_INPUT("AUX_R"), |
| 154 | SND_SOC_DAPM_INPUT("LINE_IN_L"), |
| 155 | SND_SOC_DAPM_INPUT("LINE_IN_R"), |
| 156 | |
| 157 | SND_SOC_DAPM_OUTPUT("LFE_OUT"), |
| 158 | SND_SOC_DAPM_OUTPUT("CENTER_OUT"), |
| 159 | SND_SOC_DAPM_OUTPUT("LINE_OUT_L"), |
| 160 | SND_SOC_DAPM_OUTPUT("LINE_OUT_R"), |
| 161 | SND_SOC_DAPM_OUTPUT("MONO_OUT"), |
| 162 | SND_SOC_DAPM_OUTPUT("HP_OUT_L"), |
| 163 | SND_SOC_DAPM_OUTPUT("HP_OUT_R"), |
| 164 | }; |
| 165 | |
| 166 | static const struct snd_soc_dapm_route ad1980_dapm_routes[] = { |
| 167 | { "Capture", NULL, "MIC1" }, |
| 168 | { "Capture", NULL, "MIC2" }, |
| 169 | { "Capture", NULL, "CD_L" }, |
| 170 | { "Capture", NULL, "CD_R" }, |
| 171 | { "Capture", NULL, "AUX_L" }, |
| 172 | { "Capture", NULL, "AUX_R" }, |
| 173 | { "Capture", NULL, "LINE_IN_L" }, |
| 174 | { "Capture", NULL, "LINE_IN_R" }, |
| 175 | |
| 176 | { "LFE_OUT", NULL, "Playback" }, |
| 177 | { "CENTER_OUT", NULL, "Playback" }, |
| 178 | { "LINE_OUT_L", NULL, "Playback" }, |
| 179 | { "LINE_OUT_R", NULL, "Playback" }, |
| 180 | { "MONO_OUT", NULL, "Playback" }, |
| 181 | { "HP_OUT_L", NULL, "Playback" }, |
| 182 | { "HP_OUT_R", NULL, "Playback" }, |
| 183 | }; |
| 184 | |
Mark Brown | de535a5 | 2010-10-06 16:20:07 -0700 | [diff] [blame] | 185 | static struct snd_soc_dai_driver ad1980_dai = { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 186 | .name = "ad1980-hifi", |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 187 | .playback = { |
| 188 | .stream_name = "Playback", |
| 189 | .channels_min = 2, |
Cliff Cai | 9905ed3 | 2008-11-18 16:18:16 +0800 | [diff] [blame] | 190 | .channels_max = 6, |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 191 | .rates = SNDRV_PCM_RATE_48000, |
Mark Brown | 33f503c | 2009-05-02 12:24:55 +0100 | [diff] [blame] | 192 | .formats = SND_SOC_STD_AC97_FMTS, }, |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 193 | .capture = { |
| 194 | .stream_name = "Capture", |
| 195 | .channels_min = 2, |
| 196 | .channels_max = 2, |
| 197 | .rates = SNDRV_PCM_RATE_48000, |
Mark Brown | 33f503c | 2009-05-02 12:24:55 +0100 | [diff] [blame] | 198 | .formats = SND_SOC_STD_AC97_FMTS, }, |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 199 | }; |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 200 | |
Lars-Peter Clausen | 3ab3dbd | 2015-07-21 21:53:02 +0200 | [diff] [blame] | 201 | #define AD1980_VENDOR_ID 0x41445300 |
| 202 | #define AD1980_VENDOR_MASK 0xffffff00 |
| 203 | |
Kuninori Morimoto | ac6267e | 2018-01-29 04:26:20 +0000 | [diff] [blame] | 204 | static int ad1980_reset(struct snd_soc_component *component, int try_warm) |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 205 | { |
Kuninori Morimoto | ac6267e | 2018-01-29 04:26:20 +0000 | [diff] [blame] | 206 | struct snd_ac97 *ac97 = snd_soc_component_get_drvdata(component); |
Lars-Peter Clausen | cf7b71f4 | 2014-05-20 14:23:10 +0200 | [diff] [blame] | 207 | unsigned int retry_cnt = 0; |
Lars-Peter Clausen | 3ab3dbd | 2015-07-21 21:53:02 +0200 | [diff] [blame] | 208 | int ret; |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 209 | |
Lars-Peter Clausen | cf7b71f4 | 2014-05-20 14:23:10 +0200 | [diff] [blame] | 210 | do { |
Lars-Peter Clausen | 3ab3dbd | 2015-07-21 21:53:02 +0200 | [diff] [blame] | 211 | ret = snd_ac97_reset(ac97, true, AD1980_VENDOR_ID, |
| 212 | AD1980_VENDOR_MASK); |
| 213 | if (ret >= 0) |
| 214 | return 0; |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 215 | |
Lars-Peter Clausen | cf7b71f4 | 2014-05-20 14:23:10 +0200 | [diff] [blame] | 216 | /* |
| 217 | * Set bit 16slot in register 74h, then every slot will has only |
| 218 | * 16 bits. This command is sent out in 20bit mode, in which |
| 219 | * case the first nibble of data is eaten by the addr. (Tag is |
| 220 | * always 16 bit) |
| 221 | */ |
Kuninori Morimoto | ac6267e | 2018-01-29 04:26:20 +0000 | [diff] [blame] | 222 | snd_soc_component_write(component, AC97_AD_SERIAL_CFG, 0x9900); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 223 | |
Lars-Peter Clausen | cf7b71f4 | 2014-05-20 14:23:10 +0200 | [diff] [blame] | 224 | } while (retry_cnt++ < 10); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 225 | |
Kuninori Morimoto | ac6267e | 2018-01-29 04:26:20 +0000 | [diff] [blame] | 226 | dev_err(component->dev, "Failed to reset: AC97 link error\n"); |
Lars-Peter Clausen | e5adb6c | 2014-10-30 21:00:59 +0100 | [diff] [blame] | 227 | |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 228 | return -EIO; |
| 229 | } |
| 230 | |
Kuninori Morimoto | ac6267e | 2018-01-29 04:26:20 +0000 | [diff] [blame] | 231 | static int ad1980_soc_probe(struct snd_soc_component *component) |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 232 | { |
Lars-Peter Clausen | 358a8bb | 2014-11-10 22:41:53 +0100 | [diff] [blame] | 233 | struct snd_ac97 *ac97; |
Lars-Peter Clausen | 82d1463 | 2014-11-18 19:45:53 +0100 | [diff] [blame] | 234 | struct regmap *regmap; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 235 | int ret; |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 236 | u16 vendor_id2; |
Cliff Cai | 9905ed3 | 2008-11-18 16:18:16 +0800 | [diff] [blame] | 237 | u16 ext_status; |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 238 | |
Kuninori Morimoto | ac6267e | 2018-01-29 04:26:20 +0000 | [diff] [blame] | 239 | ac97 = snd_soc_new_ac97_component(component, 0, 0); |
Lars-Peter Clausen | 358a8bb | 2014-11-10 22:41:53 +0100 | [diff] [blame] | 240 | if (IS_ERR(ac97)) { |
| 241 | ret = PTR_ERR(ac97); |
Kuninori Morimoto | ac6267e | 2018-01-29 04:26:20 +0000 | [diff] [blame] | 242 | dev_err(component->dev, "Failed to register AC97 component: %d\n", ret); |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 243 | return ret; |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 244 | } |
| 245 | |
Lars-Peter Clausen | 82d1463 | 2014-11-18 19:45:53 +0100 | [diff] [blame] | 246 | regmap = regmap_init_ac97(ac97, &ad1980_regmap_config); |
| 247 | if (IS_ERR(regmap)) { |
| 248 | ret = PTR_ERR(regmap); |
| 249 | goto err_free_ac97; |
| 250 | } |
| 251 | |
Kuninori Morimoto | ac6267e | 2018-01-29 04:26:20 +0000 | [diff] [blame] | 252 | snd_soc_component_init_regmap(component, regmap); |
| 253 | snd_soc_component_set_drvdata(component, ac97); |
Lars-Peter Clausen | 358a8bb | 2014-11-10 22:41:53 +0100 | [diff] [blame] | 254 | |
Kuninori Morimoto | ac6267e | 2018-01-29 04:26:20 +0000 | [diff] [blame] | 255 | ret = ad1980_reset(component, 0); |
Lars-Peter Clausen | e5adb6c | 2014-10-30 21:00:59 +0100 | [diff] [blame] | 256 | if (ret < 0) |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 257 | goto reset_err; |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 258 | |
Kuninori Morimoto | ac6267e | 2018-01-29 04:26:20 +0000 | [diff] [blame] | 259 | vendor_id2 = snd_soc_component_read32(component, AC97_VENDOR_ID2); |
Lars-Peter Clausen | 3ab3dbd | 2015-07-21 21:53:02 +0200 | [diff] [blame] | 260 | if (vendor_id2 == 0x5374) { |
Kuninori Morimoto | ac6267e | 2018-01-29 04:26:20 +0000 | [diff] [blame] | 261 | dev_warn(component->dev, |
Lars-Peter Clausen | 3ab3dbd | 2015-07-21 21:53:02 +0200 | [diff] [blame] | 262 | "Found AD1981 - only 2/2 IN/OUT Channels supported\n"); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 263 | } |
| 264 | |
Cliff Cai | 9905ed3 | 2008-11-18 16:18:16 +0800 | [diff] [blame] | 265 | /* unmute captures and playbacks volume */ |
Kuninori Morimoto | ac6267e | 2018-01-29 04:26:20 +0000 | [diff] [blame] | 266 | snd_soc_component_write(component, AC97_MASTER, 0x0000); |
| 267 | snd_soc_component_write(component, AC97_PCM, 0x0000); |
| 268 | snd_soc_component_write(component, AC97_REC_GAIN, 0x0000); |
| 269 | snd_soc_component_write(component, AC97_CENTER_LFE_MASTER, 0x0000); |
| 270 | snd_soc_component_write(component, AC97_SURROUND_MASTER, 0x0000); |
Cliff Cai | 9905ed3 | 2008-11-18 16:18:16 +0800 | [diff] [blame] | 271 | |
| 272 | /*power on LFE/CENTER/Surround DACs*/ |
Kuninori Morimoto | ac6267e | 2018-01-29 04:26:20 +0000 | [diff] [blame] | 273 | ext_status = snd_soc_component_read32(component, AC97_EXTENDED_STATUS); |
| 274 | snd_soc_component_write(component, AC97_EXTENDED_STATUS, ext_status&~0x3800); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 275 | |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 276 | return 0; |
| 277 | |
| 278 | reset_err: |
Kuninori Morimoto | ac6267e | 2018-01-29 04:26:20 +0000 | [diff] [blame] | 279 | snd_soc_component_exit_regmap(component); |
Lars-Peter Clausen | 82d1463 | 2014-11-18 19:45:53 +0100 | [diff] [blame] | 280 | err_free_ac97: |
Kuninori Morimoto | ac6267e | 2018-01-29 04:26:20 +0000 | [diff] [blame] | 281 | snd_soc_free_ac97_component(ac97); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 282 | return ret; |
| 283 | } |
| 284 | |
Kuninori Morimoto | ac6267e | 2018-01-29 04:26:20 +0000 | [diff] [blame] | 285 | static void ad1980_soc_remove(struct snd_soc_component *component) |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 286 | { |
Kuninori Morimoto | ac6267e | 2018-01-29 04:26:20 +0000 | [diff] [blame] | 287 | struct snd_ac97 *ac97 = snd_soc_component_get_drvdata(component); |
Lars-Peter Clausen | 358a8bb | 2014-11-10 22:41:53 +0100 | [diff] [blame] | 288 | |
Kuninori Morimoto | ac6267e | 2018-01-29 04:26:20 +0000 | [diff] [blame] | 289 | snd_soc_component_exit_regmap(component); |
| 290 | snd_soc_free_ac97_component(ac97); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 291 | } |
| 292 | |
Kuninori Morimoto | ac6267e | 2018-01-29 04:26:20 +0000 | [diff] [blame] | 293 | static const struct snd_soc_component_driver soc_component_dev_ad1980 = { |
| 294 | .probe = ad1980_soc_probe, |
| 295 | .remove = ad1980_soc_remove, |
| 296 | .controls = ad1980_snd_ac97_controls, |
| 297 | .num_controls = ARRAY_SIZE(ad1980_snd_ac97_controls), |
| 298 | .dapm_widgets = ad1980_dapm_widgets, |
| 299 | .num_dapm_widgets = ARRAY_SIZE(ad1980_dapm_widgets), |
| 300 | .dapm_routes = ad1980_dapm_routes, |
| 301 | .num_dapm_routes = ARRAY_SIZE(ad1980_dapm_routes), |
| 302 | .idle_bias_on = 1, |
| 303 | .use_pmdown_time = 1, |
| 304 | .endianness = 1, |
| 305 | .non_legacy_dai_naming = 1, |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 306 | }; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 307 | |
Bill Pemberton | 7a79e94 | 2012-12-07 09:26:37 -0500 | [diff] [blame] | 308 | static int ad1980_probe(struct platform_device *pdev) |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 309 | { |
Kuninori Morimoto | ac6267e | 2018-01-29 04:26:20 +0000 | [diff] [blame] | 310 | return devm_snd_soc_register_component(&pdev->dev, |
| 311 | &soc_component_dev_ad1980, &ad1980_dai, 1); |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 312 | } |
| 313 | |
| 314 | static struct platform_driver ad1980_codec_driver = { |
| 315 | .driver = { |
Mike Frysinger | 1afa98b | 2011-03-27 00:44:13 -0400 | [diff] [blame] | 316 | .name = "ad1980", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 317 | }, |
| 318 | |
| 319 | .probe = ad1980_probe, |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 320 | }; |
| 321 | |
Mark Brown | 5bbcc3c | 2011-11-23 22:52:08 +0000 | [diff] [blame] | 322 | module_platform_driver(ad1980_codec_driver); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 323 | |
Sonic Zhang | 2e2211a | 2010-08-07 12:06:07 -0400 | [diff] [blame] | 324 | MODULE_DESCRIPTION("ASoC ad1980 driver (Obsolete)"); |
Cliff Cai | 5f57dc8 | 2008-07-29 11:42:34 +0100 | [diff] [blame] | 325 | MODULE_AUTHOR("Roy Huang, Cliff Cai"); |
| 326 | MODULE_LICENSE("GPL"); |