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 CCC46342515 for ; Tue, 21 Jul 2026 13:05:59 +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=1784639161; cv=none; b=CJaMqp/BE9Wk5BNGGjtaqQrmn1rZ/8MhbyGhiSOVbxQpnCQzVEMYJPOmUeyxHUakhKsmd1dbio5vVzqJ39pf4HHJP3LYZoSXE+/CoWVx9YgQQXFFl+UzWssnjZ5ZkEHbznRsVAUskmEGvfTZYOODOosJyOoiWbgEj7mQ5erTm9g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784639161; c=relaxed/simple; bh=mvZuz4R68MDpMBJuL25COqTuukLaTsnYTOOzX6VHfJU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KvG/7IPL+DTKD0RyC8xM7SVyGm9FnWfdOyJvMKovlyTBy9WcwAx1g2q21Da8YpKIUDgx4/CjHZTrooiLK15Dbgodcyw37SCJBU0I8gdbtBWPt2mCA6Vv73QMwRijpyavS74L9zoJCzx3RnCDnr0gRLZhfWabKGPxUseUhmOrEAU= 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=ZTjFUZZA; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=g4J9wgdo; 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="ZTjFUZZA"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="g4J9wgdo" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66LAQqPV1611735 for ; Tue, 21 Jul 2026 13:05:59 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= +31G3iNyhTEkeua3PfRYEfavCmIUVylJgJKWF0Z+7JU=; b=ZTjFUZZA0SBpYMNR HFOBjb8j4jgjl38hdsS+/YUwxVvgoYksr3E4Q1QHd5TUuhIeEEaCt8u/HI28bJzp kDVKZfbRmzkQdGSdX6+xKtibdVgenuNfWGW720Ewsfkgv86KH6STmPVPe5Zr7RR8 lno5SWG6Nb8wGZoHFWrVjGIAmyKDkgIM3R8ozYifxgW/JeNHo2kTPRnHeXoHNDsj NtKXc9hPiLgJEHs61RFXeF9bBvDMNQxz6CR5jpp7etYUUM7FmtkerN+q5h6S/G58 b06fbuoKFmjqpAUQVIKoZ3g12CXi9YzewDw2/H4wPojZJLdME6a/ZfaVpQIJgvEs Xqxf7Q== Received: from mail-vs1-f71.google.com (mail-vs1-f71.google.com [209.85.217.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fj6r3gtrm-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 21 Jul 2026 13:05:59 +0000 (GMT) Received: by mail-vs1-f71.google.com with SMTP id ada2fe7eead31-74ab80df960so1027178137.0 for ; Tue, 21 Jul 2026 06:05:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784639158; x=1785243958; 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=+31G3iNyhTEkeua3PfRYEfavCmIUVylJgJKWF0Z+7JU=; b=g4J9wgdoekp1lsNWz3Jvw3gIt360O/yBEAR3AXiiIy7ujDbFRsLpgsgSGMHSFcdMUd sm/haJUa0kGyFJzdExvfO4Ygm06jec0DPVhDL0CHl4bPRTfELzRVkQfCSLMKKDM6Q7mj DKQmnuFsjwEuVJR8ev7LoGjXUa9/FEC9OJt5xvHv+fRQke8IodVFIMzb6I1rDn4hmi2u 3z0CAwoQuch6sfMKHAXYk/0gWhNrB0NF0xFHJvK2ftVqaVg/4c3p8Wsv5O2BvWb8wBoH 55e+HcNFVnm6XQW/MgtBUVmc3XiUAElS/wuwbOfZiI6C/pTXscQHR2xpCMkDVFsL5IdQ pncg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784639158; x=1785243958; 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=+31G3iNyhTEkeua3PfRYEfavCmIUVylJgJKWF0Z+7JU=; b=QIbOKzU/E5kr/j5WRGhw3ecfkJhxY+7DpDVe+2tc0LU/OQJl+OMylPzQ8Sfy9GkNpl cvKkVL2J/wnRg2mkCXmUcADID28TO618knkln9hJZ2eKCYZVWAPWF9bknGplcbHBYfDQ pJ8CAeut5y0AyxIf7c4k5kIPrWwK1rtRPLvFTtX+0lICTJrktP6GrZ85ABDTldTRrD1w o2y12e44LLnmuFj22Qfbhy1GmP+3jUqjntdp2v3woKhIj9shEkB1QVe5TqziFAbkrS83 fCvt06JmqD9WGvH7fy63peGHMxOl45UOiK/QSvitHaUdiX0Bmeium7+v6xf6N2dFph72 ZNWw== X-Forwarded-Encrypted: i=1; AHgh+RoMVbakvPQTwfV/MGCmpdElY8TCwAAiHzYJutI1pHa3+AmKp7+4j5UohCSHsr+ZLF7n63hPYJNawXjFAys=@vger.kernel.org X-Gm-Message-State: AOJu0YwpEbCsruyhi6Av1nLhUa+uFxSeoqQ9Pi9MBLR8G4YAMFyL1A3L kSZLGxdIy7Dthbjn3fQZdO5k7XdWvyPRZG/bLx4XycpRJcOUYA3VPRYkBZxOc/AUbn8tsh4maR3 J+8LI6iNVRFt/ljXKlmjUI4n8YorZBb8L06FdRJyFzMWRA1BzhWoq9BPVOhB8RmJq2eM= X-Gm-Gg: AR+sD117ObT8vUQd3JSG0msLUAgQ41SkCsYg5F3q6hhEV/G21TJQTGOrQvRaKtSUuew dIxIsFounej0dXoXyE+Oqq+HQZCeQHXon+cSkLMHKJafhLQDLx3A+SyGAMIkSCzg8gcUqLpPy9f U1j0CZQWkWOokLAkF94iWD7F+M0nbDKjG4vekNM1wjl6AgAVqblcy6FTIvi5pvL5LsSBvMxnE+R d+B/I72KuzNFj15CD5sAtMzyqkqobshMqo/MsMQlTCh9m1+kMOYLWCLjQ0Ssoy0FuDir0xzsp+v lXiu/ZkOHNhsxW5gUWm/nk+b8rX6MogSEsdSMmvNITMMwNn5aytKwKndHw6W/306EbjfQVfzVnJ NzTiFk86GrctobKxnpxeZxTUdN38fDLRCxisVXyfeHOMoCSrOclPRq3jXZnpHamTrymzGRqQVeg lfrsnhAPAmZ9LEfWuyUovHZh5FAxfQFOA1Y2rnSnRtshRPIiJhoto= X-Received: by 2002:a05:6102:1612:b0:6e7:5c89:3fc0 with SMTP id ada2fe7eead31-7475374957emr6867629137.25.1784639158004; Tue, 21 Jul 2026 06:05:58 -0700 (PDT) X-Received: by 2002:a05:6102:1612:b0:6e7:5c89:3fc0 with SMTP id ada2fe7eead31-7475374957emr6867500137.25.1784639155104; Tue, 21 Jul 2026 06:05:55 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2026 06:05:54 -0700 (PDT) From: Loic Poulain Date: Tue, 21 Jul 2026 15:05:48 +0200 Subject: [PATCH v5 4/5] phy: qcom: qmp-usb-legacy: 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-4-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, Abel Vesa , Dmitry Baryshkov , Loic Poulain X-Mailer: b4 0.14.2 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIxMDEzOCBTYWx0ZWRfXwvO35qxR1cZD hD8O5p/NvVDnMfl20YUFjCAG04DtxjhTBaSvsnRoj8slCzpGg/gYsUyuQ7AAMo3uJ4pJ0fjLx61 S6i91hseCMESjmIvQYsDw2Rg3kGoeGLXHpjkxkMSE1Ceh7KpR4bFcn07fYZuwpErCsBFstoSbSO 9G4AZAD0VAMqP20lt3aaoL2eijwKC5buTthYqzIXqPJFNf6zcIZHcFMXJ026w2gDQ35yW4H8LxJ KSv/QFTA9zcVbQA59SQCGrpF8d5W2/L/m1RrGIZkxoQEAOXjw2hNL0WaoYbjWV0+9wstBnSLuEq 7qHYPdLsMVu26Sf9Zx7cxXpeOHHZE8uU8MZzTfiCGh4uObxZC0D/xXXGdNrkoRoKvvFKN52b+PF smMfARrubzsrg3LwZH+ItzWs4iOawjV96MwUgjsdqoUFNOGaIDrS9d6N9ESP+ZcFALBfNOFSo/d kzNeIw/O4bJ4ThSvWZA== X-Proofpoint-ORIG-GUID: Hsblk__WNSwIgilExhnIRlpIDckhzVQZ X-Proofpoint-GUID: Hsblk__WNSwIgilExhnIRlpIDckhzVQZ X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIxMDEzOCBTYWx0ZWRfXwgZWFzvUIPQl dR08wRbOvSxyrC2TXgsbqyU8Al8VaiWcAZvoUHK4HPhiOLMPK5gkzl2fNXVWAKvBaHBgQnQFe8u UTHOicsM4bVWj8hofc86CRmMQMeY8ek= X-Authority-Analysis: v=2.4 cv=SIRykuvH c=1 sm=1 tr=0 ts=6a5f6eb7 cx=c_pps a=P2rfLEam3zuxRRdjJWA2cw==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=EUspDBNiAAAA:8 a=PcYcMbZi39MCwOMHHM8A:9 a=QEXdDO2ut3YA:10 a=ODZdjJIeia2B_SHc_B0f:22 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 priorityscore=1501 malwarescore=0 spamscore=0 phishscore=0 clxscore=1015 suspectscore=0 adultscore=0 impostorscore=0 lowpriorityscore=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 PHY, since phy_create() only enables runtime PM on the PHY device 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 PHY is not yet registered. Take a runtime PM usage reference with pm_runtime_get_noresume() before enabling runtime PM and release it once the PHY has been created to prevent the device from being runtime suspended during that window. Reviewed-by: Abel Vesa Reviewed-by: Dmitry Baryshkov Signed-off-by: Loic Poulain --- drivers/phy/qualcomm/phy-qcom-qmp-usb-legacy.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb-legacy.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb-legacy.c index fc490589c8e4888770807a60170905a1c7610421..eb1826fb26f0868f7758245b0cbe1a0590fea9a3 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb-legacy.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb-legacy.c @@ -1285,10 +1285,16 @@ static int qmp_usb_legacy_probe(struct platform_device *pdev) if (ret) goto err_node_put; + /* + * Enable runtime PM before creating the PHY, phy_create() only enables + * it on the PHY device if already enabled on the parent. Hold a usage + * reference so callbacks cannot run before qmp->phy is assigned. + */ + 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. @@ -1297,23 +1303,27 @@ static int qmp_usb_legacy_probe(struct platform_device *pdev) ret = phy_pipe_clk_register(qmp, np); if (ret) - goto err_node_put; + goto err_pm_put; qmp->phy = devm_phy_create(dev, np, &qmp_usb_legacy_phy_ops); if (IS_ERR(qmp->phy)) { ret = PTR_ERR(qmp->phy); dev_err(dev, "failed to create PHY: %d\n", ret); - goto err_node_put; + goto err_pm_put; } phy_set_drvdata(qmp->phy, qmp); + pm_runtime_put(dev); + of_node_put(np); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_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