From mboxrd@z Thu Jan 1 00:00:00 1970 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 435FA341057 for ; Tue, 21 Jul 2026 13:05:54 +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=1784639155; cv=none; b=UDi+OEbBwQyHJZ9BmyWldziqhJcqx5/wkSfhf1jzoe/UszSncQGSEbxAWeIeFVkrlnf8EyTmNRCvrXrSaxZmgdrBKK3O08ftIPHvXVJxzCVm/QiW6ZBvj/sxOpBsGg549rqJulYn+0WikTzrz7K6HjodjDXGWkK5Bp03LjDS//s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784639155; c=relaxed/simple; bh=Gv4mdxekx2e8aCObHel7a/UqUQPMN/Dl1/vyDPxgxi0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a25JNS+H9xSa20wEFdin0KbAnRoZYRGs+qzZ7rdcb+R2qHG3qDKJAJWiFhfRoJB2ZHV5p1wpLjrVSHnkjFM6aWzevqJRb7La53ZC9DWivgWuMFUalyYhcBWzMGABPuUSIcO2K7s6VR9GanGS5b/f6EoXn/rIgbAb+LuXXwex6UA= 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=l1XXiear; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=LvQoehqu; 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="l1XXiear"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="LvQoehqu" 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 66LAR2rN2502820 for ; Tue, 21 Jul 2026 13:05:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= ArevCzpRzOB06CCKd2tNeB4LMRjUeXNscgEPzgFVN68=; b=l1XXiear32KiBO9v W5xcP4duKlk8YwkOsrlPlAoxk+q7W+pb0WPtYMA7fUhbuAZDJqsD78JRbotZff8C 8PFmT9i8WJncUA1YqWNnGWhI416GtsYShPYE1nz/E4GT4sG7+MJoL/OOj/waQ9Hj 49nqarxfQgvozVnY6JmYesqp86NhpUcychte8HxlwNAQYSiBLGEf/bMIn0OhX6Js FMfBLKlWFeXs2qCVtsc3y6ebLtuq+X7/TbrsmbIgl1cGLJFSl7EVW5gn/N/f9vNR gY+fYYEwrQhW0BrEb0UUCR2wP5OOzFR5IfsWRH0WAOPwUx+6b2HR/o3OpVIWsPE+ 9o9brg== Received: from mail-ua1-f69.google.com (mail-ua1-f69.google.com [209.85.222.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fj6nsrvb7-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 21 Jul 2026 13:05:53 +0000 (GMT) Received: by mail-ua1-f69.google.com with SMTP id a1e0cc1a2514c-976feb78d1fso4293660241.2 for ; Tue, 21 Jul 2026 06:05:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784639152; x=1785243952; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ArevCzpRzOB06CCKd2tNeB4LMRjUeXNscgEPzgFVN68=; b=LvQoehquktRzss6GUaqNeDJIZRXMS1KwSnfIOsK5Lj4M/xQBk2gqeRNoCuDBov16aI 6u4WrEVg8U2t7xzxrxIUpE/3U+y72daSYWXUsTqGUqnb6oaeFYZbNGCbvc9DBvJBz53u TtqwwiuuYxgkh30dtnPs4x7RvlFQkNS4dtrAaj4tiTPlK1AIbBHbme+gk0wBnGhiPuDq 9KuWOzl9vLB0rhhVdZswLzoPV39ofmeBAO+Zuvk5HovKtMBgjTMMh7NodBwuGrlDGDhc V+KcceRzUkpL/ptURhWvQDUGTkBnYxNb9zmOVkxuebk2TQRNde5OzyTWKRfIhSqMMGFg zDaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784639152; x=1785243952; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ArevCzpRzOB06CCKd2tNeB4LMRjUeXNscgEPzgFVN68=; b=Hb70d0BxIKQD5vCCuCo1tbpxl4+DK2CiT3aTZaV/krVjPKqUeBgcBc/BfDv07fbLzN rgPPiDidCadoEO1VOiPzKxk/95bsVhjrhOhf+yRcK+vZZ4bMRHRhhOjAjEQW9L00GLrF J33AgsFX6LDowfhS+at2S+tdAdzGrbxM6z1G9YPBt++4tExdtTFic8PBDT8vvYkDFsrn zcGFY8Bq0aTTbn/JglfFEMpqf+aK8JjpXepWEjF7ldkxR7CbhErpqwgM7hygkgxfg0MW 9/+p8+Y02TMeoW5n5u5NcZ0bxYUB4D+dhVOFMgARXzXhsMDER62GNEpglS+4B8o/Dneq Blpg== X-Forwarded-Encrypted: i=1; AHgh+RqFg1fJJZhO2K3RYlgVmQYkJmJR3wSGiWBSYpJ54xdAQMdbRfqPki/l6ZkVSs9Hqh0n5iiUpS3cIgvAAf0=@vger.kernel.org X-Gm-Message-State: AOJu0YwBZwFictJNekDQVJVtZ/PDLzGd5tK8gPPzG+bJOvTGrm4x9opw WSryQsQSjbPtfUl9jI3vGOkc4E4r0s4jfnfvRmbnRiSv5Tl1o8gaeTmFXm8Z/zTWFxKjZmmTI0c bSmlhl2eUQvRpN2Lm1QSrphdxWUv1vJrTh061KmjYbIg51tuU2O7m8YlWvC7b1246Pr4= X-Gm-Gg: AR+sD11La5wVqD4EW0tJP0g+vc/rL3PQd2zrSmtRfJXibtcDtqhspwMdnEWWR5qgaVN JrlaK7LqsRNBDe8DOStSFUhfgYR8F6V3POAo2tX0DGHmJuwJcVwUPTTZNhuQQZvE7dD4q1ozmkm FGkmyRY5eMpv6nQeVzreLMaKU0itK9FXXrByxCePIPpSdXeLKdyfp+QLc+pRB96W5slgUtcloGt 2S7ZmU9PYaDYJ0587YreFLq/8xb7ZKrxeEVg6R0YLpnqMZGHvBEDHH/L8nWwc4AUasYpiUYDbtU EW0Y+RkTw7SOfTReCj5q3Syrf9dUbM0YVvIWvAIGcKDEfj3o/ixJwTccnxgVjZDzmvo6dw3lCHy izWypzq+wNhyyt4RasLD8VWt7Wto7370l4zhLtCRoI0+a3BAO6h0QC3hZ6ou12yrjT+F0w8D3Xw P+UWfmC9hrg9bkfjYuT6gr6MjQZKF7QEY/fPlqZK2umtweYlNUOhg= X-Received: by 2002:a05:6102:1487:b0:729:affa:70fd with SMTP id ada2fe7eead31-747534bf4b0mr5780651137.8.1784639152416; Tue, 21 Jul 2026 06:05:52 -0700 (PDT) X-Received: by 2002:a05:6102:1487:b0:729:affa:70fd with SMTP id ada2fe7eead31-747534bf4b0mr5780628137.8.1784639151990; Tue, 21 Jul 2026 06:05:51 -0700 (PDT) Received: from QCOM-eG0v1AUPpu.na.qualcomm.com ([2a01:e0a:830:450:751c:d61c:c91:60dd]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c17009ae04bsm591898066b.8.2026.07.21.06.05.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2026 06:05:51 -0700 (PDT) From: Loic Poulain Date: Tue, 21 Jul 2026 15:05:46 +0200 Subject: [PATCH v5 2/5] phy: qcom: qmp-usbc: Prevent unnecessary PM runtime suspend at boot Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260721-qcom-usb-phy-fix-null-v5-2-a181e2adbd2d@oss.qualcomm.com> References: <20260721-qcom-usb-phy-fix-null-v5-0-a181e2adbd2d@oss.qualcomm.com> In-Reply-To: <20260721-qcom-usb-phy-fix-null-v5-0-a181e2adbd2d@oss.qualcomm.com> To: Vinod Koul , Neil Armstrong , Dmitry Baryshkov , Wesley Cheng Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Konrad Dybcio , Abel Vesa , Dmitry Baryshkov , Loic Poulain X-Mailer: b4 0.14.2 X-Proofpoint-GUID: 7PUEveIVWAClc0D_jMN-RS34SvuyDgYb X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIxMDEzOCBTYWx0ZWRfX3KlI0pNbxulP odHuvFI4oCftEStZEF3YkwOSNHMRcVePA8Z7LgxcZP36hjlJ1P9upi1vsci7If+nucjalivqUcQ PqbV4YsNPJtIebHb8NKGTAD9oiwn9z8= X-Authority-Analysis: v=2.4 cv=ZJjnX37b c=1 sm=1 tr=0 ts=6a5f6eb1 cx=c_pps a=UbhLPJ621ZpgOD2l3yZY1w==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=PcYcMbZi39MCwOMHHM8A:9 a=QEXdDO2ut3YA:10 a=TOPH6uDL9cOC6tEoww4z:22 X-Proofpoint-ORIG-GUID: 7PUEveIVWAClc0D_jMN-RS34SvuyDgYb X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIxMDEzOCBTYWx0ZWRfX6d6O5AImWIww hUqp3MRgEGOV3/ILjeqPD4d8xiC87OYPXd9Df7Aruj8EMimVtyMEgstd4pPpqJog03in6L8l8MQ em4ha/3oB0asTqaFmPBwlbKT02y88ITD6gvkNw6rlJYUXh8Xt1IaE3q/9lulOAjd9bz6sM12yj9 qzva15u6lpiKOwoaaI/vny93qts1DjTDHm/mmVCq9ctDzVEMvzNUwgZ4a3+12gw3agRLRFpEFzq hKM+yZZ+3+TyBm6zl6J5N19eBEi2UzzEAdyYvhfnnDtHdqXIbD8ZEga4PTpMqMVUm4ZiO79viNP dqZnSJQpvnFRu5PoIYoDOsRFwBIQTE5oA8AV8wa9uEUq4Y90i+4GD6Ba4IO8catAWw6hoyELzs8 Xga5dwBiwMMdum+PI7o02qMmzhIphOjqKWY4XVOIUWa2fVDC03dEX3/RBI4tSHTuRBDUZfu8/OS IFDxcwEnhT7zfdEQ2KQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-21_01,2026-07-20_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 malwarescore=0 spamscore=0 lowpriorityscore=0 adultscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607210138 Runtime PM has to be enabled before creating the PHYs, since phy_create() only enables runtime PM on the PHY devices if it is already enabled on this parent device. This opens a small window where the device can be runtime suspended after pm_runtime_enable() and before the later pm_runtime_forbid(), causing an unnecessary suspend/resume cycle while the PHYs are not yet registered. Take a runtime PM usage reference with pm_runtime_get_noresume() before enabling runtime PM and release it once the PHYs have been created to prevent the device from being runtime suspended during that window. Reviewed-by: Konrad Dybcio Reviewed-by: Abel Vesa Reviewed-by: Dmitry Baryshkov Signed-off-by: Loic Poulain --- drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c b/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c index ab3055bb5b0c198832ae06dfcd04fd34395e271d..4317224070fd8dec98090e9200ac7d0e97265979 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c @@ -1959,10 +1959,16 @@ static int qmp_usbc_probe(struct platform_device *pdev) if (ret) goto err_node_put; + /* + * Enable runtime PM before creating the PHYs, phy_create() only enables + * it on the PHY devices if already enabled on the parent. Hold a usage + * reference so callbacks cannot run until the PHY is ready. + */ + pm_runtime_get_noresume(dev); pm_runtime_set_active(dev); ret = devm_pm_runtime_enable(dev); if (ret) - goto err_node_put; + goto err_pm_put; /* * Prevent runtime pm from being ON by default. Users can enable * it using power/control in sysfs. @@ -1971,13 +1977,13 @@ static int qmp_usbc_probe(struct platform_device *pdev) ret = qmp_usbc_register_clocks(qmp, np); if (ret) - goto err_node_put; + goto err_pm_put; qmp->usb_phy = devm_phy_create(dev, np, &qmp_usbc_usb_phy_ops); if (IS_ERR(qmp->usb_phy)) { ret = PTR_ERR(qmp->usb_phy); dev_err(dev, "failed to create PHY: %d\n", ret); - goto err_node_put; + goto err_pm_put; } phy_set_drvdata(qmp->usb_phy, qmp); @@ -1987,17 +1993,21 @@ static int qmp_usbc_probe(struct platform_device *pdev) if (IS_ERR(qmp->dp_phy)) { ret = PTR_ERR(qmp->dp_phy); dev_err(dev, "failed to create PHY: %d\n", ret); - goto err_node_put; + goto err_pm_put; } phy_set_drvdata(qmp->dp_phy, qmp); } + pm_runtime_put(dev); + of_node_put(np); phy_provider = devm_of_phy_provider_register(dev, qmp_usbc_phy_xlate); return PTR_ERR_OR_ZERO(phy_provider); +err_pm_put: + pm_runtime_put_noidle(dev); err_node_put: of_node_put(np); return ret; -- 2.34.1