Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752534AbbG0GPN (ORCPT ); Mon, 27 Jul 2015 02:15:13 -0400 Received: from terminus.zytor.com ([198.137.202.10]:58532 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752475AbbG0GPK (ORCPT ); Mon, 27 Jul 2015 02:15:10 -0400 Date: Sun, 26 Jul 2015 23:14:56 -0700 From: tip-bot for Brian Norris Message-ID: Cc: mingo@kernel.org, f.fainelli@gmail.com, jason@lakedaemon.net, cernekee@chromium.org, computersforpeace@gmail.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, hpa@zytor.com, gregory.0xf0@gmail.com Reply-To: computersforpeace@gmail.com, cernekee@chromium.org, tglx@linutronix.de, gregory.0xf0@gmail.com, hpa@zytor.com, linux-kernel@vger.kernel.org, mingo@kernel.org, f.fainelli@gmail.com, jason@lakedaemon.net In-Reply-To: <1437607300-40858-1-git-send-email-computersforpeace@gmail.com> References: <1437607300-40858-1-git-send-email-computersforpeace@gmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:irq/core] genirq: Add chip_[suspend|resume] PM support to irq_chip Git-Commit-ID: be9b22b6a7e6725162c64155a08b71f0654b675c X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5207 Lines: 114 Commit-ID: be9b22b6a7e6725162c64155a08b71f0654b675c Gitweb: http://git.kernel.org/tip/be9b22b6a7e6725162c64155a08b71f0654b675c Author: Brian Norris AuthorDate: Wed, 22 Jul 2015 16:21:39 -0700 Committer: Thomas Gleixner CommitDate: Mon, 27 Jul 2015 08:09:38 +0200 genirq: Add chip_[suspend|resume] PM support to irq_chip Some (admittedly odd) irqchips perform functions that are not directly related to any of their child IRQ lines, and therefore need to perform some tasks during suspend/resume regardless of whether there are any "installed" interrupts for the irqchip. However, the current generic-chip framework does not call the chip's irq_{suspend,resume} when there are no interrupts installed (this makes sense, because there are no irq_data objects for such a call to be made). More specifically, irq-bcm7120-l2 configures both a forwarding mask (which affects other top-level GIC IRQs) and a second-level interrupt mask (for managing its own child interrupts). The former must be saved/restored on suspend/resume, even when there's nothing to do for the latter. This patch adds a new set of suspend/resume hooks to irq_chip_generic, to help represent *chip* suspend/resume, rather than IRQ suspend/resume. These callbacks will always be called for an IRQ chip (regardless of the installed interrupts) and are based on the per-chip irq_chip_generic struct, rather than the per-IRQ irq_data struct. The original problem report is described in extra detail here: http://lkml.kernel.org/g/20150619224123.GL4917@ld-irv-0074 Signed-off-by: Brian Norris Tested-by: Florian Fainelli Cc: Gregory Fong Cc: bcm-kernel-feedback-list@broadcom.com Cc: linux-mips@linux-mips.org Cc: Kevin Cernekee Cc: Jason Cooper Link: http://lkml.kernel.org/r/1437607300-40858-1-git-send-email-computersforpeace@gmail.com Signed-off-by: Thomas Gleixner --- include/linux/irq.h | 14 ++++++++++++-- kernel/irq/generic-chip.c | 6 ++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/include/linux/irq.h b/include/linux/irq.h index 5284cb1..2c8730a 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -324,8 +324,10 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d) * @irq_bus_sync_unlock:function to sync and unlock slow bus (i2c) chips * @irq_cpu_online: configure an interrupt source for a secondary CPU * @irq_cpu_offline: un-configure an interrupt source for a secondary CPU - * @irq_suspend: function called from core code on suspend once per chip - * @irq_resume: function called from core code on resume once per chip + * @irq_suspend: function called from core code on suspend once per + * chip, when one or more interrupts are installed + * @irq_resume: function called from core code on resume once per chip, + * when one ore more interrupts are installed * @irq_pm_shutdown: function called from core code on shutdown once per chip * @irq_calc_mask: Optional function to set irq_data.mask for special cases * @irq_print_chip: optional to print special chip info in show_interrupts @@ -760,6 +762,12 @@ struct irq_chip_type { * @reg_base: Register base address (virtual) * @reg_readl: Alternate I/O accessor (defaults to readl if NULL) * @reg_writel: Alternate I/O accessor (defaults to writel if NULL) + * @suspend: Function called from core code on suspend once per + * chip; can be useful instead of irq_chip::suspend to + * handle chip details even when no interrupts are in use + * @resume: Function called from core code on resume once per chip; + * can be useful instead of irq_chip::suspend to handle + * chip details even when no interrupts are in use * @irq_base: Interrupt base nr for this chip * @irq_cnt: Number of interrupts handled by this chip * @mask_cache: Cached mask register shared between all chip types @@ -786,6 +794,8 @@ struct irq_chip_generic { void __iomem *reg_base; u32 (*reg_readl)(void __iomem *addr); void (*reg_writel)(u32 val, void __iomem *addr); + void (*suspend)(struct irq_chip_generic *gc); + void (*resume)(struct irq_chip_generic *gc); unsigned int irq_base; unsigned int irq_cnt; u32 mask_cache; diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c index 15b370d..abd286a 100644 --- a/kernel/irq/generic-chip.c +++ b/kernel/irq/generic-chip.c @@ -553,6 +553,9 @@ static int irq_gc_suspend(void) if (data) ct->chip.irq_suspend(data); } + + if (gc->suspend) + gc->suspend(gc); } return 0; } @@ -564,6 +567,9 @@ static void irq_gc_resume(void) list_for_each_entry(gc, &gc_list, list) { struct irq_chip_type *ct = gc->chip_types; + if (gc->resume) + gc->resume(gc); + if (ct->chip.irq_resume) { struct irq_data *data = irq_gc_get_irq_data(gc); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/