Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1937971lqg; Mon, 4 Mar 2024 08:08:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUB8NAC9lXzY+EkXyOl11dwiAcWWDLhyc0SqbGGLw/Ur1NG2NBto4m4vlkL97x/0thUIiqSomHrmnV+Yj3fVOG5NexZ/TOIkjOD1tiioA== X-Google-Smtp-Source: AGHT+IEMLlzRNaX8LZMa2cF0H1U1p4GnBGtzYeRXM6gn5FKPkPrn9JD616yAlraj0gt/9gChUTyr X-Received: by 2002:a05:6a20:2d13:b0:1a0:a082:b2b8 with SMTP id g19-20020a056a202d1300b001a0a082b2b8mr8093366pzl.33.1709568488377; Mon, 04 Mar 2024 08:08:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709568488; cv=pass; d=google.com; s=arc-20160816; b=xeZ/QYQvfOcKAXJhpuWxkMRP9qCd1VFYlme2DzXVRRk5+LoBApWhxAAd4vKUbiNKmP KiMLatxNOpCetrlcjg4Jc8oRIutW8bDnDgDW6acvpQ7ZuQbZJjthLDkbWs9ERth7a4U/ BTuLaGn61N4YEaqm4mSBVkb8YyqcmKO8hkij8RFKU0Q5DPDn/7uOKyB9C0GKJyBu2iVb vSp3xyBi5v09cP8ZES2CMKa6Q8e3/lPnckO1s6GmryErQSz+V7kFdBTINRtMBmlKy6Sz 7+L+leY464oGla31nsb/J6tVzzreuYU9bFT5fUesRZAwrMMUV4QkNMkw4wmkCyGQxRXW fRKg== 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=wHZQkXie84v2FP+2z7dUEuyvptHwnAyqgx34WxJkhrY=; b=aJHuHrHQKFHMT6H8qH/n/DvxKTQQbLGNfP4HkSEiaP8YalJuzWHcJFWekoOE3lqwwR mUJkZ3QytEOmfK33bwWiK3Flw7Sp72IfLTyi3ZYp+l0g/kq0Tar2XBq0hMB/36tSmUkT nn7kQXq8Jz54xPDiq4j0+yYlhfd4WKtRhGvK9ppZ6R8tcaXRuGW2AQ9T89xaPWKLQ4nR oPnopUZho6OsBnKIVtcC8qSf7kpCcRp/zuH9ofDoqfkY3Sd7ocgEEsF9PvxmbA0M5C8o 2BOXcqi45wPYDrIgjON+a3vU/6HZdwxmzyg8lARHwG5nCw0XDBhhV+kUxSOqSHct1zoT M4lQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=iljZMdmR; 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-90844-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90844-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id o8-20020a170902778800b001d893990719si8334569pll.359.2024.03.04.08.08.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 08:08:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90844-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=iljZMdmR; 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-90844-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90844-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id A2228B24DC2 for ; Mon, 4 Mar 2024 15:38:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA03F50276; Mon, 4 Mar 2024 15:36:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="iljZMdmR" 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 696824DA04; Mon, 4 Mar 2024 15:36:20 +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=1709566583; cv=none; b=pAkbKs+0kyiqtFWwsiEy8q03CkHpmJZlLA22Bp14GNdMzrfAYP+FvS0o6lAOgftE9+Ef3KxVDII3fNaf8vNJnEQFc1fufM+3sWsCUEKfy/JqG6O5YOL9WsuiMjEOmVd+wH1MDAHtxR2kaLUo67bmtkD7Yo5Ceg2vHyl3A45GqH4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709566583; c=relaxed/simple; bh=KoeKOC9BxNbULIOx5THehrA2LvyMrmoh0J2kqk1uxqk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eh04xL53d7l350a54k+4Qu9WRFavM/UIdJVxb/1XbUNf0aEXa1ytxwCdG5Fp1sn2NO6KHg5dlE/rR6TuxeARsAG36OZL+8TWo0kDI/bJZgK4KF/w15dxyayZKpoJvVVpPSfJfP0eZpYEuoXMST3uj+TFw0ngXKrqK8VCD024uo8= 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=iljZMdmR; 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 E36641BF213; Mon, 4 Mar 2024 15:36:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709566578; 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=iljZMdmRr0tNgzJK8i8VPTg8h7bHYkCzTSkGwJIhjCEjBBcw7oLlZonEqBI98qgCUaw+A6 ciopRah50UFE4MW1Dps+6X2It29g3ZyxL6hGFdXVoyHdIvsNFx1ZAkz1bqSey3SNIITiDU 2krSea/emSeDeavgElkWrdNOpPrGFCsl/2uk2OfRJOj7uUrzi8TOIGrP4QbEPduhgghnCS Y/Z/84Ytj45cR87v+fcOvdTTRITU/dtO6tk5Hw2yhC6MX9Y089sUv1KVeZqBTtTnqsqhWn l5bX8RVeVQi1vSyJ3ZS6zB4Ls1pUrXO4WVL95vKKyFlgFUfGaUltUsngq64U8A== From: Thomas Richard Date: Mon, 04 Mar 2024 16:35:48 +0100 Subject: [PATCH v4 05/18] 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-v4-5-6f1f53390c85@bootlin.com> References: <20240102-j7200-pcie-s2r-v4-0-6f1f53390c85@bootlin.com> In-Reply-To: <20240102-j7200-pcie-s2r-v4-0-6f1f53390c85@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=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 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