From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796007775; b=y+LYFfYIea+4zI8klxp9muLi7sgFVJrQNXnwvJHw6mVWIz6gORFHfWMJMWwHyVLalFNQ UgJzehgno9UZGxc0ohlmYYgWoomjtzjY8PNkBtXerjqBq2W7gQqTtd9wi4UftGnZLJcB+ KQthl/d0dusbF6HM+fvf7c+pC4YFvTq1bdlOzWAXnJeUQTTQcQSYyGvO6nK7MM41d7VZL xvg5x3X9GsDcq07D5DTSPnWakIHipmD7HiWMXJmwSotA0m3OdCc5ESvhH3oeNm58Rmwj8 tz/o/vIL/thNo24zzhPZ6KLxBNuGYYPQHnYr3HLmdExtWrj1aGxPW62OxIW2+i5PIAw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796007775; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:Date:From: To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To:X-Proofpoint-Spam-Details-Enc: X-Proofpoint-GUID:X-Proofpoint-Spam-Info:X-Proofpoint-ORIG-GUID: X-Authority-Analysis:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=me6MiGKy5BfgFNFIC8FWZELahVACUupZ/wQPWKoJJIk=; b=PopDELYZ7X1OwFnzCYYFjrV7Ggra4BSSFo6y5hcRfRKrUJ7VayzzI9D7I22ajdpAX2Vc hfbMz5m+tnZQYZzGaHJtkFVNuApu62gcsc43awyCI9fPPRsL9V7fgVipmtlzETxfOA7FS zApIJmp5wFRCos6p7k+oCrRWSuKuU8ZDW146mWYh7wrEpj0bnqSl00SqOjvjOZ3dUJP/r H1rLR4cInyUL0Nf5gmcq6QB/26uWIaMhkGIc/CLYPSzDJ3DaKS7bOvN+ftMfhFeAYR9MG ZqximCl3sYJLQ1ej4a2zndYdGk7UFj/7YmB8+H+0PMdk5uUc1N+jRA8Z3QFg8s2Nv+Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b="k8j/odKO"; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=Fj4HavSm; arc=none smtp.remote-ip=205.220.168.131 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 957FA606A31D for ; Mon, 30 Nov 2026 03:02:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 957FA606A31D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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.a=rsa-sha256 header.s=qcppdkim1 header.b=k8j/odKO; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=Fj4HavSm 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 6AU0kkr81465068 for ; Mon, 30 Nov 2026 03:02:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=qcppdkim1; bh=me6MiGKy5BfgFNFIC8FWZELa hVACUupZ/wQPWKoJJIk=; b=k8j/odKOv+Zocp7ExE4O7Lm9E6jCmhNqE034ZaoK pxApBLSI2U1aBFrX5UuxmAf4JDkLP6QL/MV9NxMK+SO5oqSyF0KBCi3c0ArJbwhG YZ8dpUHIavSkfSswOFct8jz3HdyN73L09fJfW1edVHFtFAGN/STgdR2Bu9YsRuEC sp3dCLEH4J8r46Dmm0Lh3qPZIz4WdWOQwUAep4wXQyxfwre0OQ7q04MZ5bS0ZkHX NttNek+uJiZLDYDSFcKH/Dji4Obu0/o0ngvpimrbeQICm/kZwp/3q1HL7TUK9ocf ZhxL5PumBvagE9MI7jO/+Jgq2zS3Z3KDxnbUe/rZi1gEaQ== Received: from mail-dy1-f200.google.com (mail-dy1-f200.google.com [74.125.82.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j7nwsvmst-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 30 Nov 2026 03:02:53 +0000 (GMT) Received: by mail-dy1-f200.google.com with SMTP id 5a478bee46e88-38531c1a566so8579151eec.1 for ; Sun, 29 Nov 2026 19:02:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796007773; x=1796612573; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=me6MiGKy5BfgFNFIC8FWZELahVACUupZ/wQPWKoJJIk=; b=Fj4HavSm4Q6UM34ePrFrq07qi3d9gRIhFGxfQc94EBPn3gXK24FyrjoLWbG5CuKTwH QfiHYz1G4QHGX0D/s+fpcAaT1mSTS7Oc4swZGdU9M7xoWpYEm9uQJqwScTPmc7zsy6i/ RMk1rTgkIh2YpPe7d+BXve/IaM3eNFBxlNURQBp6kB7HoTUmvYKcYefpDz3OtvfZfuYG 2f8ImAFrvef+o95Q03TQjahxf/Cp1YQlkMXFmyzYCSx2ufTvgUJj2B5eHCqxV5xSTBin YODLVBoMM+a+tJpMjyanTBYqDhjEFhC3fATUyrM84aX+vzo1fv+TfS70FdBjKCu1Hwr9 hVYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796007773; x=1796612573; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=me6MiGKy5BfgFNFIC8FWZELahVACUupZ/wQPWKoJJIk=; b=DXQmB0fTLaNfStvxPXuhGULI66yBYeOHDY0mUw8lxN3aKsJIgl9PKQToMPT9xGGZCW JIgJmFMq6G1OKhI4Pq8vIrJfWrBZs00g3jdTQPg/VCkvPJhbC4nT0FaOUSb1y8NnUXs+ dqGTRydRRaoYnG8VsCkZZMrsAimMP8tPebYzDsjS/pjzz6of2Owq4o6dyg36wPioEJt4 vE6XSo985qHgS5LZIhkH8gGFJZe5y2ZaSJheI+9iypAn/WwfosGDoym7v6P96yC2snin 43ujCxuw/fG0K6Wlo2r0PeDcE66Gr04cyOkgckGHbiAjcb7Ahm3JnNzh1O3c58/TjAdC Z+dA== X-Forwarded-Encrypted: i=1; AL+hErHqwm1e/PJ89xEVM3mU4cKXHs4mguwqJb6U7syGp3l6Lo15vX1G8U2KiGEEB1wScQmkf6qMlIm/vzCGK4M=@vger.kernel.org X-Gm-Message-State: APuU4Z8KvnwG5V+OPAfTkJ3JWWf36I1FKj0LGEjyqm1MHRmC6D//0eVX zThHEDSs+FX0szYlCHUc6djdO5CXjapPPcL7Th39WIDt/qLDDeBJP8A5vuWPYuW3OsK/WIvLRAA rbd2wNyofANzDEsgIUJ1+9duDZPtm2a5fzqaek8bXzDNE8wttMp4k1jhVB2nRlD1ZWUw= X-Gm-Gg: AZFdTZe0EvicrroBJIfpHl/lrTK6bRwD0oZXhxXt6ShyEQn3ZDmHVFdBQ2TclZY04WH ph3goQQvmpH2A28QBK9Rz5IERjbE32JNFYnw2HI5ncJPG+fzrxda0yp0hIZA/9LrnXM8D1Z12W4 a4dM27/pqiqKZBDiC6oeDXnQfJ+ceUS6IYy9VxMuKXxDA0gaDZmKLIMHAfN1gbnZWQykO+XBa4p wAbngqJjko4l9LKaB24YDK1YjPIdX2gmi/4bRArDfo7UPOhIIgN4llTAHzklmLzziZbvH8ZUPgN fsy44GYrghon/YvP7CKLUpdulIoZmT0/Ge2EnJ5GgsOzvF3Hkml3JCx9J4CBmbpUSFy615QyZ8e bbTMlSot6Dq4xVwaudoqC7sGunrrzDngmnOrfOC9igqR2YVX99IMQ3QU1EZLujUkbCtifcpzttl AnQe0lZQKkjb0BWWvFQnYv4nY= X-Received: by 2002:a05:7301:160e:b0:384:c1bd:aa5d with SMTP id 5a478bee46e88-386a87f00a6mr25350468eec.30.1796007773000; Sun, 29 Nov 2026 19:02:53 -0800 (PST) X-Received: by 2002:a05:7301:160e:b0:384:c1bd:aa5d with SMTP id 5a478bee46e88-386a87f00a6mr25350454eec.30.1796007772518; Sun, 29 Nov 2026 19:02:52 -0800 (PST) Received: from hu-petche-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-386992b404bsm79301519eec.1.2026.11.29.19.02.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 19:02:52 -0800 (PST) Date: Sun, 29 Nov 2026 19:02:50 -0800 From: Peter Chen To: Felipe Infante de Castro Cc: Thinh Nguyen , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v3] usb: dwc3: qcom: Restore DP/DM wake IRQ trigger types on unbind Message-ID: References: <20261127050938.2150497-1-felipe.infante.de.castro@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261127050938.2150497-1-felipe.infante.de.castro@gmail.com> X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTMwMDAxMSBTYWx0ZWRfXwgAJ6PV+d1uk pruV4NlH4X1E39m2BkWVge71szWh1kkVua3Fn1Hj7G7NGtNe7hfeuM9Kt4MDBCH0SgWA0ZiwYgB Od45j7G97f91Q1NvVHAsWJBp9nhBTBDLfyLs4OcAkURZID6LOCR2dKuCznKL37nD3VBil81ktP3 U8O8uU+RtEx9KHD5PYFQ64rTK0q1moRKyJvm9PyPdFxyYhd6god+uwK8QSsRxqoiA4kGDfxX4Z4 cMLog7LZSCbNAdPkpPQ3OyTvIyGHKz5T5cZrCNZt/30Z5G1YloB3MlOOgFnsM5ErxWlLV+C9PlO zoFGKBn9J51li15kZs9WlLKnRKvF4xY6m8cYjvBy85s2r39b+a+5yBaEK+z4nurbD9NK8ba9WRh Qpr8/cmloE4MEwfRJSa2pLjJWuY1gZQxUikRAJH7FaRqj5fS7AJQjknYqsIqZ4UdULFflqVeNrg HG0yXGpi28UF+0wbWqA== X-Proofpoint-GUID: rL8F2XAmS0jxJmRfR_L4vUAsxBYemua0 X-Proofpoint-Spam-Info: AW1haW4tMjYxMTMwMDAxMSBTYWx0ZWRfX7yp1o5rEsM0B r2Q2ECT+uxHlYH3WRl++1z9NpV8CFEO05UPN4COLoC8UR4Dvim06IVg96LNulGRz7HSEqzXRNcQ x7y9jHMQqPHghaOrFv2TNwPXLu+YiVc= X-Proofpoint-ORIG-GUID: rL8F2XAmS0jxJmRfR_L4vUAsxBYemua0 X-Authority-Analysis: v=2.4 cv=To1zFzXh c=1 sm=1 tr=0 ts=6b0ce75d cx=c_pps a=PfFC4Oe2JQzmKTvty2cRDw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=kj9zAlcOel0A:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=VwQbUJbxAAAA:8 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=ZUu941lUSb75aaa9kKUA:9 a=CjuIK1q_8ugA:10 a=6Ab_bkdmUrQuMsNx7PHu:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-30_01,2026-11-27_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 malwarescore=0 impostorscore=0 spamscore=0 lowpriorityscore=0 adultscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611300011 On 26-11-27 00:09:38, Felipe Infante de Castro wrote: > On suspend, dwc3_qcom_enable_wakeup_irq() sets the DP and DM high-speed > PHY interrupts to a single edge, chosen from the speed of the attached > device. The IRQ mapping outlives the driver, so after an unbind the > mapping keeps that single-edge type. > > On the next probe the interrupt is looked up again from the device tree, > which describes it as IRQ_TYPE_EDGE_BOTH. The lookup fails with a > trigger type mismatch against the existing mapping. Because the wake > interrupts are optional, probe still succeeds, but without the DP/DM > wake handlers, and USB wakeup is lost until the next boot. > > Record the trigger type of each DP/DM interrupt when it is requested and > restore it from a devres action. The action is registered after the > interrupts, so it runs while the driver still owns them. Unmapped > interrupts, unspecified types and types that already match are left > alone. > > Seen on a Microsoft Surface Laptop 7 (x1e80100-microsoft-romulus15) on a > 7.3 kernel: after unbinding and rebinding a controller the dp_hs_phy_irq > and dm_hs_phy_irq handlers were absent from /proc/interrupts. With this > change they return on every rebind. > > Fixes: 6895ea55c385 ("usb: dwc3: qcom: Configure wakeup interrupts during suspend") > Cc: stable@vger.kernel.org > Signed-off-by: Felipe Infante de Castro Reviewed-by: Peter Chen Peter > --- > Changes in v3: > - Renamed the new fields to dp_hs_phy_irq_type and dm_hs_phy_irq_type, > to match the existing dp_hs_phy_irq and dm_hs_phy_irq (Peter Chen). > - Added Cc: stable (Peter Chen). > - Sent inline; v1 and v2 went out as attachments. > > Changes in v2: > - Resent with an empty mail body. > - Added the Fixes tag suggested by the Sashiko review. > > drivers/usb/dwc3/dwc3-qcom.c | 38 +++++++++++++++++++++++++++++++++++- > 1 file changed, 37 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c > index a260841..548d69b 100644 > --- a/drivers/usb/dwc3/dwc3-qcom.c > +++ b/drivers/usb/dwc3/dwc3-qcom.c > @@ -65,6 +65,8 @@ struct dwc3_qcom_port { > int dp_hs_phy_irq; > int dm_hs_phy_irq; > int ss_phy_irq; > + unsigned int dp_hs_phy_irq_type; > + unsigned int dm_hs_phy_irq_type; > enum usb_device_speed usb2_speed; > }; > > @@ -473,6 +475,7 @@ static int dwc3_qcom_setup_port_irq(struct dwc3_qcom *qcom, > if (ret) > return ret; > qcom->ports[port_index].dp_hs_phy_irq = irq; > + qcom->ports[port_index].dp_hs_phy_irq_type = irq_get_trigger_type(irq); > } > > if (is_multiport) > @@ -488,6 +491,7 @@ static int dwc3_qcom_setup_port_irq(struct dwc3_qcom *qcom, > if (ret) > return ret; > qcom->ports[port_index].dm_hs_phy_irq = irq; > + qcom->ports[port_index].dm_hs_phy_irq_type = irq_get_trigger_type(irq); > } > > if (is_multiport) > @@ -540,6 +544,38 @@ static int dwc3_qcom_find_num_ports(struct platform_device *pdev) > return DWC3_QCOM_MAX_PORTS; > } > > +static void dwc3_qcom_restore_irq_type(struct device *dev, int irq, unsigned int type) > +{ > + int ret; > + > + if (!irq || !type || irq_get_trigger_type(irq) == type) > + return; > + > + ret = irq_set_irq_type(irq, type); > + if (ret) > + dev_warn(dev, "failed to restore IRQ %d trigger type %#x: %d\n", > + irq, type, ret); > +} > + > +static void dwc3_qcom_restore_wake_irq_types(void *data) > +{ > + struct dwc3_qcom *qcom = data; > + int i; > + > + /* > + * The IRQ mappings survive unbind. Put their firmware triggers back > + * before devres frees the handlers or the next probe can lose them. > + */ > + for (i = 0; i < qcom->num_ports; i++) { > + struct dwc3_qcom_port *port = &qcom->ports[i]; > + > + dwc3_qcom_restore_irq_type(qcom->dev, port->dp_hs_phy_irq, > + port->dp_hs_phy_irq_type); > + dwc3_qcom_restore_irq_type(qcom->dev, port->dm_hs_phy_irq, > + port->dm_hs_phy_irq_type); > + } > +} > + > static int dwc3_qcom_setup_irq(struct dwc3_qcom *qcom, struct platform_device *pdev) > { > bool is_multiport; > @@ -555,7 +591,7 @@ static int dwc3_qcom_setup_irq(struct dwc3_qcom *qcom, struct platform_device *p > return ret; > } > > - return 0; > + return devm_add_action_or_reset(qcom->dev, dwc3_qcom_restore_wake_irq_types, qcom); > } > > static void dwc3_qcom_set_role_notifier(struct dwc3 *dwc, enum usb_role next_role) > -- > 2.56.1 > -- Thanks, Peter Chen