Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754087AbbFSXj2 (ORCPT ); Fri, 19 Jun 2015 19:39:28 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:35249 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752990AbbFSXjU (ORCPT ); Fri, 19 Jun 2015 19:39:20 -0400 Message-ID: <5584A7DD.7090601@gmail.com> Date: Fri, 19 Jun 2015 16:38:05 -0700 From: Florian Fainelli User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Brian Norris , Thomas Gleixner CC: Florian Fainelli , Gregory Fong , bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, Kevin Cernekee , Jason Cooper Subject: Re: [PATCH 1/2] genirq: add chip_{suspend,resume} PM support to irq_chip References: <20150619224123.GL4917@ld-irv-0074> <1434756403-379-1-git-send-email-computersforpeace@gmail.com> In-Reply-To: <1434756403-379-1-git-send-email-computersforpeace@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3932 Lines: 100 On 19/06/15 16:26, Brian Norris wrote: > 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 Acked-by: Florian Fainelli > --- > 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); > > -- Florian -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/