From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
To: Russell King <linux@arm.linux.org.uk>,
Daniel Mack <daniel@zonque.org>,
Robert Jarzmik <robert.jarzmik@free.fr>,
Linus Walleij <linus.walleij@linaro.org>,
Alexandre Courbot <gnurou@gmail.com>,
Wolfram Sang <wsa@the-dreams.de>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Bryan Wu <cooloney@gmail.com>, Richard Purdie <rpurdie@rpsys.net>,
Samuel Ortiz <sameo@linux.intel.com>,
Lee Jones <lee.jones@linaro.org>, Mark Brown <broonie@kernel.org>,
Jingoo Han <jg1.han@samsung.com>,
Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
Tomi Valkeinen <tomi.valkeinen@ti.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Andrea Adami <andrea.adami@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
linux-input@vger.kernel.org, linux-leds@vger.kernel.org,
linux-spi@vger.kernel.org, linux-fbdev@vger.kernel.org,
alsa-devel@alsa-project.org
Subject: [PATCH v3 08/17] gpio: locomo: implement per-pin irq handling
Date: Sun, 17 May 2015 19:27:48 +0300 [thread overview]
Message-ID: <1431880077-26321-9-git-send-email-dbaryshkov@gmail.com> (raw)
In-Reply-To: <1431880077-26321-1-git-send-email-dbaryshkov@gmail.com>
LoCoMo has a possibility to generate per-GPIO edge irqs. Support for
that was there in old locomo driver, got 'cleaned up' during old driver
IRQ cascading cleanup and is now reimplemented. It is expected that
SL-5500 (collie) will use locomo gpio irqs for mmc detection irq.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/gpio/Kconfig | 1 +
drivers/gpio/gpio-locomo.c | 117 ++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 117 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 4542684..6b77614 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -737,6 +737,7 @@ config GPIO_KEMPLD
config GPIO_LOCOMO
bool "Sharp LoCoMo GPIO support"
depends on MFD_LOCOMO
+ select GPIOLIB_IRQCHIP
help
Select this to support GPIO pins on Sharp LoCoMo Grid Array found
in Sharp Zaurus collie and poodle models.
diff --git a/drivers/gpio/gpio-locomo.c b/drivers/gpio/gpio-locomo.c
index dd9a1ca..75dbf6b 100644
--- a/drivers/gpio/gpio-locomo.c
+++ b/drivers/gpio/gpio-locomo.c
@@ -16,13 +16,15 @@
#include <linux/slab.h>
#include <linux/bitops.h>
#include <linux/err.h>
-#include <linux/gpio.h>
+#include <linux/gpio/driver.h>
#include <linux/io.h>
+#include <linux/irq.h>
#include <linux/regmap.h>
#include <linux/mfd/locomo.h>
struct locomo_gpio {
struct regmap *regmap;
+ int irq;
struct gpio_chip gpio;
@@ -79,6 +81,99 @@ static int locomo_gpio_direction_output(struct gpio_chip *chip,
return 0;
}
+static void
+locomo_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
+{
+ struct gpio_chip *chip = irq_get_handler_data(irq);
+ struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+ struct irq_chip *irqchip = irq_desc_get_chip(desc);
+ unsigned int gir;
+ unsigned int gpd;
+ unsigned int req;
+
+ chained_irq_enter(irqchip, desc);
+
+ while (1) {
+ regmap_read(lg->regmap, LOCOMO_GIR, &gir);
+ regmap_read(lg->regmap, LOCOMO_GPD, &gpd);
+ req = gir & gpd;
+
+ if (!req)
+ break;
+
+ generic_handle_irq(irq_find_mapping(lg->gpio.irqdomain,
+ ffs(req) - 1));
+ }
+
+ chained_irq_exit(irqchip, desc);
+}
+
+static void locomo_gpio_ack_irq(struct irq_data *d)
+{
+ struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
+ struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+ unsigned int mask = BIT(d->hwirq);
+
+ regmap_update_bits(lg->regmap, LOCOMO_GWE, mask, mask);
+ regmap_update_bits(lg->regmap, LOCOMO_GIS, mask, 0);
+ regmap_update_bits(lg->regmap, LOCOMO_GWE, mask, 0);
+}
+
+static void locomo_gpio_mask_irq(struct irq_data *d)
+{
+ struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
+ struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+ unsigned int mask = BIT(d->hwirq);
+
+ regmap_update_bits(lg->regmap, LOCOMO_GIE, mask, 0);
+}
+
+static void locomo_gpio_unmask_irq(struct irq_data *d)
+{
+ struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
+ struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+ unsigned int mask = BIT(d->hwirq);
+
+ regmap_update_bits(lg->regmap, LOCOMO_GIE, mask, mask);
+}
+
+static int locomo_gpio_type_irq(struct irq_data *d, unsigned int type)
+{
+ struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
+ struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+ unsigned int mask;
+
+ mask = BIT(d->hwirq);
+
+ if (type == IRQ_TYPE_PROBE) {
+ if ((lg->rising_edge | lg->falling_edge) & mask)
+ return 0;
+ type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
+ }
+
+ if (type & IRQ_TYPE_EDGE_RISING)
+ lg->rising_edge |= mask;
+ else
+ lg->rising_edge &= ~mask;
+ if (type & IRQ_TYPE_EDGE_FALLING)
+ lg->falling_edge |= mask;
+ else
+ lg->falling_edge &= ~mask;
+
+ regmap_write(lg->regmap, LOCOMO_GRIE, lg->rising_edge);
+ regmap_write(lg->regmap, LOCOMO_GFIE, lg->falling_edge);
+
+ return 0;
+}
+
+static struct irq_chip locomo_gpio_irq_chip = {
+ .name = "locomo-GPIO",
+ .irq_ack = locomo_gpio_ack_irq,
+ .irq_mask = locomo_gpio_mask_irq,
+ .irq_unmask = locomo_gpio_unmask_irq,
+ .irq_set_type = locomo_gpio_type_irq,
+};
+
#ifdef CONFIG_PM_SLEEP
static int locomo_gpio_suspend(struct device *dev)
{
@@ -119,6 +214,10 @@ static int locomo_gpio_probe(struct platform_device *pdev)
if (!lg)
return -ENOMEM;
+ lg->irq = platform_get_irq(pdev, 0);
+ if (lg->irq < 0)
+ return -ENXIO;
+
lg->regmap = dev_get_regmap(pdev->dev.parent, NULL);
if (!lg->regmap)
return -EINVAL;
@@ -130,6 +229,7 @@ static int locomo_gpio_probe(struct platform_device *pdev)
regmap_write(lg->regmap, LOCOMO_GPD, 0x00);
regmap_write(lg->regmap, LOCOMO_GIE, 0x00);
+ lg->gpio.dev = &pdev->dev;
lg->gpio.base = pdata ? pdata->gpio_base : -1;
lg->gpio.label = "locomo-gpio";
lg->gpio.ngpio = 16;
@@ -142,7 +242,22 @@ static int locomo_gpio_probe(struct platform_device *pdev)
if (ret)
return ret;
+ ret = gpiochip_irqchip_add(&lg->gpio, &locomo_gpio_irq_chip, 0,
+ handle_level_irq, IRQ_TYPE_NONE);
+ if (ret) {
+ dev_err(&pdev->dev, "Failed to add irq chip\n");
+ goto err_rm_gpiochip;
+ }
+
+ gpiochip_set_chained_irqchip(&lg->gpio, &locomo_gpio_irq_chip, lg->irq,
+ locomo_gpio_irq_handler);
+
return 0;
+
+err_rm_gpiochip:
+ gpiochip_remove(&lg->gpio);
+
+ return ret;
}
static int locomo_gpio_remove(struct platform_device *pdev)
--
2.1.4
WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
To: Russell King <linux@arm.linux.org.uk>,
Daniel Mack <daniel@zonque.org>,
Robert Jarzmik <robert.jarzmik@free.fr>,
Linus Walleij <linus.walleij@linaro.org>,
Alexandre Courbot <gnurou@gmail.com>,
Wolfram Sang <wsa@the-dreams.de>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Bryan Wu <cooloney@gmail.com>, Richard Purdie <rpurdie@rpsys.net>,
Samuel Ortiz <sameo@linux.intel.com>,
Lee Jones <lee.jones@linaro.org>, Mark Brown <broonie@kernel.org>,
Jingoo Han <jg1.han@samsung.com>,
Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
Tomi Valkeinen <tomi.valkeinen@ti.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Andrea Adami <andrea.adami@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
linux-input@vger.kernel.org, linux-leds@vger.kernel.org,
linux-spi@vger.kernel.org, linux-fbdev@vger.kernel.org,
alsa-devel@alsa-project.org
Subject: [PATCH v3 08/17] gpio: locomo: implement per-pin irq handling
Date: Sun, 17 May 2015 16:27:48 +0000 [thread overview]
Message-ID: <1431880077-26321-9-git-send-email-dbaryshkov@gmail.com> (raw)
In-Reply-To: <1431880077-26321-1-git-send-email-dbaryshkov@gmail.com>
LoCoMo has a possibility to generate per-GPIO edge irqs. Support for
that was there in old locomo driver, got 'cleaned up' during old driver
IRQ cascading cleanup and is now reimplemented. It is expected that
SL-5500 (collie) will use locomo gpio irqs for mmc detection irq.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/gpio/Kconfig | 1 +
drivers/gpio/gpio-locomo.c | 117 ++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 117 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 4542684..6b77614 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -737,6 +737,7 @@ config GPIO_KEMPLD
config GPIO_LOCOMO
bool "Sharp LoCoMo GPIO support"
depends on MFD_LOCOMO
+ select GPIOLIB_IRQCHIP
help
Select this to support GPIO pins on Sharp LoCoMo Grid Array found
in Sharp Zaurus collie and poodle models.
diff --git a/drivers/gpio/gpio-locomo.c b/drivers/gpio/gpio-locomo.c
index dd9a1ca..75dbf6b 100644
--- a/drivers/gpio/gpio-locomo.c
+++ b/drivers/gpio/gpio-locomo.c
@@ -16,13 +16,15 @@
#include <linux/slab.h>
#include <linux/bitops.h>
#include <linux/err.h>
-#include <linux/gpio.h>
+#include <linux/gpio/driver.h>
#include <linux/io.h>
+#include <linux/irq.h>
#include <linux/regmap.h>
#include <linux/mfd/locomo.h>
struct locomo_gpio {
struct regmap *regmap;
+ int irq;
struct gpio_chip gpio;
@@ -79,6 +81,99 @@ static int locomo_gpio_direction_output(struct gpio_chip *chip,
return 0;
}
+static void
+locomo_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
+{
+ struct gpio_chip *chip = irq_get_handler_data(irq);
+ struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+ struct irq_chip *irqchip = irq_desc_get_chip(desc);
+ unsigned int gir;
+ unsigned int gpd;
+ unsigned int req;
+
+ chained_irq_enter(irqchip, desc);
+
+ while (1) {
+ regmap_read(lg->regmap, LOCOMO_GIR, &gir);
+ regmap_read(lg->regmap, LOCOMO_GPD, &gpd);
+ req = gir & gpd;
+
+ if (!req)
+ break;
+
+ generic_handle_irq(irq_find_mapping(lg->gpio.irqdomain,
+ ffs(req) - 1));
+ }
+
+ chained_irq_exit(irqchip, desc);
+}
+
+static void locomo_gpio_ack_irq(struct irq_data *d)
+{
+ struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
+ struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+ unsigned int mask = BIT(d->hwirq);
+
+ regmap_update_bits(lg->regmap, LOCOMO_GWE, mask, mask);
+ regmap_update_bits(lg->regmap, LOCOMO_GIS, mask, 0);
+ regmap_update_bits(lg->regmap, LOCOMO_GWE, mask, 0);
+}
+
+static void locomo_gpio_mask_irq(struct irq_data *d)
+{
+ struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
+ struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+ unsigned int mask = BIT(d->hwirq);
+
+ regmap_update_bits(lg->regmap, LOCOMO_GIE, mask, 0);
+}
+
+static void locomo_gpio_unmask_irq(struct irq_data *d)
+{
+ struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
+ struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+ unsigned int mask = BIT(d->hwirq);
+
+ regmap_update_bits(lg->regmap, LOCOMO_GIE, mask, mask);
+}
+
+static int locomo_gpio_type_irq(struct irq_data *d, unsigned int type)
+{
+ struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
+ struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+ unsigned int mask;
+
+ mask = BIT(d->hwirq);
+
+ if (type = IRQ_TYPE_PROBE) {
+ if ((lg->rising_edge | lg->falling_edge) & mask)
+ return 0;
+ type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
+ }
+
+ if (type & IRQ_TYPE_EDGE_RISING)
+ lg->rising_edge |= mask;
+ else
+ lg->rising_edge &= ~mask;
+ if (type & IRQ_TYPE_EDGE_FALLING)
+ lg->falling_edge |= mask;
+ else
+ lg->falling_edge &= ~mask;
+
+ regmap_write(lg->regmap, LOCOMO_GRIE, lg->rising_edge);
+ regmap_write(lg->regmap, LOCOMO_GFIE, lg->falling_edge);
+
+ return 0;
+}
+
+static struct irq_chip locomo_gpio_irq_chip = {
+ .name = "locomo-GPIO",
+ .irq_ack = locomo_gpio_ack_irq,
+ .irq_mask = locomo_gpio_mask_irq,
+ .irq_unmask = locomo_gpio_unmask_irq,
+ .irq_set_type = locomo_gpio_type_irq,
+};
+
#ifdef CONFIG_PM_SLEEP
static int locomo_gpio_suspend(struct device *dev)
{
@@ -119,6 +214,10 @@ static int locomo_gpio_probe(struct platform_device *pdev)
if (!lg)
return -ENOMEM;
+ lg->irq = platform_get_irq(pdev, 0);
+ if (lg->irq < 0)
+ return -ENXIO;
+
lg->regmap = dev_get_regmap(pdev->dev.parent, NULL);
if (!lg->regmap)
return -EINVAL;
@@ -130,6 +229,7 @@ static int locomo_gpio_probe(struct platform_device *pdev)
regmap_write(lg->regmap, LOCOMO_GPD, 0x00);
regmap_write(lg->regmap, LOCOMO_GIE, 0x00);
+ lg->gpio.dev = &pdev->dev;
lg->gpio.base = pdata ? pdata->gpio_base : -1;
lg->gpio.label = "locomo-gpio";
lg->gpio.ngpio = 16;
@@ -142,7 +242,22 @@ static int locomo_gpio_probe(struct platform_device *pdev)
if (ret)
return ret;
+ ret = gpiochip_irqchip_add(&lg->gpio, &locomo_gpio_irq_chip, 0,
+ handle_level_irq, IRQ_TYPE_NONE);
+ if (ret) {
+ dev_err(&pdev->dev, "Failed to add irq chip\n");
+ goto err_rm_gpiochip;
+ }
+
+ gpiochip_set_chained_irqchip(&lg->gpio, &locomo_gpio_irq_chip, lg->irq,
+ locomo_gpio_irq_handler);
+
return 0;
+
+err_rm_gpiochip:
+ gpiochip_remove(&lg->gpio);
+
+ return ret;
}
static int locomo_gpio_remove(struct platform_device *pdev)
--
2.1.4
WARNING: multiple messages have this Message-ID (diff)
From: dbaryshkov@gmail.com (Dmitry Eremin-Solenikov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 08/17] gpio: locomo: implement per-pin irq handling
Date: Sun, 17 May 2015 19:27:48 +0300 [thread overview]
Message-ID: <1431880077-26321-9-git-send-email-dbaryshkov@gmail.com> (raw)
In-Reply-To: <1431880077-26321-1-git-send-email-dbaryshkov@gmail.com>
LoCoMo has a possibility to generate per-GPIO edge irqs. Support for
that was there in old locomo driver, got 'cleaned up' during old driver
IRQ cascading cleanup and is now reimplemented. It is expected that
SL-5500 (collie) will use locomo gpio irqs for mmc detection irq.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/gpio/Kconfig | 1 +
drivers/gpio/gpio-locomo.c | 117 ++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 117 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 4542684..6b77614 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -737,6 +737,7 @@ config GPIO_KEMPLD
config GPIO_LOCOMO
bool "Sharp LoCoMo GPIO support"
depends on MFD_LOCOMO
+ select GPIOLIB_IRQCHIP
help
Select this to support GPIO pins on Sharp LoCoMo Grid Array found
in Sharp Zaurus collie and poodle models.
diff --git a/drivers/gpio/gpio-locomo.c b/drivers/gpio/gpio-locomo.c
index dd9a1ca..75dbf6b 100644
--- a/drivers/gpio/gpio-locomo.c
+++ b/drivers/gpio/gpio-locomo.c
@@ -16,13 +16,15 @@
#include <linux/slab.h>
#include <linux/bitops.h>
#include <linux/err.h>
-#include <linux/gpio.h>
+#include <linux/gpio/driver.h>
#include <linux/io.h>
+#include <linux/irq.h>
#include <linux/regmap.h>
#include <linux/mfd/locomo.h>
struct locomo_gpio {
struct regmap *regmap;
+ int irq;
struct gpio_chip gpio;
@@ -79,6 +81,99 @@ static int locomo_gpio_direction_output(struct gpio_chip *chip,
return 0;
}
+static void
+locomo_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
+{
+ struct gpio_chip *chip = irq_get_handler_data(irq);
+ struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+ struct irq_chip *irqchip = irq_desc_get_chip(desc);
+ unsigned int gir;
+ unsigned int gpd;
+ unsigned int req;
+
+ chained_irq_enter(irqchip, desc);
+
+ while (1) {
+ regmap_read(lg->regmap, LOCOMO_GIR, &gir);
+ regmap_read(lg->regmap, LOCOMO_GPD, &gpd);
+ req = gir & gpd;
+
+ if (!req)
+ break;
+
+ generic_handle_irq(irq_find_mapping(lg->gpio.irqdomain,
+ ffs(req) - 1));
+ }
+
+ chained_irq_exit(irqchip, desc);
+}
+
+static void locomo_gpio_ack_irq(struct irq_data *d)
+{
+ struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
+ struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+ unsigned int mask = BIT(d->hwirq);
+
+ regmap_update_bits(lg->regmap, LOCOMO_GWE, mask, mask);
+ regmap_update_bits(lg->regmap, LOCOMO_GIS, mask, 0);
+ regmap_update_bits(lg->regmap, LOCOMO_GWE, mask, 0);
+}
+
+static void locomo_gpio_mask_irq(struct irq_data *d)
+{
+ struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
+ struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+ unsigned int mask = BIT(d->hwirq);
+
+ regmap_update_bits(lg->regmap, LOCOMO_GIE, mask, 0);
+}
+
+static void locomo_gpio_unmask_irq(struct irq_data *d)
+{
+ struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
+ struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+ unsigned int mask = BIT(d->hwirq);
+
+ regmap_update_bits(lg->regmap, LOCOMO_GIE, mask, mask);
+}
+
+static int locomo_gpio_type_irq(struct irq_data *d, unsigned int type)
+{
+ struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
+ struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+ unsigned int mask;
+
+ mask = BIT(d->hwirq);
+
+ if (type == IRQ_TYPE_PROBE) {
+ if ((lg->rising_edge | lg->falling_edge) & mask)
+ return 0;
+ type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
+ }
+
+ if (type & IRQ_TYPE_EDGE_RISING)
+ lg->rising_edge |= mask;
+ else
+ lg->rising_edge &= ~mask;
+ if (type & IRQ_TYPE_EDGE_FALLING)
+ lg->falling_edge |= mask;
+ else
+ lg->falling_edge &= ~mask;
+
+ regmap_write(lg->regmap, LOCOMO_GRIE, lg->rising_edge);
+ regmap_write(lg->regmap, LOCOMO_GFIE, lg->falling_edge);
+
+ return 0;
+}
+
+static struct irq_chip locomo_gpio_irq_chip = {
+ .name = "locomo-GPIO",
+ .irq_ack = locomo_gpio_ack_irq,
+ .irq_mask = locomo_gpio_mask_irq,
+ .irq_unmask = locomo_gpio_unmask_irq,
+ .irq_set_type = locomo_gpio_type_irq,
+};
+
#ifdef CONFIG_PM_SLEEP
static int locomo_gpio_suspend(struct device *dev)
{
@@ -119,6 +214,10 @@ static int locomo_gpio_probe(struct platform_device *pdev)
if (!lg)
return -ENOMEM;
+ lg->irq = platform_get_irq(pdev, 0);
+ if (lg->irq < 0)
+ return -ENXIO;
+
lg->regmap = dev_get_regmap(pdev->dev.parent, NULL);
if (!lg->regmap)
return -EINVAL;
@@ -130,6 +229,7 @@ static int locomo_gpio_probe(struct platform_device *pdev)
regmap_write(lg->regmap, LOCOMO_GPD, 0x00);
regmap_write(lg->regmap, LOCOMO_GIE, 0x00);
+ lg->gpio.dev = &pdev->dev;
lg->gpio.base = pdata ? pdata->gpio_base : -1;
lg->gpio.label = "locomo-gpio";
lg->gpio.ngpio = 16;
@@ -142,7 +242,22 @@ static int locomo_gpio_probe(struct platform_device *pdev)
if (ret)
return ret;
+ ret = gpiochip_irqchip_add(&lg->gpio, &locomo_gpio_irq_chip, 0,
+ handle_level_irq, IRQ_TYPE_NONE);
+ if (ret) {
+ dev_err(&pdev->dev, "Failed to add irq chip\n");
+ goto err_rm_gpiochip;
+ }
+
+ gpiochip_set_chained_irqchip(&lg->gpio, &locomo_gpio_irq_chip, lg->irq,
+ locomo_gpio_irq_handler);
+
return 0;
+
+err_rm_gpiochip:
+ gpiochip_remove(&lg->gpio);
+
+ return ret;
}
static int locomo_gpio_remove(struct platform_device *pdev)
--
2.1.4
next prev parent reply other threads:[~2015-05-17 16:27 UTC|newest]
Thread overview: 81+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-17 16:27 [PATCH v3 00/17] new LoCoMo driver set Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` [PATCH v3 02/17] leds: port locomo leds driver to new locomo core Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-18 8:37 ` Jacek Anaszewski
2015-05-18 8:37 ` Jacek Anaszewski
2015-05-18 8:37 ` Jacek Anaszewski
2015-05-17 16:27 ` [PATCH v3 03/17] input: convert LoCoMo keyboard driver to use " Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-18 16:50 ` Dmitry Torokhov
2015-05-18 16:50 ` Dmitry Torokhov
2015-05-18 16:50 ` Dmitry Torokhov
[not found] ` <1431880077-26321-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-17 16:27 ` [PATCH v3 01/17] mfd: add new driver for Sharp LoCoMo Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
[not found] ` <1431880077-26321-2-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-19 10:38 ` Lee Jones
2015-05-19 10:38 ` Lee Jones
2015-05-19 11:21 ` Russell King - ARM Linux
2015-05-19 11:21 ` Russell King - ARM Linux
2015-05-19 11:21 ` Russell King - ARM Linux
2015-05-19 12:33 ` Lee Jones
2015-05-19 12:33 ` Lee Jones
2015-05-19 12:33 ` Lee Jones
2015-05-17 16:27 ` [PATCH v3 04/17] input: make LoCoMo keyboard driver support both poodle and collie Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
[not found] ` <1431880077-26321-5-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-18 16:50 ` Dmitry Torokhov
2015-05-18 16:50 ` Dmitry Torokhov
2015-05-18 16:50 ` Dmitry Torokhov
2015-05-17 16:27 ` [PATCH v3 13/17] ASoC: pxa: poodle: make use of new locomo GPIO interface Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` [PATCH v3 14/17] ARM: pxa: poodle: use new LoCoMo driver Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` [PATCH v3 17/17] ARM: drop old " Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` [PATCH v3 05/17] video: backlight: add new locomo backlight driver Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` [PATCH v3 06/17] video: lcd: add LoCoMo LCD driver Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-19 9:36 ` Lee Jones
2015-05-19 9:36 ` Lee Jones
2015-05-19 9:36 ` Lee Jones
2015-05-19 9:45 ` Dmitry Eremin-Solenikov
2015-05-19 9:45 ` Dmitry Eremin-Solenikov
2015-05-19 9:45 ` Dmitry Eremin-Solenikov
2015-05-19 12:34 ` Lee Jones
2015-05-19 12:34 ` Lee Jones
2015-05-19 12:34 ` Lee Jones
2015-05-17 16:27 ` [PATCH v3 07/17] gpio: port LoCoMo gpio support from old driver Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov [this message]
2015-05-17 16:27 ` [PATCH v3 08/17] gpio: locomo: implement per-pin irq handling Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` [PATCH v3 09/17] spi: add locomo SPI driver Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` [PATCH v3 10/17] i2c: add locomo i2c driver Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` [PATCH v3 11/17] ARM: sa1100: make collie use new locomo drivers Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` [PATCH v3 12/17] ARM: sa1100: don't preallocate IRQ space for locomo Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` [PATCH v3 15/17] ARM: pxa: poodle: " Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` [PATCH v3 16/17] video: backlight: drop old locomo bl/lcd driver Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
2015-05-17 16:27 ` Dmitry Eremin-Solenikov
-- strict thread matches above, loose matches on Subject: below --
2015-05-20 12:26 [PATCH v3 06/17] video: lcd: add LoCoMo LCD driver Jingoo Han
2015-05-20 12:26 ` Jingoo Han
2015-05-20 12:26 ` Jingoo Han
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1431880077-26321-9-git-send-email-dbaryshkov@gmail.com \
--to=dbaryshkov@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=andrea.adami@gmail.com \
--cc=broonie@kernel.org \
--cc=cooloney@gmail.com \
--cc=daniel@zonque.org \
--cc=dmitry.torokhov@gmail.com \
--cc=gnurou@gmail.com \
--cc=jg1.han@samsung.com \
--cc=lee.jones@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=plagnioj@jcrosoft.com \
--cc=robert.jarzmik@free.fr \
--cc=rpurdie@rpsys.net \
--cc=sameo@linux.intel.com \
--cc=tomi.valkeinen@ti.com \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.