Axel Lin | dfc0c82 | 2019-04-17 22:16:29 +0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | // |
| 3 | // arizona-micsupp.c -- Microphone supply for Arizona devices |
| 4 | // |
| 5 | // Copyright 2012 Wolfson Microelectronics PLC. |
| 6 | // |
| 7 | // Author: Mark Brown <broonie@opensource.wolfsonmicro.com> |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 8 | |
| 9 | #include <linux/module.h> |
| 10 | #include <linux/moduleparam.h> |
| 11 | #include <linux/init.h> |
| 12 | #include <linux/bitops.h> |
| 13 | #include <linux/err.h> |
Charles Keepax | 6f1c9c5 | 2014-05-08 17:17:38 +0100 | [diff] [blame] | 14 | #include <linux/of.h> |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 15 | #include <linux/platform_device.h> |
| 16 | #include <linux/regulator/driver.h> |
| 17 | #include <linux/regulator/machine.h> |
Charles Keepax | 36bcdf1 | 2014-04-16 10:01:41 +0100 | [diff] [blame] | 18 | #include <linux/regulator/of_regulator.h> |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 19 | #include <linux/slab.h> |
Mark Brown | e6ed905 | 2013-01-10 19:14:11 +0000 | [diff] [blame] | 20 | #include <linux/workqueue.h> |
| 21 | #include <sound/soc.h> |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 22 | |
| 23 | #include <linux/mfd/arizona/core.h> |
| 24 | #include <linux/mfd/arizona/pdata.h> |
| 25 | #include <linux/mfd/arizona/registers.h> |
| 26 | |
Richard Fitzgerald | 7bd7916 | 2019-05-21 11:04:39 +0100 | [diff] [blame] | 27 | #include <linux/mfd/madera/core.h> |
| 28 | #include <linux/mfd/madera/pdata.h> |
| 29 | #include <linux/mfd/madera/registers.h> |
| 30 | |
Richard Fitzgerald | 22161f3 | 2017-04-18 11:43:49 +0100 | [diff] [blame] | 31 | #include <linux/regulator/arizona-micsupp.h> |
| 32 | |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 33 | struct arizona_micsupp { |
| 34 | struct regulator_dev *regulator; |
Richard Fitzgerald | e165983 | 2017-04-18 11:43:50 +0100 | [diff] [blame] | 35 | struct regmap *regmap; |
| 36 | struct snd_soc_dapm_context **dapm; |
| 37 | unsigned int enable_reg; |
| 38 | struct device *dev; |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 39 | |
| 40 | struct regulator_consumer_supply supply; |
| 41 | struct regulator_init_data init_data; |
Mark Brown | e6ed905 | 2013-01-10 19:14:11 +0000 | [diff] [blame] | 42 | |
| 43 | struct work_struct check_cp_work; |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 44 | }; |
| 45 | |
Mark Brown | e6ed905 | 2013-01-10 19:14:11 +0000 | [diff] [blame] | 46 | static void arizona_micsupp_check_cp(struct work_struct *work) |
| 47 | { |
| 48 | struct arizona_micsupp *micsupp = |
| 49 | container_of(work, struct arizona_micsupp, check_cp_work); |
Richard Fitzgerald | e165983 | 2017-04-18 11:43:50 +0100 | [diff] [blame] | 50 | struct snd_soc_dapm_context *dapm = *micsupp->dapm; |
| 51 | struct snd_soc_component *component; |
| 52 | unsigned int val; |
Mark Brown | e6ed905 | 2013-01-10 19:14:11 +0000 | [diff] [blame] | 53 | int ret; |
| 54 | |
Richard Fitzgerald | e165983 | 2017-04-18 11:43:50 +0100 | [diff] [blame] | 55 | ret = regmap_read(micsupp->regmap, micsupp->enable_reg, &val); |
Mark Brown | e6ed905 | 2013-01-10 19:14:11 +0000 | [diff] [blame] | 56 | if (ret != 0) { |
Richard Fitzgerald | e165983 | 2017-04-18 11:43:50 +0100 | [diff] [blame] | 57 | dev_err(micsupp->dev, |
| 58 | "Failed to read CP state: %d\n", ret); |
Mark Brown | e6ed905 | 2013-01-10 19:14:11 +0000 | [diff] [blame] | 59 | return; |
| 60 | } |
| 61 | |
| 62 | if (dapm) { |
Richard Fitzgerald | e165983 | 2017-04-18 11:43:50 +0100 | [diff] [blame] | 63 | component = snd_soc_dapm_to_component(dapm); |
| 64 | |
| 65 | if ((val & (ARIZONA_CPMIC_ENA | ARIZONA_CPMIC_BYPASS)) == |
Mark Brown | e6ed905 | 2013-01-10 19:14:11 +0000 | [diff] [blame] | 66 | ARIZONA_CPMIC_ENA) |
Richard Fitzgerald | 98cf996 | 2016-12-15 14:43:49 +0000 | [diff] [blame] | 67 | snd_soc_component_force_enable_pin(component, |
| 68 | "MICSUPP"); |
Mark Brown | e6ed905 | 2013-01-10 19:14:11 +0000 | [diff] [blame] | 69 | else |
Richard Fitzgerald | 98cf996 | 2016-12-15 14:43:49 +0000 | [diff] [blame] | 70 | snd_soc_component_disable_pin(component, "MICSUPP"); |
Mark Brown | e6ed905 | 2013-01-10 19:14:11 +0000 | [diff] [blame] | 71 | |
| 72 | snd_soc_dapm_sync(dapm); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | static int arizona_micsupp_enable(struct regulator_dev *rdev) |
| 77 | { |
| 78 | struct arizona_micsupp *micsupp = rdev_get_drvdata(rdev); |
| 79 | int ret; |
| 80 | |
| 81 | ret = regulator_enable_regmap(rdev); |
| 82 | |
| 83 | if (ret == 0) |
| 84 | schedule_work(&micsupp->check_cp_work); |
| 85 | |
| 86 | return ret; |
| 87 | } |
| 88 | |
| 89 | static int arizona_micsupp_disable(struct regulator_dev *rdev) |
| 90 | { |
| 91 | struct arizona_micsupp *micsupp = rdev_get_drvdata(rdev); |
| 92 | int ret; |
| 93 | |
| 94 | ret = regulator_disable_regmap(rdev); |
| 95 | if (ret == 0) |
| 96 | schedule_work(&micsupp->check_cp_work); |
| 97 | |
| 98 | return ret; |
| 99 | } |
| 100 | |
| 101 | static int arizona_micsupp_set_bypass(struct regulator_dev *rdev, bool ena) |
| 102 | { |
| 103 | struct arizona_micsupp *micsupp = rdev_get_drvdata(rdev); |
| 104 | int ret; |
| 105 | |
| 106 | ret = regulator_set_bypass_regmap(rdev, ena); |
| 107 | if (ret == 0) |
| 108 | schedule_work(&micsupp->check_cp_work); |
| 109 | |
| 110 | return ret; |
| 111 | } |
| 112 | |
Bhumika Goyal | 2773ead | 2017-01-28 19:10:00 +0530 | [diff] [blame] | 113 | static const struct regulator_ops arizona_micsupp_ops = { |
Mark Brown | e6ed905 | 2013-01-10 19:14:11 +0000 | [diff] [blame] | 114 | .enable = arizona_micsupp_enable, |
| 115 | .disable = arizona_micsupp_disable, |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 116 | .is_enabled = regulator_is_enabled_regmap, |
| 117 | |
Charles Keepax | 71979aa | 2013-11-15 13:13:32 +0000 | [diff] [blame] | 118 | .list_voltage = regulator_list_voltage_linear_range, |
| 119 | .map_voltage = regulator_map_voltage_linear_range, |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 120 | |
| 121 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
| 122 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
Mark Brown | e477ce0 | 2012-08-27 16:04:47 -0700 | [diff] [blame] | 123 | |
| 124 | .get_bypass = regulator_get_bypass_regmap, |
Mark Brown | e6ed905 | 2013-01-10 19:14:11 +0000 | [diff] [blame] | 125 | .set_bypass = arizona_micsupp_set_bypass, |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 126 | }; |
| 127 | |
Matti Vaittinen | 60ab7f4 | 2020-05-08 18:43:36 +0300 | [diff] [blame] | 128 | static const struct linear_range arizona_micsupp_ranges[] = { |
Charles Keepax | 71979aa | 2013-11-15 13:13:32 +0000 | [diff] [blame] | 129 | REGULATOR_LINEAR_RANGE(1700000, 0, 0x1e, 50000), |
| 130 | REGULATOR_LINEAR_RANGE(3300000, 0x1f, 0x1f, 0), |
| 131 | }; |
| 132 | |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 133 | static const struct regulator_desc arizona_micsupp = { |
| 134 | .name = "MICVDD", |
| 135 | .supply_name = "CPVDD", |
| 136 | .type = REGULATOR_VOLTAGE, |
Charles Keepax | 71979aa | 2013-11-15 13:13:32 +0000 | [diff] [blame] | 137 | .n_voltages = 32, |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 138 | .ops = &arizona_micsupp_ops, |
| 139 | |
| 140 | .vsel_reg = ARIZONA_LDO2_CONTROL_1, |
| 141 | .vsel_mask = ARIZONA_LDO2_VSEL_MASK, |
| 142 | .enable_reg = ARIZONA_MIC_CHARGE_PUMP_1, |
| 143 | .enable_mask = ARIZONA_CPMIC_ENA, |
Mark Brown | e477ce0 | 2012-08-27 16:04:47 -0700 | [diff] [blame] | 144 | .bypass_reg = ARIZONA_MIC_CHARGE_PUMP_1, |
| 145 | .bypass_mask = ARIZONA_CPMIC_BYPASS, |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 146 | |
Charles Keepax | 71979aa | 2013-11-15 13:13:32 +0000 | [diff] [blame] | 147 | .linear_ranges = arizona_micsupp_ranges, |
| 148 | .n_linear_ranges = ARRAY_SIZE(arizona_micsupp_ranges), |
| 149 | |
Mark Brown | 9507281 | 2012-11-27 14:55:49 +0000 | [diff] [blame] | 150 | .enable_time = 3000, |
| 151 | |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 152 | .owner = THIS_MODULE, |
| 153 | }; |
| 154 | |
Matti Vaittinen | 60ab7f4 | 2020-05-08 18:43:36 +0300 | [diff] [blame] | 155 | static const struct linear_range arizona_micsupp_ext_ranges[] = { |
Charles Keepax | d2e7491 | 2013-11-15 13:48:23 +0000 | [diff] [blame] | 156 | REGULATOR_LINEAR_RANGE(900000, 0, 0x14, 25000), |
| 157 | REGULATOR_LINEAR_RANGE(1500000, 0x15, 0x27, 100000), |
| 158 | }; |
| 159 | |
| 160 | static const struct regulator_desc arizona_micsupp_ext = { |
| 161 | .name = "MICVDD", |
| 162 | .supply_name = "CPVDD", |
| 163 | .type = REGULATOR_VOLTAGE, |
| 164 | .n_voltages = 40, |
| 165 | .ops = &arizona_micsupp_ops, |
| 166 | |
| 167 | .vsel_reg = ARIZONA_LDO2_CONTROL_1, |
| 168 | .vsel_mask = ARIZONA_LDO2_VSEL_MASK, |
| 169 | .enable_reg = ARIZONA_MIC_CHARGE_PUMP_1, |
| 170 | .enable_mask = ARIZONA_CPMIC_ENA, |
| 171 | .bypass_reg = ARIZONA_MIC_CHARGE_PUMP_1, |
| 172 | .bypass_mask = ARIZONA_CPMIC_BYPASS, |
| 173 | |
| 174 | .linear_ranges = arizona_micsupp_ext_ranges, |
| 175 | .n_linear_ranges = ARRAY_SIZE(arizona_micsupp_ext_ranges), |
| 176 | |
| 177 | .enable_time = 3000, |
| 178 | |
| 179 | .owner = THIS_MODULE, |
| 180 | }; |
| 181 | |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 182 | static const struct regulator_init_data arizona_micsupp_default = { |
| 183 | .constraints = { |
| 184 | .valid_ops_mask = REGULATOR_CHANGE_STATUS | |
Mark Brown | 9fc50a2 | 2013-01-10 19:31:47 +0000 | [diff] [blame] | 185 | REGULATOR_CHANGE_VOLTAGE | |
| 186 | REGULATOR_CHANGE_BYPASS, |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 187 | .min_uV = 1700000, |
| 188 | .max_uV = 3300000, |
| 189 | }, |
| 190 | |
| 191 | .num_consumer_supplies = 1, |
| 192 | }; |
| 193 | |
Charles Keepax | d2e7491 | 2013-11-15 13:48:23 +0000 | [diff] [blame] | 194 | static const struct regulator_init_data arizona_micsupp_ext_default = { |
| 195 | .constraints = { |
| 196 | .valid_ops_mask = REGULATOR_CHANGE_STATUS | |
| 197 | REGULATOR_CHANGE_VOLTAGE | |
| 198 | REGULATOR_CHANGE_BYPASS, |
| 199 | .min_uV = 900000, |
| 200 | .max_uV = 3300000, |
| 201 | }, |
| 202 | |
| 203 | .num_consumer_supplies = 1, |
| 204 | }; |
| 205 | |
Richard Fitzgerald | 7bd7916 | 2019-05-21 11:04:39 +0100 | [diff] [blame] | 206 | static const struct regulator_desc madera_micsupp = { |
| 207 | .name = "MICVDD", |
| 208 | .supply_name = "CPVDD1", |
| 209 | .type = REGULATOR_VOLTAGE, |
| 210 | .n_voltages = 40, |
| 211 | .ops = &arizona_micsupp_ops, |
| 212 | |
| 213 | .vsel_reg = MADERA_LDO2_CONTROL_1, |
| 214 | .vsel_mask = MADERA_LDO2_VSEL_MASK, |
| 215 | .enable_reg = MADERA_MIC_CHARGE_PUMP_1, |
| 216 | .enable_mask = MADERA_CPMIC_ENA, |
| 217 | .bypass_reg = MADERA_MIC_CHARGE_PUMP_1, |
| 218 | .bypass_mask = MADERA_CPMIC_BYPASS, |
| 219 | |
| 220 | .linear_ranges = arizona_micsupp_ext_ranges, |
| 221 | .n_linear_ranges = ARRAY_SIZE(arizona_micsupp_ext_ranges), |
| 222 | |
| 223 | .enable_time = 3000, |
| 224 | |
| 225 | .owner = THIS_MODULE, |
| 226 | }; |
| 227 | |
Richard Fitzgerald | 22161f3 | 2017-04-18 11:43:49 +0100 | [diff] [blame] | 228 | static int arizona_micsupp_of_get_pdata(struct arizona_micsupp_pdata *pdata, |
Javier Martinez Canillas | 072e78b | 2014-11-10 14:43:53 +0100 | [diff] [blame] | 229 | struct regulator_config *config, |
| 230 | const struct regulator_desc *desc) |
Charles Keepax | 36bcdf1 | 2014-04-16 10:01:41 +0100 | [diff] [blame] | 231 | { |
Charles Keepax | 36bcdf1 | 2014-04-16 10:01:41 +0100 | [diff] [blame] | 232 | struct arizona_micsupp *micsupp = config->driver_data; |
| 233 | struct device_node *np; |
| 234 | struct regulator_init_data *init_data; |
| 235 | |
Richard Fitzgerald | 22161f3 | 2017-04-18 11:43:49 +0100 | [diff] [blame] | 236 | np = of_get_child_by_name(config->dev->of_node, "micvdd"); |
Charles Keepax | 36bcdf1 | 2014-04-16 10:01:41 +0100 | [diff] [blame] | 237 | |
| 238 | if (np) { |
| 239 | config->of_node = np; |
| 240 | |
Richard Fitzgerald | 22161f3 | 2017-04-18 11:43:49 +0100 | [diff] [blame] | 241 | init_data = of_get_regulator_init_data(config->dev, np, desc); |
Charles Keepax | 36bcdf1 | 2014-04-16 10:01:41 +0100 | [diff] [blame] | 242 | |
| 243 | if (init_data) { |
| 244 | init_data->consumer_supplies = &micsupp->supply; |
| 245 | init_data->num_consumer_supplies = 1; |
| 246 | |
Richard Fitzgerald | 22161f3 | 2017-04-18 11:43:49 +0100 | [diff] [blame] | 247 | pdata->init_data = init_data; |
Charles Keepax | 36bcdf1 | 2014-04-16 10:01:41 +0100 | [diff] [blame] | 248 | } |
| 249 | } |
| 250 | |
| 251 | return 0; |
| 252 | } |
| 253 | |
Richard Fitzgerald | 7d8d14b | 2017-04-18 11:43:51 +0100 | [diff] [blame] | 254 | static int arizona_micsupp_common_init(struct platform_device *pdev, |
| 255 | struct arizona_micsupp *micsupp, |
| 256 | const struct regulator_desc *desc, |
| 257 | struct arizona_micsupp_pdata *pdata) |
| 258 | { |
| 259 | struct regulator_config config = { }; |
| 260 | int ret; |
| 261 | |
| 262 | INIT_WORK(&micsupp->check_cp_work, arizona_micsupp_check_cp); |
| 263 | |
| 264 | micsupp->init_data.consumer_supplies = &micsupp->supply; |
| 265 | micsupp->supply.supply = "MICVDD"; |
| 266 | micsupp->supply.dev_name = dev_name(micsupp->dev); |
| 267 | micsupp->enable_reg = desc->enable_reg; |
| 268 | |
| 269 | config.dev = micsupp->dev; |
| 270 | config.driver_data = micsupp; |
| 271 | config.regmap = micsupp->regmap; |
| 272 | |
| 273 | if (IS_ENABLED(CONFIG_OF)) { |
| 274 | if (!dev_get_platdata(micsupp->dev)) { |
| 275 | ret = arizona_micsupp_of_get_pdata(pdata, &config, |
| 276 | desc); |
| 277 | if (ret < 0) |
| 278 | return ret; |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | if (pdata->init_data) |
| 283 | config.init_data = pdata->init_data; |
| 284 | else |
| 285 | config.init_data = &micsupp->init_data; |
| 286 | |
| 287 | /* Default to regulated mode */ |
| 288 | regmap_update_bits(micsupp->regmap, micsupp->enable_reg, |
| 289 | ARIZONA_CPMIC_BYPASS, 0); |
| 290 | |
| 291 | micsupp->regulator = devm_regulator_register(&pdev->dev, |
| 292 | desc, |
| 293 | &config); |
| 294 | |
| 295 | of_node_put(config.of_node); |
| 296 | |
| 297 | if (IS_ERR(micsupp->regulator)) { |
| 298 | ret = PTR_ERR(micsupp->regulator); |
| 299 | dev_err(micsupp->dev, "Failed to register mic supply: %d\n", |
| 300 | ret); |
| 301 | return ret; |
| 302 | } |
| 303 | |
| 304 | platform_set_drvdata(pdev, micsupp); |
| 305 | |
| 306 | return 0; |
| 307 | } |
| 308 | |
Bill Pemberton | a502357 | 2012-11-19 13:22:22 -0500 | [diff] [blame] | 309 | static int arizona_micsupp_probe(struct platform_device *pdev) |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 310 | { |
| 311 | struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); |
Charles Keepax | d2e7491 | 2013-11-15 13:48:23 +0000 | [diff] [blame] | 312 | const struct regulator_desc *desc; |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 313 | struct arizona_micsupp *micsupp; |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 314 | |
| 315 | micsupp = devm_kzalloc(&pdev->dev, sizeof(*micsupp), GFP_KERNEL); |
Sachin Kamat | 820cd31 | 2014-02-18 16:11:10 +0530 | [diff] [blame] | 316 | if (!micsupp) |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 317 | return -ENOMEM; |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 318 | |
Richard Fitzgerald | e165983 | 2017-04-18 11:43:50 +0100 | [diff] [blame] | 319 | micsupp->regmap = arizona->regmap; |
| 320 | micsupp->dapm = &arizona->dapm; |
| 321 | micsupp->dev = arizona->dev; |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 322 | |
| 323 | /* |
| 324 | * Since the chip usually supplies itself we provide some |
| 325 | * default init_data for it. This will be overridden with |
| 326 | * platform data if provided. |
| 327 | */ |
Charles Keepax | d2e7491 | 2013-11-15 13:48:23 +0000 | [diff] [blame] | 328 | switch (arizona->type) { |
| 329 | case WM5110: |
Richard Fitzgerald | f729311 | 2015-01-17 15:21:24 +0000 | [diff] [blame] | 330 | case WM8280: |
Charles Keepax | d2e7491 | 2013-11-15 13:48:23 +0000 | [diff] [blame] | 331 | desc = &arizona_micsupp_ext; |
| 332 | micsupp->init_data = arizona_micsupp_ext_default; |
| 333 | break; |
| 334 | default: |
| 335 | desc = &arizona_micsupp; |
| 336 | micsupp->init_data = arizona_micsupp_default; |
| 337 | break; |
| 338 | } |
| 339 | |
Richard Fitzgerald | 7d8d14b | 2017-04-18 11:43:51 +0100 | [diff] [blame] | 340 | return arizona_micsupp_common_init(pdev, micsupp, desc, |
| 341 | &arizona->pdata.micvdd); |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 342 | } |
| 343 | |
Richard Fitzgerald | 7bd7916 | 2019-05-21 11:04:39 +0100 | [diff] [blame] | 344 | static int madera_micsupp_probe(struct platform_device *pdev) |
| 345 | { |
| 346 | struct madera *madera = dev_get_drvdata(pdev->dev.parent); |
| 347 | struct arizona_micsupp *micsupp; |
| 348 | |
| 349 | micsupp = devm_kzalloc(&pdev->dev, sizeof(*micsupp), GFP_KERNEL); |
| 350 | if (!micsupp) |
| 351 | return -ENOMEM; |
| 352 | |
| 353 | micsupp->regmap = madera->regmap; |
| 354 | micsupp->dapm = &madera->dapm; |
| 355 | micsupp->dev = madera->dev; |
| 356 | micsupp->init_data = arizona_micsupp_ext_default; |
| 357 | |
| 358 | return arizona_micsupp_common_init(pdev, micsupp, &madera_micsupp, |
| 359 | &madera->pdata.micvdd); |
| 360 | } |
| 361 | |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 362 | static struct platform_driver arizona_micsupp_driver = { |
| 363 | .probe = arizona_micsupp_probe, |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 364 | .driver = { |
| 365 | .name = "arizona-micsupp", |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 366 | }, |
| 367 | }; |
| 368 | |
Richard Fitzgerald | 7bd7916 | 2019-05-21 11:04:39 +0100 | [diff] [blame] | 369 | static struct platform_driver madera_micsupp_driver = { |
| 370 | .probe = madera_micsupp_probe, |
| 371 | .driver = { |
| 372 | .name = "madera-micsupp", |
| 373 | }, |
| 374 | }; |
| 375 | |
| 376 | static struct platform_driver * const arizona_micsupp_drivers[] = { |
| 377 | &arizona_micsupp_driver, |
| 378 | &madera_micsupp_driver, |
| 379 | }; |
| 380 | |
| 381 | static int __init arizona_micsupp_init(void) |
| 382 | { |
| 383 | return platform_register_drivers(arizona_micsupp_drivers, |
| 384 | ARRAY_SIZE(arizona_micsupp_drivers)); |
| 385 | } |
| 386 | module_init(arizona_micsupp_init); |
| 387 | |
| 388 | static void __exit arizona_micsupp_exit(void) |
| 389 | { |
| 390 | platform_unregister_drivers(arizona_micsupp_drivers, |
| 391 | ARRAY_SIZE(arizona_micsupp_drivers)); |
| 392 | } |
| 393 | module_exit(arizona_micsupp_exit); |
Mark Brown | b667a45 | 2012-06-14 18:14:00 +0100 | [diff] [blame] | 394 | |
| 395 | /* Module information */ |
| 396 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); |
| 397 | MODULE_DESCRIPTION("Arizona microphone supply driver"); |
| 398 | MODULE_LICENSE("GPL"); |
| 399 | MODULE_ALIAS("platform:arizona-micsupp"); |
Richard Fitzgerald | 7bd7916 | 2019-05-21 11:04:39 +0100 | [diff] [blame] | 400 | MODULE_ALIAS("platform:madera-micsupp"); |