From nobody Mon May 25 08:13:39 2026 Received: from smtp.forwardemail.net (smtp.forwardemail.net [121.127.44.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AEF8D413D6C for ; Fri, 15 May 2026 19:55:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=121.127.44.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778874952; cv=none; b=RAOxJ90mPMVMv4PGfE17vWrYt5BsiANCx4Aw+HZ0fpvUacZLPWs1R9w7VLXlldUCv6SDePeSK6ChMkEwt28kuCegPwr9Dt/34mrQC8Tuao8BtNp0xzeRHN3rpGq3RHFmhlWIvNiTe+4Cr9wDDWjAA3Zl6dnX18KT6CAcQCrwAQQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778874952; c=relaxed/simple; bh=cQTRQuDde0X/B8gN6H1VFZ2nYJRnfwn2+JV61YvJd+Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=azwy0dRnCQhxmrpHGcppuN1RmkLOB+WXdVQdWg5wExwawsrjgL7aDW/345BjMvgEZz0YlNhAsYL5+pwLfyRWRWzCMArTSwierrBq9szD7VlLZdLsDgFIBthJdI2v9nr1vRnQOZTxwlF7tF+MysOw4euvkgyc34Vc0gc2+PhTaCk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kwiboo.se; spf=pass smtp.mailfrom=fe-bounces.kwiboo.se; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b=fJoJAU4M; arc=none smtp.client-ip=121.127.44.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kwiboo.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fe-bounces.kwiboo.se Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="fJoJAU4M" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-ID: Date: Subject: Cc: To: From; q=dns/txt; s=fe-e1b5cab7be; t=1778874934; bh=mQVj/vJocDfc9bnl+TBBUvO4ZpEZfSztcJ6eIOcbskY=; b=fJoJAU4MDc8+hB4SIaIdmc9KGoVSfgzoekrZhXU1B87nqTLeKURT0i4nRS8p4wiVQLKlmEZL6 KubLo3xbFP0nDrwuhY6RBdnCD4HU7SWEIHKu6UbongYo4qHfeAzaelyhT/+hmMPGRmRlhVkFT8n VszLwi2Bk1OSQtj04URKGHQ2mjbXSMeK9vHR6IkH3qgrxT3j44QH8ZnHn/NJTwlIOP5hXl+4YH7 ojujQUToWrXQYiwW0yX75z+9Yfuzf9yjB39TCVV0p0fhMlhOKEyD8+VkpAXaOGgg9W58DoxTrX1 ZT7q44hrquhFuMl5tA2oQJdVptgMiYUJ3rxdI1rx67fQ== X-Forward-Email-ID: 6a077a26ad7e292af75a1093 X-Forward-Email-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 121.127.44.73 X-Forward-Email-Version: 2.8.12 X-Forward-Email-Website: https://forwardemail.net X-Complaints-To: abuse@forwardemail.net X-Report-Abuse: abuse@forwardemail.net X-Report-Abuse-To: abuse@forwardemail.net From: Jonas Karlman To: Vinod Koul , Neil Armstrong , Heiko Stuebner Cc: linux-phy@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jonas Karlman Subject: [PATCH v3 1/2] phy: rockchip: inno-hdmi: Add configure() and validate() ops Date: Fri, 15 May 2026 19:55:10 +0000 Message-ID: <20260515195512.1757363-2-jonas@kwiboo.se> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260515195512.1757363-1-jonas@kwiboo.se> References: <20260515195512.1757363-1-jonas@kwiboo.se> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The commit 10ed34d6eaaf ("phy: Add HDMI configuration options") introduced a way for HDMI PHYs to be configured through the generic phy_configure() function. This driver derives the TMDS character rate from the pixel clock and the PHY bus width setting. However, no in-tree consumer of this PHY has ever called phy_set_bus_width() to change the TMDS character rate as only 8-bit RGB output is supported by the HDMI display driver. Add configure() and validate() ops to allow consumers to configure the TMDS character rate using phy_configure(). Fallback to the deprecated way of using the PHY bus width to configure the TMDS character rate. A typical call chain during DRM modeset on a RK3328 device: dw_hdmi_rockchip_encoder_atomic_check(): - inno_hdmi_phy_validate(): pixclock 148500000 tmdsclock 594000000 dw_hdmi_rockchip_encoder_atomic_mode_set(): - inno_hdmi_phy_configure(): pixclock 148500000 - inno_hdmi_phy_validate(): pixclock 148500000 tmdsclock 594000000 vop_crtc_atomic_enable(): - inno_hdmi_phy_rk3328_clk_set_rate(): rate 594000000 tmdsclk 594000000 - inno_hdmi_phy_rk3328_clk_set_rate(): pixclock 594000000 tmdsclock 59400= 0000 - inno_hdmi_phy_rk3328_clk_recalc_rate(): pixclock 594000000 vco 594000000 dw_hdmi_rockchip_encoder_enable(): - inno_hdmi_phy_power_on(): Inno HDMI PHY Power On - inno_hdmi_phy_rk3328_clk_set_rate(): rate 594000000 tmdsclk 594000000 Signed-off-by: Jonas Karlman --- Changes in v3: - Change validate() ops to only validate tmdsclock - Add comments about expected consumer usage - Update commit message with a typical call chain Changes in v2: - Add validate() ops to validate that the TMDS rate is supported - Split out parts that remove the old workaround into a separate patch Patch "drm/rockchip: dw_hdmi: Configure HDMI PHY in atomic_mode_set()" at [1] adds phy_validate() and phy_configure() calls for this HDMI PHY. [1] https://lore.kernel.org/dri-devel/20260510183114.1248840-10-jonas@kwibo= o.se/ --- drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 60 ++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c b/drivers/phy/ro= ckchip/phy-rockchip-inno-hdmi.c index 1483907413fa..efa95c22b3bb 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c @@ -245,6 +245,7 @@ struct inno_hdmi_phy { struct clk *phyclk; unsigned long pixclock; unsigned long tmdsclock; + struct phy_configure_opts_hdmi hdmi_cfg; }; =20 struct pre_pll_config { @@ -554,7 +555,12 @@ static inline void inno_update_bits(struct inno_hdmi_p= hy *inno, u8 reg, static unsigned long inno_hdmi_phy_get_tmdsclk(struct inno_hdmi_phy *inno, unsigned long rate) { - int bus_width =3D phy_get_bus_width(inno->phy); + int bus_width; + + if (inno->hdmi_cfg.tmds_char_rate) + return inno->hdmi_cfg.tmds_char_rate; + + bus_width =3D phy_get_bus_width(inno->phy); =20 switch (bus_width) { case 4: @@ -602,6 +608,55 @@ static irqreturn_t inno_hdmi_phy_rk3328_irq(int irq, v= oid *dev_id) return IRQ_HANDLED; } =20 +static int inno_hdmi_phy_validate(struct phy *phy, enum phy_mode mode, + int submode, union phy_configure_opts *opts) +{ + const struct pre_pll_config *cfg =3D pre_pll_cfg_table; + unsigned long tmdsclock; + + if (!(mode =3D=3D PHY_MODE_HDMI && submode =3D=3D PHY_HDMI_MODE_TMDS)) + return -EINVAL; + + if (!opts->hdmi.tmds_char_rate || opts->hdmi.tmds_char_rate > 594000000) + return -EINVAL; + + /* + * phy_validate() is expected to be called from encoder atomic_check(), + * before the hdmiphy pixel clock is known. Without knowing the actual + * pixel clock, we cannot do full validation of the configuration. + * Instead, we do a simple check that the pre-pll table contains an + * entry for the requested TMDS character rate. + */ + tmdsclock =3D opts->hdmi.tmds_char_rate; + for (; cfg->pixclock !=3D 0; cfg++) + if (cfg->tmdsclock =3D=3D tmdsclock) + return 0; + + return -EINVAL; +} + +static int inno_hdmi_phy_configure(struct phy *phy, + union phy_configure_opts *opts) +{ + struct inno_hdmi_phy *inno =3D phy_get_drvdata(phy); + int ret; + + ret =3D inno_hdmi_phy_validate(phy, phy_get_mode(phy), + PHY_HDMI_MODE_TMDS, opts); + if (ret) + return ret; + + /* + * phy_configure() is expected to be called from atomic_set_mode(), + * before the hdmiphy pixel clock is known. Store the requested TMDS + * character rate, so that it can be used later in power_on() and/or + * set_rate() when the pixel clock is known. + */ + inno->hdmi_cfg =3D opts->hdmi; + + return 0; +} + static int inno_hdmi_phy_power_on(struct phy *phy) { struct inno_hdmi_phy *inno =3D phy_get_drvdata(phy); @@ -670,6 +725,8 @@ static const struct phy_ops inno_hdmi_phy_ops =3D { .owner =3D THIS_MODULE, .power_on =3D inno_hdmi_phy_power_on, .power_off =3D inno_hdmi_phy_power_off, + .configure =3D inno_hdmi_phy_configure, + .validate =3D inno_hdmi_phy_validate, }; =20 static const @@ -1392,6 +1449,7 @@ static int inno_hdmi_phy_probe(struct platform_device= *pdev) } =20 phy_set_drvdata(inno->phy, inno); + phy_set_mode_ext(inno->phy, PHY_MODE_HDMI, PHY_HDMI_MODE_TMDS); phy_set_bus_width(inno->phy, 8); =20 if (inno->plat_data->ops->init) { --=20 2.54.0 From nobody Mon May 25 08:13:39 2026 Received: from smtp.forwardemail.net (smtp.forwardemail.net [121.127.44.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF0201DF261 for ; Fri, 15 May 2026 19:55:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=121.127.44.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778874951; cv=none; b=mYahjxAfj37BQipeznCrUaDjTUrMtN/LikYqw4kcnMvS3UwRnYQUKihbFBSPKU9jhEoLhftD7VOvqFvYvukb4Q5dxVta3teoiuP03Ly7UZRypNF0utkn2XlMi7IvY1DmKokrcmZCiFRrXho0ezyikggHYU5YIK12as8NB04NJN0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778874951; c=relaxed/simple; bh=Kby4wleMNcjZbcr8wTulFS7+5neEp1bXmQRbbwSrxVE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DBZQal0qbL8CLGv8kaPHtul1xjzgI7cxYHvTCYYkn4bSWcTXQbhDCj6yNr7BPLnQYCXcjw7CFyJKSpGIQQ40cDDMzNxNTw77o3PMfWITy+s93PF1k7YV1dFZdBtKUP/pAaDokiUbeegShhz4hottSMtz4ak0cFaRawzfzhpZLyI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kwiboo.se; spf=pass smtp.mailfrom=fe-bounces.kwiboo.se; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b=upPiaYD3; arc=none smtp.client-ip=121.127.44.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kwiboo.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fe-bounces.kwiboo.se Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="upPiaYD3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-ID: Date: Subject: Cc: To: From; q=dns/txt; s=fe-e1b5cab7be; t=1778874934; bh=tFwTKW3kDBLJUKllmiRBoo0ahcgcG8TLGz1il3QI99Q=; b=upPiaYD38dq5EBheZwgLGID/WD619jIWJUk/P8acgIx89REHQ0OPJoIvVLDW3USzSDMaNUVUR vQyeF++cVRQiY1oTD1kSGniSq1iDbTuMr9raxLRovvzDMHWzuWb2AJwWB57bX7D28XdJWLSacU/ Ykf/WgNmp5OFn2HVApLsturRnciTcSIuL+UrxQRhdtCAFkSCGlb0+rlM983SMWkvBMb8DSLeRgV tRSW+iippAeodplqTFLnjEODw9LqzEPLVroRiOxhifzwSIWAvUsrKGW8Uz+Nlf+XEuiX6FQw/g3 aXEDH8s0+itVJNU+aM/DiCyajaF4lLPuC7ZTzTVFvKJg== X-Forward-Email-ID: 6a077a28ad7e292af75a10b0 X-Forward-Email-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 121.127.44.73 X-Forward-Email-Version: 2.8.12 X-Forward-Email-Website: https://forwardemail.net X-Complaints-To: abuse@forwardemail.net X-Report-Abuse: abuse@forwardemail.net X-Report-Abuse-To: abuse@forwardemail.net From: Jonas Karlman To: Vinod Koul , Neil Armstrong , Heiko Stuebner Cc: linux-phy@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jonas Karlman Subject: [PATCH v3 2/2] phy: rockchip: inno-hdmi: Remove deprecated way to configure TMDS rate Date: Fri, 15 May 2026 19:55:11 +0000 Message-ID: <20260515195512.1757363-3-jonas@kwiboo.se> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260515195512.1757363-1-jonas@kwiboo.se> References: <20260515195512.1757363-1-jonas@kwiboo.se> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The TMDS character rate of this PHY is configured using PHY bus width in downstream vendor kernel and out-of-tree patches, however no in-tree consumer of this PHY has ever called phy_set_bus_width() to change the TMDS character rate as currently only 8-bit RGB output is supported by the HDMI display driver. The series "Split Generic PHY consumer and provider" clarifies that phy_set_bus_width() is intended as a provider-only function. Remove the deprecated unused fallback way to configure TMDS character rate now that this HDMI PHY support using phy_configure() to configure the TMDS character rate. Signed-off-by: Jonas Karlman --- v3: No change v2: New patch, split from original patch --- drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c b/drivers/phy/ro= ckchip/phy-rockchip-inno-hdmi.c index efa95c22b3bb..3bc73f0cff70 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c @@ -555,24 +555,10 @@ static inline void inno_update_bits(struct inno_hdmi_= phy *inno, u8 reg, static unsigned long inno_hdmi_phy_get_tmdsclk(struct inno_hdmi_phy *inno, unsigned long rate) { - int bus_width; - if (inno->hdmi_cfg.tmds_char_rate) return inno->hdmi_cfg.tmds_char_rate; =20 - bus_width =3D phy_get_bus_width(inno->phy); - - switch (bus_width) { - case 4: - case 5: - case 6: - case 10: - case 12: - case 16: - return (u64)rate * bus_width / 8; - default: - return rate; - } + return rate; } =20 static irqreturn_t inno_hdmi_phy_rk3328_hardirq(int irq, void *dev_id) @@ -1450,7 +1436,6 @@ static int inno_hdmi_phy_probe(struct platform_device= *pdev) =20 phy_set_drvdata(inno->phy, inno); phy_set_mode_ext(inno->phy, PHY_MODE_HDMI, PHY_HDMI_MODE_TMDS); - phy_set_bus_width(inno->phy, 8); =20 if (inno->plat_data->ops->init) { ret =3D inno->plat_data->ops->init(inno); --=20 2.54.0