summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-mxc.c
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2011-08-13 18:14:02 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2011-08-16 09:00:37 +0200
commit09ad8039dad91baed6e43f6ba4741805e7b48932 (patch)
tree2a12f2b9210a51c2963c7055595eb367d224f13f /drivers/gpio/gpio-mxc.c
parentarm/mxc: do not use gpio_to_irq() for static initializers (diff)
downloadlinux-09ad8039dad91baed6e43f6ba4741805e7b48932.tar.xz
linux-09ad8039dad91baed6e43f6ba4741805e7b48932.zip
gpio/mxc: add .to_irq for gpio chip
It adds .to_irq support for gpio chip, so that __gpio_to_irq in gpiolib becomes usable. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/gpio/gpio-mxc.c')
-rw-r--r--drivers/gpio/gpio-mxc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 4340acae3bd3..64aff20bc620 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -337,6 +337,15 @@ static void __devinit mxc_gpio_get_hw(struct platform_device *pdev)
mxc_gpio_hwtype = hwtype;
}
+static int mxc_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
+{
+ struct bgpio_chip *bgc = to_bgpio_chip(gc);
+ struct mxc_gpio_port *port =
+ container_of(bgc, struct mxc_gpio_port, bgc);
+
+ return port->virtual_irq_start + offset;
+}
+
static int __devinit mxc_gpio_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
@@ -403,6 +412,7 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev)
if (err)
goto out_iounmap;
+ port->bgc.gc.to_irq = mxc_gpio_to_irq;
port->bgc.gc.base = pdev->id * 32;
port->bgc.dir = port->bgc.read_reg(port->bgc.reg_dir);
port->bgc.data = port->bgc.read_reg(port->bgc.reg_set);