Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp12208265rwb; Sat, 26 Nov 2022 06:02:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf4TAUSQ5LyqBxT9CIbzUySnDsuzl3kCCNnNfMAd0T4npJF11qu1LtmU/BEzsU7gx4NoQlwV X-Received: by 2002:a17:902:a511:b0:187:3bc8:fc56 with SMTP id s17-20020a170902a51100b001873bc8fc56mr25184558plq.83.1669471352415; Sat, 26 Nov 2022 06:02:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669471352; cv=none; d=google.com; s=arc-20160816; b=RB5CPs2YqUBDGjuuoIXbUCzJ0mRANo0IwZawqdsk67aXi1DrGKPf42MGRbq5Vw6Wsv v9dVf65vgHnknUB0c7lJScRtH4qxX+3k9r71hlQakoEPdoxOKtEyRk/XZ3C6wx6cLH6H v+JwovAmVK/Fq6MadZq4LOBo0CEOvZXeRhdeXMqiTFnE8qAK8uI2nJPiT07cz67J2Zak qZWTNDcTi4ubIjx3dHos7XVJ0ZllVxQC69QuMLWuqlVIkotQis6Rt8lFRq8krtQYRPei sRforQU95gd3XwGld//6G1sWvY7f2V5BUg1vPZCb2pHq+n26kO40QkM1hg51HdvYdZ4C EJ6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=5U0P5TaU1DGDn8AO5JOG+QP7KEOXfHS3jJyhhzIqRJY=; b=JbSijD+W0tRFo0hRUJDiKYcCouEy+UNch/ARbRTmNLgQXuzBng3qZstS6mAmYxv0gB ydo9N0cv+1l6S33/tWF4kMMZ+6hrUlC/ZN73h73QZmmNvYyyB1CTPBA6nQbBA8q00oI/ MqiqdZMtpgriO8QFOKbfcgaWRvy24YbHyNCIg1bAvaF2RXwtHjO+CW27PXU9SPN2dfTW 7zCqzl+dxloOYMkQuiB8ypOeQ7jKQoExwc8FH7rt8hLKsY10q+l5+IjuEw86fjW07aG5 DCjKivnJUgXx47nU3MadpqtJvfhBlkW1PUrRI/RMt1eCTIACiQ5hZOgtoNtiltlUYQhT arVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1SiD1yLS; dkim=neutral (no key) header.i=@linutronix.de header.b=ntuFOKfR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc22-20020a656d96000000b0047701236fb2si7337341pgb.400.2022.11.26.06.02.06; Sat, 26 Nov 2022 06:02:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1SiD1yLS; dkim=neutral (no key) header.i=@linutronix.de header.b=ntuFOKfR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229701AbiKZNe5 (ORCPT + 84 others); Sat, 26 Nov 2022 08:34:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229626AbiKZNeo (ORCPT ); Sat, 26 Nov 2022 08:34:44 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BC501DA47 for ; Sat, 26 Nov 2022 05:34:38 -0800 (PST) Date: Sat, 26 Nov 2022 13:34:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669469677; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5U0P5TaU1DGDn8AO5JOG+QP7KEOXfHS3jJyhhzIqRJY=; b=1SiD1yLSMc3nD5okHfv76Uo66zaghbzQ8zAP+0hLx2pDwDobceVd3CfLnxb46lsRo9rbDV 94CMaxHYN4wO0rvh4ayshZeNDsLrC/qJptqtA+TGlQLhnfhuArIBIRYEbjLZUPTXoy2ks5 fMzdr7o4iVrz+v9Tz2sWtfkB63+PjIGFj5yZMpjElsc56aRI4TeYZtO7xYzCXeZMUSm6UR 5AIZWKRtzlzMl4BYg2q0hAW8abQkvDwQdqYBnPz+HXHZYJQJ/GGPpdHt3Aunk0Yink26SV 7o1uMCfc55ub9/0xYyf1T+PkJ1yLqpUD2xREMteWQ4w7MfJvPDPE3743A+e1xQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669469677; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5U0P5TaU1DGDn8AO5JOG+QP7KEOXfHS3jJyhhzIqRJY=; b=ntuFOKfRZXdE+hlVVSvNWaqpVdWeArcjzXaEnWmhicHEBz8neDw7jf1s4aFLppXW+2deDP 6a7tDqjB1Zx+IFAw== From: "irqchip-bot for Huacai Chen" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-kernel@vger.kernel.org Subject: [irqchip: irq/irqchip-next] irqchip/loongson-pch-lpc: Add suspend/resume support Cc: Huacai Chen , Marc Zyngier , tglx@linutronix.de In-Reply-To: <20221020073527.541845-5-chenhuacai@loongson.cn> References: <20221020073527.541845-5-chenhuacai@loongson.cn> MIME-Version: 1.0 Message-ID: <166946967598.4906.8330183421538666371.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the irq/irqchip-next branch of irqchip: Commit-ID: c7c75e32f8a61854c38326aef276e3a58dc7fd08 Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/c7c75e32f8a61854c38326aef276e3a58dc7fd08 Author: Huacai Chen AuthorDate: Thu, 20 Oct 2022 15:35:27 +08:00 Committer: Marc Zyngier CommitterDate: Sat, 26 Nov 2022 13:12:13 irqchip/loongson-pch-lpc: Add suspend/resume support Add suspend/resume support for PCH-LPC irqchip, which is needed for upcoming suspend/hibernation. Signed-off-by: Huacai Chen Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20221020073527.541845-5-chenhuacai@loongson.cn --- drivers/irqchip/irq-loongson-pch-lpc.c | 25 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+) diff --git a/drivers/irqchip/irq-loongson-pch-lpc.c b/drivers/irqchip/irq-loongson-pch-lpc.c index bf23249..9b35492 100644 --- a/drivers/irqchip/irq-loongson-pch-lpc.c +++ b/drivers/irqchip/irq-loongson-pch-lpc.c @@ -13,6 +13,7 @@ #include #include #include +#include /* Registers */ #define LPC_INT_CTL 0x00 @@ -34,6 +35,7 @@ struct pch_lpc { u32 saved_reg_pol; }; +static struct pch_lpc *pch_lpc_priv; struct fwnode_handle *pch_lpc_handle; static void lpc_irq_ack(struct irq_data *d) @@ -147,6 +149,26 @@ static int pch_lpc_disabled(struct pch_lpc *priv) (readl(priv->base + LPC_INT_STS) == 0xffffffff); } +static int pch_lpc_suspend(void) +{ + pch_lpc_priv->saved_reg_ctl = readl(pch_lpc_priv->base + LPC_INT_CTL); + pch_lpc_priv->saved_reg_ena = readl(pch_lpc_priv->base + LPC_INT_ENA); + pch_lpc_priv->saved_reg_pol = readl(pch_lpc_priv->base + LPC_INT_POL); + return 0; +} + +static void pch_lpc_resume(void) +{ + writel(pch_lpc_priv->saved_reg_ctl, pch_lpc_priv->base + LPC_INT_CTL); + writel(pch_lpc_priv->saved_reg_ena, pch_lpc_priv->base + LPC_INT_ENA); + writel(pch_lpc_priv->saved_reg_pol, pch_lpc_priv->base + LPC_INT_POL); +} + +static struct syscore_ops pch_lpc_syscore_ops = { + .suspend = pch_lpc_suspend, + .resume = pch_lpc_resume, +}; + int __init pch_lpc_acpi_init(struct irq_domain *parent, struct acpi_madt_lpc_pic *acpi_pchlpc) { @@ -191,7 +213,10 @@ int __init pch_lpc_acpi_init(struct irq_domain *parent, parent_irq = irq_create_fwspec_mapping(&fwspec); irq_set_chained_handler_and_data(parent_irq, lpc_irq_dispatch, priv); + pch_lpc_priv = priv; pch_lpc_handle = irq_handle; + register_syscore_ops(&pch_lpc_syscore_ops); + return 0; free_irq_handle: