Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp3207375lqo; Wed, 15 May 2024 03:03:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVUidwfdTf6S01rBeGwyJwIHKRXyU2YwGhx0FzwPUgINnKYd8PveLl0Eto4Wb4XwL2G1yzYN2Vhslh2g6dsbyZmr6zybn2gL0MfJEwkpg== X-Google-Smtp-Source: AGHT+IGtKLuEowDU8n9MgZieKSzptxrA7IgLDU9w67qI948IWf3htGZsh/V4xvMcUdzbTIH7/zBe X-Received: by 2002:a17:90b:100d:b0:2b6:2ef4:e2aa with SMTP id 98e67ed59e1d1-2b6cc780466mr11562850a91.25.1715767430122; Wed, 15 May 2024 03:03:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715767430; cv=pass; d=google.com; s=arc-20160816; b=YqgmJtRIph34imkXA+1IuMeNVq5HED4dew7pEqepDsYgMYFX8lNmwRvjMrQB99367A 4cy8tKzf7ncJTqB43VeFHr/O5AZLLEc7tBSlotWuXDV/lR5pJp93p9exiKYLa4hWmlWv ceNZqOQ5dZ/Cownnyoxp689KHpUiuQidiJm/rH7dMBsJfZ8LIj0tM8STcBPzP0tzuKpY ARgzWW/ZYY7OTArBqBEPyGqyzvC4hkJslVax0f1iXZNLvFQC8FIGudF3qMvNpQH3aK2A MWs9KVc/ipeeSBodfBT3eyieLm+lkrHBfRzOyNECf7nVRvhtjNyVdSBfQauogW1busWA DQMg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=jPqUbSf1Qdf1yloJtVBeCvPFg+XlI7QIXeQdbRho+l4=; fh=+6o6d2KGt2ZTSidIuE8uz1q8yt3pK0TjTqozrmclSIs=; b=M+caJlWodxVHPKiqDs9zryZ7KgX/R6aWLDkf0kzlcOpa4ozkB9jdCxxhBjdwRW8puJ mamEn9fg7daybDzQTg/BuEtQ5Pn+QGk/NI3CyBFeWnsCjojq/gtvT1luR7xS9RuzvvX0 GByCWe8C0qWcpBUOPs4flxlkcv8mWZhTrRH8Q5D8/Y/4t9hyTAjiNd2I0L7sRHUUXISa jjX69Xm5Y2U8ATtL6nQbvtmxZARs4DH/7yl1hXZydAIpZJvjJn5WE1jdx0d/nqg3WSVa KddSgYf9AKgFg3U9MIXAfwm7UuWjvXpdOEddBAp0BCf9c3scPB5BBD7FPQfuyRZluswk FGhQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Z284BDOJ; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-179741-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179741-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b628a5d461si15123201a91.52.2024.05.15.03.03.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 03:03:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179741-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Z284BDOJ; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-179741-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179741-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4894A285E98 for ; Wed, 15 May 2024 10:03:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 72E6A6EB4C; Wed, 15 May 2024 10:01:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Z284BDOJ" Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE315604B3; Wed, 15 May 2024 10:01:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715767296; cv=none; b=RwklLM/CFZ3aswGa7AToNQmoymaPTIq1arbA2IrxxV5DjgN9iSSYQHWDximxEABI3ONXlmcLgIc2ZWha7+ClTtXfDA5Y2eFh8HnCi04LMyFRdYPC5ahMy1Obe0UXoHROjKLILB2d3rGRO0HPow+RRBo3RHN7H0oShr9B0/IhIZo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715767296; c=relaxed/simple; bh=KoeKOC9BxNbULIOx5THehrA2LvyMrmoh0J2kqk1uxqk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Lwe6HGxQ5RFUOx1+5gAJRxJSQHa3KPZdcuGOvbUnQJlEUIkHfuP9QoA3EecJVcpBtq7bgaZyyObUjkEGumfGLbREGR6vs3DhacoW1hZd14WLd3BtdCLodF/zHZdfUiWozWWZ9Rwza1p1D9P8rcYpzl+eYSSS3WFCmHebxJ0Kxwg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Z284BDOJ; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id CD19F1BF213; Wed, 15 May 2024 10:01:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1715767292; 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=Z284BDOJJLPKstqIHGVQYmD2X1RGEnq6FFY6emrTxhfExkXyrmBDSt1zM7QSObjcfel2/z VnfSkU5SNcQHVM4f4OPImuIV0GcR7YCEXKV/ImscfY4isvsiKqnUSQnC2urvEkbkcyvJnC WGGnTeOiid54zl52PWTBCQw9dw7jvMM53I8HAPjP6Vk2edSqB0UuAsMIUkutLYu1FLNJBR HwVrHEbXOGTTDAXwZcSu9ck2qAeytg0o7e9jbXmwqsKQ6UOI+u3OI0ixRQVmBJbH9nAJde o2GNhJ19a8Vsu85WXNkyzsA+dtkUEMKPwh3UZuP5iFfyhHSIHyW+sApW9VNKLw== From: Thomas Richard Date: Wed, 15 May 2024 12:01:06 +0200 Subject: [PATCH v6 05/12] mux: mmio: add resume support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240102-j7200-pcie-s2r-v6-5-4656ef6e6d66@bootlin.com> References: <20240102-j7200-pcie-s2r-v6-0-4656ef6e6d66@bootlin.com> In-Reply-To: <20240102-j7200-pcie-s2r-v6-0-4656ef6e6d66@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=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 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, }; -- 2.39.2