From nobody Fri Jun 12 17:36:39 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 D84172E719C for ; Wed, 13 May 2026 14:00:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778680833; cv=none; b=hr1A720+OSzBP9E1meCx9b+IMmKZKlzVwhO+N6hXJmd/ZdQgFRn3zNMudR24D8W9tEwEEosYPJ3Pg/3p+f9339r27g0VpMueJIsZmrbUVZdrlKYjAWz3/gB1c/xu3kZ6nv0rwQQp+LsLOBD98S1xWwtWWsimBnBokkBVY3u1buw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778680833; c=relaxed/simple; bh=oPThCnshvF0b9uT3Ddx8L/OThmoOfUCulhxnC7Vt2FQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QbpsPKDiybNAZJb7Yz4XyaKNg8MRnhkJyvf/a36Qy+DTh2/zIPbDdlvvbkGit8d8iSYC9W0xSzOi3ATFm6vLCWyBbU6RKU7vAaWEUyLyydB+DWkU3U0ay0k8eqOtGhUOnSy7ZzlzXkEQssh6rkemZOZzvEgVys6Y+BthisH2lzs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=caMebPoI; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=VnqtjAXZ; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="caMebPoI"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="VnqtjAXZ" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64DC29Rd2965186 for ; Wed, 13 May 2026 14:00:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=iCR1wWYDk7P Uvs3e9gMD6BoPYPhmx+vYRptveKOv16U=; b=caMebPoI5FvCaMcWHlD1WEcec6E bFDQynP3c+xdgmTD3fh17PQaSleu5h9cdlCnTn14n7s9mxojXRuHWG9q7F4A3Fga vIeWeiGefTfH33c2s6mm2gs+aAQyS4+79olEEF/wo5xTtLqXqNRHpWRDyvwicmP+ Ru2BTpm18D8KqL+qj0B/buR/WvUqLKNKVzjxRcoxYGkriLdvrDO7bsGQh/BEzrbc VqHA7iLQckCHiY2wcZ8yvfoY42CArfCr6f28BhQKYAndlfM5XdE+ThYXEixY8dTI 4vxzqqcU19SYmLJckNpG4WZ9cjtMSF28YFRIdNAD+xIVR4WzrJjeH/Kz0Kw== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4e4ma59nm6-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 13 May 2026 14:00:26 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2b4654f9bb6so71928385ad.2 for ; Wed, 13 May 2026 07:00:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1778680826; x=1779285626; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iCR1wWYDk7PUvs3e9gMD6BoPYPhmx+vYRptveKOv16U=; b=VnqtjAXZzM8aR6HjO40bF3XiAXDs/ROWAn7jnS/zfJMKVTfMBcwdsMUUfmsHXIUQlI TRZ1i8+RqgPmO4PQYOgcyHX41gGBu1LQRJgHskg/dHOI8r/GJ3s+YWNiiuhCfxfDP72L Mum8/w7puJQz0NPPw5RtXWQScpeR3Sesoem19lkg5BQrUqqn3FtbgQamd9j5Kh1UMnMW l8Y5p77hiJpt5yq33rB9CVCZXObiYaAR3bjOo3R1vj5kBO069gz+iLcDBt815iqxRAlh I6sldKU9pn/JH6RG4ISaiB4MKgELO+sFtnjLC6zpFgqP4BrvTGBPQNmdc2C02elsNIJy 6JQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778680826; x=1779285626; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=iCR1wWYDk7PUvs3e9gMD6BoPYPhmx+vYRptveKOv16U=; b=O26jvMoDmDuEiStRJ0l4bqG5Xug9wemnqmkAJOeSTPuPG9xGRcdUo1HrapYz2S37Be aF5on5osaHLFAVMEd5GRVgW9lyawCmnc0t68Yy146DG6HS4O4sRaJdq+HAETmTGH0Ybn 6UcO4iyy1hc0XKRrpCmWmzXu1C4aLgCBrVwNjzWM6u1YgARu1Cn/IUFTxd215nlUUnnd W9F7h+A9cIMh7p9CDrJv4JPHceT8USYKFxvd3FeufHYPqaUs1y9OS6AthZI5BjyAbQA0 IT6+egrJYILaQ7E8amaikWGnZsl0BPoxWpKD224YN+5oaY0B+fNxvoO5mIAzWJTc8Cvh +pZA== X-Forwarded-Encrypted: i=1; AFNElJ8cKhWdFyUEjdjUjZM4jDVk6dRB15Ms+mTSGMPcue6Ws91wxeVDEGGtFQdsIccp6KjD+G7RCO56eCAH8fw=@vger.kernel.org X-Gm-Message-State: AOJu0YymEXmwwPtLQaFfZUYHxr1pPfI0PVUw7PHhjcVQoISYYsgan5IR 3syAqRUTJ8mbcPgbm7kzOgzuLzwVZYfI4zEy5JAitXgZns8ouoLNlrKPoJYqiBbLiQIgqIWxUfH 5lHQFH5af7VO9P04wkjYK+FSJ4ylp4Cu6+7w7lwxRSGefOm6hsgbPbPPXsq2V+Dv/Wug= X-Gm-Gg: Acq92OG+pAe6euTx3ncrmCuc2Iv7Zq2BheTWX/f2U6ucC8bUPrwsUTDB0opc4NDhPdx LqXz7ip/iB+TLBTTLr4XOxFwZOk8QMERHf0L+B2TrJnINeE5/Ut2irXmS3ukiMBlTUn44COqzUS eB3wfbQQuIFMTLezFXX3ZYZBLbDpMC5rqkhYfPNsoPK8COXAG6BSB4p7kdENecngbURhHlz9V+n ELTJkCN24LubKHRKtwuc0OBRyCTF5qlbM/pud7amlbgzQmSboqIfp+4YomCgKCN0ghNBeADcfAF FzhYb+TmRiTex/bGl+y2nmDocY9Fji6EYoRKwvE0/jdaX8zdvxOVGghuaX+9G3+E6EVjJ2znFrH 11BHv6Ylt/4pL2iG2CTRZQ+4iwqDw6B3XXOzGgqdkvTjTXexNpg== X-Received: by 2002:a17:902:b188:b0:2bc:8f30:74f0 with SMTP id d9443c01a7336-2bd275c7fa9mr25753235ad.26.1778680825497; Wed, 13 May 2026 07:00:25 -0700 (PDT) X-Received: by 2002:a17:902:b188:b0:2bc:8f30:74f0 with SMTP id d9443c01a7336-2bd275c7fa9mr25752805ad.26.1778680824882; Wed, 13 May 2026 07:00:24 -0700 (PDT) Received: from hu-nandam-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2baf1ec232esm176189555ad.81.2026.05.13.07.00.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 07:00:24 -0700 (PDT) From: Ajay Kumar Nandam To: Bjorn Andersson , Linus Walleij Cc: linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 1/2] pinctrl: qcom: lpass-lpi: Enable runtime PM hooks on LPASS LPI SoCs Date: Wed, 13 May 2026 19:30:08 +0530 Message-Id: <20260513140009.3841770-2-ajay.nandam@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260513140009.3841770-1-ajay.nandam@oss.qualcomm.com> References: <20260513140009.3841770-1-ajay.nandam@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTEzMDE0MyBTYWx0ZWRfXz2SATce/VMgh BJXc0LuvQzuJ55nQSDMe5msRL9l663sDmXbwn6nVTwG20vM6x6m9gOuOqW4HbX+BPtxZwijhOIa GVjPlQXR0PcXBZdaG9xApdk2XSDEjf1dw0NeFYtQu//7/eEe/Ub9edL79aidZYpd/9woVkWcPwv axHxMpo9/DxJAIAHfxm5Jr7fMmcJ78SJSoHbtb5X8SbBw6AcuSMpAmvmJrOUdn643Dq9uhKPIqj no04c1mA/jnZKCuLPc/8efmx4AORussODj2rIzOKCDHO6UHYXRMcUC1Vds3Xfj/Lj8wQ7cnlgBm Vry9zYNLf2fSiCJDTLfPwsJFy88mHyAeouHbQAO9EHh5F8C/oje/JkWYxqK9yu/NYCeIDmaPYxU SEkJaLzdoVKvbS6jEtmy/CTIAowLgw== X-Proofpoint-ORIG-GUID: KQjGPk0CRBAeVPObWE-zCSzB6CH4KeR4 X-Authority-Analysis: v=2.4 cv=TJZ1jVla c=1 sm=1 tr=0 ts=6a0483fa cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=NGcC8JguVDcA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=EUspDBNiAAAA:8 a=ZNL_fLR5ULJS_YlRCRQA:9 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-GUID: KQjGPk0CRBAeVPObWE-zCSzB6CH4KeR4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-05-13_01,2026-05-08_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 adultscore=0 spamscore=0 phishscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605050000 definitions=main-2605130143 Content-Type: text/plain; charset="utf-8" The LPASS LPI core conversion to PM clock framework relies on variant drivers wiring runtime PM callbacks. Hook up runtime PM callbacks for the LPASS LPI variant drivers touched in this patch so they are prepared for the shared core conversion. sc7280 wiring is completed in the following patch. This commit is a preparatory NOP on its own, as runtime PM is still disabled on these devices until the following core conversion patch. This is a mechanical per-variant driver update that relies on the same generic PM clock flow (of_pm_clk_add_clks() + pm_clk_suspend/ pm_clk_resume()) and DT-provided clocks. Runtime behavior was validated on Kodiak (sc7280). Signed-off-by: Ajay Kumar Nandam --- drivers/pinctrl/qcom/pinctrl-milos-lpass-lpi.c | 7 +++++++ drivers/pinctrl/qcom/pinctrl-sc8280xp-lpass-lpi.c | 15 +++++++++++---- drivers/pinctrl/qcom/pinctrl-sdm660-lpass-lpi.c | 7 +++++++ drivers/pinctrl/qcom/pinctrl-sdm670-lpass-lpi.c | 7 +++++++ drivers/pinctrl/qcom/pinctrl-sm4250-lpass-lpi.c | 7 +++++++ drivers/pinctrl/qcom/pinctrl-sm6115-lpass-lpi.c | 7 +++++++ drivers/pinctrl/qcom/pinctrl-sm8250-lpass-lpi.c | 15 +++++++++++---- drivers/pinctrl/qcom/pinctrl-sm8450-lpass-lpi.c | 15 +++++++++++---- drivers/pinctrl/qcom/pinctrl-sm8550-lpass-lpi.c | 15 +++++++++++---- drivers/pinctrl/qcom/pinctrl-sm8650-lpass-lpi.c | 15 +++++++++++---- 10 files changed, 90 insertions(+), 20 deletions(-) diff --git a/drivers/pinctrl/qcom/pinctrl-milos-lpass-lpi.c b/drivers/pinct= rl/qcom/pinctrl-milos-lpass-lpi.c index 3bf6fe0cf1bb..72b8ffd97860 100644 --- a/drivers/pinctrl/qcom/pinctrl-milos-lpass-lpi.c +++ b/drivers/pinctrl/qcom/pinctrl-milos-lpass-lpi.c @@ -7,6 +7,8 @@ #include #include #include +#include +#include =20 #include "pinctrl-lpass-lpi.h" =20 @@ -203,10 +205,15 @@ static const struct of_device_id lpi_pinctrl_of_match= [] =3D { }; MODULE_DEVICE_TABLE(of, lpi_pinctrl_of_match); =20 +static const struct dev_pm_ops lpi_pinctrl_pm_ops =3D { + RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL) +}; + static struct platform_driver lpi_pinctrl_driver =3D { .driver =3D { .name =3D "qcom-milos-lpass-lpi-pinctrl", .of_match_table =3D lpi_pinctrl_of_match, + .pm =3D pm_ptr(&lpi_pinctrl_pm_ops), }, .probe =3D lpi_pinctrl_probe, .remove =3D lpi_pinctrl_remove, diff --git a/drivers/pinctrl/qcom/pinctrl-sc8280xp-lpass-lpi.c b/drivers/pi= nctrl/qcom/pinctrl-sc8280xp-lpass-lpi.c index 0e839b6aaaf4..27c47710365e 100644 --- a/drivers/pinctrl/qcom/pinctrl-sc8280xp-lpass-lpi.c +++ b/drivers/pinctrl/qcom/pinctrl-sc8280xp-lpass-lpi.c @@ -6,6 +6,8 @@ #include #include #include +#include +#include =20 #include "pinctrl-lpass-lpi.h" =20 @@ -166,17 +168,22 @@ static const struct lpi_pinctrl_variant_data sc8280xp= _lpi_data =3D { =20 static const struct of_device_id lpi_pinctrl_of_match[] =3D { { - .compatible =3D "qcom,sc8280xp-lpass-lpi-pinctrl", - .data =3D &sc8280xp_lpi_data, + .compatible =3D "qcom,sc8280xp-lpass-lpi-pinctrl", + .data =3D &sc8280xp_lpi_data, }, { } }; MODULE_DEVICE_TABLE(of, lpi_pinctrl_of_match); =20 +static const struct dev_pm_ops lpi_pinctrl_pm_ops =3D { + RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL) +}; + static struct platform_driver lpi_pinctrl_driver =3D { .driver =3D { - .name =3D "qcom-sc8280xp-lpass-lpi-pinctrl", - .of_match_table =3D lpi_pinctrl_of_match, + .name =3D "qcom-sc8280xp-lpass-lpi-pinctrl", + .of_match_table =3D lpi_pinctrl_of_match, + .pm =3D pm_ptr(&lpi_pinctrl_pm_ops), }, .probe =3D lpi_pinctrl_probe, .remove =3D lpi_pinctrl_remove, diff --git a/drivers/pinctrl/qcom/pinctrl-sdm660-lpass-lpi.c b/drivers/pinc= trl/qcom/pinctrl-sdm660-lpass-lpi.c index 65411abfbfac..7b5aacaae7d7 100644 --- a/drivers/pinctrl/qcom/pinctrl-sdm660-lpass-lpi.c +++ b/drivers/pinctrl/qcom/pinctrl-sdm660-lpass-lpi.c @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include =20 #include "pinctrl-lpass-lpi.h" @@ -145,10 +147,15 @@ static const struct of_device_id sdm660_lpi_pinctrl_o= f_match[] =3D { }; MODULE_DEVICE_TABLE(of, sdm660_lpi_pinctrl_of_match); =20 +static const struct dev_pm_ops lpi_pinctrl_pm_ops =3D { + RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL) +}; + static struct platform_driver sdm660_lpi_pinctrl_driver =3D { .driver =3D { .name =3D "qcom-sdm660-lpass-lpi-pinctrl", .of_match_table =3D sdm660_lpi_pinctrl_of_match, + .pm =3D pm_ptr(&lpi_pinctrl_pm_ops), }, .probe =3D lpi_pinctrl_probe, .remove =3D lpi_pinctrl_remove, diff --git a/drivers/pinctrl/qcom/pinctrl-sdm670-lpass-lpi.c b/drivers/pinc= trl/qcom/pinctrl-sdm670-lpass-lpi.c index 858146c408d0..0a31f7ad2e0d 100644 --- a/drivers/pinctrl/qcom/pinctrl-sdm670-lpass-lpi.c +++ b/drivers/pinctrl/qcom/pinctrl-sdm670-lpass-lpi.c @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include =20 #include "pinctrl-lpass-lpi.h" @@ -151,10 +153,15 @@ static const struct of_device_id sdm670_lpi_pinctrl_o= f_match[] =3D { }; MODULE_DEVICE_TABLE(of, sdm670_lpi_pinctrl_of_match); =20 +static const struct dev_pm_ops lpi_pinctrl_pm_ops =3D { + RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL) +}; + static struct platform_driver sdm670_lpi_pinctrl_driver =3D { .driver =3D { .name =3D "qcom-sdm670-lpass-lpi-pinctrl", .of_match_table =3D sdm670_lpi_pinctrl_of_match, + .pm =3D pm_ptr(&lpi_pinctrl_pm_ops), }, .probe =3D lpi_pinctrl_probe, .remove =3D lpi_pinctrl_remove, diff --git a/drivers/pinctrl/qcom/pinctrl-sm4250-lpass-lpi.c b/drivers/pinc= trl/qcom/pinctrl-sm4250-lpass-lpi.c index c0e178be9cfc..75bafa62426a 100644 --- a/drivers/pinctrl/qcom/pinctrl-sm4250-lpass-lpi.c +++ b/drivers/pinctrl/qcom/pinctrl-sm4250-lpass-lpi.c @@ -7,6 +7,8 @@ #include #include #include +#include +#include =20 #include "pinctrl-lpass-lpi.h" =20 @@ -221,10 +223,15 @@ static const struct of_device_id lpi_pinctrl_of_match= [] =3D { }; MODULE_DEVICE_TABLE(of, lpi_pinctrl_of_match); =20 +static const struct dev_pm_ops lpi_pinctrl_pm_ops =3D { + RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL) +}; + static struct platform_driver lpi_pinctrl_driver =3D { .driver =3D { .name =3D "qcom-sm4250-lpass-lpi-pinctrl", .of_match_table =3D lpi_pinctrl_of_match, + .pm =3D pm_ptr(&lpi_pinctrl_pm_ops), }, .probe =3D lpi_pinctrl_probe, .remove =3D lpi_pinctrl_remove, diff --git a/drivers/pinctrl/qcom/pinctrl-sm6115-lpass-lpi.c b/drivers/pinc= trl/qcom/pinctrl-sm6115-lpass-lpi.c index b7d9186861a2..05435ea6e17a 100644 --- a/drivers/pinctrl/qcom/pinctrl-sm6115-lpass-lpi.c +++ b/drivers/pinctrl/qcom/pinctrl-sm6115-lpass-lpi.c @@ -7,6 +7,8 @@ #include #include #include +#include +#include =20 #include "pinctrl-lpass-lpi.h" =20 @@ -141,10 +143,15 @@ static const struct of_device_id lpi_pinctrl_of_match= [] =3D { }; MODULE_DEVICE_TABLE(of, lpi_pinctrl_of_match); =20 +static const struct dev_pm_ops lpi_pinctrl_pm_ops =3D { + RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL) +}; + static struct platform_driver lpi_pinctrl_driver =3D { .driver =3D { .name =3D "qcom-sm6115-lpass-lpi-pinctrl", .of_match_table =3D lpi_pinctrl_of_match, + .pm =3D pm_ptr(&lpi_pinctrl_pm_ops), }, .probe =3D lpi_pinctrl_probe, .remove =3D lpi_pinctrl_remove, diff --git a/drivers/pinctrl/qcom/pinctrl-sm8250-lpass-lpi.c b/drivers/pinc= trl/qcom/pinctrl-sm8250-lpass-lpi.c index c27452eece3e..454de788be21 100644 --- a/drivers/pinctrl/qcom/pinctrl-sm8250-lpass-lpi.c +++ b/drivers/pinctrl/qcom/pinctrl-sm8250-lpass-lpi.c @@ -7,6 +7,8 @@ #include #include #include +#include +#include =20 #include "pinctrl-lpass-lpi.h" =20 @@ -127,17 +129,22 @@ static const struct lpi_pinctrl_variant_data sm8250_l= pi_data =3D { =20 static const struct of_device_id lpi_pinctrl_of_match[] =3D { { - .compatible =3D "qcom,sm8250-lpass-lpi-pinctrl", - .data =3D &sm8250_lpi_data, + .compatible =3D "qcom,sm8250-lpass-lpi-pinctrl", + .data =3D &sm8250_lpi_data, }, { } }; MODULE_DEVICE_TABLE(of, lpi_pinctrl_of_match); =20 +static const struct dev_pm_ops lpi_pinctrl_pm_ops =3D { + RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL) +}; + static struct platform_driver lpi_pinctrl_driver =3D { .driver =3D { - .name =3D "qcom-sm8250-lpass-lpi-pinctrl", - .of_match_table =3D lpi_pinctrl_of_match, + .name =3D "qcom-sm8250-lpass-lpi-pinctrl", + .of_match_table =3D lpi_pinctrl_of_match, + .pm =3D pm_ptr(&lpi_pinctrl_pm_ops), }, .probe =3D lpi_pinctrl_probe, .remove =3D lpi_pinctrl_remove, diff --git a/drivers/pinctrl/qcom/pinctrl-sm8450-lpass-lpi.c b/drivers/pinc= trl/qcom/pinctrl-sm8450-lpass-lpi.c index 439f6541622e..834eee8dcce9 100644 --- a/drivers/pinctrl/qcom/pinctrl-sm8450-lpass-lpi.c +++ b/drivers/pinctrl/qcom/pinctrl-sm8450-lpass-lpi.c @@ -6,6 +6,8 @@ #include #include #include +#include +#include =20 #include "pinctrl-lpass-lpi.h" =20 @@ -195,17 +197,22 @@ static const struct lpi_pinctrl_variant_data sm8450_l= pi_data =3D { =20 static const struct of_device_id lpi_pinctrl_of_match[] =3D { { - .compatible =3D "qcom,sm8450-lpass-lpi-pinctrl", - .data =3D &sm8450_lpi_data, + .compatible =3D "qcom,sm8450-lpass-lpi-pinctrl", + .data =3D &sm8450_lpi_data, }, { } }; MODULE_DEVICE_TABLE(of, lpi_pinctrl_of_match); =20 +static const struct dev_pm_ops lpi_pinctrl_pm_ops =3D { + RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL) +}; + static struct platform_driver lpi_pinctrl_driver =3D { .driver =3D { - .name =3D "qcom-sm8450-lpass-lpi-pinctrl", - .of_match_table =3D lpi_pinctrl_of_match, + .name =3D "qcom-sm8450-lpass-lpi-pinctrl", + .of_match_table =3D lpi_pinctrl_of_match, + .pm =3D pm_ptr(&lpi_pinctrl_pm_ops), }, .probe =3D lpi_pinctrl_probe, .remove =3D lpi_pinctrl_remove, diff --git a/drivers/pinctrl/qcom/pinctrl-sm8550-lpass-lpi.c b/drivers/pinc= trl/qcom/pinctrl-sm8550-lpass-lpi.c index 73065919c8c2..875e04e5d2b9 100644 --- a/drivers/pinctrl/qcom/pinctrl-sm8550-lpass-lpi.c +++ b/drivers/pinctrl/qcom/pinctrl-sm8550-lpass-lpi.c @@ -6,6 +6,8 @@ #include #include #include +#include +#include =20 #include "pinctrl-lpass-lpi.h" =20 @@ -203,17 +205,22 @@ static const struct lpi_pinctrl_variant_data sm8550_l= pi_data =3D { =20 static const struct of_device_id lpi_pinctrl_of_match[] =3D { { - .compatible =3D "qcom,sm8550-lpass-lpi-pinctrl", - .data =3D &sm8550_lpi_data, + .compatible =3D "qcom,sm8550-lpass-lpi-pinctrl", + .data =3D &sm8550_lpi_data, }, { } }; MODULE_DEVICE_TABLE(of, lpi_pinctrl_of_match); =20 +static const struct dev_pm_ops lpi_pinctrl_pm_ops =3D { + RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL) +}; + static struct platform_driver lpi_pinctrl_driver =3D { .driver =3D { - .name =3D "qcom-sm8550-lpass-lpi-pinctrl", - .of_match_table =3D lpi_pinctrl_of_match, + .name =3D "qcom-sm8550-lpass-lpi-pinctrl", + .of_match_table =3D lpi_pinctrl_of_match, + .pm =3D pm_ptr(&lpi_pinctrl_pm_ops), }, .probe =3D lpi_pinctrl_probe, .remove =3D lpi_pinctrl_remove, diff --git a/drivers/pinctrl/qcom/pinctrl-sm8650-lpass-lpi.c b/drivers/pinc= trl/qcom/pinctrl-sm8650-lpass-lpi.c index f9fcedf5a65d..bc7889c993d0 100644 --- a/drivers/pinctrl/qcom/pinctrl-sm8650-lpass-lpi.c +++ b/drivers/pinctrl/qcom/pinctrl-sm8650-lpass-lpi.c @@ -6,6 +6,8 @@ #include #include #include +#include +#include =20 #include "pinctrl-lpass-lpi.h" =20 @@ -210,17 +212,22 @@ static const struct lpi_pinctrl_variant_data sm8650_l= pi_data =3D { =20 static const struct of_device_id lpi_pinctrl_of_match[] =3D { { - .compatible =3D "qcom,sm8650-lpass-lpi-pinctrl", - .data =3D &sm8650_lpi_data, + .compatible =3D "qcom,sm8650-lpass-lpi-pinctrl", + .data =3D &sm8650_lpi_data, }, { } }; MODULE_DEVICE_TABLE(of, lpi_pinctrl_of_match); =20 +static const struct dev_pm_ops lpi_pinctrl_pm_ops =3D { + RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL) +}; + static struct platform_driver lpi_pinctrl_driver =3D { .driver =3D { - .name =3D "qcom-sm8650-lpass-lpi-pinctrl", - .of_match_table =3D lpi_pinctrl_of_match, + .name =3D "qcom-sm8650-lpass-lpi-pinctrl", + .of_match_table =3D lpi_pinctrl_of_match, + .pm =3D pm_ptr(&lpi_pinctrl_pm_ops), }, .probe =3D lpi_pinctrl_probe, .remove =3D lpi_pinctrl_remove, --=20 2.34.1 From nobody Fri Jun 12 17:36:39 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 7BDEC2D739C for ; Wed, 13 May 2026 14:00:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778680832; cv=none; b=NsAerPuonFL9cq4t1VS+vUyuMRCtU5J+XlMiY9JmY99pS/0lXrrNhMltkQJy9oYF2j6z3SMbDiirCd0cD5S7X9sAhlt+HS1knCNv4Hfle5RnTRorVqpInzwn124el0l3z58Gc0ObjtfnrEBCC/f3RJFS0DEl2CsJOcmtho2eJz4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778680832; c=relaxed/simple; bh=p8kH/gyJtTVICpeZrt3scOkbql6vobJ1HuFCfRRT5gI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ds1OLffctCkffdc55efx+LMeVr44DQCommfoadDdm3K56GRva3HYTZAWtQ8VG0nfjT8jm6xQDRo5oYZYxxUGOSdLZFZi9SaQwYHOFMxC1CbQO1YXn9wNAGMkllhC1x1FqHE1TS1L1zTC3F8AB/YspN2VwQ7RnLP3sU+1hftJkTc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=ku7GOyc4; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Ot+Sug7X; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="ku7GOyc4"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Ot+Sug7X" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64DAhq471393176 for ; Wed, 13 May 2026 14:00:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=3qcmfJw6E9v zEBeSLZROio3CSr/CKaectPJm5kJFU2c=; b=ku7GOyc4hXy1CFdbeIWoPWnWyiQ b0EfLzMAmtIR6Dk/xD51ErvjM/J7QyV3y5YpKdFEJrpkgQmbHRtDhj+8TT/95Ikc xnhuMxbo5NN6zOyD7s1lzqazTajS2MCzAOH2trBqmIwXAgQ1ASWGXkvYm7OfWa46 cpR80hUI3I4KoAMhEYqJMgr3j6IJfLOMiLp5REMhwtX8qKsNkKegMCAaEtzZFhlc FhmMgxViIViPmxqWFjRkvVS1cLLLYJ/KTU8bpgVww8l+v0FdY3ySq4fMr7rulsXg /iAs1BLknj74Neexp1rHqLTqkrvFgCYicF0FzKfbCo3hqPAU+MCYfZos2wQ== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4e4k261ygw-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 13 May 2026 14:00:29 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2babbeff9e4so80945845ad.0 for ; Wed, 13 May 2026 07:00:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1778680829; x=1779285629; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3qcmfJw6E9vzEBeSLZROio3CSr/CKaectPJm5kJFU2c=; b=Ot+Sug7XY98/Yy7cYK1bjLGyh3umTmOGeX69Tn3MSVRe2KnLNXDkgy2/3gbMiXJOKb HQOUS0kJ/XGGm4H28dQLiCynxDB6h/2ctPYA1kqKreEkpFmr8T/kLK93KAaaJOoHnHvy Jq18JP+pg4nz+jU2jpm3ZAJJjMbSR6tOXiNrwo6lNOo0c7KbSw09VIb4XWDIPe2Sc2Bx tcfwjn/d8zm4PxwBdri/pjFP7uGUIM/hthJRvMagDMA5iPLTWt1gHRBBpWpmK92N3SSD g2oFtVI+ycA8KMP1GodcqR4xqjlGrOzUL6QndDlHoeAbtcagPwJBv6P0b3dd1NQqSnZp B7eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778680829; x=1779285629; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=3qcmfJw6E9vzEBeSLZROio3CSr/CKaectPJm5kJFU2c=; b=YXRqEiUd+QMVNSA+tNALNbR4QXiP4X779wGQ4b6UeGwgSBO7bEDhw+nzbXlIHSnGT1 5GFddxcIda4MOpdOWst5LGbHK+m3kUxs2rFvicDmgq+V9eW0BDbs3YsBpLyu9YU/psUa fTpNL0SYR/taYctd6jRpRIzdJpMprCTmsYEKapGC+EHvs6bx3GKVOMO+guqdrcVxkhrv 3iCVKIu3S2Diq5SSFhf8ML0/yIb/ouqZEGkdHIFe2lDCnkV/tekp/QLHMaGaOrzktW11 90nMVKKUJG04YJeb7V9P3WnPRnb2Kl8OaXlinSkxIJZQa+uVb1S3pLx9u5etXkPavHjm o2Gw== X-Forwarded-Encrypted: i=1; AFNElJ8jtJWR5Y7mCFNd5T44LleQeHMw5XVUijm8mT6EDTVTSN9rlAAhOUpUavr0fxfbMSaK0w8VIcYjeOFZHu4=@vger.kernel.org X-Gm-Message-State: AOJu0YzvTCRrZ4X8vKY9L5qq1hjxTRRC4J1t3wnkcoKi06rnRaOuq2Iq O6wdDEjLNyv7vYtjfybzWGBZ+8hRIynpkdluCM//SFwGgy//7ntHZOG4ZLi8MwYpkRzdh8ZG5sq nxYgDZJmf0Jxjw/uss7pKCgz0sSAsUWr/FDv4GiKYd66c3SLjSn/3I8OoetoQQBvSCkM= X-Gm-Gg: Acq92OFIZ/dLor29cdommHP/fMqNbbuBENZSxvFi1koDte3FR8bRZl8mzGzGhRfpHDq 8qGZoVku+zYiB9Wnv3IDvonzrnrrUhggLx/o6Ikp6qNpyQ9yCxAnXPNgMPwTY5ztYAF6VniFbiR fBW+l/6VV1eqIdHu6/NzmmMpxgOKq1KX+WC/xcnd/9na79bsGMGoO8KwmA5zdmXjJYClFctLkqP WCwZeF0qWverV+2WeXues8P/sH+o06Z1vSh1XszJ6sucEHOKZMJOSc2pXqQOEl0xJPUWG0txM00 mfXBBZQdtOSOsRnnGduGEcny69YRDgHyrsCRPV2p7BSVfB4ocOXwviLQnc8TASFCeeO49ZIydlb jYCxb8pYlc9IDFxMs2PVS1ER2WbreTmQ8/Pm+NWTUzC4gc28o2w== X-Received: by 2002:a17:902:9a08:b0:2ba:bab2:a867 with SMTP id d9443c01a7336-2bcfd0307fdmr60655425ad.12.1778680828320; Wed, 13 May 2026 07:00:28 -0700 (PDT) X-Received: by 2002:a17:902:9a08:b0:2ba:bab2:a867 with SMTP id d9443c01a7336-2bcfd0307fdmr60654805ad.12.1778680827437; Wed, 13 May 2026 07:00:27 -0700 (PDT) Received: from hu-nandam-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2baf1ec232esm176189555ad.81.2026.05.13.07.00.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 07:00:27 -0700 (PDT) From: Ajay Kumar Nandam To: Bjorn Andersson , Linus Walleij Cc: linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 2/2] pinctrl: qcom: lpass-lpi: Switch to PM clock framework for runtime PM Date: Wed, 13 May 2026 19:30:09 +0530 Message-Id: <20260513140009.3841770-3-ajay.nandam@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260513140009.3841770-1-ajay.nandam@oss.qualcomm.com> References: <20260513140009.3841770-1-ajay.nandam@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=M/l97Sws c=1 sm=1 tr=0 ts=6a0483fd cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=NGcC8JguVDcA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=3QRHifK0ykk7E49SFh4A:9 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTEzMDE0MyBTYWx0ZWRfX5b3xJLBBScSR yQpA5PEaVd7AZVYe4CLA0m1qXd5MU9LNRcwyhQ9sw/j6Ah6v5UzfvRdTXm1E/E9uEzx7i6Xstv4 jqf+kLWVAZe2b6FPNhRyjmGXe3ad/yn8GGpGCgjwUBdUEgaro2ps3fDPFJnQhH4lJryb8OGI6x1 t5WxtRaADkHqluL9woD8EY/Ae1aQzraQD3vouOK5QAgM8QHRWGYTFaWmrLE0uh1+8HiEnKuw3Ad jUT2pGXhGhilFg8AoWToUqCg7TrXnqo3aLAFQENSdIgVXhy1hm+NNm2IVXgyp5ZeNVo1PVSwH/2 tGQkg61g/HVA2mYj51ZUGj6Y9QYDS6iSTfB2V+Z78G5QNBuTtCis2ah5+rRhOliOwd0gA4Og2il 1K4DgWjRIHfClgYPF3PHEHBrNgByQnNgcZlyfAuZQD1ZJn7NGNDEWTwiKZ0Vw8BJSlJOCyXXKBA 0+PJgYUU4jcK3oU2UZw== X-Proofpoint-ORIG-GUID: rjd0Dbkk_EXj3gIHP1cJYuT4DY4w1GUl X-Proofpoint-GUID: rjd0Dbkk_EXj3gIHP1cJYuT4DY4w1GUl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-05-13_01,2026-05-08_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 impostorscore=0 malwarescore=0 suspectscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605050000 definitions=main-2605130143 Content-Type: text/plain; charset="utf-8" Convert the LPASS LPI pinctrl driver to use the PM clock framework for runtime power management. This allows the LPASS LPI pinctrl driver to drop clock votes when idle, improves power efficiency on platforms using LPASS LPI island mode, and aligns the driver with common runtime PM patterns used across Qualcomm LPASS subsystems. Guard GPIO register read/write helpers and slew-rate register programming with synchronous runtime PM calls so the device is active during MMIO operations whenever autosuspend is enabled. Signed-off-by: Ajay Kumar Nandam --- drivers/pinctrl/qcom/pinctrl-lpass-lpi.c | 114 +++++++++++------- .../pinctrl/qcom/pinctrl-sc7280-lpass-lpi.c | 19 ++- 2 files changed, 86 insertions(+), 47 deletions(-) diff --git a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c b/drivers/pinctrl/qco= m/pinctrl-lpass-lpi.c index 15ced5027579..c8c08f81191e 100644 --- a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c +++ b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c @@ -15,6 +15,9 @@ #include #include #include +#include +#include +#include =20 #include "../pinctrl-utils.h" =20 @@ -22,7 +25,6 @@ =20 #define MAX_NR_GPIO 32 #define GPIO_FUNC 0 -#define MAX_LPI_NUM_CLKS 2 =20 struct lpi_pinctrl { struct device *dev; @@ -31,7 +33,6 @@ struct lpi_pinctrl { struct pinctrl_desc desc; char __iomem *tlmm_base; char __iomem *slew_base; - struct clk_bulk_data clks[MAX_LPI_NUM_CLKS]; /* Protects from concurrent register updates */ struct mutex lock; DECLARE_BITMAP(ever_gpio, MAX_NR_GPIO); @@ -39,31 +40,41 @@ struct lpi_pinctrl { }; =20 static int lpi_gpio_read(struct lpi_pinctrl *state, unsigned int pin, - unsigned int addr) + unsigned int addr, u32 *val) { u32 pin_offset; + int ret; =20 if (state->data->flags & LPI_FLAG_USE_PREDEFINED_PIN_OFFSET) pin_offset =3D state->data->groups[pin].pin_offset; else pin_offset =3D LPI_TLMM_REG_OFFSET * pin; =20 - return ioread32(state->tlmm_base + pin_offset + addr); + ret =3D pm_runtime_resume_and_get(state->dev); + if (ret < 0) + return ret; + + *val =3D ioread32(state->tlmm_base + pin_offset + addr); + return pm_runtime_put_autosuspend(state->dev); } =20 static int lpi_gpio_write(struct lpi_pinctrl *state, unsigned int pin, unsigned int addr, unsigned int val) { u32 pin_offset; + int ret; =20 if (state->data->flags & LPI_FLAG_USE_PREDEFINED_PIN_OFFSET) pin_offset =3D state->data->groups[pin].pin_offset; else pin_offset =3D LPI_TLMM_REG_OFFSET * pin; =20 - iowrite32(val, state->tlmm_base + pin_offset + addr); + ret =3D pm_runtime_resume_and_get(state->dev); + if (ret < 0) + return ret; =20 - return 0; + iowrite32(val, state->tlmm_base + pin_offset + addr); + return pm_runtime_put_autosuspend(state->dev); } =20 static const struct pinctrl_ops lpi_gpio_pinctrl_ops =3D { @@ -107,8 +118,8 @@ static int lpi_gpio_set_mux(struct pinctrl_dev *pctldev= , unsigned int function, { struct lpi_pinctrl *pctrl =3D pinctrl_dev_get_drvdata(pctldev); const struct lpi_pingroup *g =3D &pctrl->data->groups[group]; - u32 val; - int i, pin =3D g->pin; + u32 val, io_val; + int i, pin =3D g->pin, ret; =20 for (i =3D 0; i < g->nfuncs; i++) { if (g->funcs[i] =3D=3D function) @@ -118,8 +129,10 @@ static int lpi_gpio_set_mux(struct pinctrl_dev *pctlde= v, unsigned int function, if (WARN_ON(i =3D=3D g->nfuncs)) return -EINVAL; =20 - mutex_lock(&pctrl->lock); - val =3D lpi_gpio_read(pctrl, pin, LPI_GPIO_CFG_REG); + guard(mutex)(&pctrl->lock); + ret =3D lpi_gpio_read(pctrl, pin, LPI_GPIO_CFG_REG, &val); + if (ret) + return ret; =20 /* * If this is the first time muxing to GPIO and the direction is @@ -129,24 +142,27 @@ static int lpi_gpio_set_mux(struct pinctrl_dev *pctld= ev, unsigned int function, */ if (i =3D=3D GPIO_FUNC && (val & LPI_GPIO_OE_MASK) && !test_and_set_bit(group, pctrl->ever_gpio)) { - u32 io_val =3D lpi_gpio_read(pctrl, group, LPI_GPIO_VALUE_REG); + ret =3D lpi_gpio_read(pctrl, group, LPI_GPIO_VALUE_REG, &io_val); + if (ret) + return ret; =20 if (io_val & LPI_GPIO_VALUE_IN_MASK) { if (!(io_val & LPI_GPIO_VALUE_OUT_MASK)) - lpi_gpio_write(pctrl, group, LPI_GPIO_VALUE_REG, - io_val | LPI_GPIO_VALUE_OUT_MASK); + ret =3D lpi_gpio_write(pctrl, group, + LPI_GPIO_VALUE_REG, + io_val | LPI_GPIO_VALUE_OUT_MASK); } else { if (io_val & LPI_GPIO_VALUE_OUT_MASK) - lpi_gpio_write(pctrl, group, LPI_GPIO_VALUE_REG, - io_val & ~LPI_GPIO_VALUE_OUT_MASK); + ret =3D lpi_gpio_write(pctrl, group, + LPI_GPIO_VALUE_REG, + io_val & ~LPI_GPIO_VALUE_OUT_MASK); } + if (ret) + return ret; } =20 u32p_replace_bits(&val, i, LPI_GPIO_FUNCTION_MASK); - lpi_gpio_write(pctrl, pin, LPI_GPIO_CFG_REG, val); - mutex_unlock(&pctrl->lock); - - return 0; + return lpi_gpio_write(pctrl, pin, LPI_GPIO_CFG_REG, val); } =20 static const struct pinmux_ops lpi_gpio_pinmux_ops =3D { @@ -162,11 +178,15 @@ static int lpi_config_get(struct pinctrl_dev *pctldev, unsigned int param =3D pinconf_to_config_param(*config); struct lpi_pinctrl *state =3D dev_get_drvdata(pctldev->dev); unsigned int arg =3D 0; + int ret; int is_out; int pull; u32 ctl_reg; =20 - ctl_reg =3D lpi_gpio_read(state, pin, LPI_GPIO_CFG_REG); + ret =3D lpi_gpio_read(state, pin, LPI_GPIO_CFG_REG, &ctl_reg); + if (ret) + return ret; + is_out =3D ctl_reg & LPI_GPIO_OE_MASK; pull =3D FIELD_GET(LPI_GPIO_PULL_MASK, ctl_reg); =20 @@ -206,7 +226,7 @@ static int lpi_config_set_slew_rate(struct lpi_pinctrl = *pctrl, { unsigned long sval; void __iomem *reg; - int slew_offset; + int slew_offset, ret; =20 if (slew > LPI_SLEW_RATE_MAX) { dev_err(pctrl->dev, "invalid slew rate %u for pin: %d\n", @@ -225,6 +245,10 @@ static int lpi_config_set_slew_rate(struct lpi_pinctrl= *pctrl, else reg =3D pctrl->slew_base + LPI_SLEW_RATE_CTL_REG; =20 + ret =3D pm_runtime_resume_and_get(pctrl->dev); + if (ret < 0) + return ret; + mutex_lock(&pctrl->lock); =20 sval =3D ioread32(reg); @@ -233,8 +257,7 @@ static int lpi_config_set_slew_rate(struct lpi_pinctrl = *pctrl, iowrite32(sval, reg); =20 mutex_unlock(&pctrl->lock); - - return 0; + return pm_runtime_put_autosuspend(pctrl->dev); } =20 static int lpi_config_set(struct pinctrl_dev *pctldev, unsigned int group, @@ -291,21 +314,22 @@ static int lpi_config_set(struct pinctrl_dev *pctldev= , unsigned int group, */ if (output_enabled) { val =3D u32_encode_bits(value ? 1 : 0, LPI_GPIO_VALUE_OUT_MASK); - lpi_gpio_write(pctrl, group, LPI_GPIO_VALUE_REG, val); + ret =3D lpi_gpio_write(pctrl, group, LPI_GPIO_VALUE_REG, val); + if (ret) + return ret; } =20 - mutex_lock(&pctrl->lock); - val =3D lpi_gpio_read(pctrl, group, LPI_GPIO_CFG_REG); + guard(mutex)(&pctrl->lock); + ret =3D lpi_gpio_read(pctrl, group, LPI_GPIO_CFG_REG, &val); + if (ret) + return ret; =20 u32p_replace_bits(&val, pullup, LPI_GPIO_PULL_MASK); u32p_replace_bits(&val, LPI_GPIO_DS_TO_VAL(strength), LPI_GPIO_OUT_STRENGTH_MASK); u32p_replace_bits(&val, output_enabled, LPI_GPIO_OE_MASK); =20 - lpi_gpio_write(pctrl, group, LPI_GPIO_CFG_REG, val); - mutex_unlock(&pctrl->lock); - - return 0; + return lpi_gpio_write(pctrl, group, LPI_GPIO_CFG_REG, val); } =20 static const struct pinconf_ops lpi_gpio_pinconf_ops =3D { @@ -354,9 +378,14 @@ static int lpi_gpio_direction_output(struct gpio_chip = *chip, static int lpi_gpio_get(struct gpio_chip *chip, unsigned int pin) { struct lpi_pinctrl *state =3D gpiochip_get_data(chip); + u32 val; + int ret; =20 - return lpi_gpio_read(state, pin, LPI_GPIO_VALUE_REG) & - LPI_GPIO_VALUE_IN_MASK; + ret =3D lpi_gpio_read(state, pin, LPI_GPIO_VALUE_REG, &val); + if (ret) + return ret; + + return val & LPI_GPIO_VALUE_IN_MASK; } =20 static int lpi_gpio_set(struct gpio_chip *chip, unsigned int pin, int valu= e) @@ -399,7 +428,9 @@ static void lpi_gpio_dbg_show_one(struct seq_file *s, =20 pctldev =3D pctldev ? : state->ctrl; pindesc =3D pctldev->desc->pins[offset]; - ctl_reg =3D lpi_gpio_read(state, offset, LPI_GPIO_CFG_REG); + if (lpi_gpio_read(state, offset, LPI_GPIO_CFG_REG, &ctl_reg)) + return; + is_out =3D ctl_reg & LPI_GPIO_OE_MASK; =20 func =3D FIELD_GET(LPI_GPIO_FUNCTION_MASK, ctl_reg); @@ -482,9 +513,6 @@ int lpi_pinctrl_probe(struct platform_device *pdev) pctrl->data =3D data; pctrl->dev =3D &pdev->dev; =20 - pctrl->clks[0].id =3D "core"; - pctrl->clks[1].id =3D "audio"; - pctrl->tlmm_base =3D devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pctrl->tlmm_base)) return dev_err_probe(dev, PTR_ERR(pctrl->tlmm_base), @@ -497,13 +525,19 @@ int lpi_pinctrl_probe(struct platform_device *pdev) "Slew resource not provided\n"); } =20 - ret =3D devm_clk_bulk_get_optional(dev, MAX_LPI_NUM_CLKS, pctrl->clks); + ret =3D devm_pm_clk_create(dev); if (ret) return ret; =20 - ret =3D clk_bulk_prepare_enable(MAX_LPI_NUM_CLKS, pctrl->clks); + ret =3D of_pm_clk_add_clks(dev); + if (ret < 0 && ret !=3D -ENODEV) + return ret; + + pm_runtime_set_autosuspend_delay(dev, 100); + pm_runtime_use_autosuspend(dev); + ret =3D devm_pm_runtime_enable(dev); if (ret) - return dev_err_probe(dev, ret, "Can't enable clocks\n"); + return ret; =20 pctrl->desc.pctlops =3D &lpi_gpio_pinctrl_ops; pctrl->desc.pmxops =3D &lpi_gpio_pinmux_ops; @@ -542,7 +576,6 @@ int lpi_pinctrl_probe(struct platform_device *pdev) =20 err_pinctrl: mutex_destroy(&pctrl->lock); - clk_bulk_disable_unprepare(MAX_LPI_NUM_CLKS, pctrl->clks); =20 return ret; } @@ -554,7 +587,6 @@ void lpi_pinctrl_remove(struct platform_device *pdev) int i; =20 mutex_destroy(&pctrl->lock); - clk_bulk_disable_unprepare(MAX_LPI_NUM_CLKS, pctrl->clks); =20 for (i =3D 0; i < pctrl->data->npins; i++) pinctrl_generic_remove_group(pctrl->ctrl, i); diff --git a/drivers/pinctrl/qcom/pinctrl-sc7280-lpass-lpi.c b/drivers/pinc= trl/qcom/pinctrl-sc7280-lpass-lpi.c index 750f410311a8..a61df10d46cb 100644 --- a/drivers/pinctrl/qcom/pinctrl-sc7280-lpass-lpi.c +++ b/drivers/pinctrl/qcom/pinctrl-sc7280-lpass-lpi.c @@ -7,6 +7,8 @@ #include #include #include +#include +#include =20 #include "pinctrl-lpass-lpi.h" =20 @@ -129,20 +131,25 @@ static const struct lpi_pinctrl_variant_data sc7280_l= pi_data =3D { =20 static const struct of_device_id lpi_pinctrl_of_match[] =3D { { - .compatible =3D "qcom,sc7280-lpass-lpi-pinctrl", - .data =3D &sc7280_lpi_data, + .compatible =3D "qcom,sc7280-lpass-lpi-pinctrl", + .data =3D &sc7280_lpi_data, }, { - .compatible =3D "qcom,sm8350-lpass-lpi-pinctrl", - .data =3D &sc7280_lpi_data, + .compatible =3D "qcom,sm8350-lpass-lpi-pinctrl", + .data =3D &sc7280_lpi_data, }, { } }; MODULE_DEVICE_TABLE(of, lpi_pinctrl_of_match); =20 +static const struct dev_pm_ops lpi_pinctrl_pm_ops =3D { + RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL) +}; + static struct platform_driver lpi_pinctrl_driver =3D { .driver =3D { - .name =3D "qcom-sc7280-lpass-lpi-pinctrl", - .of_match_table =3D lpi_pinctrl_of_match, + .name =3D "qcom-sc7280-lpass-lpi-pinctrl", + .of_match_table =3D lpi_pinctrl_of_match, + .pm =3D pm_ptr(&lpi_pinctrl_pm_ops), }, .probe =3D lpi_pinctrl_probe, .remove =3D lpi_pinctrl_remove, --=20 2.34.1