Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp2063213lqp; Tue, 16 Apr 2024 06:31:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVq+AjgkG6il84sY7gHuB9rRhd/sWI5bdLMRLh2zeFk311Z0W23pADUgGXpx7w3UNzypyvi8Nefy4tVRxlMZc4tEPpZHRMmaVw/7o95rA== X-Google-Smtp-Source: AGHT+IF2wjwx85pgEdHCzBdjZRnH795pRA+1sKjOuO48A9AnoKKy05vgajyVwlsxoS0R2UAf/G+T X-Received: by 2002:a05:6a21:3405:b0:1a9:f44b:98f6 with SMTP id yn5-20020a056a21340500b001a9f44b98f6mr6042728pzb.15.1713274264662; Tue, 16 Apr 2024 06:31:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713274264; cv=pass; d=google.com; s=arc-20160816; b=NtsSLNAiRRFTVnHG9F59f8qy6cZEOsMAkNNwnaHokylW9s9c9GjaD/UV/1MtglhQB+ UV6CdErh3PZF1FvEvYV89VeNw/sv3wLdluyUt0Ld7ZT7x1z5FZGq+e0XwCWafSOIMAj/ 9e/m4xCDASdaEcrJU9Y+M08LmvKPpB9t/I5B8cY+FE+7M8EslYib72eXSJsr//q4BUU0 2lZk1oClZ94kh0IUXOjkzj6O1X8mo0NOy13kI/5l0wn/0/EyRG58i29TJAX/mgPLqMvB JuSWZS+ma4tbugUbJzO7rmEcUCbAK2pL3f3o7kiPYlZFawyihaj7OtqwBlTLqJZ/cO3v 67UA== 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=dSO9KmOLy69eK9sDZpDk0OQgVV5KiCLFTLCitTBHDakcjyp1A3wq4Ov4YDdGXwKhMs QVtx0hoAMxHXhdl6M+hgS8KMTcUg00LLe6xpJOE5qYvjnMUFxS5fsznGPY13ugHXLPJr 65Pp7vuqlO9GDel9Rlcb2xMOFj7h4ffrg634P9/VwpGa9GfSKnt2mE+XzrR/4OFfuy2l Tm0zziIzjmUnhiBbOJzcuk08cfde3VqTKwHNVRElKfksESEiZMMMgt146GuKzX8EDbUA YNPMeqAbK27HgJHlW6TPhEL9I81A27Wc5QreWxEm2OtxgeiACer51yGAP392DvPapudH pf7A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ZL1ooC7L; 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-146881-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146881-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. [139.178.88.99]) by mx.google.com with ESMTPS id y13-20020a65528d000000b005dc8a33fcc3si9879291pgp.653.2024.04.16.06.31.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 06:31:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-146881-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ZL1ooC7L; 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-146881-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146881-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 557AC2826B3 for ; Tue, 16 Apr 2024 13:31:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F29E12C495; Tue, 16 Apr 2024 13:30:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="ZL1ooC7L" Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) (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 19A9C12C7FB; Tue, 16 Apr 2024 13:30:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713274220; cv=none; b=JlZi1Kvr/8CwZgqhc917vKkcGie5uQn4/HYzV3kwnagEkVPMdYrZnMwKvHdLpoeOaReaQtHKFcYlkCfjU3xmZbOVJ7E5D3CWWqtiXR8KN7lL71cy/6di/yFhpE8fPtL/JTkQqVIa8lIPkkOwxsN/QShhckth56oF2AcZNYYAevU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713274220; c=relaxed/simple; bh=KoeKOC9BxNbULIOx5THehrA2LvyMrmoh0J2kqk1uxqk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qbC8mxck8GIpvsjvTnq+W8MF15dxiSLghTgIF9VtPL7cgnk5TTA9QyzR+b3YH16l+ptJteIA3gwxNSTFh+qxTpg9hfkLmbj0QC2ra4aPmLmt9dV9Iqwr9tsEP7ZlIfrHZUJu3CnwcuV4GTU7d9onWd+JObk1jsfniC0zAZwCUr8= 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=ZL1ooC7L; arc=none smtp.client-ip=217.70.183.194 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 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 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-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=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