Commit ff038038 authored by Peter 'p2' De Schrijver's avatar Peter 'p2' De Schrijver Committed by Tony Lindgren

I2C: TWL4030: Adapt existing drivers to power IRQ

This patch adapts the existing driver to use the power IRQ handler. This
patch superseeds any previous version.
Signed-off-by: default avatarPeter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 2fe7e23d
...@@ -593,19 +593,6 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) ...@@ -593,19 +593,6 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
int ret = IRQ_NONE; int ret = IRQ_NONE;
u8 val; u8 val;
if (twl4030_i2c_read_u8(TWL4030_MODULE_INT, &val, REG_PWR_ISR1) < 0) {
printk(KERN_ERR "twl4030_usb: i2c read failed,"
" line %d\n", __LINE__);
goto done;
}
/* this interrupt line may be shared */
if (!(val & USB_PRES))
goto done;
/* clear the interrupt */
twl4030_i2c_write_u8(TWL4030_MODULE_INT, USB_PRES, REG_PWR_ISR1);
/* action based on cable attach or detach */ /* action based on cable attach or detach */
if (twl4030_i2c_read_u8(TWL4030_MODULE_INT, &val, REG_PWR_EDR1) < 0) { if (twl4030_i2c_read_u8(TWL4030_MODULE_INT, &val, REG_PWR_EDR1) < 0) {
printk(KERN_ERR "twl4030_usb: i2c read failed," printk(KERN_ERR "twl4030_usb: i2c read failed,"
...@@ -708,14 +695,13 @@ static int __init twl4030_usb_init(void) ...@@ -708,14 +695,13 @@ static int __init twl4030_usb_init(void)
the_transceiver = twl; the_transceiver = twl;
twl->irq = TWL4030_MODIRQ_PWR; twl->irq = TWL4030_PWRIRQ_USB_PRES;
twl->otg.set_host = twl4030_set_host; twl->otg.set_host = twl4030_set_host;
twl->otg.set_peripheral = twl4030_set_peripheral; twl->otg.set_peripheral = twl4030_set_peripheral;
twl->otg.set_suspend = twl4030_set_suspend; twl->otg.set_suspend = twl4030_set_suspend;
usb_irq_disable(); usb_irq_disable();
status = request_irq(twl->irq, twl4030_usb_irq, status = request_irq(twl->irq, twl4030_usb_irq, 0, "twl4030_usb", twl);
IRQF_DISABLED | IRQF_SHARED, "twl4030_usb", twl);
if (status < 0) { if (status < 0) {
printk(KERN_DEBUG "can't get IRQ %d, err %d\n", printk(KERN_DEBUG "can't get IRQ %d, err %d\n",
twl->irq, status); twl->irq, status);
......
...@@ -426,19 +426,6 @@ static irqreturn_t twl4030_rtc_interrupt(int irq, void *rtc) ...@@ -426,19 +426,6 @@ static irqreturn_t twl4030_rtc_interrupt(int irq, void *rtc)
int res; int res;
u8 rd_reg; u8 rd_reg;
/* clear the RTC interrupt in TWL4030 power module */
res = twl4030_i2c_read_u8(TWL4030_MODULE_INT, &rd_reg, REG_PWR_ISR1);
if (res)
goto out;
/* Check if interrupt is sourced by RTC */
if (!(rd_reg & PWR_RTC_INT_CLR))
goto out;
res = twl4030_i2c_write_u8(TWL4030_MODULE_INT, PWR_RTC_INT_CLR, REG_PWR_ISR1);
if (res)
goto out;
res = twl4030_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG); res = twl4030_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
if (res) if (res)
goto out; goto out;
...@@ -528,8 +515,8 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev) ...@@ -528,8 +515,8 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev)
if (ret < 0) if (ret < 0)
goto out1; goto out1;
ret = request_irq(TWL4030_MODIRQ_PWR, twl4030_rtc_interrupt, ret = request_irq(TWL4030_PWRIRQ_RTC, twl4030_rtc_interrupt,
IRQF_DISABLED | IRQF_SHARED, rtc->dev.bus_id, rtc); 0, rtc->dev.bus_id, rtc);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "IRQ is not free.\n"); dev_err(&pdev->dev, "IRQ is not free.\n");
goto out1; goto out1;
......
...@@ -62,6 +62,16 @@ ...@@ -62,6 +62,16 @@
#define TWL4030_MODIRQ_MADC (IH_TWL4030_BASE + 3) #define TWL4030_MODIRQ_MADC (IH_TWL4030_BASE + 3)
#define TWL4030_MODIRQ_USB (IH_TWL4030_BASE + 4) #define TWL4030_MODIRQ_USB (IH_TWL4030_BASE + 4)
#define TWL4030_MODIRQ_PWR (IH_TWL4030_BASE + 5) #define TWL4030_MODIRQ_PWR (IH_TWL4030_BASE + 5)
#define TWL4030_PWRIRQ_PWRBTN (IH_TWL4030_PWRBASE + 0)
#define TWL4030_PWRIRQ_CHG_PRES (IH_TWL4030_PWRBASE + 1)
#define TWL4030_PWRIRQ_USB_PRES (IH_TWL4030_PWRBASE + 2)
#define TWL4030_PWRIRQ_RTC (IH_TWL4030_PWRBASE + 3)
#define TWL4030_PWRIRQ_HOT_DIE (IH_TWL4030_PWRBASE + 4)
#define TWL4030_PWRIRQ_PWROK_TIMEOUT (IH_TWL4030_PWRBASE + 5)
#define TWL4030_PWRIRQ_MBCHG (IH_TWL4030_PWRBASE + 6)
#define TWL4030_PWRIRQ_SC_DETECT (IH_TWL4030_PWRBASE + 7)
/* Rest are unsued currently*/ /* Rest are unsued currently*/
/* Offsets to Power Registers */ /* Offsets to Power Registers */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment