diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2011-08-13 12:14:02 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-08-16 03:00:37 -0400 |
commit | 09ad8039dad91baed6e43f6ba4741805e7b48932 (patch) | |
tree | 2a12f2b9210a51c2963c7055595eb367d224f13f | |
parent | e309fb1864e2d59ff030d5b95c4fb8188ab0eb4c (diff) |
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>
-rw-r--r-- | drivers/gpio/gpio-mxc.c | 10 |
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) | |||
337 | mxc_gpio_hwtype = hwtype; | 337 | mxc_gpio_hwtype = hwtype; |
338 | } | 338 | } |
339 | 339 | ||
340 | static int mxc_gpio_to_irq(struct gpio_chip *gc, unsigned offset) | ||
341 | { | ||
342 | struct bgpio_chip *bgc = to_bgpio_chip(gc); | ||
343 | struct mxc_gpio_port *port = | ||
344 | container_of(bgc, struct mxc_gpio_port, bgc); | ||
345 | |||
346 | return port->virtual_irq_start + offset; | ||
347 | } | ||
348 | |||
340 | static int __devinit mxc_gpio_probe(struct platform_device *pdev) | 349 | static int __devinit mxc_gpio_probe(struct platform_device *pdev) |
341 | { | 350 | { |
342 | struct device_node *np = pdev->dev.of_node; | 351 | struct device_node *np = pdev->dev.of_node; |
@@ -403,6 +412,7 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev) | |||
403 | if (err) | 412 | if (err) |
404 | goto out_iounmap; | 413 | goto out_iounmap; |
405 | 414 | ||
415 | port->bgc.gc.to_irq = mxc_gpio_to_irq; | ||
406 | port->bgc.gc.base = pdev->id * 32; | 416 | port->bgc.gc.base = pdev->id * 32; |
407 | port->bgc.dir = port->bgc.read_reg(port->bgc.reg_dir); | 417 | port->bgc.dir = port->bgc.read_reg(port->bgc.reg_dir); |
408 | port->bgc.data = port->bgc.read_reg(port->bgc.reg_set); | 418 | port->bgc.data = port->bgc.read_reg(port->bgc.reg_set); |