Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: Convert wm831x to irq_domain

The modern idiom is to use irq_domain to allocate interrupts. This is
useful partly to allow further infrastructure to be based on the domains
and partly because it makes it much easier to allocate virtual interrupts
to devices as we don't need to allocate a contiguous range of interrupt
numbers.

Convert the wm831x driver over to this infrastructure, using a legacy
IRQ mapping if an irq_base is specified in platform data and otherwise
using a linear mapping, always registering the interrupts even if they
won't ever be used. Only boards which need to use the GPIOs as
interrupts should need to use an irq_base.

This means that we can't use the MFD irq_base management since the
unless we're using an explicit irq_base from platform data we can't rely
on a linear mapping of interrupts. Instead we need to map things via
the irq_domain - provide a conveniencem function wm831x_irq() to save a
small amount of typing when doing so. Looking at this I couldn't clearly
see anything the MFD core could do to make this nicer.

Since we're not supporting device tree yet there's no meaningful
advantage if we don't do this conversion in one, the fact that the
interrupt resources are used for repeated IP blocks makes accessor
functions for the irq_domain more trouble to do than they're worth.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

authored by

Mark Brown and committed by
Samuel Ortiz
cd99758b 4492c4c3

+132 -85
+2 -4
drivers/gpio/gpio-wm831x.c
··· 102 102 struct wm831x_gpio *wm831x_gpio = to_wm831x_gpio(chip); 103 103 struct wm831x *wm831x = wm831x_gpio->wm831x; 104 104 105 - if (!wm831x->irq_base) 106 - return -EINVAL; 107 - 108 - return wm831x->irq_base + WM831X_IRQ_GPIO_1 + offset; 105 + return irq_create_mapping(wm831x->irq_domain, 106 + WM831X_IRQ_GPIO_1 + offset); 109 107 } 110 108 111 109 static int wm831x_gpio_set_debounce(struct gpio_chip *chip, unsigned offset,
+1 -1
drivers/input/misc/wm831x-on.c
··· 73 73 { 74 74 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); 75 75 struct wm831x_on *wm831x_on; 76 - int irq = platform_get_irq(pdev, 0); 76 + int irq = wm831x_irq(wm831x, platform_get_irq(pdev, 0)); 77 77 int ret; 78 78 79 79 wm831x_on = kzalloc(sizeof(struct wm831x_on), GFP_KERNEL);
+5 -4
drivers/input/touchscreen/wm831x-ts.c
··· 260 260 * If we have a direct IRQ use it, otherwise use the interrupt 261 261 * from the WM831x IRQ controller. 262 262 */ 263 + wm831x_ts->data_irq = wm831x_irq(wm831x, 264 + platform_get_irq_byname(pdev, 265 + "TCHDATA")); 263 266 if (pdata && pdata->data_irq) 264 267 wm831x_ts->data_irq = pdata->data_irq; 265 - else 266 - wm831x_ts->data_irq = platform_get_irq_byname(pdev, "TCHDATA"); 267 268 269 + wm831x_ts->pd_irq = wm831x_irq(wm831x, 270 + platform_get_irq_byname(pdev, "TCHPD")); 268 271 if (pdata && pdata->pd_irq) 269 272 wm831x_ts->pd_irq = pdata->pd_irq; 270 - else 271 - wm831x_ts->pd_irq = platform_get_irq_byname(pdev, "TCHPD"); 272 273 273 274 if (pdata) 274 275 wm831x_ts->pressure = pdata->pressure;
+2
drivers/mfd/Kconfig
··· 496 496 select MFD_CORE 497 497 select MFD_WM831X 498 498 select REGMAP_I2C 499 + select IRQ_DOMAIN 499 500 depends on I2C=y && GENERIC_HARDIRQS 500 501 help 501 502 Support for the Wolfson Microelecronics WM831x and WM832x PMICs ··· 509 508 select MFD_CORE 510 509 select MFD_WM831X 511 510 select REGMAP_SPI 511 + select IRQ_DOMAIN 512 512 depends on SPI_MASTER && GENERIC_HARDIRQS 513 513 help 514 514 Support for the Wolfson Microelecronics WM831x and WM832x PMICs
+3 -3
drivers/mfd/wm831x-auxadc.c
··· 280 280 mutex_init(&wm831x->auxadc_lock); 281 281 INIT_LIST_HEAD(&wm831x->auxadc_pending); 282 282 283 - if (wm831x->irq && wm831x->irq_base) { 283 + if (wm831x->irq) { 284 284 wm831x->auxadc_read = wm831x_auxadc_read_irq; 285 285 286 - ret = request_threaded_irq(wm831x->irq_base + 287 - WM831X_IRQ_AUXADC_DATA, 286 + ret = request_threaded_irq(wm831x_irq(wm831x, 287 + WM831X_IRQ_AUXADC_DATA), 288 288 NULL, wm831x_auxadc_irq, 0, 289 289 "auxadc", wm831x); 290 290 if (ret < 0) {
+9 -10
drivers/mfd/wm831x-core.c
··· 1813 1813 case WM8310: 1814 1814 ret = mfd_add_devices(wm831x->dev, wm831x_num, 1815 1815 wm8310_devs, ARRAY_SIZE(wm8310_devs), 1816 - NULL, wm831x->irq_base); 1816 + NULL, 0); 1817 1817 break; 1818 1818 1819 1819 case WM8311: 1820 1820 ret = mfd_add_devices(wm831x->dev, wm831x_num, 1821 1821 wm8311_devs, ARRAY_SIZE(wm8311_devs), 1822 - NULL, wm831x->irq_base); 1822 + NULL, 0); 1823 1823 if (!pdata || !pdata->disable_touch) 1824 1824 mfd_add_devices(wm831x->dev, wm831x_num, 1825 1825 touch_devs, ARRAY_SIZE(touch_devs), 1826 - NULL, wm831x->irq_base); 1826 + NULL, 0); 1827 1827 break; 1828 1828 1829 1829 case WM8312: 1830 1830 ret = mfd_add_devices(wm831x->dev, wm831x_num, 1831 1831 wm8312_devs, ARRAY_SIZE(wm8312_devs), 1832 - NULL, wm831x->irq_base); 1832 + NULL, 0); 1833 1833 if (!pdata || !pdata->disable_touch) 1834 1834 mfd_add_devices(wm831x->dev, wm831x_num, 1835 1835 touch_devs, ARRAY_SIZE(touch_devs), 1836 - NULL, wm831x->irq_base); 1836 + NULL, 0); 1837 1837 break; 1838 1838 1839 1839 case WM8320: ··· 1842 1842 case WM8326: 1843 1843 ret = mfd_add_devices(wm831x->dev, wm831x_num, 1844 1844 wm8320_devs, ARRAY_SIZE(wm8320_devs), 1845 - NULL, wm831x->irq_base); 1845 + NULL, 0); 1846 1846 break; 1847 1847 1848 1848 default: ··· 1867 1867 if (ret & WM831X_XTAL_ENA) { 1868 1868 ret = mfd_add_devices(wm831x->dev, wm831x_num, 1869 1869 rtc_devs, ARRAY_SIZE(rtc_devs), 1870 - NULL, wm831x->irq_base); 1870 + NULL, 0); 1871 1871 if (ret != 0) { 1872 1872 dev_err(wm831x->dev, "Failed to add RTC: %d\n", ret); 1873 1873 goto err_irq; ··· 1880 1880 /* Treat errors as non-critical */ 1881 1881 ret = mfd_add_devices(wm831x->dev, wm831x_num, backlight_devs, 1882 1882 ARRAY_SIZE(backlight_devs), NULL, 1883 - wm831x->irq_base); 1883 + 0); 1884 1884 if (ret < 0) 1885 1885 dev_err(wm831x->dev, "Failed to add backlight: %d\n", 1886 1886 ret); ··· 1909 1909 { 1910 1910 wm831x_otp_exit(wm831x); 1911 1911 mfd_remove_devices(wm831x->dev); 1912 - if (wm831x->irq_base) 1913 - free_irq(wm831x->irq_base + WM831X_IRQ_AUXADC_DATA, wm831x); 1912 + free_irq(wm831x_irq(wm831x, WM831X_IRQ_AUXADC_DATA), wm831x); 1914 1913 wm831x_irq_exit(wm831x); 1915 1914 } 1916 1915
+65 -38
drivers/mfd/wm831x-irq.c
··· 18 18 #include <linux/irq.h> 19 19 #include <linux/mfd/core.h> 20 20 #include <linux/interrupt.h> 21 + #include <linux/irqdomain.h> 21 22 22 23 #include <linux/mfd/wm831x/core.h> 23 24 #include <linux/mfd/wm831x/pdata.h> ··· 329 328 static inline struct wm831x_irq_data *irq_to_wm831x_irq(struct wm831x *wm831x, 330 329 int irq) 331 330 { 332 - return &wm831x_irqs[irq - wm831x->irq_base]; 331 + return &wm831x_irqs[irq]; 333 332 } 334 333 335 334 static void wm831x_irq_lock(struct irq_data *data) ··· 375 374 { 376 375 struct wm831x *wm831x = irq_data_get_irq_chip_data(data); 377 376 struct wm831x_irq_data *irq_data = irq_to_wm831x_irq(wm831x, 378 - data->irq); 377 + data->hwirq); 379 378 380 379 wm831x->irq_masks_cur[irq_data->reg - 1] &= ~irq_data->mask; 381 380 } ··· 384 383 { 385 384 struct wm831x *wm831x = irq_data_get_irq_chip_data(data); 386 385 struct wm831x_irq_data *irq_data = irq_to_wm831x_irq(wm831x, 387 - data->irq); 386 + data->hwirq); 388 387 389 388 wm831x->irq_masks_cur[irq_data->reg - 1] |= irq_data->mask; 390 389 } ··· 394 393 struct wm831x *wm831x = irq_data_get_irq_chip_data(data); 395 394 int irq; 396 395 397 - irq = data->irq - wm831x->irq_base; 396 + irq = data->hwirq; 398 397 399 398 if (irq < WM831X_IRQ_GPIO_1 || irq > WM831X_IRQ_GPIO_11) { 400 399 /* Ignore internal-only IRQs */ ··· 470 469 * descriptors. 471 470 */ 472 471 if (primary & WM831X_TCHPD_INT) 473 - handle_nested_irq(wm831x->irq_base + WM831X_IRQ_TCHPD); 472 + handle_nested_irq(irq_find_mapping(wm831x->irq_domain, 473 + WM831X_IRQ_TCHPD)); 474 474 if (primary & WM831X_TCHDATA_INT) 475 - handle_nested_irq(wm831x->irq_base + WM831X_IRQ_TCHDATA); 475 + handle_nested_irq(irq_find_mapping(wm831x->irq_domain, 476 + WM831X_IRQ_TCHDATA)); 476 477 primary &= ~(WM831X_TCHDATA_EINT | WM831X_TCHPD_EINT); 477 478 478 479 for (i = 0; i < ARRAY_SIZE(wm831x_irqs); i++) { ··· 510 507 } 511 508 512 509 if (*status & wm831x_irqs[i].mask) 513 - handle_nested_irq(wm831x->irq_base + i); 510 + handle_nested_irq(irq_find_mapping(wm831x->irq_domain, 511 + i)); 514 512 515 513 /* Simulate an edge triggered IRQ by polling the input 516 514 * status. This is sucky but improves interoperability. ··· 520 516 wm831x->gpio_level[i - WM831X_IRQ_GPIO_1]) { 521 517 ret = wm831x_reg_read(wm831x, WM831X_GPIO_LEVEL); 522 518 while (ret & 1 << (i - WM831X_IRQ_GPIO_1)) { 523 - handle_nested_irq(wm831x->irq_base + i); 519 + handle_nested_irq(irq_find_mapping(wm831x->irq_domain, 520 + i)); 524 521 ret = wm831x_reg_read(wm831x, 525 522 WM831X_GPIO_LEVEL); 526 523 } ··· 532 527 return IRQ_HANDLED; 533 528 } 534 529 530 + static int wm831x_irq_map(struct irq_domain *h, unsigned int virq, 531 + irq_hw_number_t hw) 532 + { 533 + irq_set_chip_data(virq, h->host_data); 534 + irq_set_chip_and_handler(virq, &wm831x_irq_chip, handle_edge_irq); 535 + irq_set_nested_thread(virq, 1); 536 + 537 + /* ARM needs us to explicitly flag the IRQ as valid 538 + * and will set them noprobe when we do so. */ 539 + #ifdef CONFIG_ARM 540 + set_irq_flags(virq, IRQF_VALID); 541 + #else 542 + irq_set_noprobe(virq); 543 + #endif 544 + 545 + return 0; 546 + } 547 + 548 + static struct irq_domain_ops wm831x_irq_domain_ops = { 549 + .map = wm831x_irq_map, 550 + .xlate = irq_domain_xlate_twocell, 551 + }; 552 + 535 553 int wm831x_irq_init(struct wm831x *wm831x, int irq) 536 554 { 537 555 struct wm831x_pdata *pdata = wm831x->dev->platform_data; 538 - int i, cur_irq, ret; 556 + struct irq_domain *domain; 557 + int i, ret, irq_base; 539 558 540 559 mutex_init(&wm831x->irq_lock); 541 560 ··· 572 543 } 573 544 574 545 /* Try to dynamically allocate IRQs if no base is specified */ 575 - if (!pdata || !pdata->irq_base) 576 - wm831x->irq_base = -1; 577 - else 578 - wm831x->irq_base = pdata->irq_base; 579 - 580 - wm831x->irq_base = irq_alloc_descs(wm831x->irq_base, 0, 546 + if (pdata && pdata->irq_base) { 547 + irq_base = irq_alloc_descs(pdata->irq_base, 0, 581 548 WM831X_NUM_IRQS, 0); 582 - if (wm831x->irq_base < 0) { 583 - dev_warn(wm831x->dev, "Failed to allocate IRQs: %d\n", 584 - wm831x->irq_base); 585 - wm831x->irq_base = 0; 586 - return 0; 549 + if (irq_base < 0) { 550 + dev_warn(wm831x->dev, "Failed to allocate IRQs: %d\n", 551 + irq_base); 552 + irq_base = 0; 553 + } 554 + } else { 555 + irq_base = 0; 556 + } 557 + 558 + if (irq_base) 559 + domain = irq_domain_add_legacy(wm831x->dev->of_node, 560 + ARRAY_SIZE(wm831x_irqs), 561 + irq_base, 0, 562 + &wm831x_irq_domain_ops, 563 + wm831x); 564 + else 565 + domain = irq_domain_add_linear(wm831x->dev->of_node, 566 + ARRAY_SIZE(wm831x_irqs), 567 + &wm831x_irq_domain_ops, 568 + wm831x); 569 + 570 + if (!domain) { 571 + dev_warn(wm831x->dev, "Failed to allocate IRQ domain\n"); 572 + return -EINVAL; 587 573 } 588 574 589 575 if (pdata && pdata->irq_cmos) ··· 610 566 WM831X_IRQ_OD, i); 611 567 612 568 wm831x->irq = irq; 613 - 614 - /* Register them with genirq */ 615 - for (cur_irq = wm831x->irq_base; 616 - cur_irq < ARRAY_SIZE(wm831x_irqs) + wm831x->irq_base; 617 - cur_irq++) { 618 - irq_set_chip_data(cur_irq, wm831x); 619 - irq_set_chip_and_handler(cur_irq, &wm831x_irq_chip, 620 - handle_edge_irq); 621 - irq_set_nested_thread(cur_irq, 1); 622 - 623 - /* ARM needs us to explicitly flag the IRQ as valid 624 - * and will set them noprobe when we do so. */ 625 - #ifdef CONFIG_ARM 626 - set_irq_flags(cur_irq, IRQF_VALID); 627 - #else 628 - irq_set_noprobe(cur_irq); 629 - #endif 630 - } 569 + wm831x->irq_domain = domain; 631 570 632 571 if (irq) { 633 572 /* Try to flag /IRQ as a wake source; there are a number of
+13 -8
drivers/power/wm831x_power.c
··· 565 565 goto err_usb; 566 566 } 567 567 568 - irq = platform_get_irq_byname(pdev, "SYSLO"); 568 + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "SYSLO")); 569 569 ret = request_threaded_irq(irq, NULL, wm831x_syslo_irq, 570 570 IRQF_TRIGGER_RISING, "System power low", 571 571 power); ··· 575 575 goto err_battery; 576 576 } 577 577 578 - irq = platform_get_irq_byname(pdev, "PWR SRC"); 578 + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "PWR SRC")); 579 579 ret = request_threaded_irq(irq, NULL, wm831x_pwr_src_irq, 580 580 IRQF_TRIGGER_RISING, "Power source", 581 581 power); ··· 586 586 } 587 587 588 588 for (i = 0; i < ARRAY_SIZE(wm831x_bat_irqs); i++) { 589 - irq = platform_get_irq_byname(pdev, wm831x_bat_irqs[i]); 589 + irq = wm831x_irq(wm831x, 590 + platform_get_irq_byname(pdev, 591 + wm831x_bat_irqs[i])); 590 592 ret = request_threaded_irq(irq, NULL, wm831x_bat_irq, 591 593 IRQF_TRIGGER_RISING, 592 594 wm831x_bat_irqs[i], ··· 608 606 irq = platform_get_irq_byname(pdev, wm831x_bat_irqs[i]); 609 607 free_irq(irq, power); 610 608 } 611 - irq = platform_get_irq_byname(pdev, "PWR SRC"); 609 + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "PWR SRC")); 612 610 free_irq(irq, power); 613 611 err_syslo: 614 - irq = platform_get_irq_byname(pdev, "SYSLO"); 612 + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "SYSLO")); 615 613 free_irq(irq, power); 616 614 err_battery: 617 615 if (power->have_battery) ··· 628 626 static __devexit int wm831x_power_remove(struct platform_device *pdev) 629 627 { 630 628 struct wm831x_power *wm831x_power = platform_get_drvdata(pdev); 629 + struct wm831x *wm831x = wm831x_power->wm831x; 631 630 int irq, i; 632 631 633 632 for (i = 0; i < ARRAY_SIZE(wm831x_bat_irqs); i++) { 634 - irq = platform_get_irq_byname(pdev, wm831x_bat_irqs[i]); 633 + irq = wm831x_irq(wm831x, 634 + platform_get_irq_byname(pdev, 635 + wm831x_bat_irqs[i])); 635 636 free_irq(irq, wm831x_power); 636 637 } 637 638 638 - irq = platform_get_irq_byname(pdev, "PWR SRC"); 639 + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "PWR SRC")); 639 640 free_irq(irq, wm831x_power); 640 641 641 - irq = platform_get_irq_byname(pdev, "SYSLO"); 642 + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "SYSLO")); 642 643 free_irq(irq, wm831x_power); 643 644 644 645 if (wm831x_power->have_battery)
+15 -9
drivers/regulator/wm831x-dcdc.c
··· 565 565 goto err; 566 566 } 567 567 568 - irq = platform_get_irq_byname(pdev, "UV"); 568 + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")); 569 569 ret = request_threaded_irq(irq, NULL, wm831x_dcdc_uv_irq, 570 570 IRQF_TRIGGER_RISING, dcdc->name, dcdc); 571 571 if (ret != 0) { ··· 574 574 goto err_regulator; 575 575 } 576 576 577 - irq = platform_get_irq_byname(pdev, "HC"); 577 + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "HC")); 578 578 ret = request_threaded_irq(irq, NULL, wm831x_dcdc_oc_irq, 579 579 IRQF_TRIGGER_RISING, dcdc->name, dcdc); 580 580 if (ret != 0) { ··· 588 588 return 0; 589 589 590 590 err_uv: 591 - free_irq(platform_get_irq_byname(pdev, "UV"), dcdc); 591 + free_irq(wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")), 592 + dcdc); 592 593 err_regulator: 593 594 regulator_unregister(dcdc->regulator); 594 595 err: ··· 601 600 static __devexit int wm831x_buckv_remove(struct platform_device *pdev) 602 601 { 603 602 struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev); 603 + struct wm831x *wm831x = dcdc->wm831x; 604 604 605 605 platform_set_drvdata(pdev, NULL); 606 606 607 - free_irq(platform_get_irq_byname(pdev, "HC"), dcdc); 608 - free_irq(platform_get_irq_byname(pdev, "UV"), dcdc); 607 + free_irq(wm831x_irq(wm831x, platform_get_irq_byname(pdev, "HC")), 608 + dcdc); 609 + free_irq(wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")), 610 + dcdc); 609 611 regulator_unregister(dcdc->regulator); 610 612 if (dcdc->dvs_gpio) 611 613 gpio_free(dcdc->dvs_gpio); ··· 762 758 goto err; 763 759 } 764 760 765 - irq = platform_get_irq_byname(pdev, "UV"); 761 + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")); 766 762 ret = request_threaded_irq(irq, NULL, wm831x_dcdc_uv_irq, 767 763 IRQF_TRIGGER_RISING, dcdc->name, dcdc); 768 764 if (ret != 0) { ··· 787 783 788 784 platform_set_drvdata(pdev, NULL); 789 785 790 - free_irq(platform_get_irq_byname(pdev, "UV"), dcdc); 786 + free_irq(wm831x_irq(dcdc->wm831x, platform_get_irq_byname(pdev, "UV")), 787 + dcdc); 791 788 regulator_unregister(dcdc->regulator); 792 789 793 790 return 0; ··· 888 883 goto err; 889 884 } 890 885 891 - irq = platform_get_irq_byname(pdev, "UV"); 886 + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")); 892 887 ret = request_threaded_irq(irq, NULL, wm831x_dcdc_uv_irq, 893 888 IRQF_TRIGGER_RISING, dcdc->name, 894 889 dcdc); ··· 915 910 916 911 platform_set_drvdata(pdev, NULL); 917 912 918 - free_irq(platform_get_irq_byname(pdev, "UV"), dcdc); 913 + free_irq(wm831x_irq(dcdc->wm831x, platform_get_irq_byname(pdev, "UV")), 914 + dcdc); 919 915 regulator_unregister(dcdc->regulator); 920 916 kfree(dcdc); 921 917
+2 -2
drivers/regulator/wm831x-isink.c
··· 198 198 goto err; 199 199 } 200 200 201 - irq = platform_get_irq(pdev, 0); 201 + irq = wm831x_irq(wm831x, platform_get_irq(pdev, 0)); 202 202 ret = request_threaded_irq(irq, NULL, wm831x_isink_irq, 203 203 IRQF_TRIGGER_RISING, isink->name, isink); 204 204 if (ret != 0) { ··· 223 223 224 224 platform_set_drvdata(pdev, NULL); 225 225 226 - free_irq(platform_get_irq(pdev, 0), isink); 226 + free_irq(wm831x_irq(isink->wm831x, platform_get_irq(pdev, 0)), isink); 227 227 228 228 regulator_unregister(isink->regulator); 229 229
+6 -4
drivers/regulator/wm831x-ldo.c
··· 359 359 goto err; 360 360 } 361 361 362 - irq = platform_get_irq_byname(pdev, "UV"); 362 + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")); 363 363 ret = request_threaded_irq(irq, NULL, wm831x_ldo_uv_irq, 364 364 IRQF_TRIGGER_RISING, ldo->name, 365 365 ldo); ··· 385 385 386 386 platform_set_drvdata(pdev, NULL); 387 387 388 - free_irq(platform_get_irq_byname(pdev, "UV"), ldo); 388 + free_irq(wm831x_irq(ldo->wm831x, 389 + platform_get_irq_byname(pdev, "UV")), ldo); 389 390 regulator_unregister(ldo->regulator); 390 391 391 392 return 0; ··· 625 624 goto err; 626 625 } 627 626 628 - irq = platform_get_irq_byname(pdev, "UV"); 627 + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")); 629 628 ret = request_threaded_irq(irq, NULL, wm831x_ldo_uv_irq, 630 629 IRQF_TRIGGER_RISING, ldo->name, ldo); 631 630 if (ret != 0) { ··· 648 647 { 649 648 struct wm831x_ldo *ldo = platform_get_drvdata(pdev); 650 649 651 - free_irq(platform_get_irq_byname(pdev, "UV"), ldo); 650 + free_irq(wm831x_irq(ldo->wm831x, platform_get_irq_byname(pdev, "UV")), 651 + ldo); 652 652 regulator_unregister(ldo->regulator); 653 653 654 654 return 0;
+1 -1
drivers/rtc/rtc-wm831x.c
··· 396 396 { 397 397 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); 398 398 struct wm831x_rtc *wm831x_rtc; 399 - int alm_irq = platform_get_irq_byname(pdev, "ALM"); 399 + int alm_irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "ALM")); 400 400 int ret = 0; 401 401 402 402 wm831x_rtc = devm_kzalloc(&pdev->dev, sizeof(*wm831x_rtc), GFP_KERNEL);
+8 -1
include/linux/mfd/wm831x/core.h
··· 17 17 18 18 #include <linux/completion.h> 19 19 #include <linux/interrupt.h> 20 + #include <linux/irqdomain.h> 20 21 #include <linux/list.h> 21 22 #include <linux/regmap.h> 22 23 ··· 339 338 #define WM831X_FLL_CLK_SRC_WIDTH 2 /* FLL_CLK_SRC - [1:0] */ 340 339 341 340 struct regulator_dev; 341 + struct irq_domain; 342 342 343 343 #define WM831X_NUM_IRQ_REGS 5 344 344 #define WM831X_NUM_GPIO_REGS 16 ··· 369 367 370 368 int irq; /* Our chip IRQ */ 371 369 struct mutex irq_lock; 372 - int irq_base; 370 + struct irq_domain *irq_domain; 373 371 int irq_masks_cur[WM831X_NUM_IRQ_REGS]; /* Currently active value */ 374 372 int irq_masks_cache[WM831X_NUM_IRQ_REGS]; /* Cached hardware value */ 375 373 ··· 418 416 int wm831x_irq_init(struct wm831x *wm831x, int irq); 419 417 void wm831x_irq_exit(struct wm831x *wm831x); 420 418 void wm831x_auxadc_init(struct wm831x *wm831x); 419 + 420 + static inline int wm831x_irq(struct wm831x *wm831x, int irq) 421 + { 422 + return irq_create_mapping(wm831x->irq_domain, irq); 423 + } 421 424 422 425 extern struct regmap_config wm831x_regmap_config; 423 426