Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp478808lql; Mon, 11 Mar 2024 08:14:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX43IAaJ1H0SX+Uv4q6sLsZLG/VGj06sDCZzjAF/v2LGBGmxNYEIHljLTE+KC0/bHwKFeXm+mIBmXXAD1MC1f4dsbZAxZRca1sqle4CFg== X-Google-Smtp-Source: AGHT+IGdGcfujP19EVfxJ17AUkTRAZ+BMrn5jEYvWR2JI6wepRape6C4bqcyvJUtoqkek7ZaX/Au X-Received: by 2002:a05:651c:1a12:b0:2d4:27b0:1712 with SMTP id by18-20020a05651c1a1200b002d427b01712mr5275899ljb.11.1710170067220; Mon, 11 Mar 2024 08:14:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710170067; cv=pass; d=google.com; s=arc-20160816; b=yMoDzr7WIvyZ/udZNxiXdKSxSt/XNU5UuBFxmkbfAfN8eIFeMkJNe4ugzcy/K0ZCHg kEkDoRhApPclgXFF6mPyCMZf21+T5Mydg+RyyCy1xav29XgX1+2ia2yajxE0k7DHtIh9 0eC/TVdJI7nFzazA7pEZc1MRv0rw/jeoL2+ws7wbsw5GGrFKOmOV4hHkBIRhoMq3wWu6 YaswhE0V3R2nvCo91DxcRuxX9OQ9nOqrWWZIxgzXvN09PGaF5g3IU05gOX1kYpkgGPYT XLN0nZqEiCDlYj7RkYCVa20fNJCGp8PL7ky8YxAUpGOTAwZtT0/Ab6i6tGcrnloq4KZx yX/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=lZ9kwcIUo/08+n5RLmGMvOyaGeb3HhJoRpejNEXuVaI=; fh=QzfW9yKpzhUsHx7gh6N8YVJS23e1XP+p/KL59L4Eex0=; b=n4Yd7pasHr4Wli3i7vzW1skZnNnDDwj0CwWupy5jSHrgqW4ueZ+caOmMAMM6q/DtSM 6GusdkfAgkoiDj6rrfS3QrqP7rAb9ONOduFCtzK0YYiwAf6wYPIY3WWGzCTP9EVOJVRF v/ovxEf3pH0RRhoLKEHZJEzC/ec4oGlpyAv6EKzzV5SPSNcvu1lu1N+tPNwuVprLUga8 ntCv7o2kauXsIga3JzwJecFHgmuz26w0XP6oLI3AvhdYAeiGo+2151kvxxUodrZ7LD4j MXW4TucZg0mAxDaqvmqSakIclQwpqabeVsHOxFEHNkuELHaAb0lbqcOjirqvowvjqC2P DSyA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OV8pnm4U; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-99055-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99055-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id p7-20020a05640243c700b0056842db5c4fsi2226948edc.115.2024.03.11.08.14.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 08:14:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-99055-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OV8pnm4U; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-99055-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99055-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id E954F1F248C4 for ; Mon, 11 Mar 2024 15:14:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE86047F77; Mon, 11 Mar 2024 15:12:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OV8pnm4U" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.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 09D48482D7; Mon, 11 Mar 2024 15:12:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710169957; cv=none; b=jwfiV72hl2XrJx6LwL62zC1Hmhnqo+PJvUKWoWPCu9sF+/dFwsxtncoEp/04U5OUzcuckx+BMWXyogDcx9elEBBxy5Xjq0/2xaMRdZnkt1wPPZHp9owFayRH95ngimpe352ymPaoe+fE76zzKW6zjmWHL0wA+dtAud0H3Me6j54= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710169957; c=relaxed/simple; bh=56cDsqFOGwW5Ckc+DVvS50eIfweND0EvI8zRDNwLbWU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=O0/FtRla34y8OOFbDqv3M17T0NUyhlFHsVyAy0M6Gpo/gBccC8GP+hRTOxqaAWLt9ximTR0LWE0o8SylwHwhjPoYmMk61tz/+5OX/HTuokgsb567MM6ZqL48+10r3gi51494FKD0kz1KOP/Cjq4stZa5bvUSngxwiiv+vujTHZw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OV8pnm4U; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8FB8C43394; Mon, 11 Mar 2024 15:12:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710169956; bh=56cDsqFOGwW5Ckc+DVvS50eIfweND0EvI8zRDNwLbWU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OV8pnm4UslaKUt0BDGSQZIIcbmDMrOIWbhPfC49d5XNmcCaElcnuj9aVOscEEFWW6 kSMefRlslJt2sTLTlQmHtVZpJhLcqGInVxMtTuMU0RkA2tmISRbz0cqpcbfQx8f8v3 yMwhL1bTgO+IH2YJgJ0vo3mc1BLjdvco4rcxnWYXtu97b/S5i5I+vSVrBAYUuB/QsS wnA+L5fIdd/Lih9Y6c4CTvzLGtafoILyuNMdhV40VC0LL0yh8sOeknD653T8/GUe15 C0stA0JFM0cHhyCHkdz7aU1Qo0/R57sRFHhLGred380K+JFN92RU/hNNPKEQr6A1mQ ONbKEO2tSDf4g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Th=C3=A9o=20Lebrun?= , Mark Brown , Sasha Levin , linux-spi@vger.kernel.org Subject: [PATCH AUTOSEL 6.7 08/23] spi: cadence-qspi: add system-wide suspend and resume callbacks Date: Mon, 11 Mar 2024 11:11:48 -0400 Message-ID: <20240311151217.317068-8-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240311151217.317068-1-sashal@kernel.org> References: <20240311151217.317068-1-sashal@kernel.org> 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 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.7.9 Content-Transfer-Encoding: 8bit From: Théo Lebrun [ Upstream commit 078d62de433b4f4556bb676e5dd670f0d4103376 ] 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 Link: https://msgid.link/r/20240222-cdns-qspi-pm-fix-v4-4-6b6af8bcbf59@bootlin.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- 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 4b2d42e54f568..1a8d03958dffb 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.0