Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755882AbbFSX1J (ORCPT ); Fri, 19 Jun 2015 19:27:09 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:34918 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753855AbbFSX07 (ORCPT ); Fri, 19 Jun 2015 19:26:59 -0400 From: Brian Norris To: Thomas Gleixner Cc: Brian Norris , Florian Fainelli , Gregory Fong , , , , Kevin Cernekee , Jason Cooper Subject: [PATCH 1/2] genirq: add chip_{suspend,resume} PM support to irq_chip Date: Fri, 19 Jun 2015 16:26:42 -0700 Message-Id: <1434756403-379-1-git-send-email-computersforpeace@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <20150619224123.GL4917@ld-irv-0074> References: <20150619224123.GL4917@ld-irv-0074> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3659 Lines: 94 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 second set of suspend/resume hooks to irq_chip, this time to represent *chip* suspend/resume, rather than IRQ suspend/resume. These callbacks will always be called for an irqchip 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 --- include/linux/irq.h | 10 ++++++++++ kernel/irq/generic-chip.c | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/include/linux/irq.h b/include/linux/irq.h index de3213d271ff..2a672d2434a5 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -293,6 +293,8 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d) return d->hwirq; } +struct irq_chip_generic; + /** * struct irq_chip - hardware interrupt chip descriptor * @@ -317,6 +319,12 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d) * @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_pm_shutdown: function called from core code on shutdown once per chip + * @chip_suspend: function called from core code on suspend once per + * chip; for handling chip details even when no interrupts + * are in use + * @chip_resume: function called from core code on resume once per chip; + * for handling chip details even when no interrupts are + * in use * @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 * @irq_request_resources: optional to request resources before calling @@ -357,6 +365,8 @@ struct irq_chip { void (*irq_suspend)(struct irq_data *data); void (*irq_resume)(struct irq_data *data); void (*irq_pm_shutdown)(struct irq_data *data); + void (*chip_suspend)(struct irq_chip_generic *gc); + void (*chip_resume)(struct irq_chip_generic *gc); void (*irq_calc_mask)(struct irq_data *data); diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c index 15b370daf234..fe25e72d5d13 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 (ct->chip.chip_suspend) + ct->chip.chip_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 (ct->chip.chip_resume) + ct->chip.chip_resume(gc); + if (ct->chip.irq_resume) { struct irq_data *data = irq_gc_get_irq_data(gc); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/