Re: [RFC/RFT/PATCH V3] gpio: omap: refresh patch be more aggressive with pm_runtime against v3.12-rc5
On Sun, Dec 8, 2013 at 5:40 AM, Chao Xu caesarxuc...@gmail.com wrote: From: Felipe Balbi ba...@ti.com try to keep gpio block suspended as much as possible. Tested with pandaboard and a sysfs exported gpio. Signed-off-by: Felipe Balbi balbi at ti.com [caesarxuc...@gmail.com : Refreshed against v3.12-rc5, and added revision check to enable aggressive pm_runtime on OMAP4-only. Because am33xx_gpio_sysc.idlemodes seems to be wrongly marked as SIDLE_SMART_WKUP, which might cause missed interrupts with this patch. Tested on Pandaboard rev A2.] Signed-off-by: Chao Xu caesarxuc...@gmail.com --- changes since v2: *add wrapper function to avoid 'is_aggressive_pm' check everywhere, as suggested by Santosh Shilimkar *fix format issue in commit log I'm dropping this until you convince Kevin/Tony that this is the way to go. One thing caught my eye, you add: +static void _aggressive_pm_runtime_get_sync(struct gpio_bank *bank) +static void _aggressive_pm_runtime_put(struct gpio_bank *bank) (..) Then everywhere: + _aggressive_pm_runtime_get_sync(bank); (...) + _aggressive_pm_runtime_put(bank); Aggressive, argh, runtime PM is agressive by definition. If you want to switch this on and off use the compile option to enable/disable runtime PM altogether and do not wrap it like this. Yours, Linus Walleij -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC/RFT/PATCH V3] gpio: omap: refresh patch be more aggressive with pm_runtime against v3.12-rc5
On Thu, Dec 12, 2013 at 07:19:35PM +0100, Linus Walleij wrote: On Sun, Dec 8, 2013 at 5:40 AM, Chao Xu caesarxuc...@gmail.com wrote: From: Felipe Balbi ba...@ti.com try to keep gpio block suspended as much as possible. Tested with pandaboard and a sysfs exported gpio. Signed-off-by: Felipe Balbi balbi at ti.com [caesarxuc...@gmail.com : Refreshed against v3.12-rc5, and added revision check to enable aggressive pm_runtime on OMAP4-only. Because am33xx_gpio_sysc.idlemodes seems to be wrongly marked as SIDLE_SMART_WKUP, which might cause missed interrupts with this patch. Tested on Pandaboard rev A2.] Signed-off-by: Chao Xu caesarxuc...@gmail.com --- changes since v2: *add wrapper function to avoid 'is_aggressive_pm' check everywhere, as suggested by Santosh Shilimkar *fix format issue in commit log I'm dropping this until you convince Kevin/Tony that this is the way to go. One thing caught my eye, you add: +static void _aggressive_pm_runtime_get_sync(struct gpio_bank *bank) +static void _aggressive_pm_runtime_put(struct gpio_bank *bank) (..) Then everywhere: + _aggressive_pm_runtime_get_sync(bank); (...) + _aggressive_pm_runtime_put(bank); Aggressive, argh, runtime PM is agressive by definition. If you want to switch this on and off use the compile option to enable/disable runtime PM altogether and do not wrap it like this. heh, OMAP doesn't work without pm_runtime. -- balbi signature.asc Description: Digital signature
Re: [RFC/RFT/PATCH V3] gpio: omap: refresh patch be more aggressive with pm_runtime against v3.12-rc5
On Thu, Dec 12, 2013 at 7:28 PM, Felipe Balbi ba...@ti.com wrote: On Thu, Dec 12, 2013 at 07:19:35PM +0100, Linus Walleij wrote: One thing caught my eye, you add: +static void _aggressive_pm_runtime_get_sync(struct gpio_bank *bank) +static void _aggressive_pm_runtime_put(struct gpio_bank *bank) (..) Then everywhere: + _aggressive_pm_runtime_get_sync(bank); (...) + _aggressive_pm_runtime_put(bank); Aggressive, argh, runtime PM is agressive by definition. If you want to switch this on and off use the compile option to enable/disable runtime PM altogether and do not wrap it like this. heh, OMAP doesn't work without pm_runtime. Hm then maybe that needs to be fixed ... or the runtime PM people need to be convinced to support different levels of aggressiveness in the core? Yours, Linus Walleij -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC/RFT/PATCH V3] gpio: omap: refresh patch be more aggressive with pm_runtime against v3.12-rc5
On Sun, Dec 8, 2013 at 5:40 AM, Chao Xu caesarxuc...@gmail.com wrote: From: Felipe Balbi ba...@ti.com try to keep gpio block suspended as much as possible. Tested with pandaboard and a sysfs exported gpio. Signed-off-by: Felipe Balbi balbi at ti.com [caesarxuc...@gmail.com : Refreshed against v3.12-rc5, and added revision check to enable aggressive pm_runtime on OMAP4-only. Because am33xx_gpio_sysc.idlemodes seems to be wrongly marked as SIDLE_SMART_WKUP, which might cause missed interrupts with this patch. Tested on Pandaboard rev A2.] Signed-off-by: Chao Xu caesarxuc...@gmail.com Kevin/Santosh: you're maintainers for this driver, can you ACK/NACK this patch? Yours, Linus Walleij -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC/RFT/PATCH V3] gpio: omap: refresh patch be more aggressive with pm_runtime against v3.12-rc5
Chao Xu caesarxuc...@gmail.com writes: From: Felipe Balbi ba...@ti.com try to keep gpio block suspended as much as possible. Tested with pandaboard and a sysfs exported gpio. Signed-off-by: Felipe Balbi balbi at ti.com [caesarxuc...@gmail.com : Refreshed against v3.12-rc5, and added revision check to enable aggressive pm_runtime on OMAP4-only. Because am33xx_gpio_sysc.idlemodes seems to be wrongly marked as SIDLE_SMART_WKUP, which might cause missed interrupts with this patch. Tested on Pandaboard rev A2.] Signed-off-by: Chao Xu caesarxuc...@gmail.com I have several problems with this patch. First, the changelog is missing a lot of information. In particular, nowhere is it described what problem is this patch addressing and how this patch addresses that problem. Second, I don't see any mention of off-mode, and I suspect there are issues with off-mode here that are not being addressed. Also, I *really* don't like any approach that is targetted at a single SoC. Kevin -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC/RFT/PATCH V3] gpio: omap: refresh patch be more aggressive with pm_runtime against v3.12-rc5
From: Felipe Balbi ba...@ti.com try to keep gpio block suspended as much as possible. Tested with pandaboard and a sysfs exported gpio. Signed-off-by: Felipe Balbi balbi at ti.com [caesarxuc...@gmail.com : Refreshed against v3.12-rc5, and added revision check to enable aggressive pm_runtime on OMAP4-only. Because am33xx_gpio_sysc.idlemodes seems to be wrongly marked as SIDLE_SMART_WKUP, which might cause missed interrupts with this patch. Tested on Pandaboard rev A2.] Signed-off-by: Chao Xu caesarxuc...@gmail.com --- changes since v2: *add wrapper function to avoid 'is_aggressive_pm' check everywhere, as suggested by Santosh Shilimkar *fix format issue in commit log drivers/gpio/gpio-omap.c| 90 +-- include/linux/platform_data/gpio-omap.h |1 + 2 files changed, 74 insertions(+), 17 deletions(-) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 89675f8..fc5318b 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -76,6 +76,7 @@ struct gpio_bank { int context_loss_count; int power_mode; bool workaround_enabled; + bool is_aggressive_pm; void (*set_dataout)(struct gpio_bank *bank, int gpio, int enable); int (*get_context_loss_count)(struct device *dev); @@ -90,6 +91,18 @@ struct gpio_bank { #define BANK_USED(bank) (bank-mod_usage || bank-irq_usage) #define LINE_USED(line, offset) (line (1 offset)) +static void _aggressive_pm_runtime_get_sync(struct gpio_bank *bank) +{ + if (bank-is_aggressive_pm) + pm_runtime_get_sync(bank-dev); +} + +static void _aggressive_pm_runtime_put(struct gpio_bank *bank) +{ + if (bank-is_aggressive_pm) + pm_runtime_put(bank-dev); +} + static int irq_to_gpio(struct gpio_bank *bank, unsigned int gpio_irq) { return bank-chip.base + gpio_irq; @@ -473,8 +486,13 @@ static void _disable_gpio_module(struct gpio_bank *bank, unsigned offset) static int gpio_is_input(struct gpio_bank *bank, int mask) { void __iomem *reg = bank-base + bank-regs-direction; + u32 val; - return __raw_readl(reg) mask; + _aggressive_pm_runtime_get_sync(bank); + val = __raw_readl(reg) mask; + _aggressive_pm_runtime_put(bank); + + return val; } static int gpio_irq_type(struct irq_data *d, unsigned type) @@ -485,7 +503,7 @@ static int gpio_irq_type(struct irq_data *d, unsigned type) unsigned long flags; unsigned offset; - if (!BANK_USED(bank)) + if (!BANK_USED(bank) !bank-is_aggressive_pm) pm_runtime_get_sync(bank-dev); #ifdef CONFIG_ARCH_OMAP1 @@ -503,6 +521,7 @@ static int gpio_irq_type(struct irq_data *d, unsigned type) (type (IRQ_TYPE_LEVEL_LOW|IRQ_TYPE_LEVEL_HIGH))) return -EINVAL; + _aggressive_pm_runtime_get_sync(bank); spin_lock_irqsave(bank-lock, flags); offset = GPIO_INDEX(bank, gpio); retval = _set_gpio_triggering(bank, offset, type); @@ -511,11 +530,13 @@ static int gpio_irq_type(struct irq_data *d, unsigned type) _set_gpio_direction(bank, offset, 1); } else if (!gpio_is_input(bank, 1 offset)) { spin_unlock_irqrestore(bank-lock, flags); + _aggressive_pm_runtime_put(bank); return -EINVAL; } bank-irq_usage |= 1 GPIO_INDEX(bank, gpio); spin_unlock_irqrestore(bank-lock, flags); + _aggressive_pm_runtime_put(bank); if (type (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) __irq_set_handler_locked(d-irq, handle_level_irq); @@ -668,10 +689,11 @@ static int omap_gpio_request(struct gpio_chip *chip, unsigned offset) unsigned long flags; /* -* If this is the first gpio_request for the bank, -* enable the bank module. +* if aggressive runtime pm is supported, enable the bank module +* for each gpio_request. Otherwise enable the bank module if this +* is the first gpio_request for the bank. */ - if (!BANK_USED(bank)) + if (bank-is_aggressive_pm || !BANK_USED(bank)) pm_runtime_get_sync(bank-dev); spin_lock_irqsave(bank-lock, flags); @@ -685,7 +707,7 @@ static int omap_gpio_request(struct gpio_chip *chip, unsigned offset) } bank-mod_usage |= 1 offset; spin_unlock_irqrestore(bank-lock, flags); - + _aggressive_pm_runtime_put(bank); return 0; } @@ -694,6 +716,8 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset) struct gpio_bank *bank = container_of(chip, struct gpio_bank, chip); unsigned long flags; + _aggressive_pm_runtime_get_sync(bank); + spin_lock_irqsave(bank-lock, flags); bank-mod_usage = ~(1 offset); _disable_gpio_module(bank, offset); @@ -701,10 +725,11 @@ static void omap_gpio_free(struct gpio_chip *chip,