From patchwork Wed Dec 27 22:15:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 183571 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp1691604dyb; Wed, 27 Dec 2023 14:16:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9BWDmjbYgqBykllfL1qWCnx3OLEwviWIqjtwwsDlY9vuzoOWuXhenrTK8NlfJ2sVb2gZ/ X-Received: by 2002:a05:600c:22d6:b0:40d:6043:5128 with SMTP id 22-20020a05600c22d600b0040d60435128mr298757wmg.143.1703715384651; Wed, 27 Dec 2023 14:16:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703715384; cv=none; d=google.com; s=arc-20160816; b=CiSM8OM7zulX+38QroS3rJ6sOkoLPBKmyYcJkxK0amjgODPWOduC6MlFqAbsuQAE5T jcLGAJe/8knAAod2ULGQQJ1P7cDpSz2pprtQNusrkKDh5c3/49oxt/R9DVA0a+xw3x+Q ORqtiZ3IStjTy1crw15ZX1jZx3k8ppdx7J+1w+Tu70fwOFUQgOAS4ScYbS1g2ilT1miS UV1YRy40fci5r61mbeLjkWYlSun/xwxzx30xyDnmiBpd6EqbdFGrBumABFOWqgjaJRAE V1yx858GhU7PSSQU2D/UHOaQfpiCw+XtUSm2QTNwEnLdxf/2JVdg4wNLqUPMLcEXzINQ Ag0A== ARC-Message-Signature: i=1; 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=QF50W+U9K2q+OXtEuQkW7nHtEV7kil/7qyeX3qRNKd4=; fh=vMPF14dRYhSnas+8U32vLVecrchv7sUNtnX5uRg2iB0=; b=MKAIes453aNbATJ3LnaMfIDX8fTCcPeFs7KZ/f7wHRVb7LaEBsUHNOaHjO+vWFTkGP ItAYCuqZWy4ScIAMZ6ufRQZn2Hmvc7zgaLFFIlEoCTEdHTrMJM+wkDgzAjohjLMJVQAI YbqJc5IyqvQsWGH/hBgDaFghQe8HB05Sc/HpOMRHRN4xGa4BN1B0Z+VbRiHnGS5tdI+m fsEELD2JFYEuujalcyHtTVbdrL3l2UegdVNF6TA7/YBvJQ5qn7J9IhT9enSwKpsTlsPr v+gMju0z21e2/L/9PfqpP1V5d6NbGCe0MdiSt5JcksB1Bx7WW6pEiHqz1HqneiDLxsjA 68Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=in8ZK8Fh; spf=pass (google.com: domain of linux-kernel+bounces-12283-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12283-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id vp12-20020a17090712cc00b00a26c29bf1bfsi4625286ejb.871.2023.12.27.14.16.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 14:16:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12283-ouuuleilei=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=@linaro.org header.s=google header.b=in8ZK8Fh; spf=pass (google.com: domain of linux-kernel+bounces-12283-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12283-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 0EA4E1F231B9 for ; Wed, 27 Dec 2023 22:16:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D45B48CD1; Wed, 27 Dec 2023 22:15:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="in8ZK8Fh" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 160DC481BA for ; Wed, 27 Dec 2023 22:15:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-554fe147ddeso2361573a12.3 for ; Wed, 27 Dec 2023 14:15:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703715349; x=1704320149; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=QF50W+U9K2q+OXtEuQkW7nHtEV7kil/7qyeX3qRNKd4=; b=in8ZK8Fhm7D0rqT4uiyxXABcaJMzFIHF3TTEw13+o30Y2B3LoBxbT820g+DzoncXK7 /HaH4TEVVs6DIg/HVq3uHPxGHiMRtk1cGyd8KpHK867gaZHZZ8DvMF52Xay0w8pYLtuK 1WpHd4bsf+kRYtr1wOuU5WMcx1AHzLu2DBQnNBctR1jCclnff1bdu4pomlwQq/w8FUQI o5H+CdZMsQ/oPBw2YThjRR2g6lL1QvR7YJ+7M/bmn97WgQJYsKHFkjiX5CNh4U1lFoae PHxX78CmFJ1LKC6XwJc8LOsjbNnz6tAcG6BYnX0oup+18BF4OurXaszewNKYJfbawvhV wS7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703715349; x=1704320149; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QF50W+U9K2q+OXtEuQkW7nHtEV7kil/7qyeX3qRNKd4=; b=Ohd6GZ7yzsbR6jiIYTa25nuxvJxKyWtAIBpyPGBFCt8aTEkr362bwf6dYNPPY4cr6Q hbVl8dr+3chbwHn5uuzS/BSWrU4iT8VJzH395BAWRAXG4C/bl7YFc7PzAjZy046ODPLL DjePrbv+6k24hSoIQ/ZK8rAxB+E8AQ171DSbc4L/zCUnwktN/zDDcQaEgHET7q2eg+RU +GebGZUUJLpv1FwAKtmPbQM8ORMsMtnS/GgOlZNaFSH65YbcwzP/WoA6Tnk71WzhTRvh W2/YpSHDx2kLXWImnoXY3J5sfod61PN5co6pXgnN+YtYGXpq1sgbfhSlKs1T2PfSLAHB Cb3w== X-Gm-Message-State: AOJu0YyPS5O4SGLg9NEM4SVkjOFCYRSe2HbrWNkrawDrQMvFBepdK2bx JjqcV++BcLR4iZvio5iKbc3aFCnSLiaUxYJe2WRWpxbWdik= X-Received: by 2002:a17:906:768d:b0:a23:713d:57c0 with SMTP id o13-20020a170906768d00b00a23713d57c0mr1984365ejm.234.1703715349284; Wed, 27 Dec 2023 14:15:49 -0800 (PST) Received: from [10.167.154.1] (178235179028.dynamic-4-waw-k-1-3-0.vectranet.pl. [178.235.179.28]) by smtp.gmail.com with ESMTPSA id vw17-20020a170907059100b00a26f3d6062csm2821501ejb.50.2023.12.27.14.15.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 14:15:49 -0800 (PST) From: Konrad Dybcio Date: Wed, 27 Dec 2023 23:15:30 +0100 Subject: [PATCH 1/2] firmware/psci: Set pm_set_resume/suspend_via_firmware() for SYSTEM_SUSPEND Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231227-topic-psci_fw_sus-v1-1-6910add70bf3@linaro.org> References: <20231227-topic-psci_fw_sus-v1-0-6910add70bf3@linaro.org> In-Reply-To: <20231227-topic-psci_fw_sus-v1-0-6910add70bf3@linaro.org> To: Mark Rutland , Lorenzo Pieralisi Cc: Marijn Suijten , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bjorn Andersson , Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1703715346; l=1200; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=BOcN6TOkFupHjjux6yybqx6vqjcZtP/Ge6E7xFQ3Z1Y=; b=VqjR+6LtgrQAcFZLsGBSO7LUmQI+i23yymh1HGczYfwmvtx9rhxhsZTc5WKsyY/cald/Wznu4 dssyitvO+fmAE6L1tdpTAk5ZzwxVPqDLF3ouBmxVNbIdfCWRCKgI9pA X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786475063052067691 X-GMAIL-MSGID: 1786475063052067691 Some device drivers are curious to know whether "the firmware" (which is often assumed to be ACPI) takes care of suspending or resuming the platform. Set the flag that reports this behavior if SYSTEM_SUSPEND is implemented. Signed-off-by: Konrad Dybcio Reviewed-by: Sudeep Holla --- drivers/firmware/psci/psci.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index d9629ff87861..1bcb752977b1 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -505,12 +505,22 @@ static int psci_system_suspend(unsigned long unused) static int psci_system_suspend_enter(suspend_state_t state) { + pm_set_resume_via_firmware(); + return cpu_suspend(0, psci_system_suspend); } +static int psci_system_suspend_begin(suspend_state_t state) +{ + pm_set_suspend_via_firmware(); + + return 0; +} + static const struct platform_suspend_ops psci_suspend_ops = { .valid = suspend_valid_only_mem, .enter = psci_system_suspend_enter, + .begin = psci_system_suspend_begin, }; static void __init psci_init_system_reset2(void) From patchwork Wed Dec 27 22:15:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 183572 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp1691673dyb; Wed, 27 Dec 2023 14:16:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IFmi46RQXUvNOPImKfocIWykBfXA1LI8ouhJrqnfmhmRsLtn/j+Wj2ITQrcxXXv0I0oq34e X-Received: by 2002:a05:6830:1d54:b0:6d9:db33:39a5 with SMTP id p20-20020a0568301d5400b006d9db3339a5mr6644775oth.75.1703715393356; Wed, 27 Dec 2023 14:16:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703715393; cv=none; d=google.com; s=arc-20160816; b=O48AEx2Gn6lDK6u1KWw1Je5ZkBG4XNtAcwcUORgROW19RhfJquP2l7h+eIJoXmJrW7 lRNZJqbgTvd43RbOoI4QWjr5ucYiNnQt+HbZXg2LxphMOiFCjevTA6p+LCjLEsRvOUO5 +GAs2gEsV5oy/a9Fk9/nrwQDiJsZzQmwOSMBilFobyK1f0oPXZh6B/Qk3q6NV5dkbDyX jWoQkmOXxlbjdEGZ8+IwcF1HwguvR+2umGgzO5owAsxUZtD80yrav5vpJKGcKpNKW5T+ L6k7WZ24losAsQpLM3NA1tyYqpaNOwubQ46/gvVHdh6rTEBRC7RajxPklmUdtm82DTWy UWAg== ARC-Message-Signature: i=1; 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=DM4CXwvWCS9WJcPPk5LYsBDY7vznKyyVFP9Y3rGVGSA=; fh=vMPF14dRYhSnas+8U32vLVecrchv7sUNtnX5uRg2iB0=; b=ctZ+WkskjhXTKi14Pf450wl7OYcl0gFIYr/aKsOmnTehCEjlHUPacEjje1MRxPGhsO f/A53opeJNwLC9Ea64c5DpogEAt51tpfEw+cl34ZTx8Fs/+nR8B+TUzh6ONWR1G/x0WU qkRlAiSSDSgj5Ln0NM4XcMtkVi4koaWQ2QAEPSQpZutQXpNwghsnyYQu5HbsyhH3KHOa U/PkfChIUEXleZQtG7UuW/OVYLx98J/MaSRUlQAU2dR+/bHQP93gZPrlvnDLkFHQgY+g mbLEisos+rsp7Q3ldpJPpgVbjpMS14xlqm7wL47ZH/oCdH3c8n9jN8es12iF8aIQZ1S1 OYhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eRtOPWIu; spf=pass (google.com: domain of linux-kernel+bounces-12284-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12284-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id k125-20020a632483000000b005cdfd55d112si8941824pgk.655.2023.12.27.14.16.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 14:16:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12284-ouuuleilei=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=@linaro.org header.s=google header.b=eRtOPWIu; spf=pass (google.com: domain of linux-kernel+bounces-12284-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12284-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 36196B225A9 for ; Wed, 27 Dec 2023 22:16:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B407948CDA; Wed, 27 Dec 2023 22:15:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="eRtOPWIu" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7083E481CE for ; Wed, 27 Dec 2023 22:15:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a23566e91d5so633040866b.0 for ; Wed, 27 Dec 2023 14:15:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703715350; x=1704320150; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=DM4CXwvWCS9WJcPPk5LYsBDY7vznKyyVFP9Y3rGVGSA=; b=eRtOPWIuphs2fQLqOcXohktt1fA3wqlCgzu/53++Vb9bMackwBN5uzZwykJ3Jh7z+u ob6byIZd7dAyH03+5hrDnaq6mRBgxdXhOHolRelady5yD5WqTAtijOgFA5pGX1HOn9PN I3z3cXJlmOlobztf1dlBz4x+kn9LpJf9BvaKr8c240e3lSvvItlIr4rr/uVBK3Hh87Zp 75khnY/o68RahW+7tVtLNj3XPc08ANolGavwIbE9ZMyh3GnPnFcYI18q9Cth1N1zX1ND X0u3cBKBoyuo0cVEorDXGqvKnHGQcO0CuCv8EfBWT0rL/gJy7i+gJCinPoS0yPh4G7Tm 3R3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703715350; x=1704320150; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DM4CXwvWCS9WJcPPk5LYsBDY7vznKyyVFP9Y3rGVGSA=; b=Eq/a9gopLp3FGaxEm/fAKeCNwvEnTVIlrtjiO18WFhWdhp+XuRtCxT0VcbyVPdEcXi xP0fPhzb9WVuKnnsAoTKKupi+6aHO/pa6SDebisyPpAubKDBQks9vgjCfNDE/FPca0yZ qTQDs3JQxcGuDegMZStzdjap8F/KHs6s8ukwg3nTF1abBxNxrJdOUdB3IsCOXrdthbJU 60Y6L5ebI4F7WVxtnBemBM0IxZIhGzsfhDu2ATKC6OlhDabXsOMriJNGTFYZKO0og5K6 De2WXwnoODHeP8d2UXkEK8pY08K+fWYrshw32QKCfptJutYLIdmEbvxxJ6VWuNV0gU3c bUxA== X-Gm-Message-State: AOJu0YxRJ0sAYFEJbxv9R0GBeh9NO/PL0QrJB/miXbcxzoKDcmtrCL17 p3Cvu+iqk/ITQCqmqVi8NpTND2Xe/8H3YQ== X-Received: by 2002:a17:907:91d1:b0:a26:93d9:eb6a with SMTP id h17-20020a17090791d100b00a2693d9eb6amr2433282ejz.44.1703715350572; Wed, 27 Dec 2023 14:15:50 -0800 (PST) Received: from [10.167.154.1] (178235179028.dynamic-4-waw-k-1-3-0.vectranet.pl. [178.235.179.28]) by smtp.gmail.com with ESMTPSA id vw17-20020a170907059100b00a26f3d6062csm2821501ejb.50.2023.12.27.14.15.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 14:15:50 -0800 (PST) From: Konrad Dybcio Date: Wed, 27 Dec 2023 23:15:31 +0100 Subject: [PATCH 2/2] firmware/psci: Set pm_set_resume/suspend_via_firmware() on qcom Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231227-topic-psci_fw_sus-v1-2-6910add70bf3@linaro.org> References: <20231227-topic-psci_fw_sus-v1-0-6910add70bf3@linaro.org> In-Reply-To: <20231227-topic-psci_fw_sus-v1-0-6910add70bf3@linaro.org> To: Mark Rutland , Lorenzo Pieralisi Cc: Marijn Suijten , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bjorn Andersson , Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1703715346; l=3395; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=JzsZaTg1IMKhIfK68jHfV873UZDk10Nbu4hj2+1j2fg=; b=Mw5QVXoHdGheLV+1bzxTtADhkn/zaPQU1MbgFoSVA89LnbIQtJJVihIi5J3WuZYWxQindrXvB sUzNfSt1TuTDktJtJD/hPUp1yX52useQnsRzz4Dywpgok07cbtfO0Wk X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786475072281819531 X-GMAIL-MSGID: 1786475072281819531 Most Qualcomm platforms implementing PSCI (ab)use CPU_SUSPEND for entering various stages of suspend, across the SoC. These range from a simple WFI to a full-fledged power collapse of the entire chip (mostly, anyway). Some device drivers are curious to know whether "the firmware" (which is often assumed to be ACPI) takes care of suspending or resuming the platform. Set the flag that reports this behavior on the aforementioned chips. Some newer Qualcomm chips ship with firmware that actually advertises PSCI SYSTEM_SUSPEND, so the compatible list should only grow slightly. Signed-off-by: Konrad Dybcio --- drivers/firmware/psci/psci.c | 57 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 1bcb752977b1..ddfdc14e2423 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -523,6 +523,30 @@ static const struct platform_suspend_ops psci_suspend_ops = { .begin = psci_system_suspend_begin, }; +/* + * Some PSCI implementations (particularly on Qualcomm platforms) silently + * sneak in SoC-wide power collapse through CPU_SUSPEND, while advertising no + * support for SYSTEM_SUSPEND. + */ + +static int psci_cpu_as_system_suspend_enter(suspend_state_t state) +{ + pm_set_resume_via_firmware(); + + return 0; +} + +static int suspend_valid_all(suspend_state_t state) +{ + return state == PM_SUSPEND_TO_IDLE; +} + +static const struct platform_suspend_ops psci_cpu_as_system_suspend_ops = { + .valid = suspend_valid_all, + .enter = psci_cpu_as_system_suspend_enter, + .begin = psci_system_suspend_begin, +}; + static void __init psci_init_system_reset2(void) { int ret; @@ -533,8 +557,33 @@ static void __init psci_init_system_reset2(void) psci_system_reset2_supported = true; } + +static const struct of_device_id cpu_as_system_suspend_match_table[] = { + { .compatible = "qcom,msm8998" }, + { .compatible = "qcom,qcm2290" }, + { .compatible = "qcom,sa8775p" }, + { .compatible = "qcom,sc7180" }, + { .compatible = "qcom,sc7280" }, + { .compatible = "qcom,sc8180x" }, + { .compatible = "qcom,sc8280xp" }, + { .compatible = "qcom,sdm630" }, + { .compatible = "qcom,sdm670" }, + { .compatible = "qcom,sdm845" }, + { .compatible = "qcom,sm4450" }, + { .compatible = "qcom,sm6115" }, + { .compatible = "qcom,sm6125" }, + { .compatible = "qcom,sm6350" }, + { .compatible = "qcom,sm6375" }, + { .compatible = "qcom,sm7125" }, + { .compatible = "qcom,sm8150" }, + { .compatible = "qcom,sm8250" }, + { .compatible = "qcom,sm8350" }, + { } +}; + static void __init psci_init_system_suspend(void) { + struct device_node *np = of_find_node_by_path("/"); int ret; if (!IS_ENABLED(CONFIG_SUSPEND)) @@ -542,8 +591,14 @@ static void __init psci_init_system_suspend(void) ret = psci_features(PSCI_FN_NATIVE(1_0, SYSTEM_SUSPEND)); - if (ret != PSCI_RET_NOT_SUPPORTED) + if (ret == PSCI_RET_NOT_SUPPORTED) { + if (of_match_node(cpu_as_system_suspend_match_table, np)) + suspend_set_ops(&psci_cpu_as_system_suspend_ops); + } else { suspend_set_ops(&psci_suspend_ops); + } + + of_node_put(np); } static void __init psci_init_cpu_suspend(void)