From patchwork Tue Apr 16 13:29:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Richard X-Patchwork-Id: 13631835 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CAC1EC04FF6 for ; Tue, 16 Apr 2024 13:30:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WOr+H52UzRdVmu8t3WHFogTEiAnsN1YuVIOzVH+NyE8=; b=IL+8dOJagVizMY Hl29Teg4O9ZoSJTK5xuRqmNLZ+j8U3gSvOeYhDgLGONlRt6cA3/WUWHsZNxuwMyAPYOmefHNjud4S OnKDzM+p79bJ3l3Pfb4IwMY2D/TTVKPDU8wB+p7t8lWnNWDOdC6lOIxx5CY9x1l3i+CsyCQ5mcqNE EmxZV2fmPrhKkTrZ+aHQuxrsHoKoVBcMixkBHakveiPASl1KVxwDtdxi2IPkDk6HQhJ5aGl2y79/0 hC3mbWG5NwiAxkpPhRW5mzIbNXpW8WK5ZyhA1tf4eJsWWoe5/Kp8TF0Fj8ZakHX0kBuQTs/cpOTUb LiZokTXjq1+vOV8/+ZBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwitQ-0000000CJSs-0Kt1; Tue, 16 Apr 2024 13:30:36 +0000 Received: from relay2-d.mail.gandi.net ([217.70.183.194]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwit7-0000000CJHj-39xm for linux-arm-kernel@lists.infradead.org; Tue, 16 Apr 2024 13:30:19 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id B8E9540007; Tue, 16 Apr 2024 13:30:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1713274216; h=from:from: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=jPqUbSf1Qdf1yloJtVBeCvPFg+XlI7QIXeQdbRho+l4=; b=ZL1ooC7LClW/wnvSt9rJuIpcwX5TWts2+cJjbvrpFVnpjNZufsfCmP2cqcJQNAl9PbIW+d 5tuOzJov3/7Ae6ugSkqS9GwyVK2siy5qOX2dgriDOQ1thf4bg2jGuKSZoUnSR9d4yG5nik fIejV3ZSVPwW1J0kR0cIzSyKTheiz7pW6LPX6A3NPbfwDkkhr6yLELst5HTGSLSXVwWqvW e6vqxmRt5O/TGKbV1OtVSI8y4admj+tdIR9X3qP3EqQJRyA5Ofsyi2xJ27x4CIdogD6Wyb wtPdFIa2K8zOMmrJwUUz8PRQleuuOW4JFm2W7HrC7Dl3ct4X2a6moS0vGTX7aw== From: Thomas Richard Date: Tue, 16 Apr 2024 15:29:53 +0200 Subject: [PATCH v5 04/11] mux: mmio: add resume support MIME-Version: 1.0 Message-Id: <20240102-j7200-pcie-s2r-v5-4-4b8c46711ded@bootlin.com> References: <20240102-j7200-pcie-s2r-v5-0-4b8c46711ded@bootlin.com> In-Reply-To: <20240102-j7200-pcie-s2r-v5-0-4b8c46711ded@bootlin.com> To: Linus Walleij , Bartosz Golaszewski , Tony Lindgren , Aaro Koskinen , Janusz Krzysztofik , Vignesh R , Andi Shyti , Peter Rosin , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Rob Herring , Bjorn Helgaas , Siddharth Vadapalli Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-i2c@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, gregory.clement@bootlin.com, theo.lebrun@bootlin.com, thomas.petazzoni@bootlin.com, u-kumar1@ti.com, Thomas Richard X-Mailer: b4 0.12.0 X-GND-Sasl: thomas.richard@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240416_063017_997005_527680F6 X-CRM114-Status: GOOD ( 11.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Théo Lebrun No need to save something during the suspend stage, as the mux core has an internal cache to store the state of muxes. This cache is used by mux_chip_resume() to restore all muxes. Signed-off-by: Théo Lebrun Signed-off-by: Thomas Richard --- drivers/mux/mmio.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c index 30a952c34365..00405abe3ce3 100644 --- a/drivers/mux/mmio.c +++ b/drivers/mux/mmio.c @@ -130,13 +130,25 @@ static int mux_mmio_probe(struct platform_device *pdev) mux_chip->ops = &mux_mmio_ops; + dev_set_drvdata(dev, mux_chip); + return devm_mux_chip_register(dev, mux_chip); } +static int mux_mmio_resume_noirq(struct device *dev) +{ + struct mux_chip *mux_chip = dev_get_drvdata(dev); + + return mux_chip_resume(mux_chip); +} + +static DEFINE_NOIRQ_DEV_PM_OPS(mux_mmio_pm_ops, NULL, mux_mmio_resume_noirq); + static struct platform_driver mux_mmio_driver = { .driver = { .name = "mmio-mux", .of_match_table = mux_mmio_dt_ids, + .pm = pm_sleep_ptr(&mux_mmio_pm_ops), }, .probe = mux_mmio_probe, };