twl4030 irq updates
Subsystems (2)
PATCH 1/3 twl4030 irq updates
From: David Brownell <[email protected]>
This updates the IRQ handling support for the twl4030 driver:
- Move it into a separate file; clean and streamline it
- Restructure the init code for reuse during secondary dispatch
- Support both levels (primary, secondary) of IRQ dispatch
- Use a workqueue for irq mask/unmask and trigger configuration
Code for two subchips currently share that secondary handler code. One is the power subchip; its IRQs are now handled by this core, courtesy of this patch. The other is the GPIO module, which will be supported through a later patch.
There are also minor changes to the header file, mostly related to GPIO support; nothing yet in mainline cares about those. A few references to OMAP-specific symbols are disabled; when they can all be removed, the TWL4030 support ceases being OMAP-specific.
---
This should go on top of the current MFD queue; it brings the relevant files in sync with what's in the linux-omap tree.
drivers/mfd/Makefile | 2 drivers/mfd/twl4030-core.c | 485 --------------------------- drivers/mfd/twl4030-irq.c | 743 ++++++++++++++++++++++++++++++++++++++++++ include/linux/i2c/twl4030.h | 28 - 4 files changed, 777 insertions(+), 481 deletions(-)
drivers/mfd/Makefile +1 -1
@@ -17,7 +17,7 @@ wm8350-objs := wm8350-core.o wm8350-re obj-$(CONFIG_MFD_WM8350) += wm8350.o obj-$(CONFIG_MFD_WM8350_I2C) += wm8350-i2c.o -obj-$(CONFIG_TWL4030_CORE) += twl4030-core.o +obj-$(CONFIG_TWL4030_CORE) += twl4030-core.o twl4030-irq.o obj-$(CONFIG_MFD_CORE) += mfd-core.o
drivers/mfd/twl4030-core.c +17 -468
561 lines not on this page · raw message
drivers/mfd/twl4030-irq.c new file +743 -0
743 lines not on this page · raw message
include/linux/i2c/twl4030.h +16 -12
@@ -228,6 +228,12 @@ struct twl4030_gpio_platform_data {int gpio_base;unsigned irq_base, irq_end; +/* package the two LED signals as output-only GPIOs? */ +bool use_leds; + +/* gpio-n should control VMMC(n+1) if BIT(n) in mmc_cd is set */ +u8 mmc_cd; +/* For gpio-N, bit (1 << N) in "pullups" is set if that pullup * should be enabled. Else, if that bit is set in "pulldowns", * that pulldown is enabled. Don't waste power by letting any
@@ -277,6 +283,8 @@ struct twl4030_platform_data {/*----------------------------------------------------------------------*/ +int twl4030_sih_setup (int module); +/* * FIXME completely stop using TWL4030_IRQ_BASE ... instead, pass the * IRQ data to subsidiary devices using platform device resources.
@@ -291,16 +299,16 @@ struct twl4030_platform_data {#define TWL4030_MODIRQ_BCI (TWL4030_IRQ_BASE + 2)#define TWL4030_MODIRQ_MADC (TWL4030_IRQ_BASE + 3)/* #define TWL4030_MODIRQ_USB (TWL4030_IRQ_BASE + 4) */ -#define TWL4030_MODIRQ_PWR (TWL4030_IRQ_BASE + 5) +/* #define TWL4030_MODIRQ_PWR (TWL4030_IRQ_BASE + 5) */ #define TWL4030_PWRIRQ_PWRBTN (TWL4030_PWR_IRQ_BASE + 0) -#define TWL4030_PWRIRQ_CHG_PRES (TWL4030_PWR_IRQ_BASE + 1) -#define TWL4030_PWRIRQ_USB_PRES (TWL4030_PWR_IRQ_BASE + 2) -#define TWL4030_PWRIRQ_RTC (TWL4030_PWR_IRQ_BASE + 3) -#define TWL4030_PWRIRQ_HOT_DIE (TWL4030_PWR_IRQ_BASE + 4) -#define TWL4030_PWRIRQ_PWROK_TIMEOUT (TWL4030_PWR_IRQ_BASE + 5) -#define TWL4030_PWRIRQ_MBCHG (TWL4030_PWR_IRQ_BASE + 6) -#define TWL4030_PWRIRQ_SC_DETECT (TWL4030_PWR_IRQ_BASE + 7) +/* #define TWL4030_PWRIRQ_CHG_PRES (TWL4030_PWR_IRQ_BASE + 1) */ +/* #define TWL4030_PWRIRQ_USB_PRES (TWL4030_PWR_IRQ_BASE + 2) */ +/* #define TWL4030_PWRIRQ_RTC (TWL4030_PWR_IRQ_BASE + 3) */ +/* #define TWL4030_PWRIRQ_HOT_DIE (TWL4030_PWR_IRQ_BASE + 4) */ +/* #define TWL4030_PWRIRQ_PWROK_TIMEOUT (TWL4030_PWR_IRQ_BASE + 5) */ +/* #define TWL4030_PWRIRQ_MBCHG (TWL4030_PWR_IRQ_BASE + 6) */ +/* #define TWL4030_PWRIRQ_SC_DETECT (TWL4030_PWR_IRQ_BASE + 7) */ /* Rest are unsued currently*/
@@ -317,17 +325,13 @@ struct twl4030_platform_data {/* TWL4030 GPIO interrupt definitions */ #define TWL4030_GPIO_IRQ_NO (n) (TWL4030_GPIO_IRQ_BASE + (n)) -#define TWL4030_GPIO_IS_ENABLE 1/* * Exported TWL4030 GPIO APIs * * WARNING -- use standard GPIO and IRQ calls instead; these will vanish. */ -int twl4030_get_gpio_datain (int gpio); -int twl4030_request_gpio (int gpio);int twl4030_set_gpio_debounce (int gpio,int enable); -int twl4030_free_gpio (int gpio);#if defined(CONFIG_TWL4030_BCI_BATTERY ) || \ defined(CONFIG_TWL4030_BCI_BATTERY_MODULE )
From: David Brownell <[email protected]>
This updates the IRQ handling support for the twl4030 driver:
- Move it into a separate file; clean and streamline it
- Restructure the init code for reuse during secondary dispatch
- Support both levels (primary, secondary) of IRQ dispatch
- Use a workqueue for irq mask/unmask and trigger configuration
Code for two subchips currently share that secondary handler code. One is the power subchip; its IRQs are now handled by this core, courtesy of this patch. The other is the GPIO module, which will be supported through a later patch.
There are also minor changes to the header file, mostly related to GPIO support; nothing yet in mainline cares about those. A few references to OMAP-specific symbols are disabled; when they can all be removed, the TWL4030 support ceases being OMAP-specific.
---
This is the same as what I posted Friday, except that it's against mainline and *with* the previous minor IRQ cleanup patch (which I'd neglected to apply). Patches #2 and #3 of this series remain unchanged.
drivers/mfd/Makefile | 2 drivers/mfd/twl4030-core.c | 421 ----------------------- drivers/mfd/twl4030-irq.c | 743 ++++++++++++++++++++++++++++++++++++++++++ include/linux/i2c/twl4030.h | 28 - 4 files changed, 777 insertions(+), 417 deletions(-)
drivers/mfd/Makefile +1 -1
@@ -17,7 +17,7 @@ wm8350-objs := wm8350-core.o wm8350-re obj-$(CONFIG_MFD_WM8350) += wm8350.o obj-$(CONFIG_MFD_WM8350_I2C) += wm8350-i2c.o -obj-$(CONFIG_TWL4030_CORE) += twl4030-core.o +obj-$(CONFIG_TWL4030_CORE) += twl4030-core.o twl4030-irq.o obj-$(CONFIG_MFD_CORE) += mfd-core.o
drivers/mfd/twl4030-core.c +17 -404
498 lines not on this page · raw message
drivers/mfd/twl4030-irq.c new file +743 -0
743 lines not on this page · raw message
include/linux/i2c/twl4030.h +16 -12
@@ -228,6 +228,12 @@ struct twl4030_gpio_platform_data {int gpio_base;unsigned irq_base, irq_end; +/* package the two LED signals as output-only GPIOs? */ +bool use_leds; + +/* gpio-n should control VMMC(n+1) if BIT(n) in mmc_cd is set */ +u8 mmc_cd; +/* For gpio-N, bit (1 << N) in "pullups" is set if that pullup * should be enabled. Else, if that bit is set in "pulldowns", * that pulldown is enabled. Don't waste power by letting any
@@ -277,6 +283,8 @@ struct twl4030_platform_data {/*----------------------------------------------------------------------*/ +int twl4030_sih_setup (int module); +/* * FIXME completely stop using TWL4030_IRQ_BASE ... instead, pass the * IRQ data to subsidiary devices using platform device resources.
@@ -291,16 +299,16 @@ struct twl4030_platform_data {#define TWL4030_MODIRQ_BCI (TWL4030_IRQ_BASE + 2)#define TWL4030_MODIRQ_MADC (TWL4030_IRQ_BASE + 3)/* #define TWL4030_MODIRQ_USB (TWL4030_IRQ_BASE + 4) */ -#define TWL4030_MODIRQ_PWR (TWL4030_IRQ_BASE + 5) +/* #define TWL4030_MODIRQ_PWR (TWL4030_IRQ_BASE + 5) */ #define TWL4030_PWRIRQ_PWRBTN (TWL4030_PWR_IRQ_BASE + 0) -#define TWL4030_PWRIRQ_CHG_PRES (TWL4030_PWR_IRQ_BASE + 1) -#define TWL4030_PWRIRQ_USB_PRES (TWL4030_PWR_IRQ_BASE + 2) -#define TWL4030_PWRIRQ_RTC (TWL4030_PWR_IRQ_BASE + 3) -#define TWL4030_PWRIRQ_HOT_DIE (TWL4030_PWR_IRQ_BASE + 4) -#define TWL4030_PWRIRQ_PWROK_TIMEOUT (TWL4030_PWR_IRQ_BASE + 5) -#define TWL4030_PWRIRQ_MBCHG (TWL4030_PWR_IRQ_BASE + 6) -#define TWL4030_PWRIRQ_SC_DETECT (TWL4030_PWR_IRQ_BASE + 7) +/* #define TWL4030_PWRIRQ_CHG_PRES (TWL4030_PWR_IRQ_BASE + 1) */ +/* #define TWL4030_PWRIRQ_USB_PRES (TWL4030_PWR_IRQ_BASE + 2) */ +/* #define TWL4030_PWRIRQ_RTC (TWL4030_PWR_IRQ_BASE + 3) */ +/* #define TWL4030_PWRIRQ_HOT_DIE (TWL4030_PWR_IRQ_BASE + 4) */ +/* #define TWL4030_PWRIRQ_PWROK_TIMEOUT (TWL4030_PWR_IRQ_BASE + 5) */ +/* #define TWL4030_PWRIRQ_MBCHG (TWL4030_PWR_IRQ_BASE + 6) */ +/* #define TWL4030_PWRIRQ_SC_DETECT (TWL4030_PWR_IRQ_BASE + 7) */ /* Rest are unsued currently*/
@@ -317,17 +325,13 @@ struct twl4030_platform_data {/* TWL4030 GPIO interrupt definitions */ #define TWL4030_GPIO_IRQ_NO (n) (TWL4030_GPIO_IRQ_BASE + (n)) -#define TWL4030_GPIO_IS_ENABLE 1/* * Exported TWL4030 GPIO APIs * * WARNING -- use standard GPIO and IRQ calls instead; these will vanish. */ -int twl4030_get_gpio_datain (int gpio); -int twl4030_request_gpio (int gpio);int twl4030_set_gpio_debounce (int gpio,int enable); -int twl4030_free_gpio (int gpio);#if defined(CONFIG_TWL4030_BCI_BATTERY ) || \ defined(CONFIG_TWL4030_BCI_BATTERY_MODULE )