From patchwork Fri Jan 26 14:36:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Richard X-Patchwork-Id: 192622 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:e09d:b0:103:945f:af90 with SMTP id gm29csp701219dyb; Fri, 26 Jan 2024 06:39:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IEt4nGBP/qk/CmChOC8YUbhX1qKi7OI/90bNnTreH+o36ozQfdX+EsQNL0IXiLLU5FIsekl X-Received: by 2002:ad4:5cc6:0:b0:685:fd96:c537 with SMTP id iu6-20020ad45cc6000000b00685fd96c537mr1568292qvb.61.1706279983711; Fri, 26 Jan 2024 06:39:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706279983; cv=pass; d=google.com; s=arc-20160816; b=eq395c12hFVCcItsCXZ5dicxyu27fi+IBgkCa5FEa4/n4X7b4uz8u96Wqo1cP9kOxP eDWyYbcKj2cp/Fi+pVyp1dNfhe984W94Wiigdmtg5h3tFWA3PVIZxN3wBpnMdAQzAf55 SYEQrQC4cGmue+CNuP1Sk5/5wJyHuwU1r3LS1AajMjXHZnotElcXlmicX0UghaQr16lP 111jqhz2eHR7/dTmwuXbrLYx7IwAidyib1IDm6p0expzyBK5Ec+qixQHqC9LT8dYbJ5S YCXDAyUR2LcraVcb+TERuSrpqm4h00p227oUgcromPrNJT4oECjUNMvaUvgFMwYXpxlm sYJQ== 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=tZJ+2FIjmJ3bZ38rbdAVVTffmaC+WvVgUK7GwRKTE04=; fh=ihwxVJW8DyodhmdJo1IfhLUDNDWeXh+49SpWXYbpL2Y=; b=IwlB5kZ6z8MquCexLxT2e3JAIQe+7ovYruVhmQqKTi4XkWeUiBIGnbASa1Swwr3x5F n3lmb4K8ZxtoOImYUIu+3ZhoSR61PyWRZnx0Yxfs5vP/HF0fBTfA8bTGnrHqRUYyG+zS x+h7I3F4M+SN+c2dCd2+mewX8KvFXHs/sWHxi8aitN9EwJOAPdgGjqHMN7m1pRhgTpk5 Mrb7xShOeYmrK2nYK06kBNn1hWYKDHtP/vJkOBg9LLU3XdIBq5KozPctlb88R/zGo7Wq xe7MCyT9/LX/uldcn27xfpZx8bSXWtZoJTyhAe3RfhDQ4Qf1cUuierBt1UtZYQYExnSg ToZw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=UpAgNFun; 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-40204-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40204-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id gh1-20020a05621429c100b0067f28fb3f53si1350264qvb.445.2024.01.26.06.39.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 06:39:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40204-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=UpAgNFun; 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-40204-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40204-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 813741C21A2A for ; Fri, 26 Jan 2024 14:39:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 52B7B1EA7C; Fri, 26 Jan 2024 14:37:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="UpAgNFun" 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 4F53C1DA40; Fri, 26 Jan 2024 14:37:47 +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=1706279870; cv=none; b=Jp/ST4/l9tjZsh5HoyA64wo5qmH64icaxFmtsqS+BScdUcRd6inLz6IVMAkGnwC6yyCmK8IUbwmJi0K8wKkHtK1T8crGbdK+qOF5T8Yww3otGwQcV3cmmZlz42mu9AfV+SY5U43AJXSXmWOcfADAV8f0NwqfTha4XBw30rKPGG0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706279870; c=relaxed/simple; bh=NovYJkg9hWLmm6w5SFRQCUJycR7xJIZD4whepEe3ZIk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Rf3TfKa6bPktRpHSROwJwT5SRysQlohLQ93BVmqBYpbtfBcnjkzMwssCgjlJU0/LZN1gIGXGpN2ynOqCqflevRy8mmI0pagncqhs4wZ98sHNay9W8Atl+UB5WIFLiuAPNGZzQy8j+d8vCxZ/KjcplDvIRktqE8H83ca2lNyGpB4= 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=UpAgNFun; 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 F15CA4000C; Fri, 26 Jan 2024 14:37:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1706279866; 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=tZJ+2FIjmJ3bZ38rbdAVVTffmaC+WvVgUK7GwRKTE04=; b=UpAgNFun0NVNnY8k9eOqBgvyd6OtEWrfn5hfbdJb2qghuKCU3lVrcVGffgLMqHcaoxFviT pTB1e8YU8XTPwd+W2XZD+RUiodvkRevqbKPCk8pAvEBeHmF6HaEvTfhvub2s3Kbn4Bcdtf 2p5ppt4VTXli4/hl0EtBoYu7wcoP8i+4mZMeC1kawKLhTFwjx3Aco3xV6GwgSUKN9BPGD2 2KiZAq5m5s1Ng8xEyE2NhWoxf3oyc6Ns5GFn+gClI8BpgUTB5xhVZquAI1fVWPmIH5bOZJ oj0upQRBh/YBaMDou6cDcjCbj+IPpvU9i7NZ5GJ+i5XhNhGpiF4hhnePELNHbA== From: Thomas Richard Date: Fri, 26 Jan 2024 15:36:47 +0100 Subject: [PATCH v2 05/15] 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 Message-Id: <20240102-j7200-pcie-s2r-v2-5-8e4f7d228ec2@bootlin.com> References: <20240102-j7200-pcie-s2r-v2-0-8e4f7d228ec2@bootlin.com> In-Reply-To: <20240102-j7200-pcie-s2r-v2-0-8e4f7d228ec2@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 , Tom Joseph , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789164240457121938 X-GMAIL-MSGID: 1789164240457121938 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, };