Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Arizona interrupt support |
| 3 | * |
| 4 | * Copyright 2012 Wolfson Microelectronics plc |
| 5 | * |
| 6 | * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License version 2 as |
| 10 | * published by the Free Software Foundation. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/delay.h> |
| 14 | #include <linux/gpio.h> |
| 15 | #include <linux/interrupt.h> |
| 16 | #include <linux/irq.h> |
| 17 | #include <linux/irqdomain.h> |
| 18 | #include <linux/module.h> |
| 19 | #include <linux/pm_runtime.h> |
| 20 | #include <linux/regmap.h> |
| 21 | #include <linux/regulator/consumer.h> |
| 22 | #include <linux/slab.h> |
| 23 | |
| 24 | #include <linux/mfd/arizona/core.h> |
| 25 | #include <linux/mfd/arizona/registers.h> |
| 26 | |
| 27 | #include "arizona.h" |
| 28 | |
| 29 | static int arizona_map_irq(struct arizona *arizona, int irq) |
| 30 | { |
| 31 | int ret; |
| 32 | |
Richard Fitzgerald | ea1f333 | 2015-11-03 15:08:32 +0000 | [diff] [blame] | 33 | if (arizona->aod_irq_chip) { |
| 34 | ret = regmap_irq_get_virq(arizona->aod_irq_chip, irq); |
| 35 | if (ret >= 0) |
| 36 | return ret; |
| 37 | } |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 38 | |
Richard Fitzgerald | ea1f333 | 2015-11-03 15:08:32 +0000 | [diff] [blame] | 39 | return regmap_irq_get_virq(arizona->irq_chip, irq); |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | int arizona_request_irq(struct arizona *arizona, int irq, char *name, |
| 43 | irq_handler_t handler, void *data) |
| 44 | { |
| 45 | irq = arizona_map_irq(arizona, irq); |
| 46 | if (irq < 0) |
| 47 | return irq; |
| 48 | |
| 49 | return request_threaded_irq(irq, NULL, handler, IRQF_ONESHOT, |
| 50 | name, data); |
| 51 | } |
| 52 | EXPORT_SYMBOL_GPL(arizona_request_irq); |
| 53 | |
| 54 | void arizona_free_irq(struct arizona *arizona, int irq, void *data) |
| 55 | { |
| 56 | irq = arizona_map_irq(arizona, irq); |
| 57 | if (irq < 0) |
| 58 | return; |
| 59 | |
| 60 | free_irq(irq, data); |
| 61 | } |
| 62 | EXPORT_SYMBOL_GPL(arizona_free_irq); |
| 63 | |
| 64 | int arizona_set_irq_wake(struct arizona *arizona, int irq, int on) |
| 65 | { |
| 66 | irq = arizona_map_irq(arizona, irq); |
| 67 | if (irq < 0) |
| 68 | return irq; |
| 69 | |
| 70 | return irq_set_irq_wake(irq, on); |
| 71 | } |
| 72 | EXPORT_SYMBOL_GPL(arizona_set_irq_wake); |
| 73 | |
| 74 | static irqreturn_t arizona_boot_done(int irq, void *data) |
| 75 | { |
| 76 | struct arizona *arizona = data; |
| 77 | |
| 78 | dev_dbg(arizona->dev, "Boot done\n"); |
| 79 | |
| 80 | return IRQ_HANDLED; |
| 81 | } |
| 82 | |
| 83 | static irqreturn_t arizona_ctrlif_err(int irq, void *data) |
| 84 | { |
| 85 | struct arizona *arizona = data; |
| 86 | |
| 87 | /* |
| 88 | * For pretty much all potential sources a register cache sync |
| 89 | * won't help, we've just got a software bug somewhere. |
| 90 | */ |
| 91 | dev_err(arizona->dev, "Control interface error\n"); |
| 92 | |
| 93 | return IRQ_HANDLED; |
| 94 | } |
| 95 | |
| 96 | static irqreturn_t arizona_irq_thread(int irq, void *data) |
| 97 | { |
| 98 | struct arizona *arizona = data; |
Mark Brown | 3092f80 | 2013-03-24 23:05:58 +0000 | [diff] [blame] | 99 | bool poll; |
Mark Brown | 3080de4 | 2012-08-21 20:02:03 +0100 | [diff] [blame] | 100 | unsigned int val; |
Mark Brown | cdabc1c | 2012-09-08 09:00:59 +0800 | [diff] [blame] | 101 | int ret; |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 102 | |
| 103 | ret = pm_runtime_get_sync(arizona->dev); |
| 104 | if (ret < 0) { |
| 105 | dev_err(arizona->dev, "Failed to resume device: %d\n", ret); |
| 106 | return IRQ_NONE; |
| 107 | } |
| 108 | |
Mark Brown | 3092f80 | 2013-03-24 23:05:58 +0000 | [diff] [blame] | 109 | do { |
| 110 | poll = false; |
Mark Brown | 3080de4 | 2012-08-21 20:02:03 +0100 | [diff] [blame] | 111 | |
Richard Fitzgerald | ea1f333 | 2015-11-03 15:08:32 +0000 | [diff] [blame] | 112 | if (arizona->aod_irq_chip) |
| 113 | handle_nested_irq(irq_find_mapping(arizona->virq, 0)); |
Mark Brown | 3092f80 | 2013-03-24 23:05:58 +0000 | [diff] [blame] | 114 | |
| 115 | /* |
| 116 | * Check if one of the main interrupts is asserted and only |
| 117 | * check that domain if it is. |
| 118 | */ |
| 119 | ret = regmap_read(arizona->regmap, ARIZONA_IRQ_PIN_STATUS, |
| 120 | &val); |
| 121 | if (ret == 0 && val & ARIZONA_IRQ1_STS) { |
| 122 | handle_nested_irq(irq_find_mapping(arizona->virq, 1)); |
| 123 | } else if (ret != 0) { |
| 124 | dev_err(arizona->dev, |
| 125 | "Failed to read main IRQ status: %d\n", ret); |
| 126 | } |
| 127 | |
| 128 | /* |
| 129 | * Poll the IRQ pin status to see if we're really done |
| 130 | * if the interrupt controller can't do it for us. |
| 131 | */ |
| 132 | if (!arizona->pdata.irq_gpio) { |
| 133 | break; |
| 134 | } else if (arizona->pdata.irq_flags & IRQF_TRIGGER_RISING && |
| 135 | gpio_get_value_cansleep(arizona->pdata.irq_gpio)) { |
| 136 | poll = true; |
| 137 | } else if (arizona->pdata.irq_flags & IRQF_TRIGGER_FALLING && |
| 138 | !gpio_get_value_cansleep(arizona->pdata.irq_gpio)) { |
| 139 | poll = true; |
| 140 | } |
| 141 | } while (poll); |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 142 | |
| 143 | pm_runtime_mark_last_busy(arizona->dev); |
| 144 | pm_runtime_put_autosuspend(arizona->dev); |
| 145 | |
| 146 | return IRQ_HANDLED; |
| 147 | } |
| 148 | |
| 149 | static void arizona_irq_enable(struct irq_data *data) |
| 150 | { |
| 151 | } |
| 152 | |
| 153 | static void arizona_irq_disable(struct irq_data *data) |
| 154 | { |
| 155 | } |
| 156 | |
Charles Keepax | c38715f | 2014-09-01 15:29:11 +0100 | [diff] [blame] | 157 | static int arizona_irq_set_wake(struct irq_data *data, unsigned int on) |
| 158 | { |
| 159 | struct arizona *arizona = irq_data_get_irq_chip_data(data); |
| 160 | |
| 161 | return irq_set_irq_wake(arizona->irq, on); |
| 162 | } |
| 163 | |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 164 | static struct irq_chip arizona_irq_chip = { |
| 165 | .name = "arizona", |
| 166 | .irq_disable = arizona_irq_disable, |
| 167 | .irq_enable = arizona_irq_enable, |
Charles Keepax | c38715f | 2014-09-01 15:29:11 +0100 | [diff] [blame] | 168 | .irq_set_wake = arizona_irq_set_wake, |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 169 | }; |
| 170 | |
Charles Keepax | dedf24a | 2016-03-25 14:27:09 +0000 | [diff] [blame] | 171 | static struct lock_class_key arizona_irq_lock_class; |
| 172 | |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 173 | static int arizona_irq_map(struct irq_domain *h, unsigned int virq, |
| 174 | irq_hw_number_t hw) |
| 175 | { |
Charles Keepax | 0a464df | 2015-09-11 16:07:56 +0100 | [diff] [blame] | 176 | struct arizona *data = h->host_data; |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 177 | |
| 178 | irq_set_chip_data(virq, data); |
Charles Keepax | dedf24a | 2016-03-25 14:27:09 +0000 | [diff] [blame] | 179 | irq_set_lockdep_class(virq, &arizona_irq_lock_class); |
Charles Keepax | cfeb35d | 2014-09-09 17:00:09 +0100 | [diff] [blame] | 180 | irq_set_chip_and_handler(virq, &arizona_irq_chip, handle_simple_irq); |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 181 | irq_set_nested_thread(virq, 1); |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 182 | irq_set_noprobe(virq); |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 183 | |
| 184 | return 0; |
| 185 | } |
| 186 | |
Krzysztof Kozlowski | 7ce7b26 | 2015-04-27 21:54:13 +0900 | [diff] [blame] | 187 | static const struct irq_domain_ops arizona_domain_ops = { |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 188 | .map = arizona_irq_map, |
| 189 | .xlate = irq_domain_xlate_twocell, |
| 190 | }; |
| 191 | |
| 192 | int arizona_irq_init(struct arizona *arizona) |
| 193 | { |
| 194 | int flags = IRQF_ONESHOT; |
| 195 | int ret, i; |
| 196 | const struct regmap_irq_chip *aod, *irq; |
Mark Brown | 22c75fe | 2013-03-24 23:16:56 +0000 | [diff] [blame] | 197 | struct irq_data *irq_data; |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 198 | |
Charles Keepax | 30a2af3 | 2014-07-15 11:21:50 +0100 | [diff] [blame] | 199 | arizona->ctrlif_error = true; |
| 200 | |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 201 | switch (arizona->type) { |
Mark Brown | 863df8d | 2012-07-05 20:35:31 +0100 | [diff] [blame] | 202 | #ifdef CONFIG_MFD_WM5102 |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 203 | case WM5102: |
| 204 | aod = &wm5102_aod; |
| 205 | irq = &wm5102_irq; |
Mark Brown | 92d8013 | 2012-08-07 19:57:53 +0100 | [diff] [blame] | 206 | |
Charles Keepax | 30a2af3 | 2014-07-15 11:21:50 +0100 | [diff] [blame] | 207 | arizona->ctrlif_error = false; |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 208 | break; |
Mark Brown | 863df8d | 2012-07-05 20:35:31 +0100 | [diff] [blame] | 209 | #endif |
Mark Brown | e102bef | 2012-07-10 12:37:58 +0100 | [diff] [blame] | 210 | #ifdef CONFIG_MFD_WM5110 |
| 211 | case WM5110: |
Richard Fitzgerald | e5d4ef0 | 2015-01-17 15:21:22 +0000 | [diff] [blame] | 212 | case WM8280: |
Mark Brown | e102bef | 2012-07-10 12:37:58 +0100 | [diff] [blame] | 213 | aod = &wm5110_aod; |
Charles Keepax | 3215501 | 2014-07-15 11:21:48 +0100 | [diff] [blame] | 214 | |
| 215 | switch (arizona->rev) { |
| 216 | case 0 ... 2: |
| 217 | irq = &wm5110_irq; |
| 218 | break; |
| 219 | default: |
| 220 | irq = &wm5110_revd_irq; |
| 221 | break; |
| 222 | } |
Mark Brown | 92d8013 | 2012-08-07 19:57:53 +0100 | [diff] [blame] | 223 | |
Charles Keepax | 30a2af3 | 2014-07-15 11:21:50 +0100 | [diff] [blame] | 224 | arizona->ctrlif_error = false; |
Mark Brown | e102bef | 2012-07-10 12:37:58 +0100 | [diff] [blame] | 225 | break; |
| 226 | #endif |
Richard Fitzgerald | ea1f333 | 2015-11-03 15:08:32 +0000 | [diff] [blame] | 227 | #ifdef CONFIG_MFD_CS47L24 |
| 228 | case WM1831: |
| 229 | case CS47L24: |
| 230 | aod = NULL; |
| 231 | irq = &cs47l24_irq; |
| 232 | |
| 233 | arizona->ctrlif_error = false; |
| 234 | break; |
| 235 | #endif |
Charles Keepax | dc7d486 | 2013-06-13 09:43:29 +0100 | [diff] [blame] | 236 | #ifdef CONFIG_MFD_WM8997 |
| 237 | case WM8997: |
| 238 | aod = &wm8997_aod; |
| 239 | irq = &wm8997_irq; |
| 240 | |
Charles Keepax | 30a2af3 | 2014-07-15 11:21:50 +0100 | [diff] [blame] | 241 | arizona->ctrlif_error = false; |
Charles Keepax | dc7d486 | 2013-06-13 09:43:29 +0100 | [diff] [blame] | 242 | break; |
| 243 | #endif |
Richard Fitzgerald | 6887b04 | 2015-07-03 16:16:35 +0100 | [diff] [blame] | 244 | #ifdef CONFIG_MFD_WM8998 |
| 245 | case WM8998: |
| 246 | case WM1814: |
| 247 | aod = &wm8998_aod; |
| 248 | irq = &wm8998_irq; |
| 249 | |
| 250 | arizona->ctrlif_error = false; |
| 251 | break; |
| 252 | #endif |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 253 | default: |
| 254 | BUG_ON("Unknown Arizona class device" == NULL); |
| 255 | return -EINVAL; |
| 256 | } |
| 257 | |
Mark Brown | 1816cb3 | 2013-01-17 16:54:18 +0900 | [diff] [blame] | 258 | /* Disable all wake sources by default */ |
| 259 | regmap_write(arizona->regmap, ARIZONA_WAKE_CONTROL, 0); |
| 260 | |
Mark Brown | 22c75fe | 2013-03-24 23:16:56 +0000 | [diff] [blame] | 261 | /* Read the flags from the interrupt controller if not specified */ |
| 262 | if (!arizona->pdata.irq_flags) { |
| 263 | irq_data = irq_get_irq_data(arizona->irq); |
| 264 | if (!irq_data) { |
| 265 | dev_err(arizona->dev, "Invalid IRQ: %d\n", |
| 266 | arizona->irq); |
| 267 | return -EINVAL; |
| 268 | } |
| 269 | |
| 270 | arizona->pdata.irq_flags = irqd_get_trigger_type(irq_data); |
| 271 | switch (arizona->pdata.irq_flags) { |
| 272 | case IRQF_TRIGGER_LOW: |
| 273 | case IRQF_TRIGGER_HIGH: |
| 274 | case IRQF_TRIGGER_RISING: |
| 275 | case IRQF_TRIGGER_FALLING: |
| 276 | break; |
| 277 | |
| 278 | case IRQ_TYPE_NONE: |
| 279 | default: |
| 280 | /* Device default */ |
| 281 | arizona->pdata.irq_flags = IRQF_TRIGGER_LOW; |
| 282 | break; |
| 283 | } |
| 284 | } |
Mark Brown | f8a0941 | 2013-03-22 12:59:33 +0100 | [diff] [blame] | 285 | |
| 286 | if (arizona->pdata.irq_flags & (IRQF_TRIGGER_HIGH | |
| 287 | IRQF_TRIGGER_RISING)) { |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 288 | ret = regmap_update_bits(arizona->regmap, ARIZONA_IRQ_CTRL_1, |
| 289 | ARIZONA_IRQ_POL, 0); |
| 290 | if (ret != 0) { |
| 291 | dev_err(arizona->dev, "Couldn't set IRQ polarity: %d\n", |
| 292 | ret); |
| 293 | goto err; |
| 294 | } |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 295 | } |
| 296 | |
Mark Brown | f8a0941 | 2013-03-22 12:59:33 +0100 | [diff] [blame] | 297 | flags |= arizona->pdata.irq_flags; |
| 298 | |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 299 | /* Allocate a virtual IRQ domain to distribute to the regmap domains */ |
| 300 | arizona->virq = irq_domain_add_linear(NULL, 2, &arizona_domain_ops, |
| 301 | arizona); |
| 302 | if (!arizona->virq) { |
Mark Brown | b7dea5d | 2012-12-05 11:46:26 +0900 | [diff] [blame] | 303 | dev_err(arizona->dev, "Failed to add core IRQ domain\n"); |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 304 | ret = -EINVAL; |
| 305 | goto err; |
| 306 | } |
| 307 | |
Richard Fitzgerald | ea1f333 | 2015-11-03 15:08:32 +0000 | [diff] [blame] | 308 | if (aod) { |
| 309 | ret = regmap_add_irq_chip(arizona->regmap, |
| 310 | irq_create_mapping(arizona->virq, 0), |
| 311 | IRQF_ONESHOT, 0, aod, |
| 312 | &arizona->aod_irq_chip); |
| 313 | if (ret != 0) { |
| 314 | dev_err(arizona->dev, |
| 315 | "Failed to add AOD IRQs: %d\n", ret); |
Charles Keepax | 6c006b1 | 2015-12-16 13:53:59 +0000 | [diff] [blame] | 316 | goto err; |
Richard Fitzgerald | ea1f333 | 2015-11-03 15:08:32 +0000 | [diff] [blame] | 317 | } |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 318 | } |
| 319 | |
| 320 | ret = regmap_add_irq_chip(arizona->regmap, |
| 321 | irq_create_mapping(arizona->virq, 1), |
Charles Keepax | 2a3377e | 2014-08-12 14:51:22 +0100 | [diff] [blame] | 322 | IRQF_ONESHOT, 0, irq, |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 323 | &arizona->irq_chip); |
| 324 | if (ret != 0) { |
Charles Keepax | d1cb4cc | 2014-05-19 17:35:29 +0100 | [diff] [blame] | 325 | dev_err(arizona->dev, "Failed to add main IRQs: %d\n", ret); |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 326 | goto err_aod; |
| 327 | } |
| 328 | |
Mark Brown | 3092f80 | 2013-03-24 23:05:58 +0000 | [diff] [blame] | 329 | /* Used to emulate edge trigger and to work around broken pinmux */ |
| 330 | if (arizona->pdata.irq_gpio) { |
| 331 | if (gpio_to_irq(arizona->pdata.irq_gpio) != arizona->irq) { |
| 332 | dev_warn(arizona->dev, "IRQ %d is not GPIO %d (%d)\n", |
| 333 | arizona->irq, arizona->pdata.irq_gpio, |
| 334 | gpio_to_irq(arizona->pdata.irq_gpio)); |
| 335 | arizona->irq = gpio_to_irq(arizona->pdata.irq_gpio); |
| 336 | } |
| 337 | |
| 338 | ret = devm_gpio_request_one(arizona->dev, |
| 339 | arizona->pdata.irq_gpio, |
| 340 | GPIOF_IN, "arizona IRQ"); |
| 341 | if (ret != 0) { |
| 342 | dev_err(arizona->dev, |
| 343 | "Failed to request IRQ GPIO %d:: %d\n", |
| 344 | arizona->pdata.irq_gpio, ret); |
| 345 | arizona->pdata.irq_gpio = 0; |
| 346 | } |
| 347 | } |
| 348 | |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 349 | ret = request_threaded_irq(arizona->irq, NULL, arizona_irq_thread, |
| 350 | flags, "arizona", arizona); |
| 351 | |
| 352 | if (ret != 0) { |
Mark Brown | 7994c66 | 2013-03-19 09:51:14 +0000 | [diff] [blame] | 353 | dev_err(arizona->dev, "Failed to request primary IRQ %d: %d\n", |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 354 | arizona->irq, ret); |
| 355 | goto err_main_irq; |
| 356 | } |
| 357 | |
Charles Keepax | 6c006b1 | 2015-12-16 13:53:59 +0000 | [diff] [blame] | 358 | /* Make sure the boot done IRQ is unmasked for resumes */ |
| 359 | i = arizona_map_irq(arizona, ARIZONA_IRQ_BOOT_DONE); |
| 360 | ret = request_threaded_irq(i, NULL, arizona_boot_done, IRQF_ONESHOT, |
| 361 | "Boot done", arizona); |
| 362 | if (ret != 0) { |
| 363 | dev_err(arizona->dev, "Failed to request boot done %d: %d\n", |
| 364 | arizona->irq, ret); |
| 365 | goto err_boot_done; |
| 366 | } |
| 367 | |
| 368 | /* Handle control interface errors in the core */ |
| 369 | if (arizona->ctrlif_error) { |
| 370 | i = arizona_map_irq(arizona, ARIZONA_IRQ_CTRLIF_ERR); |
| 371 | ret = request_threaded_irq(i, NULL, arizona_ctrlif_err, |
| 372 | IRQF_ONESHOT, |
| 373 | "Control interface error", arizona); |
| 374 | if (ret != 0) { |
| 375 | dev_err(arizona->dev, |
| 376 | "Failed to request CTRLIF_ERR %d: %d\n", |
| 377 | arizona->irq, ret); |
| 378 | goto err_ctrlif; |
| 379 | } |
| 380 | } |
| 381 | |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 382 | return 0; |
| 383 | |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 384 | err_ctrlif: |
| 385 | free_irq(arizona_map_irq(arizona, ARIZONA_IRQ_BOOT_DONE), arizona); |
| 386 | err_boot_done: |
Charles Keepax | 6c006b1 | 2015-12-16 13:53:59 +0000 | [diff] [blame] | 387 | free_irq(arizona->irq, arizona); |
| 388 | err_main_irq: |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 389 | regmap_del_irq_chip(irq_create_mapping(arizona->virq, 1), |
| 390 | arizona->irq_chip); |
| 391 | err_aod: |
| 392 | regmap_del_irq_chip(irq_create_mapping(arizona->virq, 0), |
| 393 | arizona->aod_irq_chip); |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 394 | err: |
| 395 | return ret; |
| 396 | } |
| 397 | |
| 398 | int arizona_irq_exit(struct arizona *arizona) |
| 399 | { |
Charles Keepax | 30a2af3 | 2014-07-15 11:21:50 +0100 | [diff] [blame] | 400 | if (arizona->ctrlif_error) |
| 401 | free_irq(arizona_map_irq(arizona, ARIZONA_IRQ_CTRLIF_ERR), |
| 402 | arizona); |
Mark Brown | 966cdc9 | 2012-06-19 16:34:23 +0100 | [diff] [blame] | 403 | free_irq(arizona_map_irq(arizona, ARIZONA_IRQ_BOOT_DONE), arizona); |
| 404 | regmap_del_irq_chip(irq_create_mapping(arizona->virq, 1), |
| 405 | arizona->irq_chip); |
| 406 | regmap_del_irq_chip(irq_create_mapping(arizona->virq, 0), |
| 407 | arizona->aod_irq_chip); |
| 408 | free_irq(arizona->irq, arizona); |
| 409 | |
| 410 | return 0; |
| 411 | } |