From patchwork Thu Feb 15 15:17:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Richard X-Patchwork-Id: 13558625 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 865AAC48BF0 for ; Thu, 15 Feb 2024 15:19:03 +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=dLBZARenEeHuh9Hr2oAsL0qFJs/hMI0DHdPywCS/TzI=; b=pTCn4VKJSCgl9D hZFBOme05jgR1OCSJOOdeIOYEkN8WVg8/sp3FiyN7O7ETg8UffEwqFytc0EBwZ7709u7N/ngo9/I7 pDRes3HhMZ391X37GqKsTmyx/SotpeO/dWg+aQgRlmrwuEFH/bDqdsx3qhyhF7Ng4WiYVGjmPTSUk lTMj5o/Yv9SfgSRN0bA8GGANzJee0P/C5S+7uFfO6ltlV9K0+hCO84caOBX4D1c5IsEc9c76NxtrJ Q3VXVR7+HQqMiMLKDm0pH8AMJ3v7PJbKR48p2OP52DXz83wSL9obErt1F8Gbif/7ISHtVZreM07gz +qbJdcMWoEisA3xF9SYA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1radVg-0000000GhHg-3Icm; Thu, 15 Feb 2024 15:18:48 +0000 Received: from relay1-d.mail.gandi.net ([217.70.183.193]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1radV1-0000000GgpO-3MNM; Thu, 15 Feb 2024 15:18:11 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 2E89F240014; Thu, 15 Feb 2024 15:18:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708010286; 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=mPxPc7Xvb7+q1PFnLq8F3pklOXjELgiYL5RrEQlPZLM=; b=hv4KJLdEm3D68ygjCeQI0f6Li0bYy6g5tgDVSnZMtNe5x1p7CsSbwqLnRHg6UPqX2YrxVe 10MkwKsoaqwKb5voo2rwB+E1cey1kphwHuEJI+D9LjchjctBi2Hgsm8bSrfselmBVdPuVh SEebNpingPgX6J9U4thp4aGS3BJO4liAmfG4PckUMTSG/sUAOx71jXmetVFjjVbR1BNuf7 YwG6o1He6OZPyy76WnL8/Ke04Dc1nflsHMnflWwDL28k3u+tbMUGl0denojY3kPv8dOfy2 /Oa1lFZtnWTPEK6ZIwkUKlkuRKgFAjwozvFucfG1Lhd4K5etvMd9xmCCo1LXMQ== From: Thomas Richard Date: Thu, 15 Feb 2024 16:17:51 +0100 Subject: [PATCH v3 06/18] mux: mmio: add resume support MIME-Version: 1.0 Message-Id: <20240102-j7200-pcie-s2r-v3-6-5c2e4a3fac1f@bootlin.com> References: <20240102-j7200-pcie-s2r-v3-0-5c2e4a3fac1f@bootlin.com> In-Reply-To: <20240102-j7200-pcie-s2r-v3-0-5c2e4a3fac1f@bootlin.com> To: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Tony Lindgren , Haojian Zhuang , Vignesh R , Aaro Koskinen , Janusz Krzysztofik , Andi Shyti , Peter Rosin , Vinod Koul , Kishon Vijay Abraham I , Philipp Zabel , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Rob Herring , Bjorn Helgaas Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-i2c@vger.kernel.org, linux-phy@lists.infradead.org, linux-pci@vger.kernel.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-20240215_071808_040601_806BDD80 X-CRM114-Status: GOOD ( 11.24 ) 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 fd1d121a584b..892ff4714b68 100644 --- a/drivers/mux/mmio.c +++ b/drivers/mux/mmio.c @@ -125,13 +125,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, };