From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 EC3C91E8855; Thu, 30 Jan 2025 14:25:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738247151; cv=none; b=Zs4xH+68jRfbtk4R/+BeI4wNZpdlx9h1D1UQw5gYqFygSxVHsvTXXz3CHKTKPnK4/d2INtO1wmWUQM/sUqNh2XQoMhE+wxlRbeXFGYz/j6DJIFP0KNSu/idAdal6bDQArQqJe/jMSZKIe4DGU0e2S87ltwS1dFmrTeRwOqU+4E4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738247151; c=relaxed/simple; bh=lwkWeI4f9tOgFPJqiSSw0tWa2ctkqEeQQ4p1hv6mI+c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OGbyvx0/mZ6aPD4iqTltM1WP7mGBfXn1qcyMcNKe7u91YqOBIkzpYy6QGFyTjNRMhBCcZXIoqZQPj6Ea2lXg5NUr+w8ubt7nu9iHQ/zDsVBoAfQqSwjhuDMIIru8HEqLmGf7HDwMUU1NA7e2T4pIvPrH/6jckwtNYIJedW0TLzw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=SYbn+jFv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="SYbn+jFv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75499C4CED2; Thu, 30 Jan 2025 14:25:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1738247150; bh=lwkWeI4f9tOgFPJqiSSw0tWa2ctkqEeQQ4p1hv6mI+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SYbn+jFvUPlhI+exTSUJVZ34eZIrA+3lJOWi5h+aPXQ8OUrQGMICc+DUD6prkK0sR 2Z/ESKuAxsNLiI5FBL/4l2aSmisWRIiBYju2UGYDvv2yxq982OmyNQeIJ/9i+X3Akh XQECyLu9ceJvZVTKs+G/zK9bME1MxMyTLqRV6ktY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Justin Chen , Florian Fainelli , Vinod Koul Subject: [PATCH 5.10 070/133] phy: usb: Fix clock imbalance for suspend/resume Date: Thu, 30 Jan 2025 15:00:59 +0100 Message-ID: <20250130140145.339383890@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250130140142.491490528@linuxfoundation.org> References: <20250130140142.491490528@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Justin Chen commit 8484199c09347bdd5d81ee8a2bc530850f900797 upstream. We should be disabling clocks when wake from USB is not needed. Since this wasn't done, we had a clock imbalance since clocks were always being enabled on resume. Fixes: ae532b2b7aa5 ("phy: usb: Add "wake on" functionality for newer Synopsis XHCI controllers") Fixes: b0c0b66c0b43 ("phy: usb: Add support for wake and USB low power mode for 7211 S2/S5") Signed-off-by: Justin Chen Acked-by: Florian Fainelli Link: https://lore.kernel.org/r/1665005418-15807-7-git-send-email-justinpopo6@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c | 2 -- drivers/phy/broadcom/phy-brcm-usb-init.h | 1 - drivers/phy/broadcom/phy-brcm-usb.c | 8 +++++--- 3 files changed, 5 insertions(+), 6 deletions(-) --- a/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c +++ b/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c @@ -430,7 +430,6 @@ void brcm_usb_dvr_init_7216(struct brcm_ params->family_name = "7216"; params->ops = &bcm7216_ops; - params->suspend_with_clocks = true; } void brcm_usb_dvr_init_7211b0(struct brcm_usb_init_params *params) @@ -440,5 +439,4 @@ void brcm_usb_dvr_init_7211b0(struct brc params->family_name = "7211"; params->ops = &bcm7211b0_ops; - params->suspend_with_clocks = true; } --- a/drivers/phy/broadcom/phy-brcm-usb-init.h +++ b/drivers/phy/broadcom/phy-brcm-usb-init.h @@ -61,7 +61,6 @@ struct brcm_usb_init_params { const struct brcm_usb_init_ops *ops; struct regmap *syscon_piarbctl; bool wake_enabled; - bool suspend_with_clocks; }; void brcm_usb_dvr_init_7445(struct brcm_usb_init_params *params); --- a/drivers/phy/broadcom/phy-brcm-usb.c +++ b/drivers/phy/broadcom/phy-brcm-usb.c @@ -585,7 +585,7 @@ static int brcm_usb_phy_suspend(struct d * and newer XHCI->2.0-clks/3.0-clks. */ - if (!priv->ini.suspend_with_clocks) { + if (!priv->ini.wake_enabled) { if (priv->phys[BRCM_USB_PHY_3_0].inited) clk_disable_unprepare(priv->usb_30_clk); if (priv->phys[BRCM_USB_PHY_2_0].inited || @@ -602,8 +602,10 @@ static int brcm_usb_phy_resume(struct de { struct brcm_usb_phy_data *priv = dev_get_drvdata(dev); - clk_prepare_enable(priv->usb_20_clk); - clk_prepare_enable(priv->usb_30_clk); + if (!priv->ini.wake_enabled) { + clk_prepare_enable(priv->usb_20_clk); + clk_prepare_enable(priv->usb_30_clk); + } brcm_usb_init_ipp(&priv->ini); /*