From nobody Sun May 24 20:35:36 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 1C34935AC2F for ; Fri, 22 May 2026 20:47:04 +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=1779482827; cv=none; b=JnI8ganvHcrjwBOtYZZjFW12x0fx4fT3u5iZizroCys+aiQwe9BVdT3MwTV6Sr9O+KzIzm0By8dtP1S7kK9foEs6kJ+wyk0zVr2FtdRwMrwd+8xHN+ORpkJpL9Z6mi5aYG2/4lTl/AhUeHfpWqBjW9AwLmIZJa7/PggdsgXYnJE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779482827; c=relaxed/simple; bh=1ArzpGhOQxCx3RVe6axct8hrohdVOyEEi512dTfwxgI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Z18uLXVBkGtdTzTDjvB9iu/6sWSzhhbnxfx8aWBJRSmlmLVCcla+1m5esCNtKre4CIPSqkoopEdHlFLqHgn+GAhTsHeuP0YA506+pK+VUZHGAg9CDD901kFp1ZHxGmYzIOLU7BXDGcfyGsQ81jBJQUbZxHj8MqQHJ2K2Zl268cI= 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=eRV2u6q3; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=OIpyGHDg; 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="eRV2u6q3"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="OIpyGHDg" 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 64MDpYpq2125208 for ; Fri, 22 May 2026 20:47:04 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=f33Syln7KaI 1HAb8TNlHzt9EL9a9sngfU9QVHdZizrE=; b=eRV2u6q3RXQNKq5/I9SdjqlUyj1 aSdZ/UesxuSYw2nI7TnBF3h9ycZEifFVwLVnr1YV55PmJPHPZKFzHxV/7IJNfb4G OO37qsFmcY+O5yRQ9WuMXVQU+OcIh4oF19ZKzyvRjbtmaSVAU1cPy5jxvA61UxTR p/eTeosoZjMw3qh50FIjR5CXUD4IxWGWCVUdhbbmiuoPIKO7vZtfNY0d/FvXYjIu bqHqbjX0hKbq+5r6i4PJqTCeuMlzcuqHwmPwPdHQJVoXbVPlRr/rGHuhUCR3AXpT G4m/XDOsfwfEXZRnrGjNDBqrzjd36WZDSKc2mlm17XDTbrxl2yAIdPqWsVA== Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4eard89m5h-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 22 May 2026 20:47:04 +0000 (GMT) Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-36603ad6709so6444556a91.2 for ; Fri, 22 May 2026 13:47:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1779482824; x=1780087624; 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=f33Syln7KaI1HAb8TNlHzt9EL9a9sngfU9QVHdZizrE=; b=OIpyGHDgB9rsYcjZKCS+xNYEaJ21RjikxRu+/od8nj31Ijo6cQfagRaHy5hMT8MXmw WiTH8ZJB7g0sfHQk/YhlxuYqR2r1rbUu63s3qSrVR0ikmnRt5OfbxtvG8xHb2uGwNUBv rU37qP5OLjIoRW5tevWBn1iBJ1CwxBp5M2ir7HqH3fWHrqcUCMjbTUSRJUWoGzTP0jU5 1hZMC52QalVXKMz0oUoT9iu7THHBnO/0/0nN0SUVPpXGw59h6uP4OELeLZSyVlnXkMSj JpjqNcngVhLRRNaH9hC46KsI+SzJ0LW4qBmzKsn+nyLZ4oTmKivBot0LBiW/ieipVhY6 1dQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779482824; x=1780087624; 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=f33Syln7KaI1HAb8TNlHzt9EL9a9sngfU9QVHdZizrE=; b=OBOpHocO5jbt80xZFHVDi5Of+69I2lh2g3wef1fj4LNKyAylNHAZOldH8We8Sa16Dt jpdBgkKM8JnWLv1lGcyzXrO0YFgrsrbuO7CgueipWRUyL3u8Wl99YDMHiD78RxtbtrCN EsIhIWFYBUEYIfDpq+1tuLIlnoDW3EkDcg2PvWzqnBlJjyR5AGVqrL8AhB4cSC9qgr4V BRUtb4BZEDD8drPebMlGmWWg4fPMiR4vJBVpfLiY+WZnYa45UEKUTEJiMDOJbhWgQxZ9 h9gV3S61EM7s0NsLi+Hb665StTChC5mMO0kZAg/KOZ+7ORGFc6XT0yxcz9uMEONaJgJ6 tpcw== X-Forwarded-Encrypted: i=1; AFNElJ+q78dysQw9Itdhyvyt13fv20BqWhW5Tigapu1FTlFXJLg+XMu6wKe8kPEm8m4St5HAS27EpVO4iCMUVLs=@vger.kernel.org X-Gm-Message-State: AOJu0YwE4l2OdGEoGsiE+PujgMLRFJbAsOjBd+ehErAU4PAptoC/dD7K BF56uhSNXRSuB4SsQNFmnvOj7VMHwpttjx+ayF+lI45q3zAYes+gjxw4PGt83LxaWO/bnSvbsF2 G3MNa8qtbvPErKZrp/DvrB7OlOurtWpd4jQwNCPAquZOkikhPKq6JWz1v7nJRSbGcQRs= X-Gm-Gg: Acq92OGpMsYT/PaSqOJGamWa9oJ+K+J5b4VPrMMUyQ7P8hsRsfiES/a76ekgCWQnG1X iwQx8u1t5458Dq74fJh1zjCwb3cGE0nyRHKgqBT1SiSw5FuApjLLfO4o8ZW69im/dEqPi5WACY5 +nvCwKWM/+H9v421rq7wkM6pcaMpGsYm+wftwVRKTmSsyRDektxt62xQY/Z2BG9l+8nWjWZota+ 2DJB77zETBCZP3MFzrbTnvuuSbKXmUvASJzFOcsyqBsyY46orkj4Zyn2ZiICL4ydt+O4cJq3RAz eXya0rIUG8d66+XYwbO2LAo8FfSKQ7QgsaYfnT+C+NipW6L1f+iguYFoGM+D2mJMvYQYdEaJtTz SHV6oGUyT/ayoFRt4RWH/TSvu9RiJ5CEw2F60jFcenpDzbCC8qoB9CJjHHPvc X-Received: by 2002:a17:90b:564f:b0:366:159a:c1ba with SMTP id 98e67ed59e1d1-36a676f4ebcmr4536774a91.3.1779482823575; Fri, 22 May 2026 13:47:03 -0700 (PDT) X-Received: by 2002:a17:90b:564f:b0:366:159a:c1ba with SMTP id 98e67ed59e1d1-36a676f4ebcmr4536758a91.3.1779482823020; Fri, 22 May 2026 13:47:03 -0700 (PDT) Received: from hu-nandam-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36a7263179bsm2720956a91.1.2026.05.22.13.47.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2026 13:47:02 -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, mohammad.rafi.shaik@oss.qualcomm.com, ajay.nandam@oss.qualcomm.com, Konrad Dybcio Subject: [PATCH v6 1/2] pinctrl: qcom: lpass-lpi: Enable runtime PM hooks on LPASS LPI SoCs Date: Sat, 23 May 2026 02:16:43 +0530 Message-Id: <20260522204644.4101640-2-ajay.nandam@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260522204644.4101640-1-ajay.nandam@oss.qualcomm.com> References: <20260522204644.4101640-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=Fus1OWrq c=1 sm=1 tr=0 ts=6a10c0c8 cx=c_pps a=0uOsjrqzRL749jD1oC5vDA==: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=Rko4qIHHiJ4K03xOnZQA:9 a=mQ_c8vxmzFEMiUWkPHU9:22 X-Proofpoint-ORIG-GUID: NbmXHOxvMIQsnIcxD46LNRsxiRRPIfit X-Proofpoint-GUID: NbmXHOxvMIQsnIcxD46LNRsxiRRPIfit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTIyMDIwNyBTYWx0ZWRfXzhtxZKndWdPA VvGW0Pw1R46QYNdRucepXT5nk7dhc6a04ZHNvKBYNpiS3IIu5MbXVH9ciUYzSwHcPhtxACxGgga eUKApGUXzV9DbsyRX3Y73/uiT3u6CdQ/L7YKIsBrXbQrjyAxtzvNtMOjzY5LNsJ4dphl/pKv0sx Nlc9W0+Fj8MmjOI+O9zPQscc3eJUteqR3/HiPZmGjK0nKYX3fdCMfxNl8rJE+oxjJ2BBnTi/4+x 5rRwvnTh/FIqiCCruo3LLk3+2m3KgoRJ2ETDU8etheBE/+0XCFd4fl8VCa3sQiZtwlxL45VPISw b9phkC1tXesokQVz3pu6rW1Tvu0hjhCLHZmtVfOJALxSnH3LDLKYY6fHjBgJlvm8A4aeOZpvYtx dwPE+6OzJKRBxPcqtT5JfGUbd4rqq7Rt8J5XqKTUXjMESYef4HyauDE48UHc2AoKjxPWFzxMs7W ejvnYaY2M59S5t7LSwA== 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-22_05,2026-05-18_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 suspectscore=0 spamscore=0 malwarescore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605130000 definitions=main-2605220207 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. 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). Suggested-by: Konrad Dybcio Signed-off-by: Ajay Kumar Nandam --- .../pinctrl/qcom/pinctrl-milos-lpass-lpi.c | 7 +++++++ .../pinctrl/qcom/pinctrl-sc7280-lpass-lpi.c | 19 +++++++++++++------ .../pinctrl/qcom/pinctrl-sc8280xp-lpass-lpi.c | 15 +++++++++++---- .../pinctrl/qcom/pinctrl-sdm660-lpass-lpi.c | 7 +++++++ .../pinctrl/qcom/pinctrl-sdm670-lpass-lpi.c | 7 +++++++ .../pinctrl/qcom/pinctrl-sm4250-lpass-lpi.c | 7 +++++++ .../pinctrl/qcom/pinctrl-sm6115-lpass-lpi.c | 7 +++++++ .../pinctrl/qcom/pinctrl-sm6350-lpass-lpi.c | 7 +++++++ .../pinctrl/qcom/pinctrl-sm8250-lpass-lpi.c | 15 +++++++++++---- .../pinctrl/qcom/pinctrl-sm8450-lpass-lpi.c | 15 +++++++++++---- .../pinctrl/qcom/pinctrl-sm8550-lpass-lpi.c | 15 +++++++++++---- .../pinctrl/qcom/pinctrl-sm8650-lpass-lpi.c | 15 +++++++++++---- 12 files changed, 110 insertions(+), 26 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-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, 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-sm6350-lpass-lpi.c b/drivers/pinc= trl/qcom/pinctrl-sm6350-lpass-lpi.c index 4d06abcfedfd..946b23084304 100644 --- a/drivers/pinctrl/qcom/pinctrl-sm6350-lpass-lpi.c +++ b/drivers/pinctrl/qcom/pinctrl-sm6350-lpass-lpi.c @@ -6,6 +6,8 @@ #include #include #include +#include +#include =20 #include "pinctrl-lpass-lpi.h" =20 @@ -135,10 +137,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-sm6350-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 Sun May 24 20:35:36 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 40CAE25B09E for ; Fri, 22 May 2026 20:47:08 +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=1779482829; cv=none; b=CD7Q0C+ly4lGkGjtMf0/JHqC2lgxmSnpOw8IHN5ynjHeC2xqkWC+7eMFJOdo368e6Hrzx89a9cSx9nri/ghNcZVTry8+G3kU3pBXeO9065QfEVSIFvVOmQeiyDZi19hZrhxyWgmmFAbEwLZJzgJFQ8kPtvz9hHWeUWDKtnswfic= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779482829; c=relaxed/simple; bh=zw5R6m3M1dCTX7To//JP8E/7ll4enY2Rw+uZa3j95iQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sTESwmtLjnBQjV2fph+kbEMwIyViQl72ZnoZx4OP8lGuv5g1phrNx7AO2UYTx0fJVOj1Jp9Xlapj56BSKNeUdVULDsdO+Gl5VzUV8qYXoQM6RSOg1QM6m4e1O4KKv/u1jGCbMYnCZ/YGqI/2UqigMsIDr6if1fztbM/c1w/+pvk= 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=Dv+664DC; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ZCTi7pSB; 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="Dv+664DC"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ZCTi7pSB" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64MG0uKZ3477414 for ; Fri, 22 May 2026 20:47:07 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=5FiIOIUfN1k cJqWXQMagb5vvpYV/X2uCsLwWpe6IZ/E=; b=Dv+664DCcIDZ+qDqu2yG3e5Uect vK2E/VKIdvvJvGcnxH0Hv8qnhU2DId48ozYwiTHMfGwYkHHZLsrmL/rEMME+5PGh U023S7Cg6kfWcJx2YkT63Ht1fj7fIQM0Gndxz7a3GMfGV7vZvj6i/B3nmqbLRbP4 BImvnCBZiQBZ78F2q5WxfCw2HPGv3I6BXUq+MDsfU0qHh5t5b/FfBdMyyanOzvat hkuGTyMDt34S9DoLxeZoD+MxnuRB1OqBVmb92acOFoJRe3PYFgxjbDwDfebqlFw7 Z75pgxJ0Xe6043WyDVIA8k2dHGXTYIRcp9njkYFBO7pGrOlnM1wmCJ6N1hQ== Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4eat9r8y3y-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 22 May 2026 20:47:07 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-365d4d2fa04so7129580a91.3 for ; Fri, 22 May 2026 13:47:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1779482827; x=1780087627; 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=5FiIOIUfN1kcJqWXQMagb5vvpYV/X2uCsLwWpe6IZ/E=; b=ZCTi7pSBpMuqDtRKiuQ+ele8Xps0fP2CmhOVZiHdvIQH1mWVZPts4kuzZD4kx3U2ei mRWFZI9xfGTg/+fDKJJPHxrn+HUxZgXS83kSOo3/WLeC0qg7a9xpEAUvkbHjt03yFHF6 W8wqazG30zWqo2b7M7wiFwTzfC2mohNz51yAVObALHsqQVsGa1q2DsLXr2vCP6TGS1BC vnEoGoM4DMgubsJOyhsRh+t5jmNwkO2cApgNg69+6XW0insUFJjm9/lx2EQJK5kUFprk Ftzkbrb3hGG8PzWho6RR8mY0Pxu/UIIiVfXRwSC+TcdG9zdgDa5yJR8eW9aCyjgSJaJn ZAwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779482827; x=1780087627; 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=5FiIOIUfN1kcJqWXQMagb5vvpYV/X2uCsLwWpe6IZ/E=; b=bA4Q9ZxyGmLLmCfrtxoWXWBm5iYI54313bLWfx3ChYHsdYHSMM8PO1IJHQ0hgD2tdw PdOQ5lM8kt/axthFE4vHRknfbLrBjZmJUmunvTELbbHxR3RXrWs5AWNYcCm5taTfzO6p ctMrTUEQA4REkIZXa6EOXCHQLZS+d5CDgk9/lUQL9DFov+5YJNba7R5DG6GRXi1JOzpL /lQ9rBYaihIHNSmmT9iIdWRXr/gF9LsW9swWactQiBGMdturrOL/TsK6ZZttl25vFGpX gY1J/tWi3irmDvVHa+Dw9rdeQyojufkHy8Da25uTPSOv0v3ZOibT0EM3YcA9AIag9qrX cK1g== X-Forwarded-Encrypted: i=1; AFNElJ9Kb1JYGbc6CEfxJDRfRKo0sNK5peQqyyYVghcfnRM96I7SYdAM4RmVb2DASfzyMm0KOr+NNhN2OE/Pup4=@vger.kernel.org X-Gm-Message-State: AOJu0Yxo1EnaDlrB1LbAt3TyAKsYcj9TzI+w6/0jrT5KDyudOhCbnZ+V 5hSMnndjvVQntrGn6SE66ROqu/VbZlynDQGPpdyo892Ff8byQ4LPEEqnYlyl/v5l1QaT6ikYR1L aHNgxjy3t1TPUZ/pqVFSFnqE6LcZVPWWhhIz13b3pY1fSDD4Hz6p11pI+nfztw5Rh56o= X-Gm-Gg: Acq92OFIOCvm1o0pYgnPTAOizf1FD4dBlzqogWUFJwI6MsT2C+BRhuu4D33chpIgxe3 IEO1zmHGzmyg9BNrsj+Ves+fGpztJfdNyRUxcu4fbxLqzdtR1VHHaqICAC0LQgEd1nqBR39ake3 lPQ5fIZYWVynoTAxvmew3ienXm2P9o8JEGnZ3gGptgZ1TLulQIDHxXN9EXUjPm0YecQgWpPPnBf z6X9mD1PqwX61nk22c0qDQ10FuKBqdSKtDqZ8jPE53xF/dHx1bqU6FHR5KsDuGWRkMxpsAidjPn Vpbz2MPQF+nx/wusnxmMG6sPejQJOx7UdwfD+kXLioFFUSedEZ87pBA1Me3wE49VyCfZg4Ehjzt MtZ/vCs503SbNhP8/cGH/MRpIL+pGF7LROmfYTXpwZ84ykicUQQ== X-Received: by 2002:a17:90b:35cd:b0:36a:9d7:859b with SMTP id 98e67ed59e1d1-36a67831948mr5093999a91.13.1779482826636; Fri, 22 May 2026 13:47:06 -0700 (PDT) X-Received: by 2002:a17:90b:35cd:b0:36a:9d7:859b with SMTP id 98e67ed59e1d1-36a67831948mr5093971a91.13.1779482826161; Fri, 22 May 2026 13:47:06 -0700 (PDT) Received: from hu-nandam-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36a7263179bsm2720956a91.1.2026.05.22.13.47.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2026 13:47:05 -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, mohammad.rafi.shaik@oss.qualcomm.com, ajay.nandam@oss.qualcomm.com, Konrad Dybcio Subject: [PATCH v6 2/2] pinctrl: qcom: lpass-lpi: Switch to PM clock framework for runtime PM Date: Sat, 23 May 2026 02:16:44 +0530 Message-Id: <20260522204644.4101640-3-ajay.nandam@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260522204644.4101640-1-ajay.nandam@oss.qualcomm.com> References: <20260522204644.4101640-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=dt/rzVg4 c=1 sm=1 tr=0 ts=6a10c0cb cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=NGcC8JguVDcA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=gi8XeulvwEclXWRguk8A:9 a=uKXjsCUrEbL0IQVhDsJ9:22 X-Proofpoint-ORIG-GUID: lQQ5a427yyBM0X9qanyXa2wh005OFGUF X-Proofpoint-GUID: lQQ5a427yyBM0X9qanyXa2wh005OFGUF X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTIyMDIwNyBTYWx0ZWRfX8cQmom+mcJYR ch5j7Vbp21j/Y7cRrVw+vkkwAgsnanzY3yEg/8D9fBJbjheYDzquYpT/Jyg3KMPN4BlUKHCvfmO gyhG+PCRKvE0fppfbZaayxiKW1/2A+wJVXVUhHqJ6MlOKRSPmJBDTtxhDwTy2KqpG3wWXTWk6KB thJgbJ/t0sQVZqebhiuE0fKJJ6B+9hKLUIqbDVYzSCAo84QwgMoD5jGr7ZtD8SJcaWDmT1VUwXh mJ2wk9SF7+b6QypURX5yL944h3MoiiEKuGYUBW/cnobNEcPpkbsQKofSXHTjkDFDOMG0i+7XuQJ PV9OVYCJa9jMpHHGn2mKG6FwXV+XPCSYJoEktz9UK7N5+8sphOxizH6IHrJaPIZSqrB2Oh1zh7x AxYomdTB8r42I3vKFy4ewthCfoywtFOhlyZm1Xz8W4asU6f/PC2I3bObmtKCAS9ZfvIXDWRQokI QvZWQX5Ywq4vZ9aAk9w== 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-22_05,2026-05-18_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 suspectscore=0 clxscore=1015 phishscore=0 adultscore=0 lowpriorityscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605130000 definitions=main-2605220207 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. Make PINCTRL_LPASS_LPI depend on PM_CLK, since this patch introduces direct PM clock API use in the shared core. Suggested-by: Konrad Dybcio Signed-off-by: Ajay Kumar Nandam --- drivers/pinctrl/qcom/Kconfig | 1 + drivers/pinctrl/qcom/pinctrl-lpass-lpi.c | 144 +++++++++++++++-------- 2 files changed, 99 insertions(+), 46 deletions(-) diff --git a/drivers/pinctrl/qcom/Kconfig b/drivers/pinctrl/qcom/Kconfig index a09e840a01c6..18db350222b9 100644 --- a/drivers/pinctrl/qcom/Kconfig +++ b/drivers/pinctrl/qcom/Kconfig @@ -55,6 +55,7 @@ config PINCTRL_LPASS_LPI select PINCONF select GENERIC_PINCONF select GENERIC_PINCTRL_GROUPS + depends on PM_CLK depends on GPIOLIB help This is the pinctrl, pinmux, pinconf and gpiolib driver for the diff --git a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c b/drivers/pinctrl/qco= m/pinctrl-lpass-lpi.c index 15ced5027579..4d758fd117c4 100644 --- a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c +++ b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c @@ -11,10 +11,13 @@ #include #include #include +#include =20 #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,15 +33,14 @@ 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); const struct lpi_pinctrl_variant_data *data; }; =20 -static int lpi_gpio_read(struct lpi_pinctrl *state, unsigned int pin, - unsigned int addr) +static void __iomem *lpi_gpio_reg(struct lpi_pinctrl *state, + unsigned int pin, unsigned int addr) { u32 pin_offset; =20 @@ -48,22 +49,48 @@ static int lpi_gpio_read(struct lpi_pinctrl *state, uns= igned int pin, else pin_offset =3D LPI_TLMM_REG_OFFSET * pin; =20 - return ioread32(state->tlmm_base + pin_offset + addr); + return state->tlmm_base + pin_offset + addr; +} + +static void __lpi_gpio_read(struct lpi_pinctrl *state, + unsigned int pin, unsigned int addr, u32 *val) +{ + *val =3D ioread32(lpi_gpio_reg(state, pin, addr)); +} + +static void __lpi_gpio_write(struct lpi_pinctrl *state, + unsigned int pin, unsigned int addr, + unsigned int val) +{ + iowrite32(val, lpi_gpio_reg(state, pin, addr)); +} + +static int lpi_gpio_read(struct lpi_pinctrl *state, unsigned int pin, + unsigned int addr, u32 *val) +{ + int ret; + + ret =3D pm_runtime_resume_and_get(state->dev); + if (ret < 0) + return ret; + + __lpi_gpio_read(state, pin, addr, val); + + 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; + ret =3D pm_runtime_resume_and_get(state->dev); + if (ret < 0) + return ret; =20 - iowrite32(val, state->tlmm_base + pin_offset + addr); + __lpi_gpio_write(state, pin, addr, val); =20 - return 0; + return pm_runtime_put_autosuspend(state->dev); } =20 static const struct pinctrl_ops lpi_gpio_pinctrl_ops =3D { @@ -107,8 +134,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 io_val, 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 +145,12 @@ 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); + ret =3D pm_runtime_resume_and_get(pctrl->dev); + if (ret < 0) + return ret; + + guard(mutex)(&pctrl->lock); + __lpi_gpio_read(pctrl, pin, LPI_GPIO_CFG_REG, &val); =20 /* * If this is the first time muxing to GPIO and the direction is @@ -129,24 +160,25 @@ 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); + __lpi_gpio_read(pctrl, group, LPI_GPIO_VALUE_REG, &io_val); =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); + __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); + __lpi_gpio_write(pctrl, group, + LPI_GPIO_VALUE_REG, + io_val & ~LPI_GPIO_VALUE_OUT_MASK); } } =20 u32p_replace_bits(&val, i, LPI_GPIO_FUNCTION_MASK); - lpi_gpio_write(pctrl, pin, LPI_GPIO_CFG_REG, val); - mutex_unlock(&pctrl->lock); + __lpi_gpio_write(pctrl, pin, LPI_GPIO_CFG_REG, val); =20 - return 0; + return pm_runtime_put_autosuspend(pctrl->dev); } =20 static const struct pinmux_ops lpi_gpio_pinmux_ops =3D { @@ -162,11 +194,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; + u32 ctl_reg; int is_out; int pull; - u32 ctl_reg; + int ret; + + ret =3D lpi_gpio_read(state, pin, LPI_GPIO_CFG_REG, &ctl_reg); + if (ret) + return ret; =20 - ctl_reg =3D lpi_gpio_read(state, pin, LPI_GPIO_CFG_REG); is_out =3D ctl_reg & LPI_GPIO_OE_MASK; pull =3D FIELD_GET(LPI_GPIO_PULL_MASK, ctl_reg); =20 @@ -197,6 +233,7 @@ static int lpi_config_get(struct pinctrl_dev *pctldev, } =20 *config =3D pinconf_to_config_packed(param, arg); + return 0; } =20 @@ -206,7 +243,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 +262,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); @@ -234,7 +275,7 @@ static int lpi_config_set_slew_rate(struct lpi_pinctrl = *pctrl, =20 mutex_unlock(&pctrl->lock); =20 - return 0; + return pm_runtime_put_autosuspend(pctrl->dev); } =20 static int lpi_config_set(struct pinctrl_dev *pctldev, unsigned int group, @@ -244,8 +285,8 @@ static int lpi_config_set(struct pinctrl_dev *pctldev, = unsigned int group, unsigned int param, arg, pullup =3D LPI_GPIO_BIAS_DISABLE, strength =3D 2; bool value, output_enabled =3D false; const struct lpi_pingroup *g; - int i, ret; u32 val; + int i, ret; =20 g =3D &pctrl->data->groups[group]; for (i =3D 0; i < nconfs; i++) { @@ -289,23 +330,26 @@ static int lpi_config_set(struct pinctrl_dev *pctldev= , unsigned int group, * As per Hardware Programming Guide, when configuring pin as output, * set the pin value before setting output-enable (OE). */ + ret =3D pm_runtime_resume_and_get(pctrl->dev); + if (ret < 0) + return ret; + + guard(mutex)(&pctrl->lock); 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); + __lpi_gpio_write(pctrl, group, LPI_GPIO_VALUE_REG, val); } =20 - mutex_lock(&pctrl->lock); - val =3D lpi_gpio_read(pctrl, group, LPI_GPIO_CFG_REG); + __lpi_gpio_read(pctrl, group, LPI_GPIO_CFG_REG, &val); =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); + __lpi_gpio_write(pctrl, group, LPI_GPIO_CFG_REG, val); =20 - return 0; + return pm_runtime_put_autosuspend(pctrl->dev); } =20 static const struct pinconf_ops lpi_gpio_pinconf_ops =3D { @@ -354,9 +398,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; + + ret =3D lpi_gpio_read(state, pin, LPI_GPIO_VALUE_REG, &val); + if (ret) + return ret; =20 - return lpi_gpio_read(state, pin, LPI_GPIO_VALUE_REG) & - LPI_GPIO_VALUE_IN_MASK; + 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 +448,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 +533,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 +545,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 +596,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 +607,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); --=20 2.34.1