Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp243162rdb; Thu, 22 Feb 2024 02:12:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVPNGfTehPO3vtrnbrqx/etyRcwiIl0SqVXHZHcamg6xMGXIaA94T6VwyPon+4OhqKV8g/bYi+xMBJbQCpqE6Tv1Du6mJdaZkPE6DSLLA== X-Google-Smtp-Source: AGHT+IH0BLhfO74+PkH3CAUTl3yF1EIT02QYs8QiG5nRpI11Y3AH1rUeVoPQ2EJhAEubxLfCZzH8 X-Received: by 2002:a05:6a20:e188:b0:1a0:b3e1:aa2 with SMTP id ks8-20020a056a20e18800b001a0b3e10aa2mr7609822pzb.17.1708596767424; Thu, 22 Feb 2024 02:12:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708596767; cv=pass; d=google.com; s=arc-20160816; b=DmWqBHUgZj8bTuNqJkeGk9fl2mm35MenUcUOCay9rXNv1T2Q2gXDRi7KwzRNh0otDX 8y9n0BGvsw9g+70I3fmCf/CGgASzJSdayca+H2A4HvhExkc77QjrxXlRFRpMex1S0q5/ 51RggI1Bn0qDK7GtRB4YK3tANWSfhUtoFRLMJhzZ1P273Yi6sktlZOHqkbeM7tNwzQaC aUcoyFddygZjsSdA36VMugNU3irLSY+5JXjoZVQUj3p98vZcGqDNKZ9yrWiNi9FEdN8V Q6oy1WUy8yHui/cLPEwd7X8RRvCRoJf/N0BBIoiaAU5tQZkAVq7YYjWzHHCIfrnvMre1 Wf6g== 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=Eg97yjO7KdqvwAZXBVokHmZiB+7Ptk8zlKT2d8Y1vCs=; fh=Oc81uuoSiCYmWPIZrJKh6tUWDhA09tD21Re6ielkk1Y=; b=BONjQnO8ymGTG0rUwRPL/BfR0FDZWNs6VMaFt+Fdqqjb8oM9ZA8TZ8aks6rdQxhp1c k9vwq/8VC7O5R4zOymQFPPe4KRd5502z2ayPO1lJWAAhx/wWqjcPbSspaJSLTWwEGxTd fo1I7Bk3ZnIPQNQbhXd4TRPnMucPZmh1AbpplY5srUc9Yi0ycg0w4VRwvlaJlYIYxtks crHi2atEp7A9ZI/ijhfjxFLRcfnxFnBllXRBC61br3A8c9fbgiEQ2oYbDNLQeLwZfjOy JdTH9oVx0bAqBVAJB+Ttr9kv5LrYucq+9F/CXod3ZVkTorgEgWt56e1ON1kFekO4jO/T qexQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=SqGH+qEE; 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-76297-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76297-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 e36-20020a631e24000000b005e270acf8f3si7374713pge.748.2024.02.22.02.12.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 02:12:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76297-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=SqGH+qEE; 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-76297-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76297-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 27625281FB6 for ; Thu, 22 Feb 2024 10:12:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E530339FDC; Thu, 22 Feb 2024 10:12:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="SqGH+qEE" Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (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 ADB0239876; Thu, 22 Feb 2024 10:12:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708596757; cv=none; b=o9ubogkRHDnhyXDaoSRaFVTQmBX7FcFF9pJY8xRo9xnmFrrNOzU8TQpc3o4DGegSAp2zeF9V/pxzguRhWjJuAb/f9jAkvEtPHNRzPgydEgtEvvs4mPpT4f/YymjHixi3sO821RUI0tZUSDBO/IN2UZi5RhO6zEqaAWUP8eJWhgs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708596757; c=relaxed/simple; bh=phqB6EsMKmMZCxST51NEKAHp04XCYXDRfwNdDc4qp3c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DYnaqOZOAvLvuUlitX1JKj3TiYcL4RQHyBaiRc52+BK8ocvg9RTFLAfo2VP5if7M++RVNAb9NdHfeVxws6m6hf8P9EOMMxYa/P0hwKaJVzoSCINFVu2KjjN66SZ1O/9LX3qPHc6p/z6XjbDQtoOMEmXFALNPkTiTGByr2ePlOeg= 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=SqGH+qEE; arc=none smtp.client-ip=217.70.183.200 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 5239320013; Thu, 22 Feb 2024 10:12:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708596752; 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=Eg97yjO7KdqvwAZXBVokHmZiB+7Ptk8zlKT2d8Y1vCs=; b=SqGH+qEEI2ulAOG8ee55jdUpIZiKanKdcg3SxLMP34ZEIL0BtCd4sBiOQU0Tra3JQhnFbD PjaMzsqcC5FdcQLbQ1pRoYgt1dX9lmG3fW1z3HZA6RCI7cdsAyKv34zCRGJyygK7L7bHDU wHeAzwYBq7D5Ai1cGs2XeLRjFA3KNFQpdfTAwozXeWoVAKiiXwRFT8DruAPifaj8DnSaWH kIZtV8CZtGFTG6rdP35efOOTIaSsysvUDaze0bdkXfkk+/TdBUzlksUi4/nPjECEpa0sMu +y18tn4dI5IPHVHkGrJYbNgXrhEXrCb6SJBVN7L3O6jcrVk/x5Pd5EUs3gCYeg== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 22 Feb 2024 11:12:32 +0100 Subject: [PATCH v4 4/4] spi: cadence-qspi: add system-wide suspend and resume callbacks 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: <20240222-cdns-qspi-pm-fix-v4-4-6b6af8bcbf59@bootlin.com> References: <20240222-cdns-qspi-pm-fix-v4-0-6b6af8bcbf59@bootlin.com> In-Reply-To: <20240222-cdns-qspi-pm-fix-v4-0-6b6af8bcbf59@bootlin.com> To: Mark Brown , Apurva Nandan , Dhruva Gole Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Gregory CLEMENT , Vladimir Kondratiev , Thomas Petazzoni , Tawfik Bayouk , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com Each SPI controller is expected to call the spi_controller_suspend() and spi_controller_resume() callbacks at system-wide suspend and resume. It (1) handles the kthread worker for queued controllers and (2) marks the controller as suspended to have spi_sync() fail while the controller is unavailable. Those two operations do not require the controller to be active, we do not need to increment the runtime PM usage counter. Signed-off-by: Théo Lebrun --- drivers/spi/spi-cadence-quadspi.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c index ee14965142ba..8bcbab90cb75 100644 --- a/drivers/spi/spi-cadence-quadspi.c +++ b/drivers/spi/spi-cadence-quadspi.c @@ -1949,8 +1949,24 @@ static int cqspi_runtime_resume(struct device *dev) return 0; } -static DEFINE_RUNTIME_DEV_PM_OPS(cqspi_dev_pm_ops, cqspi_runtime_suspend, - cqspi_runtime_resume, NULL); +static int cqspi_suspend(struct device *dev) +{ + struct cqspi_st *cqspi = dev_get_drvdata(dev); + + return spi_controller_suspend(cqspi->host); +} + +static int cqspi_resume(struct device *dev) +{ + struct cqspi_st *cqspi = dev_get_drvdata(dev); + + return spi_controller_resume(cqspi->host); +} + +static const struct dev_pm_ops cqspi_dev_pm_ops = { + RUNTIME_PM_OPS(cqspi_runtime_suspend, cqspi_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(cqspi_suspend, cqspi_resume) +}; static const struct cqspi_driver_platdata cdns_qspi = { .quirks = CQSPI_DISABLE_DAC_MODE, -- 2.43.2