* [PATCH 1/2] gpio: tegra: create irq mapping in gpio_to_irq
@ 2012-11-07 15:01 Laxman Dewangan
2012-11-07 15:01 ` [PATCH 2/2] gpio: tegra: fix suspend/resume apis Laxman Dewangan
[not found] ` <1352300492-24779-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
0 siblings, 2 replies; 6+ messages in thread
From: Laxman Dewangan @ 2012-11-07 15:01 UTC (permalink / raw)
To: linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
grant.likely-s3s/WqlpOiPyB63q8FvJNQ
Cc: swarren-DDmLM1+adcrQT0dZR+AlfA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Laxman Dewangan
The gpio interrupts get mapped linearly and hence the mapping
of irq need to be created by irq_create_mapping().
The function gpio_to_irq() returns the irq by irq_find_mapping()
and so returns 0 as there is no mapping created. Fix the function
to create mapping when gpio_to_irq() get called.
Signed-off-by: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
drivers/gpio/gpio-tegra.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index c7c175a..6c08613 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -156,7 +156,7 @@ static int tegra_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
static int tegra_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
{
- return irq_find_mapping(irq_domain, offset);
+ return irq_create_mapping(irq_domain, offset);
}
static struct gpio_chip tegra_gpio_chip = {
--
1.7.1.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/2] gpio: tegra: fix suspend/resume apis 2012-11-07 15:01 [PATCH 1/2] gpio: tegra: create irq mapping in gpio_to_irq Laxman Dewangan @ 2012-11-07 15:01 ` Laxman Dewangan [not found] ` <1352300492-24779-2-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> [not found] ` <1352300492-24779-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 1 sibling, 1 reply; 6+ messages in thread From: Laxman Dewangan @ 2012-11-07 15:01 UTC (permalink / raw) To: linus.walleij, grant.likely Cc: swarren, linux-kernel, linux-tegra, Laxman Dewangan Following are changes done to fix the suspend/resume functionality of tegra gpio driver: - Protect suspend/resume callbacks with CONFIG_PM_SLEEP because CONFIG_PM doesn't actually enable any of the PM callbacks, it only allows to enable CONFIG_PM_SLEEP and CONFIG_PM_RUNTIME. This means if CONFIG_PM is used to protect system sleep callbacks then it may end up unreferenced if only runtime PM is enabled. - Fix the suspend/resume APIs declaration as per callback prototype. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> --- drivers/gpio/gpio-tegra.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index 6c08613..9c1884b 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c @@ -27,6 +27,7 @@ #include <linux/module.h> #include <linux/irqdomain.h> #include <linux/pinctrl/consumer.h> +#include <linux/pm.h> #include <asm/mach/irq.h> @@ -64,7 +65,7 @@ struct tegra_gpio_bank { int bank; int irq; spinlock_t lvl_lock[4]; -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP u32 cnf[4]; u32 out[4]; u32 oe[4]; @@ -285,8 +286,8 @@ static void tegra_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) } -#ifdef CONFIG_PM -void tegra_gpio_resume(void) +#ifdef CONFIG_PM_SLEEP +static int tegra_gpio_resume(struct device *dev) { unsigned long flags; int b; @@ -308,9 +309,10 @@ void tegra_gpio_resume(void) } local_irq_restore(flags); + return 0; } -void tegra_gpio_suspend(void) +static int tegra_gpio_suspend(struct device *dev) { unsigned long flags; int b; @@ -330,6 +332,7 @@ void tegra_gpio_suspend(void) } } local_irq_restore(flags); + return 0; } static int tegra_gpio_wake_enable(struct irq_data *d, unsigned int enable) @@ -345,11 +348,15 @@ static struct irq_chip tegra_gpio_irq_chip = { .irq_mask = tegra_gpio_irq_mask, .irq_unmask = tegra_gpio_irq_unmask, .irq_set_type = tegra_gpio_irq_set_type, -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP .irq_set_wake = tegra_gpio_wake_enable, #endif }; +static const struct dev_pm_ops tegra_gpio_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(tegra_gpio_suspend, tegra_gpio_resume) +}; + struct tegra_gpio_soc_config { u32 bank_stride; u32 upper_offset; @@ -489,6 +496,7 @@ static struct platform_driver tegra_gpio_driver = { .driver = { .name = "tegra-gpio", .owner = THIS_MODULE, + .pm = &tegra_gpio_pm_ops, .of_match_table = tegra_gpio_of_match, }, .probe = tegra_gpio_probe, -- 1.7.1.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
[parent not found: <1352300492-24779-2-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH 2/2] gpio: tegra: fix suspend/resume apis [not found] ` <1352300492-24779-2-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> @ 2012-11-07 17:11 ` Stephen Warren 2012-11-08 21:24 ` Linus Walleij 1 sibling, 0 replies; 6+ messages in thread From: Stephen Warren @ 2012-11-07 17:11 UTC (permalink / raw) To: Laxman Dewangan Cc: linus.walleij-QSEj5FYQhm4dnm+yROfE0A, grant.likely-s3s/WqlpOiPyB63q8FvJNQ, swarren-DDmLM1+adcrQT0dZR+AlfA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-tegra-u79uwXL29TY76Z2rM5mHXA On 11/07/2012 08:01 AM, Laxman Dewangan wrote: > Following are changes done to fix the suspend/resume > functionality of tegra gpio driver: > - Protect suspend/resume callbacks with CONFIG_PM_SLEEP > because CONFIG_PM doesn't actually enable any of the PM callbacks, it > only allows to enable CONFIG_PM_SLEEP and CONFIG_PM_RUNTIME. > This means if CONFIG_PM is used to protect system sleep callbacks > then it may end up unreferenced if only runtime PM is enabled. > > - Fix the suspend/resume APIs declaration as per callback prototype. Seems plausible, so this patch, Acked-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> I wonder why the suspend/resume functions weren't actually hooked up anywhere before. Oh well. Just one very minor nit below: > diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c > +#ifdef CONFIG_PM_SLEEP > +static int tegra_gpio_resume(struct device *dev) There are two spaces after "int" there. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] gpio: tegra: fix suspend/resume apis [not found] ` <1352300492-24779-2-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2012-11-07 17:11 ` Stephen Warren @ 2012-11-08 21:24 ` Linus Walleij 1 sibling, 0 replies; 6+ messages in thread From: Linus Walleij @ 2012-11-08 21:24 UTC (permalink / raw) To: Laxman Dewangan Cc: grant.likely-s3s/WqlpOiPyB63q8FvJNQ, swarren-DDmLM1+adcrQT0dZR+AlfA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-tegra-u79uwXL29TY76Z2rM5mHXA On Wed, Nov 7, 2012 at 4:01 PM, Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> wrote: > Following are changes done to fix the suspend/resume > functionality of tegra gpio driver: > - Protect suspend/resume callbacks with CONFIG_PM_SLEEP > because CONFIG_PM doesn't actually enable any of the PM callbacks, it > only allows to enable CONFIG_PM_SLEEP and CONFIG_PM_RUNTIME. > This means if CONFIG_PM is used to protect system sleep callbacks > then it may end up unreferenced if only runtime PM is enabled. > > - Fix the suspend/resume APIs declaration as per callback prototype. > > Signed-off-by: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> OK patch applied to my devel branch, with Stephens ACK and I also fixed the whitespace issue he pointed out. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <1352300492-24779-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH 1/2] gpio: tegra: create irq mapping in gpio_to_irq [not found] ` <1352300492-24779-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> @ 2012-11-07 17:08 ` Stephen Warren 2012-11-08 4:29 ` Laxman Dewangan 0 siblings, 1 reply; 6+ messages in thread From: Stephen Warren @ 2012-11-07 17:08 UTC (permalink / raw) To: Laxman Dewangan Cc: linus.walleij-QSEj5FYQhm4dnm+yROfE0A, grant.likely-s3s/WqlpOiPyB63q8FvJNQ, swarren-DDmLM1+adcrQT0dZR+AlfA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-tegra-u79uwXL29TY76Z2rM5mHXA On 11/07/2012 08:01 AM, Laxman Dewangan wrote: > The gpio interrupts get mapped linearly and hence the mapping > of irq need to be created by irq_create_mapping(). > > The function gpio_to_irq() returns the irq by irq_find_mapping() > and so returns 0 as there is no mapping created. Fix the function > to create mapping when gpio_to_irq() get called. I'm not convinced this should be needed. tegra_gpio_probe() contains: > for (gpio = 0; gpio < tegra_gpio_chip.ngpio; gpio++) { > int irq = irq_create_mapping(irq_domain, gpio); which should create the mapping for every IRQ. (although I do think the gpiochip_add() should be moved to the very end of probe(), I doubt that impacts this issue much) ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] gpio: tegra: create irq mapping in gpio_to_irq 2012-11-07 17:08 ` [PATCH 1/2] gpio: tegra: create irq mapping in gpio_to_irq Stephen Warren @ 2012-11-08 4:29 ` Laxman Dewangan 0 siblings, 0 replies; 6+ messages in thread From: Laxman Dewangan @ 2012-11-08 4:29 UTC (permalink / raw) To: Stephen Warren Cc: linus.walleij@linaro.org, grant.likely@secretlab.ca, Stephen Warren, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org On Wednesday 07 November 2012 10:38 PM, Stephen Warren wrote: > On 11/07/2012 08:01 AM, Laxman Dewangan wrote: >> The gpio interrupts get mapped linearly and hence the mapping >> of irq need to be created by irq_create_mapping(). >> >> The function gpio_to_irq() returns the irq by irq_find_mapping() >> and so returns 0 as there is no mapping created. Fix the function >> to create mapping when gpio_to_irq() get called. > I'm not convinced this should be needed. tegra_gpio_probe() contains: Oh, yes, I did not observe this code in my review. So this change is not resolving any issue. I think we should move the mapping to gpio_to_irq() rather than doing this in probe. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-11-08 21:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-07 15:01 [PATCH 1/2] gpio: tegra: create irq mapping in gpio_to_irq Laxman Dewangan
2012-11-07 15:01 ` [PATCH 2/2] gpio: tegra: fix suspend/resume apis Laxman Dewangan
[not found] ` <1352300492-24779-2-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-11-07 17:11 ` Stephen Warren
2012-11-08 21:24 ` Linus Walleij
[not found] ` <1352300492-24779-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-11-07 17:08 ` [PATCH 1/2] gpio: tegra: create irq mapping in gpio_to_irq Stephen Warren
2012-11-08 4:29 ` Laxman Dewangan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).