Commit 7814bb1c authored by Felipe Balbi's avatar Felipe Balbi Committed by Tony Lindgren

i2c: switch twl4030-usb to use a resource for irq

use platform_get_irq() for getting irq number passed
to twl4030-usb via twl4030-core.c:add_children()
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 8c7c2b6a
...@@ -819,9 +819,16 @@ static int add_children(struct twl4030_platform_data *pdata) ...@@ -819,9 +819,16 @@ static int add_children(struct twl4030_platform_data *pdata)
} }
if (twl_has_usb() && pdata->usb) { if (twl_has_usb() && pdata->usb) {
pdev = platform_device_alloc("twl4030_usb", -1);
if (pdev) {
twl = &twl4030_modules[TWL4030_SLAVENUM_NUM0]; twl = &twl4030_modules[TWL4030_SLAVENUM_NUM0];
pdev = platform_device_alloc("twl4030_usb", -1);
if (!pdev) {
pr_debug("%s: can't alloc usb dev\n", DRIVER_NAME);
status = -ENOMEM;
goto err;
}
if (status == 0) {
pdev->dev.parent = &twl->client->dev; pdev->dev.parent = &twl->client->dev;
device_init_wakeup(&pdev->dev, 1); device_init_wakeup(&pdev->dev, 1);
status = platform_device_add_data(pdev, pdata->usb, status = platform_device_add_data(pdev, pdata->usb,
...@@ -833,17 +840,26 @@ static int add_children(struct twl4030_platform_data *pdata) ...@@ -833,17 +840,26 @@ static int add_children(struct twl4030_platform_data *pdata)
status); status);
goto err; goto err;
} }
}
if (status == 0) {
struct resource r = {
.start = TWL4030_PWRIRQ_USB_PRES,
.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) { if (status < 0) {
platform_device_put(pdev); platform_device_put(pdev);
dev_dbg(&twl->client->dev, dev_dbg(&twl->client->dev,
"can't create usb dev, %d\n", "can't create usb dev, %d\n",
status); status);
} }
} else {
pr_debug("%s: can't alloc usb dev\n", DRIVER_NAME);
status = -ENOMEM;
}
} }
err: err:
......
...@@ -684,7 +684,7 @@ static int __init twl4030_usb_probe(struct platform_device *pdev) ...@@ -684,7 +684,7 @@ static int __init twl4030_usb_probe(struct platform_device *pdev)
vbus &= USB_PRES_RISING; vbus &= USB_PRES_RISING;
twl->dev = &pdev->dev; twl->dev = &pdev->dev;
twl->irq = TWL4030_PWRIRQ_USB_PRES; twl->irq = platform_get_irq(pdev, 0);
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;
......
...@@ -112,7 +112,7 @@ struct twl4030_platform_data { ...@@ -112,7 +112,7 @@ struct twl4030_platform_data {
#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)
#define TWL4030_MODIRQ_USB (TWL4030_IRQ_BASE + 4) /* #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_PWRBTN (TWL4030_PWR_IRQ_BASE + 0)
......
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