From nobody Sun Feb 8 20:17:57 2026 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 80FCF285CA3 for ; Sun, 21 Dec 2025 10:47:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314026; cv=none; b=BJdFi2uMHJ8R8GTOci3iYd7JGPv9GTnoF9rTX2/qp6jy/h8b1mmhrzqS1Mdv3Bv9zIyKX3OBNgw9UpUq28R9y5pAzCX/VYnuJAhnD7rmhWgIEmwliZW/U9yc5rdzkad6YHudZ2nOdnZgN8Hc9nio/iHi2aKLBxzNrW5bA7VyBiU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314026; c=relaxed/simple; bh=Z9aStTjQ5oTuRN0GPLQ6iWNOlIGeZuaICw+hagAkRZs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=msrizYNTM16yUsyanqk2QfJ3mQGB1s/r7p/c3P0h5kgOFZS82gzImy0OxuXKfbwLBEx4v4sa9TI6v3qFR2oN3lA//l+TlXL35CD4In15ZMvznQqavYBZZdxuRPi5kmx2KHS7vitJE1+1fctPG5SSuzfe2xPhYgPxtvg/PyhwHlo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=e/Oze/4D; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="e/Oze/4D" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1766314022; bh=Z9aStTjQ5oTuRN0GPLQ6iWNOlIGeZuaICw+hagAkRZs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=e/Oze/4D5QeRBg3BHXvISMij0YsDU2wWaO9WOK5yrAxtASFnerasKC4ONsWtucvdC hocuotpVjef4hRnecUrjlGQb0+PlB8jDLFVF3rEK0QaGH4agMTANsSWn9K+WhQEEHl OFuWoWVRVVxBrq/wNHVTY33bGlgm7f8RVO+wswxH4CkFxIvHRu7QFV42QW52CLnBuO /nHVeRcY4gz0aJrrZokDIirXNmD+33QbpQgcMzhSVyebI9fvS9rkKr9tdnhD+Trdo0 yuxr4hAzcmIIbTsodNcorfYd8sqPv28IamtuZIXg9iT6zS+XoGmQBZWEjaxZemh9Tb KIsKKbOF1fseA== Received: from localhost (unknown [82.79.138.145]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id 7F32E17E0506; Sun, 21 Dec 2025 11:47:02 +0100 (CET) From: Cristian Ciocaltea Date: Sun, 21 Dec 2025 12:46:48 +0200 Subject: [PATCH v5 01/11] phy: hdmi: Add HDMI 2.1 FRL configuration options 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: quoted-printable Message-Id: <20251221-phy-hdptx-frl-v5-1-dac390a780be@collabora.com> References: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> In-Reply-To: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> To: Vinod Koul , Kishon Vijay Abraham I , Heiko Stuebner , Algea Cao , Dmitry Baryshkov , Neil Armstrong Cc: kernel@collabora.com, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.3 The HDMI 2.1 specification introduced the Fixed Rate Link (FRL) mode, aiming to replace the older Transition-Minimized Differential Signaling (TMDS) mode used in previous HDMI versions to support much higher bandwidths (up to 48 Gbps) for modern video and audio formats. FRL has been designed to support ultra high resolution formats at high refresh rates like 8K@60Hz or 4K@120Hz, and eliminates the need for dynamic bandwidth adjustments, which reduces latency. It operates with 3 or 4 lanes at different link rates: 3Gbps, 6Gbps, 8Gbps, 10Gbps or 12Gbps. Add support for configuring the FRL mode for HDMI PHYs. Signed-off-by: Cristian Ciocaltea --- include/linux/phy/phy-hdmi.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/include/linux/phy/phy-hdmi.h b/include/linux/phy/phy-hdmi.h index f0ec963c6e84..d4cf4430ee8f 100644 --- a/include/linux/phy/phy-hdmi.h +++ b/include/linux/phy/phy-hdmi.h @@ -6,16 +6,31 @@ #ifndef __PHY_HDMI_H_ #define __PHY_HDMI_H_ =20 +#include + +enum phy_hdmi_mode { + PHY_HDMI_MODE_TMDS, + PHY_HDMI_MODE_FRL, +}; + /** * struct phy_configure_opts_hdmi - HDMI configuration set - * @tmds_char_rate: HDMI TMDS Character Rate in Hertz. * @bpc: Bits per color channel. + * @tmds_char_rate: HDMI TMDS Character Rate in Hertz. + * @frl.rate_per_lane: HDMI FRL Rate per Lane in Gbps. + * @frl.lanes: HDMI FRL lanes count. * * This structure is used to represent the configuration state of a HDMI p= hy. */ struct phy_configure_opts_hdmi { - unsigned long long tmds_char_rate; unsigned int bpc; + union { + unsigned long long tmds_char_rate; + struct { + u8 rate_per_lane; + u8 lanes; + } frl; + }; }; =20 #endif /* __PHY_HDMI_H_ */ --=20 2.51.2 From nobody Sun Feb 8 20:17:57 2026 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 3966A2877D8 for ; Sun, 21 Dec 2025 10:47:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314026; cv=none; b=blqBgKbyeDA/aXAUhUTuMt8Z8eodblzQnrPZ3XkNOfbroL1xrASpcmzDq01V8T4a/zp3c9jnF7ABcPw7stCjNueM2nwNvxdC8kR2dkgbfuXcqQL99bhE5tI7H8RC+VtK/zyr5nbdH/vR9xSQ08ToOu4f+YaCLN99GheCKVvO99g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314026; c=relaxed/simple; bh=i3Gw9Sac+Z2pq57AbgEFnTYEU8tyfk0Z8DX5cPEHcPE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=O7LG759Oj4BPKCBqA7XoOK5zTBUIJe22sDvpIuFZQIEuetn7/uRRa6uXCW/lE+zqFexbgDMoy+sdXrEnJaVxjBeQ2M6ESkTHmyRicTaa1C1kVi4cqHrVtpZgaIp2L2umymPT0bsDjE7D89DLiVUlVe2aPi+zv+bhMo5QR/oCGtc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=NJSQ9bbG; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="NJSQ9bbG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1766314023; bh=i3Gw9Sac+Z2pq57AbgEFnTYEU8tyfk0Z8DX5cPEHcPE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=NJSQ9bbGLCT0KBBXwCNqPCcuYonYOby3UGeC649qbc7GQlq5SrOA9iUxB9hMTXeEQ Aer0rYOiirSt/2UzvvBY4LTLkPOcUHinQohLHjZVoraV2bRb2DU6klTXxuDkYNMxI7 IX7GxcMkbvjNGNySYXAdLCTiqOMFMg+/zHKBzs/W8QK8mFil7sqMoAmgK+prD8TVQZ Vo3bwsZPx+ByTWMI8RW0XmZc5zoNMTx0Jdq7cZeVgfFSG0oKztHWiYIixsPmLoestD wH400GOZfNk2Xb1u49q0cyaBcgyYX+FDPYszMWsB/LishnNDQePlFdRu4JZ6EVLySZ BC61c0b6xN9vw== Received: from localhost (unknown [82.79.138.145]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id 620B017E12E8; Sun, 21 Dec 2025 11:47:03 +0100 (CET) From: Cristian Ciocaltea Date: Sun, 21 Dec 2025 12:46:49 +0200 Subject: [PATCH v5 02/11] phy: rockchip: samsung-hdptx: Use usleep_range() instead of udelay() 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: quoted-printable Message-Id: <20251221-phy-hdptx-frl-v5-2-dac390a780be@collabora.com> References: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> In-Reply-To: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> To: Vinod Koul , Kishon Vijay Abraham I , Heiko Stuebner , Algea Cao , Dmitry Baryshkov , Neil Armstrong Cc: kernel@collabora.com, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.3 rk_hdptx_dp_reset() is allowed to sleep, hence replace the busy waiting with usleep_range(), to allow other threads to run. Signed-off-by: Cristian Ciocaltea --- drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c b/drivers/ph= y/rockchip/phy-rockchip-samsung-hdptx.c index e3d817e81d6d..a6981b222c8b 100644 --- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c @@ -1042,7 +1042,7 @@ static void rk_hdptx_dp_reset(struct rk_hdptx_phy *hd= ptx) reset_control_assert(hdptx->rsts[RST_INIT].rstc); =20 reset_control_assert(hdptx->rsts[RST_APB].rstc); - udelay(10); + usleep_range(10, 15); reset_control_deassert(hdptx->rsts[RST_APB].rstc); =20 regmap_update_bits(hdptx->regmap, LANE_REG(0301), --=20 2.51.2 From nobody Sun Feb 8 20:17:57 2026 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 EE546289358 for ; Sun, 21 Dec 2025 10:47:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314027; cv=none; b=BJ824tNf48qNxslCR3/Jk7yr+EfC+Od0bhvf6aWgdttlOXoWWvgTzG3bPpUheMruPti9owO3Prp9O59OdxzOnmv1SaoyIvtUkDqJcYntYz5d0uWyTdlYQ4JMgGZ1bdso4hKSc2Humhspqih1qluBIq/8mfwBxL4eBK2nv/hT0EI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314027; c=relaxed/simple; bh=w3CDRpcsY6xhK2RpA7uNbw4htf5/+LJq5JXG6y4hSRg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WMs+zI7ci9XWwghq5eyr1nCTZ/Dv8vAaEIMgbH2tZnmFNmujnbeD/awcjRx5Jvi3qxZDjm6X73MB0hjwpPDxinL977xeGi7cCN2hpRyF3moR1AGacttkmnn+pGIwA2SwOyayZnF93GOZrCTXSfqkN/sobZA9TvCe30V1q92r1EM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=RimCL7Xt; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="RimCL7Xt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1766314024; bh=w3CDRpcsY6xhK2RpA7uNbw4htf5/+LJq5JXG6y4hSRg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=RimCL7XtQpLTfh/Jg3uXYaJMwTqcMSANYo28gYU60BmpnYLDgIrq5VWzYV93s9W1I Tu+FifYHQZHSf94mT2KI+Tk5inxYRaggl0WrWs/kTWsqmwdnSsZFOfj6VEIzguX7sk /StASQeLVjAtzc38mE8POSWI33Z9LvLNDTSD7wYf62ZT6c/ucvgCgDszTZiQ4IlLtC bAqPzYnVyjXQC9IDC8gh9fLzaRLD07en72uXR1eRamkbSDdihCMgvjrlIY4MMdjGnV 8/Qn3pyANt+y4MbNWhb2ubitzqaCCZdr4P7lwmx1/tzKEmm6S2FDhqmfGIHPFvqw4h kNhV1Egv8yFoQ== Received: from localhost (unknown [82.79.138.145]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id 2DA4117E1330; Sun, 21 Dec 2025 11:47:04 +0100 (CET) From: Cristian Ciocaltea Date: Sun, 21 Dec 2025 12:46:50 +0200 Subject: [PATCH v5 03/11] phy: rockchip: samsung-hdptx: Fix coding style alignment 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: quoted-printable Message-Id: <20251221-phy-hdptx-frl-v5-3-dac390a780be@collabora.com> References: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> In-Reply-To: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> To: Vinod Koul , Kishon Vijay Abraham I , Heiko Stuebner , Algea Cao , Dmitry Baryshkov , Neil Armstrong Cc: kernel@collabora.com, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.3 Handle a bunch of reported checkpatch.pl complaints: CHECK: Alignment should match open parenthesis Signed-off-by: Cristian Ciocaltea --- drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c b/drivers/ph= y/rockchip/phy-rockchip-samsung-hdptx.c index a6981b222c8b..b2c9df761861 100644 --- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c @@ -1624,11 +1624,11 @@ static void rk_hdptx_phy_set_voltage(struct rk_hdpt= x_phy *hdptx, regmap_update_bits(hdptx->regmap, LANE_REG(030a) + offset, LN_TX_JEQ_EVEN_CTRL_RBR_MASK, FIELD_PREP(LN_TX_JEQ_EVEN_CTRL_RBR_MASK, - ctrl->tx_jeq_even_ctrl)); + ctrl->tx_jeq_even_ctrl)); regmap_update_bits(hdptx->regmap, LANE_REG(030c) + offset, LN_TX_JEQ_ODD_CTRL_RBR_MASK, FIELD_PREP(LN_TX_JEQ_ODD_CTRL_RBR_MASK, - ctrl->tx_jeq_odd_ctrl)); + ctrl->tx_jeq_odd_ctrl)); regmap_update_bits(hdptx->regmap, LANE_REG(0311) + offset, LN_TX_SER_40BIT_EN_RBR_MASK, FIELD_PREP(LN_TX_SER_40BIT_EN_RBR_MASK, 0x1)); @@ -1638,11 +1638,11 @@ static void rk_hdptx_phy_set_voltage(struct rk_hdpt= x_phy *hdptx, regmap_update_bits(hdptx->regmap, LANE_REG(030b) + offset, LN_TX_JEQ_EVEN_CTRL_HBR_MASK, FIELD_PREP(LN_TX_JEQ_EVEN_CTRL_HBR_MASK, - ctrl->tx_jeq_even_ctrl)); + ctrl->tx_jeq_even_ctrl)); regmap_update_bits(hdptx->regmap, LANE_REG(030d) + offset, LN_TX_JEQ_ODD_CTRL_HBR_MASK, FIELD_PREP(LN_TX_JEQ_ODD_CTRL_HBR_MASK, - ctrl->tx_jeq_odd_ctrl)); + ctrl->tx_jeq_odd_ctrl)); regmap_update_bits(hdptx->regmap, LANE_REG(0311) + offset, LN_TX_SER_40BIT_EN_HBR_MASK, FIELD_PREP(LN_TX_SER_40BIT_EN_HBR_MASK, 0x1)); @@ -1653,11 +1653,11 @@ static void rk_hdptx_phy_set_voltage(struct rk_hdpt= x_phy *hdptx, regmap_update_bits(hdptx->regmap, LANE_REG(030b) + offset, LN_TX_JEQ_EVEN_CTRL_HBR2_MASK, FIELD_PREP(LN_TX_JEQ_EVEN_CTRL_HBR2_MASK, - ctrl->tx_jeq_even_ctrl)); + ctrl->tx_jeq_even_ctrl)); regmap_update_bits(hdptx->regmap, LANE_REG(030d) + offset, LN_TX_JEQ_ODD_CTRL_HBR2_MASK, FIELD_PREP(LN_TX_JEQ_ODD_CTRL_HBR2_MASK, - ctrl->tx_jeq_odd_ctrl)); + ctrl->tx_jeq_odd_ctrl)); regmap_update_bits(hdptx->regmap, LANE_REG(0311) + offset, LN_TX_SER_40BIT_EN_HBR2_MASK, FIELD_PREP(LN_TX_SER_40BIT_EN_HBR2_MASK, 0x1)); --=20 2.51.2 From nobody Sun Feb 8 20:17:57 2026 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 EC28E28CF56 for ; Sun, 21 Dec 2025 10:47:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314029; cv=none; b=BssxcrSFS91sICOPb1b21ZAqOJXQdoKPvjlXEAfgUxpGshv1FKfjeHv8MwaNTNDepwM2njnaZQ24JjHmOkYkz1VDxHbbTdlRjuiZhHSSar093kP0KB0AC9ha8Hpl6SEXM4/F9I23cxRB1DOj8sN8qW4RLaPp7vhbAV9c+c+4aDU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314029; c=relaxed/simple; bh=79zd8d916l3WthpQL0m/XMMHpm7xM3ah6UhD55Gl+6A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VumfhzfQF1mF/iKAVC2qK+V3H2nxSbThkkg9lQu+8HyotLKt+6FzVlVMFu485ucKa09PqpbwD8lUozsDnkNx5Ov+U4HNchVKOlbghr8uc3jtrEiM5DT47nV+UvcRP+z7QpTTckXoOTpYURfw7TO8z5n12izSnsqvxhrysU+WQVc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=UkDanOOF; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="UkDanOOF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1766314025; bh=79zd8d916l3WthpQL0m/XMMHpm7xM3ah6UhD55Gl+6A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=UkDanOOFNh0rVoLCvqTo9/q21NeA5YIvjkXE7lvPqghVQ8y1g1LVhFW0qNRpv1S4M VH7m9J0ooYYz2Azh65HZqhDtcE1PczeeXxH53Air7uPlrnwUT0w2Ti1XvnvqKQtyHj E1tD9dBb7F6vZczIyM8r30VDvg6b0y2/X/ITiQYwwKd3RptRRojNJqTdj+XOe4F83Y w2Mgz10lwgnDtvb36T6vo8Dn0Fkx066qZUKNABaT43oTdl6Xj5CYavKAcpxvjz/SlA lkhmpUp2a1RwYAgGT2bqQlfnOx1IAqOKIhHRi7B2gsTHH+ntrAV5ty/xhoQOoRiBVV fh1TeeSVMr4Zg== Received: from localhost (unknown [82.79.138.145]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id 0CF1C17E1340; Sun, 21 Dec 2025 11:47:05 +0100 (CET) From: Cristian Ciocaltea Date: Sun, 21 Dec 2025 12:46:51 +0200 Subject: [PATCH v5 04/11] phy: rockchip: samsung-hdptx: Consistently use [rk_]hdptx_[tmds_] prefixes 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: quoted-printable Message-Id: <20251221-phy-hdptx-frl-v5-4-dac390a780be@collabora.com> References: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> In-Reply-To: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> To: Vinod Koul , Kishon Vijay Abraham I , Heiko Stuebner , Algea Cao , Dmitry Baryshkov , Neil Armstrong Cc: kernel@collabora.com, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.3 Fix the naming inconsistencies for some of the functions and global variables: * Add the missing 'rk_hdptx_' prefix to ropll_tmds_cfg variable * Replace '_ropll_tmds_' with '_tmds_ropll_' globally * Replace 'hdtpx' with 'hdptx' globally Signed-off-by: Cristian Ciocaltea --- drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 62 +++++++++++--------= ---- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c b/drivers/ph= y/rockchip/phy-rockchip-samsung-hdptx.c index b2c9df761861..ac315061b6ee 100644 --- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c @@ -32,17 +32,17 @@ #define HDPTX_O_PHY_RDY BIT(1) #define HDPTX_O_SB_RDY BIT(0) =20 -#define HDTPX_REG(_n, _min, _max) \ +#define HDPTX_REG(_n, _min, _max) \ ( \ BUILD_BUG_ON_ZERO((0x##_n) < (0x##_min)) + \ BUILD_BUG_ON_ZERO((0x##_n) > (0x##_max)) + \ ((0x##_n) * 4) \ ) =20 -#define CMN_REG(n) HDTPX_REG(n, 0000, 00a7) -#define SB_REG(n) HDTPX_REG(n, 0100, 0129) -#define LNTOP_REG(n) HDTPX_REG(n, 0200, 0229) -#define LANE_REG(n) HDTPX_REG(n, 0300, 062d) +#define CMN_REG(n) HDPTX_REG(n, 0000, 00a7) +#define SB_REG(n) HDPTX_REG(n, 0100, 0129) +#define LNTOP_REG(n) HDPTX_REG(n, 0200, 0229) +#define LANE_REG(n) HDPTX_REG(n, 0300, 062d) =20 /* CMN_REG(0008) */ #define OVRD_LCPLL_EN_MASK BIT(7) @@ -397,7 +397,7 @@ struct rk_hdptx_phy { unsigned int lanes; }; =20 -static const struct ropll_config ropll_tmds_cfg[] =3D { +static const struct ropll_config rk_hdptx_tmds_ropll_cfg[] =3D { /* | pms | sdm | = sdc | */ /* rate, mdiv, mdafc, pdiv, rdiv, sdiv, en, deno, nsig, num, n, n= um, deno, */ { 594000000ULL, 124, 124, 1, 1, 0, 1, 62, 1, 16, 5, = 0, 1, }, @@ -424,7 +424,7 @@ static const struct ropll_config ropll_tmds_cfg[] =3D { { 25175000ULL, 84, 84, 1, 1, 15, 1, 168, 1, 16, 4, = 1, 1, }, }; =20 -static const struct reg_sequence rk_hdtpx_common_cmn_init_seq[] =3D { +static const struct reg_sequence rk_hdptx_common_cmn_init_seq[] =3D { REG_SEQ0(CMN_REG(0009), 0x0c), REG_SEQ0(CMN_REG(000a), 0x83), REG_SEQ0(CMN_REG(000b), 0x06), @@ -514,7 +514,7 @@ static const struct reg_sequence rk_hdtpx_common_cmn_in= it_seq[] =3D { REG_SEQ0(CMN_REG(009b), 0x10), }; =20 -static const struct reg_sequence rk_hdtpx_tmds_cmn_init_seq[] =3D { +static const struct reg_sequence rk_hdptx_tmds_cmn_init_seq[] =3D { REG_SEQ0(CMN_REG(0008), 0x00), REG_SEQ0(CMN_REG(0011), 0x01), REG_SEQ0(CMN_REG(0017), 0x20), @@ -556,14 +556,14 @@ static const struct reg_sequence rk_hdtpx_tmds_cmn_in= it_seq[] =3D { REG_SEQ0(CMN_REG(009b), 0x00), }; =20 -static const struct reg_sequence rk_hdtpx_common_sb_init_seq[] =3D { +static const struct reg_sequence rk_hdptx_common_sb_init_seq[] =3D { REG_SEQ0(SB_REG(0114), 0x00), REG_SEQ0(SB_REG(0115), 0x00), REG_SEQ0(SB_REG(0116), 0x00), REG_SEQ0(SB_REG(0117), 0x00), }; =20 -static const struct reg_sequence rk_hdtpx_tmds_lntop_highbr_seq[] =3D { +static const struct reg_sequence rk_hdptx_tmds_lntop_highbr_seq[] =3D { REG_SEQ0(LNTOP_REG(0201), 0x00), REG_SEQ0(LNTOP_REG(0202), 0x00), REG_SEQ0(LNTOP_REG(0203), 0x0f), @@ -571,7 +571,7 @@ static const struct reg_sequence rk_hdtpx_tmds_lntop_hi= ghbr_seq[] =3D { REG_SEQ0(LNTOP_REG(0205), 0xff), }; =20 -static const struct reg_sequence rk_hdtpx_tmds_lntop_lowbr_seq[] =3D { +static const struct reg_sequence rk_hdptx_tmds_lntop_lowbr_seq[] =3D { REG_SEQ0(LNTOP_REG(0201), 0x07), REG_SEQ0(LNTOP_REG(0202), 0xc1), REG_SEQ0(LNTOP_REG(0203), 0xf0), @@ -579,7 +579,7 @@ static const struct reg_sequence rk_hdtpx_tmds_lntop_lo= wbr_seq[] =3D { REG_SEQ0(LNTOP_REG(0205), 0x1f), }; =20 -static const struct reg_sequence rk_hdtpx_common_lane_init_seq[] =3D { +static const struct reg_sequence rk_hdptx_common_lane_init_seq[] =3D { REG_SEQ0(LANE_REG(0303), 0x0c), REG_SEQ0(LANE_REG(0307), 0x20), REG_SEQ0(LANE_REG(030a), 0x17), @@ -634,7 +634,7 @@ static const struct reg_sequence rk_hdtpx_common_lane_i= nit_seq[] =3D { REG_SEQ0(LANE_REG(0620), 0xa0), }; =20 -static const struct reg_sequence rk_hdtpx_tmds_lane_init_seq[] =3D { +static const struct reg_sequence rk_hdptx_tmds_lane_init_seq[] =3D { REG_SEQ0(LANE_REG(0312), 0x00), REG_SEQ0(LANE_REG(0412), 0x00), REG_SEQ0(LANE_REG(0512), 0x00), @@ -938,7 +938,7 @@ static bool rk_hdptx_phy_clk_pll_calc(unsigned long lon= g rate, return true; } =20 -static int rk_hdptx_ropll_tmds_cmn_config(struct rk_hdptx_phy *hdptx) +static int rk_hdptx_tmds_ropll_cmn_config(struct rk_hdptx_phy *hdptx) { const struct ropll_config *cfg =3D NULL; struct ropll_config rc =3D {0}; @@ -947,9 +947,9 @@ static int rk_hdptx_ropll_tmds_cmn_config(struct rk_hdp= tx_phy *hdptx) if (!hdptx->hdmi_cfg.tmds_char_rate) return 0; =20 - for (i =3D 0; i < ARRAY_SIZE(ropll_tmds_cfg); i++) - if (hdptx->hdmi_cfg.tmds_char_rate =3D=3D ropll_tmds_cfg[i].rate) { - cfg =3D &ropll_tmds_cfg[i]; + for (i =3D 0; i < ARRAY_SIZE(rk_hdptx_tmds_ropll_cfg); i++) + if (hdptx->hdmi_cfg.tmds_char_rate =3D=3D rk_hdptx_tmds_ropll_cfg[i].rat= e) { + cfg =3D &rk_hdptx_tmds_ropll_cfg[i]; break; } =20 @@ -969,8 +969,8 @@ static int rk_hdptx_ropll_tmds_cmn_config(struct rk_hdp= tx_phy *hdptx) =20 rk_hdptx_pre_power_up(hdptx); =20 - rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_common_cmn_init_seq); - rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_tmds_cmn_init_seq); + rk_hdptx_multi_reg_write(hdptx, rk_hdptx_common_cmn_init_seq); + rk_hdptx_multi_reg_write(hdptx, rk_hdptx_tmds_cmn_init_seq); =20 regmap_write(hdptx->regmap, CMN_REG(0051), cfg->pms_mdiv); regmap_write(hdptx->regmap, CMN_REG(0055), cfg->pms_mdiv_afc); @@ -1012,25 +1012,25 @@ static int rk_hdptx_ropll_tmds_cmn_config(struct rk= _hdptx_phy *hdptx) return ret; } =20 -static int rk_hdptx_ropll_tmds_mode_config(struct rk_hdptx_phy *hdptx) +static int rk_hdptx_tmds_ropll_mode_config(struct rk_hdptx_phy *hdptx) { - rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_common_sb_init_seq); + rk_hdptx_multi_reg_write(hdptx, rk_hdptx_common_sb_init_seq); =20 regmap_write(hdptx->regmap, LNTOP_REG(0200), 0x06); =20 if (hdptx->hdmi_cfg.tmds_char_rate > HDMI14_MAX_RATE) { /* For 1/40 bitrate clk */ - rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_tmds_lntop_highbr_seq); + rk_hdptx_multi_reg_write(hdptx, rk_hdptx_tmds_lntop_highbr_seq); } else { /* For 1/10 bitrate clk */ - rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_tmds_lntop_lowbr_seq); + rk_hdptx_multi_reg_write(hdptx, rk_hdptx_tmds_lntop_lowbr_seq); } =20 regmap_write(hdptx->regmap, LNTOP_REG(0206), 0x07); regmap_write(hdptx->regmap, LNTOP_REG(0207), 0x0f); =20 - rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_common_lane_init_seq); - rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_tmds_lane_init_seq); + rk_hdptx_multi_reg_write(hdptx, rk_hdptx_common_lane_init_seq); + rk_hdptx_multi_reg_write(hdptx, rk_hdptx_tmds_lane_init_seq); =20 return rk_hdptx_post_enable_lane(hdptx); } @@ -1089,7 +1089,7 @@ static int rk_hdptx_phy_consumer_get(struct rk_hdptx_= phy *hdptx) if (mode =3D=3D PHY_MODE_DP) { rk_hdptx_dp_reset(hdptx); } else { - ret =3D rk_hdptx_ropll_tmds_cmn_config(hdptx); + ret =3D rk_hdptx_tmds_ropll_cmn_config(hdptx); if (ret) goto dec_usage; } @@ -1436,7 +1436,7 @@ static int rk_hdptx_phy_power_on(struct phy *phy) regmap_write(hdptx->grf, GRF_HDPTX_CON0, HDPTX_MODE_SEL << 16 | FIELD_PREP(HDPTX_MODE_SEL, 0x0)); =20 - ret =3D rk_hdptx_ropll_tmds_mode_config(hdptx); + ret =3D rk_hdptx_tmds_ropll_mode_config(hdptx); if (ret) rk_hdptx_phy_consumer_put(hdptx, true); } @@ -1459,11 +1459,11 @@ static int rk_hdptx_phy_verify_hdmi_config(struct r= k_hdptx_phy *hdptx, if (!hdmi->tmds_char_rate || hdmi->tmds_char_rate > HDMI20_MAX_RATE) return -EINVAL; =20 - for (i =3D 0; i < ARRAY_SIZE(ropll_tmds_cfg); i++) - if (hdmi->tmds_char_rate =3D=3D ropll_tmds_cfg[i].rate) + for (i =3D 0; i < ARRAY_SIZE(rk_hdptx_tmds_ropll_cfg); i++) + if (hdmi->tmds_char_rate =3D=3D rk_hdptx_tmds_ropll_cfg[i].rate) break; =20 - if (i =3D=3D ARRAY_SIZE(ropll_tmds_cfg) && + if (i =3D=3D ARRAY_SIZE(rk_hdptx_tmds_ropll_cfg) && !rk_hdptx_phy_clk_pll_calc(hdmi->tmds_char_rate, NULL)) return -EINVAL; =20 @@ -1888,7 +1888,7 @@ static int rk_hdptx_phy_clk_set_rate(struct clk_hw *h= w, unsigned long rate, * while the latter being executed only once, i.e. when clock remains * in the prepared state during rate changes. */ - return rk_hdptx_ropll_tmds_cmn_config(hdptx); + return rk_hdptx_tmds_ropll_cmn_config(hdptx); } =20 static const struct clk_ops hdptx_phy_clk_ops =3D { --=20 2.51.2 From nobody Sun Feb 8 20:17:57 2026 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 E0A7C2868B4 for ; Sun, 21 Dec 2025 10:47:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314030; cv=none; b=XuMWI2+Us+4c2WN7jD0QqspzXtF44LlFLQUC7mj2Pn9hoAQe/+cpR3edLDlcZTLRxnvUM8pswyXNp38zJSx9eWss5b9ZoqVzHhGUC8icF9H5uPxUDzvf4UV7j/tx8pzlKxbW8GCjhR5k89W38vrNATN2Rh6e6MTL3NcvEqrQNYU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314030; c=relaxed/simple; bh=5rfOgISBLmyjOyZ8Fnzh3ZfSqcWEflITTY4405YuFVU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dJ2IXXyrrhphnidBaiPXpAwO2yec2hyppbCUHlk0Ykmj3lWE3hJD0bkY2wcu39zEcnHa1AX4it0zHD/5mOvisSewXZJ8OXuw0zY/jmSKKYdu61BvClbqVncYarGIKCsGM2skBU+aUKgixOHYj75DULLScBw9/CnxmSG0gUk2sgY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=d5H4MfiG; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="d5H4MfiG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1766314026; bh=5rfOgISBLmyjOyZ8Fnzh3ZfSqcWEflITTY4405YuFVU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=d5H4MfiGdzom97xzQ4YgHlIohQCyes8i2J0KQ8gBcZrhq45thA8Ky8mWHdlouAMG4 FFLFBxR0Msqa+6sOnAjjsr83ktrTbWZL94tKbrDFrD/1Xo0FdC7NzFv7kZNiS2W7cJ K5axVl67BkFeLOl6Kx/gmAH04PfUqEevQ4l9MJWScIEDTjHAHow/xrwDAp8dN9T3+P GlbnVJ7UgCAp5wAv7RzeUu9DBd8OiiVTuvsiSOrgtWPCjp+mbMUijk9dGEVraXG0C4 5K1YmFdVk4xvfIOlfXyz1WmeGlA8w2arXw4t9YRMCt4NOXTF0Zb+8LQt6OKHvyAssC 1qukXoA278LNA== Received: from localhost (unknown [82.79.138.145]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id EC53717E13D0; Sun, 21 Dec 2025 11:47:05 +0100 (CET) From: Cristian Ciocaltea Date: Sun, 21 Dec 2025 12:46:52 +0200 Subject: [PATCH v5 05/11] phy: rockchip: samsung-hdptx: Enable lane output in common helper 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: quoted-printable Message-Id: <20251221-phy-hdptx-frl-v5-5-dac390a780be@collabora.com> References: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> In-Reply-To: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> To: Vinod Koul , Kishon Vijay Abraham I , Heiko Stuebner , Algea Cao , Dmitry Baryshkov , Neil Armstrong Cc: kernel@collabora.com, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.3 In preparation to support FRL mode, move the PHY lane output enablement from the TMDS specific configuration to the common *_post_enable_lane() helper and make sure it gets turned off in *_phy_disable(). Signed-off-by: Cristian Ciocaltea --- drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c b/drivers/ph= y/rockchip/phy-rockchip-samsung-hdptx.c index ac315061b6ee..7e5e0332f3bf 100644 --- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c @@ -797,6 +797,8 @@ static int rk_hdptx_post_enable_lane(struct rk_hdptx_ph= y *hdptx) HDPTX_I_BIAS_EN | HDPTX_I_BGR_EN; regmap_write(hdptx->grf, GRF_HDPTX_CON0, val); =20 + regmap_write(hdptx->regmap, LNTOP_REG(0207), 0x0f); + ret =3D regmap_read_poll_timeout(hdptx->grf, GRF_HDPTX_STATUS, val, (val & HDPTX_O_PHY_RDY) && (val & HDPTX_O_PLL_LOCK_DONE), @@ -850,6 +852,7 @@ static void rk_hdptx_phy_disable(struct rk_hdptx_phy *h= dptx) usleep_range(20, 30); reset_control_deassert(hdptx->rsts[RST_APB].rstc); =20 + regmap_write(hdptx->regmap, LNTOP_REG(0207), 0x0); regmap_write(hdptx->regmap, LANE_REG(0300), 0x82); regmap_write(hdptx->regmap, SB_REG(010f), 0xc1); regmap_write(hdptx->regmap, SB_REG(0110), 0x1); @@ -1027,7 +1030,6 @@ static int rk_hdptx_tmds_ropll_mode_config(struct rk_= hdptx_phy *hdptx) } =20 regmap_write(hdptx->regmap, LNTOP_REG(0206), 0x07); - regmap_write(hdptx->regmap, LNTOP_REG(0207), 0x0f); =20 rk_hdptx_multi_reg_write(hdptx, rk_hdptx_common_lane_init_seq); rk_hdptx_multi_reg_write(hdptx, rk_hdptx_tmds_lane_init_seq); --=20 2.51.2 From nobody Sun Feb 8 20:17:57 2026 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 9428A288CA6 for ; Sun, 21 Dec 2025 10:47:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314031; cv=none; b=SOKCSp842HIlWLrIm+JuuFvr3EbwJh10GBq8XylsAKAz+GM6HAMXZABj+7Bgh0ygB5wh91XOoRE8HI+Cpr3jt5krZ36C+jZSBiM4JHb0QVqISztNYVw+CjFzsZwNgf2JTds5nOr7cilaFo3uYABzU5lASJIlyHihAFdJDJA2/M0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314031; c=relaxed/simple; bh=bLR5izwlKB8yA90I3hP1Yd4av3ijx/LKiLYcVu8QwyY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BbNl0Ef1y9oP86ZTEjhMHRdlU8lnuvVaEHnqCD61i0uGqKzpdHRgN/RqmTkZ3dcjN5eO73jVkq+f8B5e9WBiJN49IacBALwyKih1RYtN1xUpbqXJ+QYbDz4kitssNatlZ/9W/rKTH5PPnKHsg32bXh+jxO3rc7HvqA1gbybgcz4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=KOQKtxAr; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="KOQKtxAr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1766314027; bh=bLR5izwlKB8yA90I3hP1Yd4av3ijx/LKiLYcVu8QwyY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KOQKtxAr/qpN4+jGGgVGsbcVH8InTJ/vJcK8OroG2ppqgT/83KRstHtLdYS3S3MNe rbqI3gb53JZwttTLqocFkGQB0t1ZxGfi1LtTiJ2pCqoblAsi+vsQG5pb5z+yCndCsp /iT8ucyjH6JY7bFghc+G2caZuYO9yIU5Fu+GHemxXS+/Bub+NbLadVCKO2ieWwAUBn MIxekR7lpzj8XbOm0zmSlxu9obPoI64KVgqSSLb9S78bm6WrlEi58YUljqbKVoMv/w NADVoUWhE18XshkYHFjAsWRzZQatvpj1ZjonTWX6kbxUIj/QuWPZsYH0dEUdpEl1Pv 8aossv7DUR9hQ== Received: from localhost (unknown [82.79.138.145]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id C966617E1404; Sun, 21 Dec 2025 11:47:06 +0100 (CET) From: Cristian Ciocaltea Date: Sun, 21 Dec 2025 12:46:53 +0200 Subject: [PATCH v5 06/11] phy: rockchip: samsung-hdptx: Cleanup *_cmn_init_seq lists 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: quoted-printable Message-Id: <20251221-phy-hdptx-frl-v5-6-dac390a780be@collabora.com> References: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> In-Reply-To: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> To: Vinod Koul , Kishon Vijay Abraham I , Heiko Stuebner , Algea Cao , Dmitry Baryshkov , Neil Armstrong Cc: kernel@collabora.com, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.3 Drop redundant reg_sequence entries from rk_hdptx_common_cmn_init_seq[], i.e. those that are either duplicated or overridden in rk_hdptx_tmds_cmn_init_seq[]. Additionally, a few items do not really belong to the former, hence move them to the latter. That's mostly a preparatory step for adding FRL support. No functional changes intended at this point. Signed-off-by: Cristian Ciocaltea --- drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 22 ++++---------------= --- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c b/drivers/ph= y/rockchip/phy-rockchip-samsung-hdptx.c index 7e5e0332f3bf..42f0ac5a74b1 100644 --- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c @@ -433,13 +433,11 @@ static const struct reg_sequence rk_hdptx_common_cmn_= init_seq[] =3D { REG_SEQ0(CMN_REG(000e), 0x0f), REG_SEQ0(CMN_REG(000f), 0x0f), REG_SEQ0(CMN_REG(0010), 0x04), - REG_SEQ0(CMN_REG(0011), 0x00), REG_SEQ0(CMN_REG(0012), 0x26), REG_SEQ0(CMN_REG(0013), 0x22), REG_SEQ0(CMN_REG(0014), 0x24), REG_SEQ0(CMN_REG(0015), 0x77), REG_SEQ0(CMN_REG(0016), 0x08), - REG_SEQ0(CMN_REG(0017), 0x00), REG_SEQ0(CMN_REG(0018), 0x04), REG_SEQ0(CMN_REG(0019), 0x48), REG_SEQ0(CMN_REG(001a), 0x01), @@ -447,13 +445,7 @@ static const struct reg_sequence rk_hdptx_common_cmn_i= nit_seq[] =3D { REG_SEQ0(CMN_REG(001c), 0x01), REG_SEQ0(CMN_REG(001d), 0x64), REG_SEQ0(CMN_REG(001f), 0x00), - REG_SEQ0(CMN_REG(0026), 0x53), REG_SEQ0(CMN_REG(0029), 0x01), - REG_SEQ0(CMN_REG(0030), 0x00), - REG_SEQ0(CMN_REG(0031), 0x20), - REG_SEQ0(CMN_REG(0032), 0x30), - REG_SEQ0(CMN_REG(0033), 0x0b), - REG_SEQ0(CMN_REG(0034), 0x23), REG_SEQ0(CMN_REG(0035), 0x00), REG_SEQ0(CMN_REG(0038), 0x00), REG_SEQ0(CMN_REG(0039), 0x00), @@ -464,7 +456,6 @@ static const struct reg_sequence rk_hdptx_common_cmn_in= it_seq[] =3D { REG_SEQ0(CMN_REG(003f), 0x83), REG_SEQ0(CMN_REG(0040), 0x06), REG_SEQ0(CMN_REG(0041), 0x20), - REG_SEQ0(CMN_REG(0042), 0xb8), REG_SEQ0(CMN_REG(0043), 0x00), REG_SEQ0(CMN_REG(0044), 0x46), REG_SEQ0(CMN_REG(0045), 0x24), @@ -474,14 +465,9 @@ static const struct reg_sequence rk_hdptx_common_cmn_i= nit_seq[] =3D { REG_SEQ0(CMN_REG(004b), 0x00), REG_SEQ0(CMN_REG(004c), 0x01), REG_SEQ0(CMN_REG(004d), 0x64), - REG_SEQ0(CMN_REG(004e), 0x14), REG_SEQ0(CMN_REG(004f), 0x00), REG_SEQ0(CMN_REG(0050), 0x00), - REG_SEQ0(CMN_REG(005d), 0x0c), REG_SEQ0(CMN_REG(005f), 0x01), - REG_SEQ0(CMN_REG(006b), 0x04), - REG_SEQ0(CMN_REG(0073), 0x30), - REG_SEQ0(CMN_REG(0074), 0x00), REG_SEQ0(CMN_REG(0075), 0x20), REG_SEQ0(CMN_REG(0076), 0x30), REG_SEQ0(CMN_REG(0077), 0x08), @@ -493,13 +479,10 @@ static const struct reg_sequence rk_hdptx_common_cmn_= init_seq[] =3D { REG_SEQ0(CMN_REG(007e), 0x00), REG_SEQ0(CMN_REG(007f), 0x00), REG_SEQ0(CMN_REG(0080), 0x00), - REG_SEQ0(CMN_REG(0081), 0x09), REG_SEQ0(CMN_REG(0082), 0x04), REG_SEQ0(CMN_REG(0083), 0x24), REG_SEQ0(CMN_REG(0084), 0x20), REG_SEQ0(CMN_REG(0085), 0x03), - REG_SEQ0(CMN_REG(0086), 0x01), - REG_SEQ0(CMN_REG(0087), 0x0c), REG_SEQ0(CMN_REG(008a), 0x55), REG_SEQ0(CMN_REG(008b), 0x25), REG_SEQ0(CMN_REG(008c), 0x2c), @@ -511,7 +494,6 @@ static const struct reg_sequence rk_hdptx_common_cmn_in= it_seq[] =3D { REG_SEQ0(CMN_REG(0092), 0x00), REG_SEQ0(CMN_REG(0093), 0x00), REG_SEQ0(CMN_REG(009a), 0x11), - REG_SEQ0(CMN_REG(009b), 0x10), }; =20 static const struct reg_sequence rk_hdptx_tmds_cmn_init_seq[] =3D { @@ -545,9 +527,13 @@ static const struct reg_sequence rk_hdptx_tmds_cmn_ini= t_seq[] =3D { REG_SEQ0(CMN_REG(0048), 0x11), REG_SEQ0(CMN_REG(004e), 0x34), REG_SEQ0(CMN_REG(005c), 0x25), + REG_SEQ0(CMN_REG(005d), 0x0c), REG_SEQ0(CMN_REG(005e), 0x4f), + REG_SEQ0(CMN_REG(006b), 0x04), + REG_SEQ0(CMN_REG(0073), 0x30), REG_SEQ0(CMN_REG(0074), 0x04), REG_SEQ0(CMN_REG(0081), 0x01), + REG_SEQ0(CMN_REG(0086), 0x01), REG_SEQ0(CMN_REG(0087), 0x04), REG_SEQ0(CMN_REG(0089), 0x00), REG_SEQ0(CMN_REG(0095), 0x00), --=20 2.51.2 From nobody Sun Feb 8 20:17:57 2026 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 4DB5B2989B4 for ; Sun, 21 Dec 2025 10:47:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314031; cv=none; b=bkhWtJz29cvVyjuZkgaIepI8vtpkvVv0z573lUb8BEU+AoPBPZptbOQG4e/tVybMP7wHdrxsPeU2nwYJB3nKPTvrzUIdvXd2QFHRtOyM9iMFtIYiPGJ9/+NsB8Y9Nz7D4AY5W2fB1w9LrDw0Bl6hrbSwt96kzdqhahBY8vPQYvc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314031; c=relaxed/simple; bh=kDXcyjHMjIrOytzsZ+Lma1zPlSuP3hSoSfDGQ8aV6Wk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gJ9Gh6bkHkKGrqH7J1wIOE5SqTVcfNgM0uNe6o9Egfy8adSEYEH7/FKh8hUR1wDuB0PrF3t5r0Kt155NnqOVpFUtM0fOgCHaIgzAXdjAgZXlibZYwEAJlhlQAzYlyNtQeP3+XgwAwWfctvSOKzW3DKa3K1Ncj7C0Y/W/1xGOjYI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=HqHfxUpI; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="HqHfxUpI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1766314027; bh=kDXcyjHMjIrOytzsZ+Lma1zPlSuP3hSoSfDGQ8aV6Wk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HqHfxUpIR/VQ4vr5TpYaGljM9/Kmxesu0pgHXvKkKBs67iyd8z9Nhvik4fih9OMGd EqfuLlG8bVMmqBJgj5OQHqk+f7MdrbR/7zTtV9x9P2vA9RhVKP6FtrKJl8GHkqXy0E tiWlkkpfjWGcvifPce9DNyFe1SUZwcNirnUiWq4RF29CoboNBLMtzkJ6kuYfoXeWBS 2AnuSBU12cS4PEKPDNtJ/ZBpsNKYN8MYckYP00osNv1Coja0U8jKkVWFIBT1srBb0J /lqXu3BY7LWQP4xULAvmIz6U29cui820iR9bt5axwpODL7zFJAvNtxi4TS1da+VjQB a5291X7IaQtQA== Received: from localhost (unknown [82.79.138.145]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id 9D7DD17E0506; Sun, 21 Dec 2025 11:47:07 +0100 (CET) From: Cristian Ciocaltea Date: Sun, 21 Dec 2025 12:46:54 +0200 Subject: [PATCH v5 07/11] phy: rockchip: samsung-hdptx: Compute clk rate from PLL config 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: quoted-printable Message-Id: <20251221-phy-hdptx-frl-v5-7-dac390a780be@collabora.com> References: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> In-Reply-To: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> To: Vinod Koul , Kishon Vijay Abraham I , Heiko Stuebner , Algea Cao , Dmitry Baryshkov , Neil Armstrong Cc: kernel@collabora.com, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.3 Improve ->recalc_rate() callback of hdptx_phy_clk_ops to calculate the initial clock rate based on the actual PHY PLL configuration as retrieved from the related hardware registers. Signed-off-by: Cristian Ciocaltea --- drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 91 +++++++++++++++++++= +++- 1 file changed, 90 insertions(+), 1 deletion(-) diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c b/drivers/ph= y/rockchip/phy-rockchip-samsung-hdptx.c index 42f0ac5a74b1..c2d2f2468ba2 100644 --- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c @@ -1818,12 +1818,101 @@ static void rk_hdptx_phy_clk_unprepare(struct clk_= hw *hw) rk_hdptx_phy_consumer_put(hdptx, true); } =20 +#define PLL_REF_CLK 24000000ULL + +static u64 rk_hdptx_phy_clk_calc_rate_from_pll_cfg(struct rk_hdptx_phy *hd= ptx) +{ + struct ropll_config ropll_hw; + u64 fout, sdm; + u32 mode, val; + int ret; + + ret =3D regmap_read(hdptx->regmap, CMN_REG(0008), &mode); + if (ret) + return 0; + + if (mode & LCPLL_LCVCO_MODE_EN_MASK) + return 0; + + ret =3D regmap_read(hdptx->regmap, CMN_REG(0051), &val); + if (ret) + return 0; + ropll_hw.pms_mdiv =3D val; + + ret =3D regmap_read(hdptx->regmap, CMN_REG(005E), &val); + if (ret) + return 0; + ropll_hw.sdm_en =3D val & ROPLL_SDM_EN_MASK; + + ret =3D regmap_read(hdptx->regmap, CMN_REG(0064), &val); + if (ret) + return 0; + ropll_hw.sdm_num_sign =3D val & ROPLL_SDM_NUM_SIGN_RBR_MASK; + + ret =3D regmap_read(hdptx->regmap, CMN_REG(0065), &val); + if (ret) + return 0; + ropll_hw.sdm_num =3D val; + + ret =3D regmap_read(hdptx->regmap, CMN_REG(0060), &val); + if (ret) + return 0; + ropll_hw.sdm_deno =3D val; + + ret =3D regmap_read(hdptx->regmap, CMN_REG(0069), &val); + if (ret) + return 0; + ropll_hw.sdc_n =3D (val & ROPLL_SDC_N_RBR_MASK) + 3; + + ret =3D regmap_read(hdptx->regmap, CMN_REG(006c), &val); + if (ret) + return 0; + ropll_hw.sdc_num =3D val; + + ret =3D regmap_read(hdptx->regmap, CMN_REG(0070), &val); + if (ret) + return 0; + ropll_hw.sdc_deno =3D val; + + ret =3D regmap_read(hdptx->regmap, CMN_REG(0086), &val); + if (ret) + return 0; + ropll_hw.pms_sdiv =3D ((val & PLL_PCG_POSTDIV_SEL_MASK) >> 4) + 1; + + fout =3D PLL_REF_CLK * ropll_hw.pms_mdiv; + if (ropll_hw.sdm_en) { + sdm =3D div_u64(PLL_REF_CLK * ropll_hw.sdc_deno * + ropll_hw.pms_mdiv * ropll_hw.sdm_num, + 16 * ropll_hw.sdm_deno * + (ropll_hw.sdc_deno * ropll_hw.sdc_n - ropll_hw.sdc_num)); + + if (ropll_hw.sdm_num_sign) + fout =3D fout - sdm; + else + fout =3D fout + sdm; + } + + return div_u64(fout * 2, ropll_hw.pms_sdiv * 10); +} + static unsigned long rk_hdptx_phy_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { struct rk_hdptx_phy *hdptx =3D to_rk_hdptx_phy(hw); + u32 status; + u64 rate; + int ret; + + if (hdptx->hw_rate) + return hdptx->hw_rate; + + ret =3D regmap_read(hdptx->grf, GRF_HDPTX_CON0, &status); + if (ret || !(status & HDPTX_I_PLL_EN)) + return 0; + + rate =3D rk_hdptx_phy_clk_calc_rate_from_pll_cfg(hdptx); =20 - return hdptx->hw_rate; + return DIV_ROUND_CLOSEST_ULL(rate * 8, hdptx->hdmi_cfg.bpc); } =20 static long rk_hdptx_phy_clk_round_rate(struct clk_hw *hw, unsigned long r= ate, --=20 2.51.2 From nobody Sun Feb 8 20:17:57 2026 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 8169B299947 for ; Sun, 21 Dec 2025 10:47:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314032; cv=none; b=OtS19FGhcQbrXX0WF19woDy55tvghOgdDfM9PaJqTS980tXNWnbinaeZELroBEY5iBsG3O7or/CkoKASULNXuX2F2iaCNCCdEkHiyqVK6zzQbDGqwOWZw/Ja3sYA4Hntv836Za4CC7VXBx63a2nxrBOOkBD5+Uog2/hOU0BVg7U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314032; c=relaxed/simple; bh=pkrTHhkieAKBxBYD20sxtrfyc/Bzjx9yUWbb8SYks40=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=foMAV99U4quU7eSjsEV4AgC+ECOKaxpI+LhEFed6JpEASX6T3p6cov3bXfNAEiDbbUcCYRIKQiRH48wOfQZqGffT5tdtUbReZqbD+oYJfwV4/E2CRWK8IkYGWtM7PNEEjMX7UUrkcUsRojRtmHR21w2FEfzV17/UhXGmWVVAPhI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=YpZQu4+C; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="YpZQu4+C" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1766314028; bh=pkrTHhkieAKBxBYD20sxtrfyc/Bzjx9yUWbb8SYks40=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=YpZQu4+C3iE8xIhcjAz8rUSLJjp0vA3IHSXYYgUOm3xV0RHSBsPWXPzVxrtsPFThi ZRkLdrRc8N7YkgiaXJFXawET6ZvOAh+vJLAsDLl89hSnuteX/0O792ryfF/NOoHy7y JcUq2t234psTdvyETXZQFLAyO4pnGz7W9oYHvQiGMgXylY3bBEG4K8dodW/j5K/FBG 57bj2uD6KQN2zrIYS2mdChnBXjPQj8UujHXb3vejox1Tbg36CkZdDHMycRoxv7h4Ms Ru2F5sBKns2q+07F/AXhxxdVDCw5p13j2wpeCINPgzhf86cIMKAaFKe8Ly4dpoIb1k b6/omHP3nEAGg== Received: from localhost (unknown [82.79.138.145]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id 6F57B17E12E8; Sun, 21 Dec 2025 11:47:08 +0100 (CET) From: Cristian Ciocaltea Date: Sun, 21 Dec 2025 12:46:55 +0200 Subject: [PATCH v5 08/11] phy: rockchip: samsung-hdptx: Drop hw_rate driver data 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: quoted-printable Message-Id: <20251221-phy-hdptx-frl-v5-8-dac390a780be@collabora.com> References: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> In-Reply-To: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> To: Vinod Koul , Kishon Vijay Abraham I , Heiko Stuebner , Algea Cao , Dmitry Baryshkov , Neil Armstrong Cc: kernel@collabora.com, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.3 The ->hw_rate member of struct rk_hdptx_phy was mainly used to keep track of the clock rate programmed in hardware and support implementing the ->recalc_rate() callback in hdptx_phy_clk_ops. Computing the clock rate from the actual PHY PLL configuration seems to work reliably, hence remove the now redundant struct member. Signed-off-by: Cristian Ciocaltea --- drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c b/drivers/ph= y/rockchip/phy-rockchip-samsung-hdptx.c index c2d2f2468ba2..5a534c53a52d 100644 --- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c @@ -387,7 +387,6 @@ struct rk_hdptx_phy { =20 /* clk provider */ struct clk_hw hw; - unsigned long hw_rate; bool restrict_rate_change; =20 atomic_t usage_count; @@ -931,7 +930,7 @@ static int rk_hdptx_tmds_ropll_cmn_config(struct rk_hdp= tx_phy *hdptx) { const struct ropll_config *cfg =3D NULL; struct ropll_config rc =3D {0}; - int ret, i; + int i; =20 if (!hdptx->hdmi_cfg.tmds_char_rate) return 0; @@ -993,12 +992,7 @@ static int rk_hdptx_tmds_ropll_cmn_config(struct rk_hd= ptx_phy *hdptx) regmap_update_bits(hdptx->regmap, CMN_REG(0086), PLL_PCG_CLK_EN_MASK, FIELD_PREP(PLL_PCG_CLK_EN_MASK, 0x1)); =20 - ret =3D rk_hdptx_post_enable_pll(hdptx); - if (!ret) - hdptx->hw_rate =3D DIV_ROUND_CLOSEST_ULL(hdptx->hdmi_cfg.tmds_char_rate = * 8, - hdptx->hdmi_cfg.bpc); - - return ret; + return rk_hdptx_post_enable_pll(hdptx); } =20 static int rk_hdptx_tmds_ropll_mode_config(struct rk_hdptx_phy *hdptx) @@ -1903,9 +1897,6 @@ static unsigned long rk_hdptx_phy_clk_recalc_rate(str= uct clk_hw *hw, u64 rate; int ret; =20 - if (hdptx->hw_rate) - return hdptx->hw_rate; - ret =3D regmap_read(hdptx->grf, GRF_HDPTX_CON0, &status); if (ret || !(status & HDPTX_I_PLL_EN)) return 0; --=20 2.51.2 From nobody Sun Feb 8 20:17:57 2026 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 172B5299AA9 for ; Sun, 21 Dec 2025 10:47:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314033; cv=none; b=q2wDZwvaFhBSwobweQat2jMsJtp1V2JVsvOQHbHcPa/WDrQ6hPNItr866M5txA16ahtP5TH8JEBEX3rHsanl1rbn+JE3bmy9szy5lPsZ6hRit8M4dVbCt5SEDHDug3T8titBl7RBLLvW6GLNFPeqybng63Mk9Q8i7HvZPTT0Wb4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314033; c=relaxed/simple; bh=A+uwENkGHcgMbTr9ZKV4OLhPhNTxapb5MY4SXE73Flg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CbgKndIal7a8W2wUGrI3ANBnEwid1vvk99W4CdncNU8LTaDC6d7R7u4cS9gbpQkzdMf9wQpkLz24IknwSgTx4PN+PhSRmluPCjjboDKApuIhRKzqwwWtMN3lh3GxOSbdV7eZTYp03OUyHR4z8093ETimeFcBND0KjK1AQobScpM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=KJx3pzuW; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="KJx3pzuW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1766314029; bh=A+uwENkGHcgMbTr9ZKV4OLhPhNTxapb5MY4SXE73Flg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KJx3pzuW+epPA/n6tgZ5VVad7p0Lkm5UL3NsAn6Fq0N6byq7rPakeWp7fZK9WcZVB 6RmCMP7bbn+jh0X5olQAIM0g56G7INTdA0b3hupyQh3YN3de4W1PyOBrwnjvWceIE6 slQsJIkUazgxvfU3iX20WcRYdiawTrLMotk7+Qtcw0FQU/PgCfo+MKT5O0iVKvr378 3NqsOQNNfWAUln68zwoobVilklihuQziD68lRlecPrRCRK2Q0c2ioVzr+K7tpR/vV/ Lu75NTmIZB27c6NXcJDYZXtMjNE+9ICGC8z7O3kn3tZIc6cM+Jf40g3KQYd6bTJuo1 ImgSXHjUKMpUA== Received: from localhost (unknown [82.79.138.145]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id 4169E17E1513; Sun, 21 Dec 2025 11:47:09 +0100 (CET) From: Cristian Ciocaltea Date: Sun, 21 Dec 2025 12:46:56 +0200 Subject: [PATCH v5 09/11] phy: rockchip: samsung-hdptx: Switch to driver specific HDMI config 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: quoted-printable Message-Id: <20251221-phy-hdptx-frl-v5-9-dac390a780be@collabora.com> References: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> In-Reply-To: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> To: Vinod Koul , Kishon Vijay Abraham I , Heiko Stuebner , Algea Cao , Dmitry Baryshkov , Neil Armstrong Cc: kernel@collabora.com, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.3 In preparation to support the FRL operation mode which gets configured via the lanes and rate per lane tuple, switch to a driver specific struct for configuring the link rate and bpc. This simplifies and optimizes the implementation by allowing implicit switches between TMDS and FRL rates, without requiring additional checks of the active PHY mode followed by recalculations of the link rate when operating in FRL mode. Signed-off-by: Cristian Ciocaltea --- drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 44 +++++++++++++------= ---- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c b/drivers/ph= y/rockchip/phy-rockchip-samsung-hdptx.c index 5a534c53a52d..3bec69058f7b 100644 --- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c @@ -373,6 +373,11 @@ struct rk_hdptx_phy_cfg { unsigned int phy_ids[MAX_HDPTX_PHY_NUM]; }; =20 +struct rk_hdptx_hdmi_cfg { + unsigned long long rate; + unsigned int bpc; +}; + struct rk_hdptx_phy { struct device *dev; struct regmap *regmap; @@ -380,7 +385,7 @@ struct rk_hdptx_phy { =20 int phy_id; struct phy *phy; - struct phy_configure_opts_hdmi hdmi_cfg; + struct rk_hdptx_hdmi_cfg hdmi_cfg; struct clk_bulk_data *clks; int nr_clks; struct reset_control_bulk_data rsts[RST_MAX]; @@ -932,19 +937,19 @@ static int rk_hdptx_tmds_ropll_cmn_config(struct rk_h= dptx_phy *hdptx) struct ropll_config rc =3D {0}; int i; =20 - if (!hdptx->hdmi_cfg.tmds_char_rate) + if (!hdptx->hdmi_cfg.rate) return 0; =20 for (i =3D 0; i < ARRAY_SIZE(rk_hdptx_tmds_ropll_cfg); i++) - if (hdptx->hdmi_cfg.tmds_char_rate =3D=3D rk_hdptx_tmds_ropll_cfg[i].rat= e) { + if (hdptx->hdmi_cfg.rate =3D=3D rk_hdptx_tmds_ropll_cfg[i].rate) { cfg =3D &rk_hdptx_tmds_ropll_cfg[i]; break; } =20 if (!cfg) { - if (!rk_hdptx_phy_clk_pll_calc(hdptx->hdmi_cfg.tmds_char_rate, &rc)) { + if (!rk_hdptx_phy_clk_pll_calc(hdptx->hdmi_cfg.rate, &rc)) { dev_err(hdptx->dev, "%s cannot find pll cfg for rate=3D%llu\n", - __func__, hdptx->hdmi_cfg.tmds_char_rate); + __func__, hdptx->hdmi_cfg.rate); return -EINVAL; } =20 @@ -952,7 +957,7 @@ static int rk_hdptx_tmds_ropll_cmn_config(struct rk_hdp= tx_phy *hdptx) } =20 dev_dbg(hdptx->dev, "%s rate=3D%llu mdiv=3D%u sdiv=3D%u sdm_en=3D%u k_sig= n=3D%u k=3D%u lc=3D%u\n", - __func__, hdptx->hdmi_cfg.tmds_char_rate, cfg->pms_mdiv, cfg->pms_sdiv += 1, + __func__, hdptx->hdmi_cfg.rate, cfg->pms_mdiv, cfg->pms_sdiv + 1, cfg->sdm_en, cfg->sdm_num_sign, cfg->sdm_num, cfg->sdm_deno); =20 rk_hdptx_pre_power_up(hdptx); @@ -1001,7 +1006,7 @@ static int rk_hdptx_tmds_ropll_mode_config(struct rk_= hdptx_phy *hdptx) =20 regmap_write(hdptx->regmap, LNTOP_REG(0200), 0x06); =20 - if (hdptx->hdmi_cfg.tmds_char_rate > HDMI14_MAX_RATE) { + if (hdptx->hdmi_cfg.rate > HDMI14_MAX_RATE) { /* For 1/40 bitrate clk */ rk_hdptx_multi_reg_write(hdptx, rk_hdptx_tmds_lntop_highbr_seq); } else { @@ -1372,19 +1377,19 @@ static int rk_hdptx_phy_power_on(struct phy *phy) int ret, lane; =20 if (mode !=3D PHY_MODE_DP) { - if (!hdptx->hdmi_cfg.tmds_char_rate) { + if (!hdptx->hdmi_cfg.rate) { /* * FIXME: Temporary workaround to setup TMDS char rate * from the RK DW HDMI QP bridge driver. * Will be removed as soon the switch to the HDMI PHY * configuration API has been completed on both ends. */ - hdptx->hdmi_cfg.tmds_char_rate =3D phy_get_bus_width(hdptx->phy) & 0xff= fffff; - hdptx->hdmi_cfg.tmds_char_rate *=3D 100; + hdptx->hdmi_cfg.rate =3D phy_get_bus_width(hdptx->phy) & 0xfffffff; + hdptx->hdmi_cfg.rate *=3D 100; } =20 dev_dbg(hdptx->dev, "%s rate=3D%llu bpc=3D%u\n", __func__, - hdptx->hdmi_cfg.tmds_char_rate, hdptx->hdmi_cfg.bpc); + hdptx->hdmi_cfg.rate, hdptx->hdmi_cfg.bpc); } =20 ret =3D rk_hdptx_phy_consumer_get(hdptx); @@ -1731,12 +1736,13 @@ static int rk_hdptx_phy_configure(struct phy *phy, = union phy_configure_opts *opt if (ret) { dev_err(hdptx->dev, "invalid hdmi params for phy configure\n"); } else { - hdptx->hdmi_cfg =3D opts->hdmi; + hdptx->hdmi_cfg.rate =3D opts->hdmi.tmds_char_rate; + hdptx->hdmi_cfg.bpc =3D opts->hdmi.bpc; hdptx->restrict_rate_change =3D true; } =20 dev_dbg(hdptx->dev, "%s rate=3D%llu bpc=3D%u\n", __func__, - hdptx->hdmi_cfg.tmds_char_rate, hdptx->hdmi_cfg.bpc); + hdptx->hdmi_cfg.rate, hdptx->hdmi_cfg.bpc); return ret; } =20 @@ -1916,7 +1922,7 @@ static long rk_hdptx_phy_clk_round_rate(struct clk_hw= *hw, unsigned long rate, * To be dropped as soon as the RK DW HDMI QP bridge driver * switches to make use of phy_configure(). */ - if (!hdptx->restrict_rate_change && rate !=3D hdptx->hdmi_cfg.tmds_char_r= ate) { + if (!hdptx->restrict_rate_change && rate !=3D hdptx->hdmi_cfg.rate) { struct phy_configure_opts_hdmi hdmi =3D { .tmds_char_rate =3D rate, }; @@ -1925,7 +1931,7 @@ static long rk_hdptx_phy_clk_round_rate(struct clk_hw= *hw, unsigned long rate, if (ret) return ret; =20 - hdptx->hdmi_cfg =3D hdmi; + hdptx->hdmi_cfg.rate =3D rate; } =20 /* @@ -1933,7 +1939,7 @@ static long rk_hdptx_phy_clk_round_rate(struct clk_hw= *hw, unsigned long rate, * hence ensure rk_hdptx_phy_clk_set_rate() won't be invoked with * a different rate argument. */ - return DIV_ROUND_CLOSEST_ULL(hdptx->hdmi_cfg.tmds_char_rate * 8, hdptx->h= dmi_cfg.bpc); + return DIV_ROUND_CLOSEST_ULL(hdptx->hdmi_cfg.rate * 8, hdptx->hdmi_cfg.bp= c); } =20 static int rk_hdptx_phy_clk_set_rate(struct clk_hw *hw, unsigned long rate, @@ -1943,10 +1949,10 @@ static int rk_hdptx_phy_clk_set_rate(struct clk_hw = *hw, unsigned long rate, unsigned long long tmds_rate =3D DIV_ROUND_CLOSEST_ULL(rate * hdptx->hdmi= _cfg.bpc, 8); =20 /* Revert any unlikely TMDS char rate change since round_rate() */ - if (hdptx->hdmi_cfg.tmds_char_rate !=3D tmds_rate) { + if (hdptx->hdmi_cfg.rate !=3D tmds_rate) { dev_warn(hdptx->dev, "Reverting unexpected rate change from %llu to %llu= \n", - tmds_rate, hdptx->hdmi_cfg.tmds_char_rate); - hdptx->hdmi_cfg.tmds_char_rate =3D tmds_rate; + tmds_rate, hdptx->hdmi_cfg.rate); + hdptx->hdmi_cfg.rate =3D tmds_rate; } =20 /* --=20 2.51.2 From nobody Sun Feb 8 20:17:57 2026 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 AB4DA29A312 for ; Sun, 21 Dec 2025 10:47:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314033; cv=none; b=LUGhObdSYCz9qvAKXR38jF4F2WfhLRWaER1NWOd/O0L3sUiZoa4mm+XHhuDFje5X4DhTMmR1NsCycgl632FXC4NN4BRvHPBp+gmlT/UZ/FDX3uHUECvY+wPpStUuadeqT8+tS6QG64vt5aSCv1qNIoAAg0X4VolCpYMJhM9zhFg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314033; c=relaxed/simple; bh=ty7rHkOBss4XtGNZPB+rY4ONc7mJMM6L//EU0KH5icE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PCa5KxZMq2wvxNMovV8q9qsut8jlzn7PHmgvhU7pFviSf+MUuoFm7vSWPKdUOO943Mc750zoW3UfSDYli02V2U4ZqkJkl3UBRQT1AnXRU9nZsXWzAmZQJxp3s6DhdF+peGRs+GfOHWJ+xJj+YcqVWbZiY1pqnAxl7PkNSX2e2V8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=f2gwIOkI; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="f2gwIOkI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1766314030; bh=ty7rHkOBss4XtGNZPB+rY4ONc7mJMM6L//EU0KH5icE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=f2gwIOkIjo4DegkSbebeUFtOHMsrE0GnwQpcszgkRBexSxKXpqKMkubIsP5nf3yxT h1EvKVj/E46H8sa/da0tMljbN3K6fQ3bKTFM62Inyfk6aLibHxb/cmV79YscRfsHIh vci6pD2mwkuxZXJENidUJ4W8hyxmV6+mxhQm4K+YQxzRtzkPNDkWC+FmBbWaOgb+uf RguynmVAq6oliRB4BKg4dE9VfC12V6KeemhENpBRTTBhx05BTZd+72CfphMP/YkBWu ceoUnVZ2jGJ+dsnb6v6ofa+4owXSHO85WhUpxoZty4ed+94W8C/t46XUdjt5wiAu7w i0Q5OG8+Fdm8g== Received: from localhost (unknown [82.79.138.145]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id 17ACC17E1517; Sun, 21 Dec 2025 11:47:10 +0100 (CET) From: Cristian Ciocaltea Date: Sun, 21 Dec 2025 12:46:57 +0200 Subject: [PATCH v5 10/11] phy: rockchip: samsung-hdptx: Extend rk_hdptx_phy_verify_hdmi_config() helper 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: quoted-printable Message-Id: <20251221-phy-hdptx-frl-v5-10-dac390a780be@collabora.com> References: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> In-Reply-To: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> To: Vinod Koul , Kishon Vijay Abraham I , Heiko Stuebner , Algea Cao , Dmitry Baryshkov , Neil Armstrong Cc: kernel@collabora.com, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.3 In order to facilitate introduction of HDMI 2.1 FRL support and to avoid recomputing the link rate after verifying the HDMI configuration given as input, extend rk_hdptx_phy_verify_hdmi_config() by providing an optional output parameter to store the validated configuration. For improved code readability, also rename the existing hdmi input parameter. Signed-off-by: Cristian Ciocaltea --- drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 35 ++++++++++++-------= ---- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c b/drivers/ph= y/rockchip/phy-rockchip-samsung-hdptx.c index 3bec69058f7b..ecf024b5414f 100644 --- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c @@ -1439,25 +1439,24 @@ static int rk_hdptx_phy_power_off(struct phy *phy) } =20 static int rk_hdptx_phy_verify_hdmi_config(struct rk_hdptx_phy *hdptx, - struct phy_configure_opts_hdmi *hdmi) + struct phy_configure_opts_hdmi *hdmi_in, + struct rk_hdptx_hdmi_cfg *hdmi_out) { int i; =20 - if (!hdmi->tmds_char_rate || hdmi->tmds_char_rate > HDMI20_MAX_RATE) + if (!hdmi_in->tmds_char_rate || hdmi_in->tmds_char_rate > HDMI20_MAX_RATE) return -EINVAL; =20 for (i =3D 0; i < ARRAY_SIZE(rk_hdptx_tmds_ropll_cfg); i++) - if (hdmi->tmds_char_rate =3D=3D rk_hdptx_tmds_ropll_cfg[i].rate) + if (hdmi_in->tmds_char_rate =3D=3D rk_hdptx_tmds_ropll_cfg[i].rate) break; =20 if (i =3D=3D ARRAY_SIZE(rk_hdptx_tmds_ropll_cfg) && - !rk_hdptx_phy_clk_pll_calc(hdmi->tmds_char_rate, NULL)) + !rk_hdptx_phy_clk_pll_calc(hdmi_in->tmds_char_rate, NULL)) return -EINVAL; =20 - if (!hdmi->bpc) - hdmi->bpc =3D 8; - - switch (hdmi->bpc) { + switch (hdmi_in->bpc) { + case 0: case 8: case 10: case 12: @@ -1467,6 +1466,11 @@ static int rk_hdptx_phy_verify_hdmi_config(struct rk= _hdptx_phy *hdptx, return -EINVAL; } =20 + if (hdmi_out) { + hdmi_out->rate =3D hdmi_in->tmds_char_rate; + hdmi_out->bpc =3D hdmi_in->bpc ?: 8; + } + return 0; } =20 @@ -1732,17 +1736,15 @@ static int rk_hdptx_phy_configure(struct phy *phy, = union phy_configure_opts *opt int ret; =20 if (mode !=3D PHY_MODE_DP) { - ret =3D rk_hdptx_phy_verify_hdmi_config(hdptx, &opts->hdmi); + ret =3D rk_hdptx_phy_verify_hdmi_config(hdptx, &opts->hdmi, &hdptx->hdmi= _cfg); if (ret) { dev_err(hdptx->dev, "invalid hdmi params for phy configure\n"); } else { - hdptx->hdmi_cfg.rate =3D opts->hdmi.tmds_char_rate; - hdptx->hdmi_cfg.bpc =3D opts->hdmi.bpc; hdptx->restrict_rate_change =3D true; + dev_dbg(hdptx->dev, "%s rate=3D%llu bpc=3D%u\n", __func__, + hdptx->hdmi_cfg.rate, hdptx->hdmi_cfg.bpc); } =20 - dev_dbg(hdptx->dev, "%s rate=3D%llu bpc=3D%u\n", __func__, - hdptx->hdmi_cfg.rate, hdptx->hdmi_cfg.bpc); return ret; } =20 @@ -1786,7 +1788,7 @@ static int rk_hdptx_phy_validate(struct phy *phy, enu= m phy_mode mode, struct rk_hdptx_phy *hdptx =3D phy_get_drvdata(phy); =20 if (mode !=3D PHY_MODE_DP) - return rk_hdptx_phy_verify_hdmi_config(hdptx, &opts->hdmi); + return rk_hdptx_phy_verify_hdmi_config(hdptx, &opts->hdmi, NULL); =20 return rk_hdptx_phy_verify_dp_config(hdptx, &opts->dp); } @@ -1926,12 +1928,11 @@ static long rk_hdptx_phy_clk_round_rate(struct clk_= hw *hw, unsigned long rate, struct phy_configure_opts_hdmi hdmi =3D { .tmds_char_rate =3D rate, }; - int ret =3D rk_hdptx_phy_verify_hdmi_config(hdptx, &hdmi); + + int ret =3D rk_hdptx_phy_verify_hdmi_config(hdptx, &hdmi, &hdptx->hdmi_c= fg); =20 if (ret) return ret; - - hdptx->hdmi_cfg.rate =3D rate; } =20 /* --=20 2.51.2 From nobody Sun Feb 8 20:17:57 2026 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 D6B15296BA5 for ; Sun, 21 Dec 2025 10:47:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314035; cv=none; b=sfy/3qAKfnIIAQKP3J7G8UKa3b7EWBEe5gd2UHGtn2rBoN2czrdBQgMvOyMFH+1mbYr+nDCKr2DnVky3MJhRWbhsNwpS0dImpyRNIYR0+JWrvKz9yDQu3xXtqqsstDXiXk/UpwHE5C7QbHaNhU7M7UW3YJ1YN+bBwNsJTjNUAUo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766314035; c=relaxed/simple; bh=buIJe3N1a5dHHvq2OFYD0l/CyAqzqGwt1CtqNcR+qcw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rwQUAkY/I9HfKrSd/dC0DENc15Ja0slRVRcGHoXTkZX1dkkIVGBYpw1ANErOuNUo1xS99ewbqw4TgYSIfyZImB+T7pueSPAfJ7Ei0ZeM0bAgt0MgSw+23aFluTKIHuKSXDeHFGPB8V2+Z4kJCteQFTkP7IbOpuH6kVcOy71f2k4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=YkqAXFW5; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="YkqAXFW5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1766314031; bh=buIJe3N1a5dHHvq2OFYD0l/CyAqzqGwt1CtqNcR+qcw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=YkqAXFW5zJzUBruOOe4TBT5qX9bPc55FozS42Y8kwKwvWBMMM1dimMPjds5D9DUJP OXWz1dl+zQ+dJVz6bIc38mBqqWuM+IeQsEfcFDPMsKHeLkcYzFD9oIEzTuyYzrsKFy fW5TFjLLlgbmn7o2J/kcFg11fzziBHVawHkHtSMgrnpwmSM/EpMrjAvfIiCQUsmh1u WqRjW64B0NWslX07+B/kyV66l83v3UPqyR0hM2rHweW8ZO8CztbqAujOjFHD47nxGf LHXID3EDjGrfgigg9h6B6gjdPX84GGylmv+XqoCdLRhpGlW7GayLW059CCfLL8+7SA aF3zPH70EXi2A== Received: from localhost (unknown [82.79.138.145]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id EE96717E151A; Sun, 21 Dec 2025 11:47:10 +0100 (CET) From: Cristian Ciocaltea Date: Sun, 21 Dec 2025 12:46:58 +0200 Subject: [PATCH v5 11/11] phy: rockchip: samsung-hdptx: Add HDMI 2.1 FRL support 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: quoted-printable Message-Id: <20251221-phy-hdptx-frl-v5-11-dac390a780be@collabora.com> References: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> In-Reply-To: <20251221-phy-hdptx-frl-v5-0-dac390a780be@collabora.com> To: Vinod Koul , Kishon Vijay Abraham I , Heiko Stuebner , Algea Cao , Dmitry Baryshkov , Neil Armstrong Cc: kernel@collabora.com, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.3 The PHY is capable of handling four HDMI 2.1 Fixed Rate Link (FRL) lanes, and each one can operate at any of the rates of 3Gbps, 6Gbps, 8Gbps, 10Gbps or 12Gbps. Add the necessary driver changes to support the feature. Co-developed-by: Algea Cao Signed-off-by: Algea Cao Signed-off-by: Cristian Ciocaltea --- drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 441 ++++++++++++++++++= ++-- 1 file changed, 418 insertions(+), 23 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c b/drivers/ph= y/rockchip/phy-rockchip-samsung-hdptx.c index ecf024b5414f..cfa9fcb82c1f 100644 --- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c @@ -22,6 +22,7 @@ #include =20 #define GRF_HDPTX_CON0 0x00 +#define LC_REF_CLK_SEL BIT(11) #define HDPTX_I_PLL_EN BIT(7) #define HDPTX_I_BIAS_EN BIT(6) #define HDPTX_I_BGR_EN BIT(5) @@ -322,6 +323,9 @@ =20 #define HDMI14_MAX_RATE 340000000 #define HDMI20_MAX_RATE 600000000 +#define FRL_3G3L_RATE 900000000 +#define FRL_6G3L_RATE 1800000000 +#define FRL_8G4L_RATE 3200000000 =20 enum dp_link_rate { DP_BW_RBR, @@ -329,6 +333,22 @@ enum dp_link_rate { DP_BW_HBR2, }; =20 +struct lcpll_config { + unsigned long long rate; + u8 lcvco_mode_en; + u8 pi_en; + u8 clk_en_100m; + u8 pms_mdiv; + u8 pms_mdiv_afc; + u8 pms_pdiv; + u8 pms_refdiv; + u8 pms_sdiv; + u8 sdm_deno; + u8 sdm_num_sign; + u8 sdm_num; + u8 sdc_n; +}; + struct ropll_config { unsigned long long rate; u8 pms_mdiv; @@ -374,6 +394,7 @@ struct rk_hdptx_phy_cfg { }; =20 struct rk_hdptx_hdmi_cfg { + enum phy_hdmi_mode mode; unsigned long long rate; unsigned int bpc; }; @@ -401,6 +422,16 @@ struct rk_hdptx_phy { unsigned int lanes; }; =20 +static const struct lcpll_config rk_hdptx_frl_lcpll_cfg[] =3D { + /* | pms | s= dm | */ + /* rate, lcen, pien, cken, mdiv, mdafc, pdiv, rdiv, sdiv, deno, n= sig, num, sdcn, */ + { 4800000000ULL, 1, 0, 0, 125, 125, 1, 1, 0, 1, = 0, 0, 2, }, + { 4000000000ULL, 1, 1, 0, 104, 104, 1, 1, 0, 9, = 0, 1, 1, }, + { 2400000000ULL, 1, 0, 0, 125, 125, 1, 1, 1, 1, = 0, 0, 2, }, + { 1800000000ULL, 1, 0, 0, 125, 125, 1, 1, 1, 1, = 0, 0, 2, }, + { 900000000ULL, 1, 0, 0, 125, 125, 1, 1, 3, 1, = 0, 0, 2, }, +}; + static const struct ropll_config rk_hdptx_tmds_ropll_cfg[] =3D { /* | pms | sdm | = sdc | */ /* rate, mdiv, mdafc, pdiv, rdiv, sdiv, en, deno, nsig, num, n, n= um, deno, */ @@ -500,6 +531,110 @@ static const struct reg_sequence rk_hdptx_common_cmn_= init_seq[] =3D { REG_SEQ0(CMN_REG(009a), 0x11), }; =20 +static const struct reg_sequence rk_hdptx_frl_lcpll_cmn_init_seq[] =3D { + REG_SEQ0(CMN_REG(0011), 0x00), + REG_SEQ0(CMN_REG(0017), 0x00), + REG_SEQ0(CMN_REG(0025), 0x10), + REG_SEQ0(CMN_REG(0026), 0x53), + REG_SEQ0(CMN_REG(0027), 0x01), + REG_SEQ0(CMN_REG(0028), 0x0d), + REG_SEQ0(CMN_REG(002e), 0x02), + REG_SEQ0(CMN_REG(002f), 0x0d), + REG_SEQ0(CMN_REG(0030), 0x00), + REG_SEQ0(CMN_REG(0031), 0x20), + REG_SEQ0(CMN_REG(0032), 0x30), + REG_SEQ0(CMN_REG(0033), 0x0b), + REG_SEQ0(CMN_REG(0034), 0x23), + REG_SEQ0(CMN_REG(003d), 0x00), + REG_SEQ0(CMN_REG(0042), 0xb8), + REG_SEQ0(CMN_REG(0046), 0xff), + REG_SEQ0(CMN_REG(0048), 0x44), + REG_SEQ0(CMN_REG(004e), 0x14), + REG_SEQ0(CMN_REG(0051), 0x00), + REG_SEQ0(CMN_REG(0055), 0x00), + REG_SEQ0(CMN_REG(0059), 0x11), + REG_SEQ0(CMN_REG(005a), 0x03), + REG_SEQ0(CMN_REG(005c), 0x05), + REG_SEQ0(CMN_REG(005d), 0x0c), + REG_SEQ0(CMN_REG(005e), 0x07), + REG_SEQ0(CMN_REG(0060), 0x01), + REG_SEQ0(CMN_REG(0064), 0x07), + REG_SEQ0(CMN_REG(0065), 0x00), + REG_SEQ0(CMN_REG(0069), 0x00), + REG_SEQ0(CMN_REG(006b), 0x04), + REG_SEQ0(CMN_REG(006c), 0x00), + REG_SEQ0(CMN_REG(0070), 0x01), + REG_SEQ0(CMN_REG(0073), 0x30), + REG_SEQ0(CMN_REG(0074), 0x00), + REG_SEQ0(CMN_REG(0081), 0x09), + REG_SEQ0(CMN_REG(0086), 0x01), + REG_SEQ0(CMN_REG(0087), 0x0c), + REG_SEQ0(CMN_REG(0089), 0x02), + REG_SEQ0(CMN_REG(0095), 0x00), + REG_SEQ0(CMN_REG(0097), 0x00), + REG_SEQ0(CMN_REG(0099), 0x00), + REG_SEQ0(CMN_REG(009b), 0x10), +}; + +static const struct reg_sequence rk_hdptx_frl_lcpll_ropll_cmn_init_seq[] = =3D { + REG_SEQ0(CMN_REG(0008), 0xd0), + REG_SEQ0(CMN_REG(0011), 0x00), + REG_SEQ0(CMN_REG(0017), 0x00), + REG_SEQ0(CMN_REG(001e), 0x35), + REG_SEQ0(CMN_REG(0020), 0x6b), + REG_SEQ0(CMN_REG(0021), 0x6b), + REG_SEQ0(CMN_REG(0022), 0x11), + REG_SEQ0(CMN_REG(0024), 0x00), + REG_SEQ0(CMN_REG(0025), 0x10), + REG_SEQ0(CMN_REG(0026), 0x53), + REG_SEQ0(CMN_REG(0027), 0x15), + REG_SEQ0(CMN_REG(0028), 0x0d), + REG_SEQ0(CMN_REG(002a), 0x09), + REG_SEQ0(CMN_REG(002b), 0x01), + REG_SEQ0(CMN_REG(002c), 0x02), + REG_SEQ0(CMN_REG(002d), 0x02), + REG_SEQ0(CMN_REG(002e), 0x0d), + REG_SEQ0(CMN_REG(002f), 0x61), + REG_SEQ0(CMN_REG(0030), 0x00), + REG_SEQ0(CMN_REG(0031), 0x20), + REG_SEQ0(CMN_REG(0032), 0x30), + REG_SEQ0(CMN_REG(0033), 0x0b), + REG_SEQ0(CMN_REG(0034), 0x23), + REG_SEQ0(CMN_REG(0037), 0x00), + REG_SEQ0(CMN_REG(003d), 0xc0), + REG_SEQ0(CMN_REG(0042), 0xb8), + REG_SEQ0(CMN_REG(0046), 0xff), + REG_SEQ0(CMN_REG(0048), 0x44), + REG_SEQ0(CMN_REG(004e), 0x14), + REG_SEQ0(CMN_REG(0054), 0x19), + REG_SEQ0(CMN_REG(0058), 0x19), + REG_SEQ0(CMN_REG(0059), 0x11), + REG_SEQ0(CMN_REG(005b), 0x30), + REG_SEQ0(CMN_REG(005c), 0x25), + REG_SEQ0(CMN_REG(005d), 0x14), + REG_SEQ0(CMN_REG(005e), 0x0e), + REG_SEQ0(CMN_REG(0063), 0x01), + REG_SEQ0(CMN_REG(0064), 0x0e), + REG_SEQ0(CMN_REG(0068), 0x00), + REG_SEQ0(CMN_REG(0069), 0x02), + REG_SEQ0(CMN_REG(006b), 0x00), + REG_SEQ0(CMN_REG(006f), 0x00), + REG_SEQ0(CMN_REG(0073), 0x02), + REG_SEQ0(CMN_REG(0074), 0x00), + REG_SEQ0(CMN_REG(007a), 0x00), + REG_SEQ0(CMN_REG(0081), 0x09), + REG_SEQ0(CMN_REG(0086), 0x11), + REG_SEQ0(CMN_REG(0087), 0x0c), + REG_SEQ0(CMN_REG(0089), 0x00), + REG_SEQ0(CMN_REG(0095), 0x03), + REG_SEQ0(CMN_REG(0097), 0x00), + REG_SEQ0(CMN_REG(0099), 0x00), + REG_SEQ0(CMN_REG(009b), 0x10), + REG_SEQ0(CMN_REG(009e), 0x03), + REG_SEQ0(CMN_REG(009f), 0xff), + REG_SEQ0(CMN_REG(00a0), 0x60), +}; + static const struct reg_sequence rk_hdptx_tmds_cmn_init_seq[] =3D { REG_SEQ0(CMN_REG(0008), 0x00), REG_SEQ0(CMN_REG(0011), 0x01), @@ -553,6 +688,16 @@ static const struct reg_sequence rk_hdptx_common_sb_in= it_seq[] =3D { REG_SEQ0(SB_REG(0117), 0x00), }; =20 +static const struct reg_sequence rk_hdptx_frl_lntop_init_seq[] =3D { + REG_SEQ0(LNTOP_REG(0200), 0x04), + REG_SEQ0(LNTOP_REG(0201), 0x00), + REG_SEQ0(LNTOP_REG(0202), 0x00), + REG_SEQ0(LNTOP_REG(0203), 0xf0), + REG_SEQ0(LNTOP_REG(0204), 0xff), + REG_SEQ0(LNTOP_REG(0205), 0xff), + REG_SEQ0(LNTOP_REG(0206), 0x05), +}; + static const struct reg_sequence rk_hdptx_tmds_lntop_highbr_seq[] =3D { REG_SEQ0(LNTOP_REG(0201), 0x00), REG_SEQ0(LNTOP_REG(0202), 0x00), @@ -624,6 +769,38 @@ static const struct reg_sequence rk_hdptx_common_lane_= init_seq[] =3D { REG_SEQ0(LANE_REG(0620), 0xa0), }; =20 +static const struct reg_sequence rk_hdptx_frl_lane_init_seq[] =3D { + REG_SEQ0(LANE_REG(0312), 0x3c), + REG_SEQ0(LANE_REG(0412), 0x3c), + REG_SEQ0(LANE_REG(0512), 0x3c), + REG_SEQ0(LANE_REG(0612), 0x3c), + REG_SEQ0(LANE_REG(0303), 0x2f), + REG_SEQ0(LANE_REG(0403), 0x2f), + REG_SEQ0(LANE_REG(0503), 0x2f), + REG_SEQ0(LANE_REG(0603), 0x2f), + REG_SEQ0(LANE_REG(0305), 0x03), + REG_SEQ0(LANE_REG(0405), 0x03), + REG_SEQ0(LANE_REG(0505), 0x03), + REG_SEQ0(LANE_REG(0605), 0x03), + REG_SEQ0(LANE_REG(0306), 0xfc), + REG_SEQ0(LANE_REG(0406), 0xfc), + REG_SEQ0(LANE_REG(0506), 0xfc), + REG_SEQ0(LANE_REG(0606), 0xfc), + REG_SEQ0(LANE_REG(0305), 0x4f), + REG_SEQ0(LANE_REG(0405), 0x4f), + REG_SEQ0(LANE_REG(0505), 0x4f), + REG_SEQ0(LANE_REG(0605), 0x4f), + REG_SEQ0(LANE_REG(0304), 0x14), + REG_SEQ0(LANE_REG(0404), 0x14), + REG_SEQ0(LANE_REG(0504), 0x14), + REG_SEQ0(LANE_REG(0604), 0x14), + /* Keep Inter-Pair Skew in the limits */ + REG_SEQ0(LANE_REG(031e), 0x02), + REG_SEQ0(LANE_REG(041e), 0x02), + REG_SEQ0(LANE_REG(051e), 0x02), + REG_SEQ0(LANE_REG(061e), 0x02), +}; + static const struct reg_sequence rk_hdptx_tmds_lane_init_seq[] =3D { REG_SEQ0(LANE_REG(0312), 0x00), REG_SEQ0(LANE_REG(0412), 0x00), @@ -787,7 +964,12 @@ static int rk_hdptx_post_enable_lane(struct rk_hdptx_p= hy *hdptx) HDPTX_I_BIAS_EN | HDPTX_I_BGR_EN; regmap_write(hdptx->grf, GRF_HDPTX_CON0, val); =20 - regmap_write(hdptx->regmap, LNTOP_REG(0207), 0x0f); + /* 3 lanes FRL mode */ + if (hdptx->hdmi_cfg.rate =3D=3D FRL_6G3L_RATE || + hdptx->hdmi_cfg.rate =3D=3D FRL_3G3L_RATE) + regmap_write(hdptx->regmap, LNTOP_REG(0207), 0x07); + else + regmap_write(hdptx->regmap, LNTOP_REG(0207), 0x0f); =20 ret =3D regmap_read_poll_timeout(hdptx->grf, GRF_HDPTX_STATUS, val, (val & HDPTX_O_PHY_RDY) && @@ -931,6 +1113,80 @@ static bool rk_hdptx_phy_clk_pll_calc(unsigned long l= ong rate, return true; } =20 +static int rk_hdptx_frl_lcpll_cmn_config(struct rk_hdptx_phy *hdptx) +{ + const struct lcpll_config *cfg =3D NULL; + int i; + + dev_dbg(hdptx->dev, "%s rate=3D%llu\n", __func__, hdptx->hdmi_cfg.rate); + + for (i =3D 0; i < ARRAY_SIZE(rk_hdptx_frl_lcpll_cfg); i++) { + if (hdptx->hdmi_cfg.rate =3D=3D rk_hdptx_frl_lcpll_cfg[i].rate) { + cfg =3D &rk_hdptx_frl_lcpll_cfg[i]; + break; + } + } + + if (!cfg) { + dev_err(hdptx->dev, "%s cannot find pll cfg for rate=3D%llu\n", + __func__, hdptx->hdmi_cfg.rate); + return -EINVAL; + } + + rk_hdptx_pre_power_up(hdptx); + + regmap_write(hdptx->grf, GRF_HDPTX_CON0, LC_REF_CLK_SEL << 16); + + rk_hdptx_multi_reg_write(hdptx, rk_hdptx_common_cmn_init_seq); + rk_hdptx_multi_reg_write(hdptx, rk_hdptx_frl_lcpll_cmn_init_seq); + + regmap_update_bits(hdptx->regmap, CMN_REG(0008), + LCPLL_EN_MASK | LCPLL_LCVCO_MODE_EN_MASK, + FIELD_PREP(LCPLL_EN_MASK, 1) | + FIELD_PREP(LCPLL_LCVCO_MODE_EN_MASK, cfg->lcvco_mode_en)); + + regmap_update_bits(hdptx->regmap, CMN_REG(001e), + LCPLL_PI_EN_MASK | LCPLL_100M_CLK_EN_MASK, + FIELD_PREP(LCPLL_PI_EN_MASK, cfg->pi_en) | + FIELD_PREP(LCPLL_100M_CLK_EN_MASK, cfg->clk_en_100m)); + + regmap_write(hdptx->regmap, CMN_REG(0020), cfg->pms_mdiv); + regmap_write(hdptx->regmap, CMN_REG(0021), cfg->pms_mdiv_afc); + regmap_write(hdptx->regmap, CMN_REG(0022), + (cfg->pms_pdiv << 4) | cfg->pms_refdiv); + regmap_write(hdptx->regmap, CMN_REG(0023), + (cfg->pms_sdiv << 4) | cfg->pms_sdiv); + regmap_write(hdptx->regmap, CMN_REG(002a), cfg->sdm_deno); + regmap_write(hdptx->regmap, CMN_REG(002b), cfg->sdm_num_sign); + regmap_write(hdptx->regmap, CMN_REG(002c), cfg->sdm_num); + + regmap_update_bits(hdptx->regmap, CMN_REG(002d), LCPLL_SDC_N_MASK, + FIELD_PREP(LCPLL_SDC_N_MASK, cfg->sdc_n)); + + regmap_update_bits(hdptx->regmap, CMN_REG(0086), PLL_PCG_POSTDIV_SEL_MASK, + FIELD_PREP(PLL_PCG_POSTDIV_SEL_MASK, cfg->pms_sdiv)); + regmap_update_bits(hdptx->regmap, CMN_REG(0086), PLL_PCG_CLK_SEL_MASK, + FIELD_PREP(PLL_PCG_CLK_SEL_MASK, (hdptx->hdmi_cfg.bpc - 8) >> 1)); + + return rk_hdptx_post_enable_pll(hdptx); +} + +static int rk_hdptx_frl_lcpll_ropll_cmn_config(struct rk_hdptx_phy *hdptx) +{ + dev_dbg(hdptx->dev, "%s rate=3D%llu\n", __func__, hdptx->hdmi_cfg.rate); + + rk_hdptx_pre_power_up(hdptx); + + /* ROPLL input reference clock from LCPLL (cascade mode) */ + regmap_write(hdptx->grf, GRF_HDPTX_CON0, + (LC_REF_CLK_SEL << 16) | LC_REF_CLK_SEL); + + rk_hdptx_multi_reg_write(hdptx, rk_hdptx_common_cmn_init_seq); + rk_hdptx_multi_reg_write(hdptx, rk_hdptx_frl_lcpll_ropll_cmn_init_seq); + + return rk_hdptx_post_enable_pll(hdptx); +} + static int rk_hdptx_tmds_ropll_cmn_config(struct rk_hdptx_phy *hdptx) { const struct ropll_config *cfg =3D NULL; @@ -962,6 +1218,8 @@ static int rk_hdptx_tmds_ropll_cmn_config(struct rk_hd= ptx_phy *hdptx) =20 rk_hdptx_pre_power_up(hdptx); =20 + regmap_write(hdptx->grf, GRF_HDPTX_CON0, LC_REF_CLK_SEL << 16); + rk_hdptx_multi_reg_write(hdptx, rk_hdptx_common_cmn_init_seq); rk_hdptx_multi_reg_write(hdptx, rk_hdptx_tmds_cmn_init_seq); =20 @@ -1000,6 +1258,28 @@ static int rk_hdptx_tmds_ropll_cmn_config(struct rk_= hdptx_phy *hdptx) return rk_hdptx_post_enable_pll(hdptx); } =20 +static int rk_hdptx_pll_cmn_config(struct rk_hdptx_phy *hdptx) +{ + if (hdptx->hdmi_cfg.rate <=3D HDMI20_MAX_RATE) + return rk_hdptx_tmds_ropll_cmn_config(hdptx); + + if (hdptx->hdmi_cfg.rate =3D=3D FRL_8G4L_RATE) + return rk_hdptx_frl_lcpll_ropll_cmn_config(hdptx); + + return rk_hdptx_frl_lcpll_cmn_config(hdptx); +} + +static int rk_hdptx_frl_lcpll_mode_config(struct rk_hdptx_phy *hdptx) +{ + rk_hdptx_multi_reg_write(hdptx, rk_hdptx_common_sb_init_seq); + rk_hdptx_multi_reg_write(hdptx, rk_hdptx_frl_lntop_init_seq); + + rk_hdptx_multi_reg_write(hdptx, rk_hdptx_common_lane_init_seq); + rk_hdptx_multi_reg_write(hdptx, rk_hdptx_frl_lane_init_seq); + + return rk_hdptx_post_enable_lane(hdptx); +} + static int rk_hdptx_tmds_ropll_mode_config(struct rk_hdptx_phy *hdptx) { rk_hdptx_multi_reg_write(hdptx, rk_hdptx_common_sb_init_seq); @@ -1076,7 +1356,7 @@ static int rk_hdptx_phy_consumer_get(struct rk_hdptx_= phy *hdptx) if (mode =3D=3D PHY_MODE_DP) { rk_hdptx_dp_reset(hdptx); } else { - ret =3D rk_hdptx_tmds_ropll_cmn_config(hdptx); + ret =3D rk_hdptx_pll_cmn_config(hdptx); if (ret) goto dec_usage; } @@ -1377,7 +1657,7 @@ static int rk_hdptx_phy_power_on(struct phy *phy) int ret, lane; =20 if (mode !=3D PHY_MODE_DP) { - if (!hdptx->hdmi_cfg.rate) { + if (!hdptx->hdmi_cfg.rate && hdptx->hdmi_cfg.mode !=3D PHY_HDMI_MODE_FRL= ) { /* * FIXME: Temporary workaround to setup TMDS char rate * from the RK DW HDMI QP bridge driver. @@ -1423,7 +1703,11 @@ static int rk_hdptx_phy_power_on(struct phy *phy) regmap_write(hdptx->grf, GRF_HDPTX_CON0, HDPTX_MODE_SEL << 16 | FIELD_PREP(HDPTX_MODE_SEL, 0x0)); =20 - ret =3D rk_hdptx_tmds_ropll_mode_config(hdptx); + if (hdptx->hdmi_cfg.mode =3D=3D PHY_HDMI_MODE_FRL) + ret =3D rk_hdptx_frl_lcpll_mode_config(hdptx); + else + ret =3D rk_hdptx_tmds_ropll_mode_config(hdptx); + if (ret) rk_hdptx_phy_consumer_put(hdptx, true); } @@ -1444,16 +1728,49 @@ static int rk_hdptx_phy_verify_hdmi_config(struct r= k_hdptx_phy *hdptx, { int i; =20 - if (!hdmi_in->tmds_char_rate || hdmi_in->tmds_char_rate > HDMI20_MAX_RATE) - return -EINVAL; + if (hdptx->hdmi_cfg.mode =3D=3D PHY_HDMI_MODE_FRL) { + unsigned long long frl_rate =3D 100000000ULL * hdmi_in->frl.lanes * + hdmi_in->frl.rate_per_lane; =20 - for (i =3D 0; i < ARRAY_SIZE(rk_hdptx_tmds_ropll_cfg); i++) - if (hdmi_in->tmds_char_rate =3D=3D rk_hdptx_tmds_ropll_cfg[i].rate) + switch (hdmi_in->frl.rate_per_lane) { + case 3: + case 6: + case 8: + case 10: + case 12: break; + default: + return -EINVAL; + } =20 - if (i =3D=3D ARRAY_SIZE(rk_hdptx_tmds_ropll_cfg) && - !rk_hdptx_phy_clk_pll_calc(hdmi_in->tmds_char_rate, NULL)) - return -EINVAL; + if (!hdmi_in->frl.lanes || hdmi_in->frl.lanes > 4) + return -EINVAL; + + if (frl_rate !=3D FRL_8G4L_RATE) { + for (i =3D 0; i < ARRAY_SIZE(rk_hdptx_frl_lcpll_cfg); i++) + if (frl_rate =3D=3D rk_hdptx_frl_lcpll_cfg[i].rate) + break; + if (i =3D=3D ARRAY_SIZE(rk_hdptx_frl_lcpll_cfg)) + return -EINVAL; + } + + if (hdmi_out) + hdmi_out->rate =3D frl_rate; + } else { + if (!hdmi_in->tmds_char_rate || hdmi_in->tmds_char_rate > HDMI20_MAX_RAT= E) + return -EINVAL; + + for (i =3D 0; i < ARRAY_SIZE(rk_hdptx_tmds_ropll_cfg); i++) + if (hdmi_in->tmds_char_rate =3D=3D rk_hdptx_tmds_ropll_cfg[i].rate) + break; + + if (i =3D=3D ARRAY_SIZE(rk_hdptx_tmds_ropll_cfg) && + !rk_hdptx_phy_clk_pll_calc(hdmi_in->tmds_char_rate, NULL)) + return -EINVAL; + + if (hdmi_out) + hdmi_out->rate =3D hdmi_in->tmds_char_rate; + } =20 switch (hdmi_in->bpc) { case 0: @@ -1466,10 +1783,8 @@ static int rk_hdptx_phy_verify_hdmi_config(struct rk= _hdptx_phy *hdptx, return -EINVAL; } =20 - if (hdmi_out) { - hdmi_out->rate =3D hdmi_in->tmds_char_rate; + if (hdmi_out) hdmi_out->bpc =3D hdmi_in->bpc ?: 8; - } =20 return 0; } @@ -1729,6 +2044,31 @@ static int rk_hdptx_phy_set_voltages(struct rk_hdptx= _phy *hdptx, return 0; } =20 +static int rk_hdptx_phy_set_mode(struct phy *phy, enum phy_mode mode, int = submode) +{ + struct rk_hdptx_phy *hdptx =3D phy_get_drvdata(phy); + + if (mode =3D=3D PHY_MODE_DP) + return 0; + + if (mode !=3D PHY_MODE_HDMI) { + dev_err(&phy->dev, "invalid PHY mode: %d\n", mode); + return -EINVAL; + } + + switch (submode) { + case PHY_HDMI_MODE_TMDS: + case PHY_HDMI_MODE_FRL: + hdptx->hdmi_cfg.mode =3D submode; + break; + default: + dev_err(&phy->dev, "invalid HDMI mode: %d\n", submode); + return -EINVAL; + } + + return 0; +} + static int rk_hdptx_phy_configure(struct phy *phy, union phy_configure_opt= s *opts) { struct rk_hdptx_phy *hdptx =3D phy_get_drvdata(phy); @@ -1796,6 +2136,7 @@ static int rk_hdptx_phy_validate(struct phy *phy, enu= m phy_mode mode, static const struct phy_ops rk_hdptx_phy_ops =3D { .power_on =3D rk_hdptx_phy_power_on, .power_off =3D rk_hdptx_phy_power_off, + .set_mode =3D rk_hdptx_phy_set_mode, .configure =3D rk_hdptx_phy_configure, .validate =3D rk_hdptx_phy_validate, .owner =3D THIS_MODULE, @@ -1824,17 +2165,62 @@ static void rk_hdptx_phy_clk_unprepare(struct clk_h= w *hw) =20 static u64 rk_hdptx_phy_clk_calc_rate_from_pll_cfg(struct rk_hdptx_phy *hd= ptx) { + struct lcpll_config lcpll_hw; struct ropll_config ropll_hw; u64 fout, sdm; u32 mode, val; - int ret; + int ret, i; =20 ret =3D regmap_read(hdptx->regmap, CMN_REG(0008), &mode); if (ret) return 0; =20 - if (mode & LCPLL_LCVCO_MODE_EN_MASK) + if (mode & LCPLL_LCVCO_MODE_EN_MASK) { + ret =3D regmap_read(hdptx->regmap, CMN_REG(0020), &val); + if (ret) + return 0; + lcpll_hw.pms_mdiv =3D val; + + ret =3D regmap_read(hdptx->regmap, CMN_REG(0023), &val); + if (ret) + return 0; + lcpll_hw.pms_sdiv =3D val & 0xf; + + ret =3D regmap_read(hdptx->regmap, CMN_REG(002B), &val); + if (ret) + return 0; + lcpll_hw.sdm_num_sign =3D val; + + ret =3D regmap_read(hdptx->regmap, CMN_REG(002C), &val); + if (ret) + return 0; + lcpll_hw.sdm_num =3D val; + + ret =3D regmap_read(hdptx->regmap, CMN_REG(002A), &val); + if (ret) + return 0; + lcpll_hw.sdm_deno =3D val; + + ret =3D regmap_read(hdptx->regmap, CMN_REG(002D), &val); + if (ret) + return 0; + lcpll_hw.sdc_n =3D (val & LCPLL_SDC_N_MASK) >> 1; + + for (i =3D 0; i < ARRAY_SIZE(rk_hdptx_frl_lcpll_cfg); i++) { + const struct lcpll_config *cfg =3D &rk_hdptx_frl_lcpll_cfg[i]; + + if (cfg->pms_mdiv =3D=3D lcpll_hw.pms_mdiv && + cfg->pms_sdiv =3D=3D lcpll_hw.pms_sdiv && + cfg->sdm_num_sign =3D=3D lcpll_hw.sdm_num_sign && + cfg->sdm_num =3D=3D lcpll_hw.sdm_num && + cfg->sdm_deno =3D=3D lcpll_hw.sdm_deno && + cfg->sdc_n =3D=3D lcpll_hw.sdc_n) + return cfg->rate; + } + + dev_dbg(hdptx->dev, "%s no FRL match found\n", __func__); return 0; + } =20 ret =3D regmap_read(hdptx->regmap, CMN_REG(0051), &val); if (ret) @@ -1911,6 +2297,9 @@ static unsigned long rk_hdptx_phy_clk_recalc_rate(str= uct clk_hw *hw, =20 rate =3D rk_hdptx_phy_clk_calc_rate_from_pll_cfg(hdptx); =20 + if (hdptx->hdmi_cfg.mode =3D=3D PHY_HDMI_MODE_FRL) + return rate; + return DIV_ROUND_CLOSEST_ULL(rate * 8, hdptx->hdmi_cfg.bpc); } =20 @@ -1919,6 +2308,9 @@ static long rk_hdptx_phy_clk_round_rate(struct clk_hw= *hw, unsigned long rate, { struct rk_hdptx_phy *hdptx =3D to_rk_hdptx_phy(hw); =20 + if (hdptx->hdmi_cfg.mode =3D=3D PHY_HDMI_MODE_FRL) + return hdptx->hdmi_cfg.rate; + /* * FIXME: Temporarily allow altering TMDS char rate via CCF. * To be dropped as soon as the RK DW HDMI QP bridge driver @@ -1947,23 +2339,26 @@ static int rk_hdptx_phy_clk_set_rate(struct clk_hw = *hw, unsigned long rate, unsigned long parent_rate) { struct rk_hdptx_phy *hdptx =3D to_rk_hdptx_phy(hw); - unsigned long long tmds_rate =3D DIV_ROUND_CLOSEST_ULL(rate * hdptx->hdmi= _cfg.bpc, 8); + unsigned long long link_rate =3D rate; + + if (hdptx->hdmi_cfg.mode !=3D PHY_HDMI_MODE_FRL) + link_rate =3D DIV_ROUND_CLOSEST_ULL(rate * hdptx->hdmi_cfg.bpc, 8); =20 - /* Revert any unlikely TMDS char rate change since round_rate() */ - if (hdptx->hdmi_cfg.rate !=3D tmds_rate) { + /* Revert any unlikely link rate change since round_rate() */ + if (hdptx->hdmi_cfg.rate !=3D link_rate) { dev_warn(hdptx->dev, "Reverting unexpected rate change from %llu to %llu= \n", - tmds_rate, hdptx->hdmi_cfg.rate); - hdptx->hdmi_cfg.rate =3D tmds_rate; + link_rate, hdptx->hdmi_cfg.rate); + hdptx->hdmi_cfg.rate =3D link_rate; } =20 /* - * The TMDS char rate would be normally programmed in HW during + * The link rate would be normally programmed in HW during * phy_ops.power_on() or clk_ops.prepare() callbacks, but it might * happen that the former gets fired too late, i.e. after this call, * while the latter being executed only once, i.e. when clock remains * in the prepared state during rate changes. */ - return rk_hdptx_tmds_ropll_cmn_config(hdptx); + return rk_hdptx_pll_cmn_config(hdptx); } =20 static const struct clk_ops hdptx_phy_clk_ops =3D { --=20 2.51.2