From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=8.221.36.217 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796030351; b=xhh1C3pZae9kPNZ6tlu20gpPxJvg4ybENjAjOdBJFNEU98ZCAaBj5rzAmPkxdjF1RgwN 0BxTZzyYRlMWxWlBSHERgJb/KuBUGRlClKGjrKxSNjSrJYO4u9UPYD0yEbPZWsOLBQblp 93nLlBIPs/HdUjk7NYYhalCAQ8LcEDSQfK9R7Tx3bEry5XAgeueeCC/+sYpA0XOL2DoEF d8/a3wdX40qZdgzEGsCF9ba/Jb6Sfuww31Fc5+XQkQBCUdh3EWYHpyv0MkXDvXLH/9cwy eso4XeaCaju6G+68dJc2zLc2FhCgoUBM4XcZo/ilzozBDzO4PnKmGfq188wGYMdbw0g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796030351; h=DMARC-Filter:Received:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-HM-Tid:X-HM-MType: X-HM-Spam-Status:DKIM-Signature; bh=beS7yPT+t1hLLma5YLQC064TYBJiY4zqNohFJa3SZGA=; b=ZfuINxyy5uVTCEatWEVOROd7lRNgDgYE/SPkF6d2Q24YKuiborAAMgFtsowQ5JHT5DwJ m1xOUBOC7wo9BmAadBXxb+pItWg+tD7MQIRnBL4Yy74G1Qf1TSiMa+quwGQD152j9TR6l z3OrVX7rK44Baast9LI9GCRmib+Y7pOeuZbmnASHWf4O2pxdFKUNifryylMo7VauJwaxd cYOjM0A9twzhyQ1MW8i1wwfmNYSZxdKpVfCiTtxUZOJN8621CB59/rYQg93HNLZAy5Ywa eWo16ZwhsuUJXunAOVskoUxlnQSkiCo/yKLNUD/jwWRGvPiucBdzuXmGpvk75d0yljA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=rock-chips.com; spf=pass smtp.mailfrom=rock-chips.com; dkim=pass header.d=rock-chips.com header.i=@rock-chips.com header.a=rsa-sha256 header.s=default header.b="bzuQYfT/"; arc=none smtp.remote-ip=8.221.36.217 Received: from mail-m822136217.xmail.ntesmail.com (mail-m822136217.xmail.ntesmail.com [8.221.36.217]) (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 6CA89606A31C for ; Mon, 30 Nov 2026 09:19:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6CA89606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rock-chips.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rock-chips.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=rock-chips.com header.i=@rock-chips.com header.a=rsa-sha256 header.s=default header.b=bzuQYfT/ Received: from [172.16.12.74] (unknown [61.154.14.86]) by smtp.qiye.163.com (Hmail) with ESMTP id 567f21436; Mon, 30 Nov 2026 17:18:56 +0800 (GMT+08:00) Message-ID: <98be600c-2595-495f-a648-5861b418bf09@rock-chips.com> Date: Mon, 30 Nov 2026 17:18:57 +0800 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 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] phy: rockchip: samsung-hdptx: Power down the lanes on phy_power_off() To: aiyengar1990@gmail.com, Vinod Koul , Neil Armstrong , Manivannan Sadhasivam , Heiko Stuebner , Philipp Zabel , Cristian Ciocaltea Cc: linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org References: <20261110-hdptx-lanes-pwroff-v1-1-c2f85b7e06a4@gmail.com> Content-Language: en-US From: Damon Ding In-Reply-To: <20261110-hdptx-lanes-pwroff-v1-1-c2f85b7e06a4@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-HM-Tid: 0aa22bc00f5303a8kunmc22ff9a4a3eebf X-HM-MType: 1 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWRgWCB1ZQUpXWS1ZQUlXWQ8JGhUIEh9ZQVlDTEhKVkNNSBgfQkxPHxpJHVYVFA kWGhdVEwETFhoSFyQUDg9ZV1kYEgtZQVlNSlVKTk9VSk9VQ01ZV1kWGg8SFR0UWUFZT0tIVUpLSE pKQkxVSktLVUpCS0tZBg++ DKIM-Signature: a=rsa-sha256; b=bzuQYfT/sllaASQK2XkhOYNCYM8Gxulk3ruHJ6wm4oSTxy5KJHdyFqY5h6lUoNzrgfsCuBSI47c+wNQnML/qtMyEo0ryrQdrupHJFbJStIWNpwZ5amEug2pgRjl1zlpi5DZXjRDWz+sZeRjCx/zRVZEKXcCUDh3num+yekJODdU=; s=default; c=relaxed/relaxed; d=rock-chips.com; v=1; bh=beS7yPT+t1hLLma5YLQC064TYBJiY4zqNohFJa3SZGA=; h=date:mime-version:subject:message-id:from; Hi Arun, On 11/10/2026 3:16 PM, Arun Iyengar via B4 Relay wrote: > From: Arun Iyengar > > Since the PHY became a clock provider, rk_hdptx_phy_power_off() does > nothing but drop the shared usage count, and the PHY is only really > disabled when that count reaches zero. The count is also held by every > clock consumer of the PHY PLL, so with a clock reference outstanding > the lanes keep driving the link after the HDMI controller has asked for > the PHY to be powered off. > > On RK3588 a clock reference is almost always outstanding: the VOP lists > the PHY clock among its clocks so it can source its DCLK from it, and > the Rockchip power domain driver puts every clock of a device under > pm_clk, which prepares the PHY clock (i.e. bumps the usage count) > whenever the VOP is runtime active. As soon as any other video port is > in use, e.g. a DP output, switching the HDMI CRTC off therefore leaves > the HDMI lanes enabled and the TMDS clock on the cable, so the sink > never sees the link go away. The lanes stay on until the whole VOP > goes to runtime suspend. > > The lanes belong to the PHY consumer alone, whereas the PLL is shared > with the clock consumers. Hence disable the lane output and hold the > lanes in reset in rk_hdptx_phy_power_off() regardless of the usage > count, and keep leaving the PLL to the count. This is the state the > PHY is in between PLL and lane bring-up anyway, and the next > rk_hdptx_phy_power_on() restores the lanes through the regular > rk_hdptx_post_enable_lane() path, so no additional PLL re-init is > needed. The vendor driver does the same: its power_off callback only > clears the lane enable bits, leaving the PLL to the clock refcount. > > The DP mode is left untouched: its PLL is not exposed as a clock and > the lanes are torn down by rk_hdptx_dp_reset() from the usage count. > > Fixes: c4b09c562086 ("phy: phy-rockchip-samsung-hdptx: Add clock provider support") > Signed-off-by: Arun Iyengar > --- > The problem was found on an Orange Pi 5 (RK3588S): with the HDMI output > switched off, clk_summary still showed clk_hdmiphy_pixel0 at > prepare/enable count 1/1, held by the VOP through pm_clk, so > phy_power_off() never reached rk_hdptx_phy_disable() and the PHY lanes > stayed on across DPMS off. Rockchip's vendor kernel only clears the > lane enable register (LNTOP_REG0207) in its power_off callback too. > > Tested on the same board: a trace of the PHY register writes shows each > HDMI CRTC ACTIVE=0 commit writing 0 to LNTOP_REG0207 from > rk_hdptx_phy_power_off(), the lanes staying off for the 3 s off window, > and power_on writing 0xf back with the picture returning. A run of 102 > off/on transitions over a range of TMDS modes, checked with a camera on > the TV, gave a correct picture every time, no "Failed to get PHY lane > lock" message, and three suspend-to-idle cycles resumed normally. The > patch has been in the board's kernel since. > > This patch was developed with Claude (Anthropic) as a coding assistant: > it wrote the code and the commit message, and I reviewed and tested it > as described above. > --- > drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c > index 6879eecc5a9f..751bb503dcfe 100644 > --- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c > +++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c > @@ -1768,10 +1768,25 @@ static int rk_hdptx_phy_power_on(struct phy *phy) > return ret; > } > > +static void rk_hdptx_lane_disable(struct rk_hdptx_phy *hdptx) > +{ > + regmap_update_bits(hdptx->regmap, LNTOP_REG(0207), LANE_EN_MASK, > + FIELD_PREP(LANE_EN_MASK, 0)); > + reset_control_assert(hdptx->rsts[RST_LANE].rstc); > +} > + > static int rk_hdptx_phy_power_off(struct phy *phy) > { > struct rk_hdptx_phy *hdptx = phy_get_drvdata(phy); > > + /* > + * The lanes are owned by the PHY consumer alone, hence shut them > + * down right away. The PLL is shared with the clock consumers, so > + * leave its fate to the usage count. > + */ > + if (phy_get_mode(phy) != PHY_MODE_DP) > + rk_hdptx_lane_disable(hdptx); > + > return rk_hdptx_phy_consumer_put(hdptx, false); > } > > We recently ran into the same issue, so this approach looks good to me: Reviewed-by: Damon Ding TIP: The commit message seems a bit long (AI tends to describe everything in great detail, which loses the focus). Could we trim it down? I think the core point is that phy power_off disables the lane output directly while keeping the PLL running for the clock consumers. Best regards, Damon