Commit 8c7c2b6a authored by David Brownell's avatar David Brownell Committed by Tony Lindgren

minor irq-related cleanups

Minor IRQ-related cleanups:  comment out the no-longer-used
GPIO irq symbol (more to come, eventually); create RTC IRQ
resource; and use that RTC IRQ resource.

And incidentally, make the RTC code free the correct IRQ;
it was pretty goofed up...
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent a5f78ae6
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
/* REVISIT when these symbols vanish elsewhere, remove them here too */ /* REVISIT when these symbols vanish elsewhere, remove them here too */
/* #undef TWL4030_GPIO_IRQ_BASE */ /* #undef TWL4030_GPIO_IRQ_BASE */
/* #undef TWL4030_GPIO_IRQ_END */ /* #undef TWL4030_GPIO_IRQ_END */
#undef TWL4030_MODIRQ_GPIO
static struct gpio_chip twl_gpiochip; static struct gpio_chip twl_gpiochip;
static int twl4030_gpio_irq_base; static int twl4030_gpio_irq_base;
......
...@@ -776,37 +776,44 @@ static int add_children(struct twl4030_platform_data *pdata) ...@@ -776,37 +776,44 @@ static int add_children(struct twl4030_platform_data *pdata)
} }
if (twl_has_rtc()) { if (twl_has_rtc()) {
twl = &twl4030_modules[TWL4030_SLAVENUM_NUM3];
pdev = platform_device_alloc("twl4030_rtc", -1); pdev = platform_device_alloc("twl4030_rtc", -1);
if (pdev) { if (!pdev) {
twl = &twl4030_modules[TWL4030_SLAVENUM_NUM3]; pr_debug("%s: can't alloc rtc dev\n", DRIVER_NAME);
status = -ENOMEM;
} else {
pdev->dev.parent = &twl->client->dev; pdev->dev.parent = &twl->client->dev;
device_init_wakeup(&pdev->dev, 1); device_init_wakeup(&pdev->dev, 1);
}
/* /*
* FIXME add the relevant IRQ resource, and make the * REVISIT platform_data here currently might use of
* rtc driver use it instead of hard-wiring ... * "msecure" line ... but for now we just expect board
* * setup to tell the chip "we are secure" at all times.
* REVISIT platform_data here currently only supports * Eventually, Linux might become more aware of such
* setting up the "msecure" line ... which actually * HW security concerns, and "least privilege".
* violates the "princple of least privilege", since */
* it's effectively always in "high trust" mode.
* /* RTC module IRQ */
* For now, expect equivalent treatment at board init: if (status == 0) {
* setting msecure high. Eventually, Linux might struct resource r = {
* become more aware of those HW security concerns. /* REVISIT don't hard-wire this stuff */
*/ .start = TWL4030_PWRIRQ_RTC,
.flags = IORESOURCE_IRQ,
};
status = platform_device_add_resources(pdev, &r, 1);
}
if (status == 0)
status = platform_device_add(pdev); status = platform_device_add(pdev);
if (status < 0) {
platform_device_put(pdev); if (status < 0) {
dev_dbg(&twl->client->dev, platform_device_put(pdev);
"can't create rtc dev, %d\n", dev_dbg(&twl->client->dev,
status); "can't create rtc dev, %d\n",
goto err; status);
}
} else {
pr_debug("%s: can't alloc rtc dev\n", DRIVER_NAME);
status = -ENOMEM;
goto err; goto err;
} }
} }
......
...@@ -353,8 +353,12 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev) ...@@ -353,8 +353,12 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev)
struct twl4030rtc_platform_data *pdata = pdev->dev.platform_data; struct twl4030rtc_platform_data *pdata = pdev->dev.platform_data;
struct rtc_device *rtc; struct rtc_device *rtc;
int ret = 0; int ret = 0;
int irq = platform_get_irq(pdev, 0);
u8 rd_reg; u8 rd_reg;
if (irq < 0)
return irq;
if (pdata != NULL && pdata->init != NULL) { if (pdata != NULL && pdata->init != NULL) {
ret = pdata->init(); ret = pdata->init();
if (ret < 0) if (ret < 0)
...@@ -389,7 +393,7 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev) ...@@ -389,7 +393,7 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev)
if (ret < 0) if (ret < 0)
goto out1; goto out1;
ret = request_irq(TWL4030_PWRIRQ_RTC, twl4030_rtc_interrupt, ret = request_irq(irq, twl4030_rtc_interrupt,
0, 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");
...@@ -438,7 +442,7 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev) ...@@ -438,7 +442,7 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev)
out2: out2:
free_irq(TWL4030_MODIRQ_PWR, rtc); free_irq(irq, rtc);
out1: out1:
rtc_device_unregister(rtc); rtc_device_unregister(rtc);
out0: out0:
...@@ -457,11 +461,12 @@ static int __devexit twl4030_rtc_remove(struct platform_device *pdev) ...@@ -457,11 +461,12 @@ static int __devexit twl4030_rtc_remove(struct platform_device *pdev)
/* leave rtc running, but disable irqs */ /* leave rtc running, but disable irqs */
struct twl4030rtc_platform_data *pdata = pdev->dev.platform_data; struct twl4030rtc_platform_data *pdata = pdev->dev.platform_data;
struct rtc_device *rtc = platform_get_drvdata(pdev); struct rtc_device *rtc = platform_get_drvdata(pdev);
int irq = platform_get_irq(pdev, 0);
mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M); mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M); mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
free_irq(TWL4030_MODIRQ_PWR, rtc); free_irq(irq, rtc);
if (pdata != NULL && pdata->exit != NULL) if (pdata != NULL && pdata->exit != NULL)
pdata->exit(); pdata->exit();
......
...@@ -108,7 +108,7 @@ struct twl4030_platform_data { ...@@ -108,7 +108,7 @@ struct twl4030_platform_data {
#include <mach/irqs.h> #include <mach/irqs.h>
/* TWL4030 interrupts */ /* TWL4030 interrupts */
#define TWL4030_MODIRQ_GPIO (TWL4030_IRQ_BASE + 0) /* #define TWL4030_MODIRQ_GPIO (TWL4030_IRQ_BASE + 0) */
#define TWL4030_MODIRQ_KEYPAD (TWL4030_IRQ_BASE + 1) #define TWL4030_MODIRQ_KEYPAD (TWL4030_IRQ_BASE + 1)
#define TWL4030_MODIRQ_BCI (TWL4030_IRQ_BASE + 2) #define TWL4030_MODIRQ_BCI (TWL4030_IRQ_BASE + 2)
#define TWL4030_MODIRQ_MADC (TWL4030_IRQ_BASE + 3) #define TWL4030_MODIRQ_MADC (TWL4030_IRQ_BASE + 3)
......
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