From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6F14CD2D0FD for ; Tue, 13 Jan 2026 13:30:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2RVTawRuNv1HQsxZT+jOvmyf8CoTzBTKNYTp/w1WNUs=; b=qQyiQvS1SLHtzH BkTlhgadGG6M8dhJwC90EmyKH+FL1XcylkZ7aejgVvOj6h59XgOg2iq9c/e6ah93caDL1SvHryavx ZKyZsrrJSgRsasxk1XZ30QdEz6gwTiFQtbfIl9csaUuTN3jFDg5bF+SOn72xMw/5+gOGYPP5Kqhrc A3lgfl+ybg+2fvFVK/cBdrVnmuP9el/Ikh5fqkTwfmCM/VRkwVHwZ5LSvlUBwOWW0xVkqBdRaM7Ja D8Tk4Wtz2v5IOXi69lOpHIa61NGMHz/RdsECjNTkpfVXnyBr4jaMj+b5TAtiYA9v5qbSlu/GRXrVV AodrF+TyLE9wuEwWQA7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vfeTS-00000007A5A-3jGr; Tue, 13 Jan 2026 13:30:22 +0000 Received: from smtp1.tecnico.ulisboa.pt ([2001:690:2100:1::15]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vfeTO-00000007A4j-3duY for linux-phy@lists.infradead.org; Tue, 13 Jan 2026 13:30:17 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp1.tecnico.ulisboa.pt (Postfix) with ESMTP id D16B860020E1; Tue, 13 Jan 2026 13:30:09 +0000 (WET) X-Virus-Scanned: by amavis-2.13.0 (20230106) (Debian) at tecnico.ulisboa.pt Received: from smtp1.tecnico.ulisboa.pt ([127.0.0.1]) by localhost (smtp1.tecnico.ulisboa.pt [127.0.0.1]) (amavis, port 10025) with LMTP id HXHwJlX5thU1; Tue, 13 Jan 2026 13:30:07 +0000 (WET) Received: from mail1.tecnico.ulisboa.pt (mail1.ist.utl.pt [193.136.128.10]) by smtp1.tecnico.ulisboa.pt (Postfix) with ESMTPS id 07F1F6001428; Tue, 13 Jan 2026 13:30:07 +0000 (WET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tecnico.ulisboa.pt; s=mail2; t=1768311007; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TwarZgYPrLABi/etu50xEE5OV50XboMHuJPg3X2erGw=; b=bouw3uEnjuFfI0PXt/XNA54iHtwyIC06SUYhoz2Brhv36PBaQEfQl0rm5TRaNdd4YXzAtA HdLegFh8MXdxtSXTiKiPCcWtHymlr3h5kRaeUAswoiIVOkcrjTVjl+bY33dvwMSuVMfn0+ 4tQjJhHo4MtlnJ0F8PW35Uo5KlrmF2/ArGEM2t/SdNYN8PYfqKFX75Qeb1TYObdTyYIDnk 6PRj8/6XbBuML6FK8eNh2OWLp6pZYyfVl61Mt37Ho7mhGP2AVX+Q7oiA78pstwLTDEmMbA e5ANvgIlYXfDh/kFScXhL5ZBsxbBFDyQWA4Px4stjcVCICYvn+cNOhAyJoU1Ug== Received: from [192.168.2.110] (unknown [148.63.39.39]) (Authenticated sender: ist187313) by mail1.tecnico.ulisboa.pt (Postfix) with ESMTPSA id 0443836006F; Tue, 13 Jan 2026 13:30:05 +0000 (WET) Message-ID: Date: Tue, 13 Jan 2026 13:30:02 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/5] phy: tegra: xusb: Fix USB2 port regulator disable logic To: Vinod Koul , Jonathan Hunter Cc: Mathias Nyman , Greg Kroah-Hartman , Thierry Reding , JC Kuo , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org References: <20251204-diogo-tegra_phy-v1-0-51a2016d0be8@tecnico.ulisboa.pt> <20251204-diogo-tegra_phy-v1-2-51a2016d0be8@tecnico.ulisboa.pt> Content-Language: en-US From: Diogo Ivo In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260113_053015_360615_F9C6678A X-CRM114-Status: GOOD ( 20.77 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org On 12/24/25 07:27, Vinod Koul wrote: > On 04-12-25, 21:27, Diogo Ivo wrote: >> The USB2 PHY mode handling on Tegra210 incorrectly relied on >> regulator_is_enabled() when determining whether the VBUS supply should >> be disabled during role changes. This is because regulator_is_enabled() >> reports exactly what is states and not if there is an unbalanced number >> of calls between regulator_enable() and regulator_disable(). For >> example, regulator_is_enabled() always reports true on a fixed-regulator >> with no enable gpio, which is the case on the Pixel C. >> >> This then leads to the PHY driver wrongfully calling regulator_disable() >> when transitioning from USB_ROLE_DEVICE to USB_ROLE_NONE since the driver >> did not previously call the corresponding regulator_enable(). >> >> Fix this by keeping track of the current role and updating the logic to >> disable the regulator only when the previous role was USB_ROLE_HOST. >> >> While at it fix a small typo in a comment. > > Never mix a patch with something else please. More imp if it is fix > which will go to rcX. Please send a different patch for typo Ok, will split for v2. >> Signed-off-by: Diogo Ivo >> --- >> drivers/phy/tegra/xusb-tegra210.c | 5 +++-- >> drivers/phy/tegra/xusb.h | 1 + >> 2 files changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/phy/tegra/xusb-tegra210.c b/drivers/phy/tegra/xusb-tegra210.c >> index 3409924498e9..63ad57d95514 100644 >> --- a/drivers/phy/tegra/xusb-tegra210.c >> +++ b/drivers/phy/tegra/xusb-tegra210.c >> @@ -1934,9 +1934,9 @@ static int tegra210_usb2_phy_set_mode(struct phy *phy, enum phy_mode mode, >> /* >> * When port is peripheral only or role transitions to >> * USB_ROLE_NONE from USB_ROLE_DEVICE, regulator is not >> - * be enabled. >> + * enabled. >> */ >> - if (regulator_is_enabled(port->supply)) >> + if (port->role == USB_ROLE_HOST) >> regulator_disable(port->supply); >> >> tegra210_xusb_padctl_id_override(padctl, false); >> @@ -1944,6 +1944,7 @@ static int tegra210_usb2_phy_set_mode(struct phy *phy, enum phy_mode mode, >> } >> } >> >> + port->role = submode; >> mutex_unlock(&padctl->lock); >> >> return err; >> diff --git a/drivers/phy/tegra/xusb.h b/drivers/phy/tegra/xusb.h >> index d2b5f9565132..273af147dfd3 100644 >> --- a/drivers/phy/tegra/xusb.h >> +++ b/drivers/phy/tegra/xusb.h >> @@ -317,6 +317,7 @@ struct tegra_xusb_usb2_port { >> enum usb_dr_mode mode; >> bool internal; >> int usb3_port_fake; >> + enum usb_role role; >> }; > > Jonathan can we get some t-b for these two patches > -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy