Skip to contentSkip to conversation

hdmi: Add common TMDS character rate constants

PATCH Applied Javier Martinez Canillas 5 participants 15 messages May 20 – May 21

Subsystems (10)
lore
Share & tools
lore
#0 lore raw

v2 cover hdmi: Add common TMDS character rate constants

Several DRM drivers define their own local macros or use magic numbers for the standard HDMI TMDS character rate limits. Maxime Ripard suggested that instead these common rate constants could be included to a shared header.

This series introduces these constants to the <linux/hdmi.h> header and replaces the local defined constants or magic numbers in drivers.

I split the changes as one patch per driver, so that these can be reviewed individually and merged at their own pace.

This is a version 2 that addresses issues pointed out by Maxime Ripard and Dmitry Baryshkov.

Changes in v2:
- Change naming convention to HDMI_$SPEC_TMDS_CHAR_RATE_MAX_HZ (Maxime).
- Define the constants in <linux/hdmi.h> (Dmitry).

Javier Martinez Canillas (8):
video/hdmi: Add common TMDS character rate constants drm/bridge: dw-hdmi: Use the common TMDS char rate constant drm/bridge: dw-hdmi-qp: Use the common TMDS char rate constant drm/bridge: inno-hdmi: Use the common TMDS char rate constant drm/sti: hdmi: Use the common TMDS char rate constants drm/sun4i: hdmi: Use the common TMDS char rate constant drm/msm/hdmi: Use the common TMDS char rate constants in 8996 PHY drm/msm/hdmi: Use the common TMDS char rate constants in 8998 PHY

 drivers/gpu/drm/bridge/inno-hdmi.c           |  4 +---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c |  6 ++----
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c    | 10 ++++------
 drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c     |  6 ++----
 drivers/gpu/drm/msm/hdmi/hdmi_phy_8998.c     |  6 ++----
 drivers/gpu/drm/sti/sti_hdmi_tx3g4c28phy.c   |  6 ++++--
 drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c       |  4 ++--
 include/linux/hdmi.h                         |  6 ++++++
 8 files changed, 23 insertions(+), 25 deletions(-)
Signature · 4 lines
2.54.0

base-commit: 88658ff0e4e7f46dbf8179af1280f2cb295fb0cb
branch: add-common-tmds-rates-v2
#1 lore raw

PATCH v2 1/8 video/hdmi: Add common TMDS character rate constants

Several DRM drivers already define their own constants for minimum and maximum TMDS character rates.

By defining common rate constants in a shared header, drivers can just use them instead of having driver local define macros or use magic numbers.

The values defined in the <linux/hdmi.h> header correspond to maximum TMDS character rates defined by each HDMI specification version:

- HDMI_TMDS_CHAR_RATE_MIN_HZ: 25 MHz (minimum for all versions)
- HDMI_1_0_TMDS_CHAR_RATE_MAX_HZ: 165 MHz (HDMI 1.0 maximum)
- HDMI_1_3_TMDS_CHAR_RATE_MAX_HZ: 340 MHz (HDMI 1.3 maximum)
- HDMI_2_0_TMDS_CHAR_RATE_MAX_HZ: 600 MHz (HDMI 2.0 maximum)

---

Changes in v2:
- Change naming convention to HDMI_$SPEC_TMDS_CHAR_RATE_MAX_HZ (Maxime).
- Define the constants in <linux/hdmi.h> (Dmitry).

 include/linux/hdmi.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/hdmi.h +6 -0
index 96bda41d9148..8dab78e1f61b 100644
@@ -50,6 +50,12 @@ enum hdmi_infoframe_type {
 	HDMI_INFOFRAME_TYPE_DRM = 0x87,
 };
 
+/* HDMI spec maximum TMDS character rates, in Hz */
+#define HDMI_TMDS_CHAR_RATE_MIN_HZ         25000000
+#define HDMI_1_0_TMDS_CHAR_RATE_MAX_HZ    165000000
+#define HDMI_1_3_TMDS_CHAR_RATE_MAX_HZ    340000000
+#define HDMI_2_0_TMDS_CHAR_RATE_MAX_HZ    600000000
+
 #define HDMI_IEEE_OUI 0x000c03
 #define HDMI_FORUM_IEEE_OUI 0xc45dd8
 #define HDMI_INFOFRAME_HEADER_SIZE  4
Signature · 1 line
2.54.0
Reviewed-by on v2 1/8
#2 lore raw

Re: [PATCH v2 1/8] video/hdmi: Add common TMDS character rate constants

Quoted 17 lines · Javier Martinez Canillas

Several DRM drivers already define their own constants for minimum and maximum TMDS character rates.

By defining common rate constants in a shared header, drivers can just use them instead of having driver local define macros or use magic numbers.

The values defined in the <linux/hdmi.h> header correspond to maximum TMDS character rates defined by each HDMI specification version:

- HDMI_TMDS_CHAR_RATE_MIN_HZ: 25 MHz (minimum for all versions)
- HDMI_1_0_TMDS_CHAR_RATE_MAX_HZ: 165 MHz (HDMI 1.0 maximum)
- HDMI_1_3_TMDS_CHAR_RATE_MAX_HZ: 340 MHz (HDMI 1.3 maximum)
- HDMI_2_0_TMDS_CHAR_RATE_MAX_HZ: 600 MHz (HDMI 2.0 maximum)

Quoted 9 lines

---

Changes in v2:
- Change naming convention to HDMI_$SPEC_TMDS_CHAR_RATE_MAX_HZ (Maxime).
- Define the constants in <linux/hdmi.h> (Dmitry).

 include/linux/hdmi.h | 6 ++++++
 1 file changed, 6 insertions(+)
Signature · 2 lines
With best wishes
Dmitry
#3 lore raw

Re: [PATCH v2 1/8] video/hdmi: Add common TMDS character rate constants

In reply to Javier Martinez Canillas

Javier Martinez Canillas <[email protected]> writes:

[adding the dri-devel ML since patman didn't include it for this patch]

Quoted 46 lines

Several DRM drivers already define their own constants for minimum and maximum TMDS character rates.

By defining common rate constants in a shared header, drivers can just use them instead of having driver local define macros or use magic numbers.

The values defined in the <linux/hdmi.h> header correspond to maximum TMDS character rates defined by each HDMI specification version:

- HDMI_TMDS_CHAR_RATE_MIN_HZ: 25 MHz (minimum for all versions)
- HDMI_1_0_TMDS_CHAR_RATE_MAX_HZ: 165 MHz (HDMI 1.0 maximum)
- HDMI_1_3_TMDS_CHAR_RATE_MAX_HZ: 340 MHz (HDMI 1.3 maximum)
- HDMI_2_0_TMDS_CHAR_RATE_MAX_HZ: 600 MHz (HDMI 2.0 maximum)

---

Changes in v2:
- Change naming convention to HDMI_$SPEC_TMDS_CHAR_RATE_MAX_HZ (Maxime).
- Define the constants in <linux/hdmi.h> (Dmitry).

 include/linux/hdmi.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/hdmi.h +6 -0
index 96bda41d9148..8dab78e1f61b 100644
@@ -50,6 +50,12 @@ enum hdmi_infoframe_type {
 	HDMI_INFOFRAME_TYPE_DRM = 0x87,
 };
 
+/* HDMI spec maximum TMDS character rates, in Hz */
+#define HDMI_TMDS_CHAR_RATE_MIN_HZ         25000000
+#define HDMI_1_0_TMDS_CHAR_RATE_MAX_HZ    165000000
+#define HDMI_1_3_TMDS_CHAR_RATE_MAX_HZ    340000000
+#define HDMI_2_0_TMDS_CHAR_RATE_MAX_HZ    600000000
+
 #define HDMI_IEEE_OUI 0x000c03
 #define HDMI_FORUM_IEEE_OUI 0xc45dd8
 #define HDMI_INFOFRAME_HEADER_SIZE  4
Signature · 1 line
2.54.0
Signature · 5 lines
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat
maintainer Reviewed-by on v2 1/8
#4 lore raw

Re: [PATCH v2 1/8] video/hdmi: Add common TMDS character rate constants

In reply to Javier Martinez Canillas
Quoted 33 lines · Javier Martinez Canillas

Several DRM drivers already define their own constants for minimum and maximum TMDS character rates.

By defining common rate constants in a shared header, drivers can just use them instead of having driver local define macros or use magic numbers.

The values defined in the <linux/hdmi.h> header correspond to maximum TMDS character rates defined by each HDMI specification version:

- HDMI_TMDS_CHAR_RATE_MIN_HZ: 25 MHz (minimum for all versions)
- HDMI_1_0_TMDS_CHAR_RATE_MAX_HZ: 165 MHz (HDMI 1.0 maximum)
- HDMI_1_3_TMDS_CHAR_RATE_MAX_HZ: 340 MHz (HDMI 1.3 maximum)
- HDMI_2_0_TMDS_CHAR_RATE_MAX_HZ: 600 MHz (HDMI 2.0 maximum)

---

Changes in v2:
- Change naming convention to HDMI_$SPEC_TMDS_CHAR_RATE_MAX_HZ (Maxime).
- Define the constants in <linux/hdmi.h> (Dmitry).

  include/linux/hdmi.h | 6 ++++++
  1 file changed, 6 insertions(+)
include/linux/hdmi.h +0 -0
index 96bda41d9148..8dab78e1f61b 100644
@@ -50,6 +50,12 @@ enum hdmi_infoframe_type {
  	HDMI_INFOFRAME_TYPE_DRM = 0x87,
  };

include/linux/hdmi.h enum hdmi_infoframe_type { · line 61

Quoted 10 lines
include/linux/hdmi.h +6 -0
 
+/* HDMI spec maximum TMDS character rates, in Hz */
+#define HDMI_TMDS_CHAR_RATE_MIN_HZ         25000000
+#define HDMI_1_0_TMDS_CHAR_RATE_MAX_HZ    165000000
+#define HDMI_1_3_TMDS_CHAR_RATE_MAX_HZ    340000000
+#define HDMI_2_0_TMDS_CHAR_RATE_MAX_HZ    600000000
+
  #define HDMI_IEEE_OUI 0x000c03
  #define HDMI_FORUM_IEEE_OUI 0xc45dd8
  #define HDMI_INFOFRAME_HEADER_SIZE  4

Thanks,
Neil

#5 lore raw

PATCH v2 2/8 drm/bridge: dw-hdmi: Use the common TMDS char rate constant

In reply to Javier Martinez Canillas

Replace the driver local HDMI14_MAX_TMDSCLK define with the shared constant defined in the <linux/hdmi.h> header.

The local define incorrectly referenced HDMI 1.4, but the 340 MHz maximum TMDS character rate was actually introduced in HDMI 1.3.

---

(no changes since v1)

 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +4 -6
index 41b3a9cfa2f5..17d5caedb32e 100644
@@ -51,8 +51,6 @@
 /* DW-HDMI Controller >= 0x200a are at least compliant with SCDC version 1 */
 #define SCDC_MIN_SOURCE_VERSION	0x1
 
-#define HDMI14_MAX_TMDSCLK	340000000
-
 static const u16 csc_coeff_default[3][4] = {
 	{ 0x2000, 0x0000, 0x0000, 0x0000 },
 	{ 0x0000, 0x2000, 0x0000, 0x0000 },
@@ -1426,7 +1424,7 @@ void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi,
 
 	/* Control for TMDS Bit Period/TMDS Clock-Period Ratio */
 	if (dw_hdmi_support_scdc(hdmi, display)) {
-		if (mtmdsclock > HDMI14_MAX_TMDSCLK)
+		if (mtmdsclock > HDMI_1_3_TMDS_CHAR_RATE_MAX_HZ)
 			drm_scdc_set_high_tmds_clock_ratio(hdmi->curr_conn, 1);
 		else
 			drm_scdc_set_high_tmds_clock_ratio(hdmi->curr_conn, 0);
@@ -1671,7 +1669,7 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi,
 	}
 
 	/* Wait for resuming transmission of TMDS clock and data */
-	if (mtmdsclock > HDMI14_MAX_TMDSCLK)
+	if (mtmdsclock > HDMI_1_3_TMDS_CHAR_RATE_MAX_HZ)
 		msleep(100);
 
 	return dw_hdmi_phy_power_on(hdmi);
@@ -2032,7 +2030,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
 	/* Set up HDMI_FC_INVIDCONF */
 	inv_val = (hdmi->hdmi_data.hdcp_enable ||
 		   (dw_hdmi_support_scdc(hdmi, display) &&
-		    (vmode->mtmdsclock > HDMI14_MAX_TMDSCLK ||
+		    (vmode->mtmdsclock > HDMI_1_3_TMDS_CHAR_RATE_MAX_HZ ||
 		     hdmi_info->scdc.scrambling.low_rates)) ?
 		HDMI_FC_INVIDCONF_HDCP_KEEPOUT_ACTIVE :
 		HDMI_FC_INVIDCONF_HDCP_KEEPOUT_INACTIVE);
@@ -2100,7 +2098,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
 
 	/* Scrambling Control */
 	if (dw_hdmi_support_scdc(hdmi, display)) {
-		if (vmode->mtmdsclock > HDMI14_MAX_TMDSCLK ||
+		if (vmode->mtmdsclock > HDMI_1_3_TMDS_CHAR_RATE_MAX_HZ ||
 		    hdmi_info->scdc.scrambling.low_rates) {
 			/*
 			 * HDMI2.0 Specifies the following procedure:
Signature · 1 line
2.54.0
#6 lore raw

PATCH v2 3/8 drm/bridge: dw-hdmi-qp: Use the common TMDS char rate constant

In reply to Javier Martinez Canillas

Replace the driver local HDMI14_MAX_TMDSCLK define with the shared constant defined in the <linux/hdmi.h> header.

The local define incorrectly referenced HDMI 1.4, but the 340 MHz maximum TMDS character rate was actually introduced in HDMI 1.3.

---

(no changes since v1)

 drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c +2 -4
index 0dbb12743609..1c214a8e6dc2 100644
@@ -38,8 +38,6 @@
 #define DDC_CI_ADDR		0x37
 #define DDC_SEGMENT_ADDR	0x30
 
-#define HDMI14_MAX_TMDSCLK	340000000
-
 #define SCRAMB_POLL_DELAY_MS	3000
 
 /*
@@ -835,9 +833,9 @@ dw_hdmi_qp_bridge_tmds_char_rate_valid(const struct drm_bridge *bridge,
 	/*
 	 * TODO: when hdmi->no_hpd is 1 we must not support modes that
 	 * require scrambling, including every mode with a clock above
-	 * HDMI14_MAX_TMDSCLK.
+	 * HDMI_1_3_TMDS_CHAR_RATE_MAX_HZ.
 	 */
-	if (rate > HDMI14_MAX_TMDSCLK) {
+	if (rate > HDMI_1_3_TMDS_CHAR_RATE_MAX_HZ) {
 		dev_dbg(hdmi->dev, "Unsupported TMDS char rate: %lld\n", rate);
 		return MODE_CLOCK_HIGH;
 	}
Signature · 1 line
2.54.0
maintainer Reviewed-by on v2 3/8
#7 lore raw

Re: [PATCH v2 3/8] drm/bridge: dw-hdmi-qp: Use the common TMDS char rate constant

Am Mittwoch, 20. Mai 2026, 16:43:39 Mitteleuropäische Sommerzeit schrieb Javier Martinez Canillas:

Quoted 9 lines

Replace the driver local HDMI14_MAX_TMDSCLK define with the shared constant defined in the <linux/hdmi.h> header.

The local define incorrectly referenced HDMI 1.4, but the 340 MHz maximum TMDS character rate was actually introduced in HDMI 1.3.

#8 lore raw

PATCH v2 4/8 drm/bridge: inno-hdmi: Use the common TMDS char rate constant

In reply to Javier Martinez Canillas

Replace the driver local INNO_HDMI_MIN_TMDS_CLOCK define with the shared constant defined in the <linux/hdmi.h> header.

---

(no changes since v1)

 drivers/gpu/drm/bridge/inno-hdmi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/bridge/inno-hdmi.c +1 -3
index 1091af29ad8f..5fa533a4eb34 100644
@@ -31,8 +31,6 @@
 #include <drm/display/drm_hdmi_helper.h>
 #include <drm/display/drm_hdmi_state_helper.h>
 
-#define INNO_HDMI_MIN_TMDS_CLOCK  25000000U
-
 #define DDC_SEGMENT_ADDR		0x30
 
 #define HDMI_SCL_RATE			(100 * 1000)
@@ -820,7 +818,7 @@ static enum drm_mode_status inno_hdmi_bridge_mode_valid(struct drm_bridge *bridg
 
 	mpixelclk = mode->clock * 1000;
 
-	if (mpixelclk < INNO_HDMI_MIN_TMDS_CLOCK)
+	if (mpixelclk < HDMI_TMDS_CHAR_RATE_MIN_HZ)
 		return MODE_CLOCK_LOW;
 
 	if (inno_hdmi_find_phy_config(hdmi, mpixelclk) < 0)
Signature · 1 line
2.54.0
#9 lore raw

PATCH v2 5/8 drm/sti: hdmi: Use the common TMDS char rate constants

In reply to Javier Martinez Canillas

Replace the 340000000 and 165000000 magic numbers with the shared constants defined in the <linux/hdmi.h> header.

---

(no changes since v1)

 drivers/gpu/drm/sti/sti_hdmi_tx3g4c28phy.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/sti/sti_hdmi_tx3g4c28phy.c +4 -2
index d25ecd4f4b67..4fe0c54a096f 100644
@@ -4,6 +4,8 @@
  * Author: Vincent Abriou <[email protected]> for STMicroelectronics.
  */
 
+#include <linux/hdmi.h>
+
 #include <drm/drm_print.h>
 
 #include "sti_hdmi_tx3g4c28phy.h"
@@ -102,7 +104,7 @@ static bool sti_hdmi_tx3g4c28phy_start(struct sti_hdmi *hdmi)
 	tmdsck = ckpxpll;
 	pllctrl |= 40 << PLL_CFG_NDIV_SHIFT;
 
-	if (tmdsck > 340000000) {
+	if (tmdsck > HDMI_1_3_TMDS_CHAR_RATE_MAX_HZ) {
 		DRM_ERROR("output TMDS clock (%d) out of range\n", tmdsck);
 		goto err;
 	}
@@ -135,7 +137,7 @@ static bool sti_hdmi_tx3g4c28phy_start(struct sti_hdmi *hdmi)
 	       HDMI_SRZ_CFG_EN_BIASRES_DETECTION |
 	       HDMI_SRZ_CFG_EN_SINK_TERM_DETECTION);
 
-	if (tmdsck > 165000000)
+	if (tmdsck > HDMI_1_0_TMDS_CHAR_RATE_MAX_HZ)
 		val |= HDMI_SRZ_CFG_EN_SRC_TERMINATION;
 
 	/*
Signature · 1 line
2.54.0
#10 lore raw

PATCH v2 6/8 drm/sun4i: hdmi: Use the common TMDS char rate constant

In reply to Javier Martinez Canillas

Replace the 165000000 magic number with the shared constant defined in the <linux/hdmi.h> header.

The old comment referenced "HDMI <= 1.2" but 165 MHz is actually the maximum TMDS character rate defined by the HDMI 1.0 spec.

---

(no changes since v1)

 drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +2 -2
index 07e2afcb4f95..74c7c3720ba8 100644
@@ -189,8 +189,8 @@ sun4i_hdmi_connector_clock_valid(const struct drm_connector *connector,
 	if (mode->flags & DRM_MODE_FLAG_DBLCLK)
 		return MODE_BAD;
 
-	/* 165 MHz is the typical max pixelclock frequency for HDMI <= 1.2 */
-	if (clock > 165000000)
+	/* HDMI 1.0 max TMDS character rate */
+	if (clock > HDMI_1_0_TMDS_CHAR_RATE_MAX_HZ)
 		return MODE_CLOCK_HIGH;
 
 	rounded_rate = clk_round_rate(hdmi->tmds_clk, clock);
Signature · 1 line
2.54.0
#11 lore raw

PATCH v2 7/8 drm/msm/hdmi: Use the common TMDS char rate constants in 8996 PHY

In reply to Javier Martinez Canillas

Replace the driver local defines with the shared constants defined in the <linux/hdmi.h> header for the minimum and maximum TMDS character rates.

---

(no changes since v1)

 drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c +2 -4
index 36e928b0fd5a..71da20322b3d 100644
@@ -11,9 +11,6 @@
 #define HDMI_VCO_MAX_FREQ			12000000000UL
 #define HDMI_VCO_MIN_FREQ			8000000000UL
 
-#define HDMI_PCLK_MAX_FREQ			600000000
-#define HDMI_PCLK_MIN_FREQ			25000000
-
 #define HDMI_HIGH_FREQ_BIT_CLK_THRESHOLD	3400000000UL
 #define HDMI_DIG_FREQ_BIT_CLK_THRESHOLD		1500000000UL
 #define HDMI_MID_FREQ_BIT_CLK_THRESHOLD		750000000UL
@@ -632,7 +629,8 @@ static int hdmi_8996_pll_prepare(struct clk_hw *hw)
 static int hdmi_8996_pll_determine_rate(struct clk_hw *hw,
 					struct clk_rate_request *req)
 {
-	req->rate = clamp_t(unsigned long, req->rate, HDMI_PCLK_MIN_FREQ, HDMI_PCLK_MAX_FREQ);
+	req->rate = clamp_t(unsigned long, req->rate, HDMI_TMDS_CHAR_RATE_MIN_HZ,
+			    HDMI_2_0_TMDS_CHAR_RATE_MAX_HZ);
 
 	return 0;
 }
Signature · 1 line
2.54.0
#12 lore raw

PATCH v2 8/8 drm/msm/hdmi: Use the common TMDS char rate constants in 8998 PHY

In reply to Javier Martinez Canillas

Replace the driver local defines with the shared constants defined in the <linux/hdmi.h> header for the minimum and maximum TMDS character rates.

---

(no changes since v1)

 drivers/gpu/drm/msm/hdmi/hdmi_phy_8998.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/hdmi/hdmi_phy_8998.c +2 -4
index a86ff3706369..05c3ffad858d 100644
@@ -12,9 +12,6 @@
 #define HDMI_VCO_MAX_FREQ			12000000000UL
 #define HDMI_VCO_MIN_FREQ			8000000000UL
 
-#define HDMI_PCLK_MAX_FREQ			600000000
-#define HDMI_PCLK_MIN_FREQ			25000000
-
 #define HDMI_HIGH_FREQ_BIT_CLK_THRESHOLD	3400000000UL
 #define HDMI_DIG_FREQ_BIT_CLK_THRESHOLD		1500000000UL
 #define HDMI_MID_FREQ_BIT_CLK_THRESHOLD		750000000UL
@@ -649,7 +646,8 @@ static int hdmi_8998_pll_prepare(struct clk_hw *hw)
 static int hdmi_8998_pll_determine_rate(struct clk_hw *hw,
 					struct clk_rate_request *req)
 {
-	req->rate = clamp_t(unsigned long, req->rate, HDMI_PCLK_MIN_FREQ, HDMI_PCLK_MAX_FREQ);
+	req->rate = clamp_t(unsigned long, req->rate, HDMI_TMDS_CHAR_RATE_MIN_HZ,
+			    HDMI_2_0_TMDS_CHAR_RATE_MAX_HZ);
 
 	return 0;
 }
Signature · 1 line
2.54.0
maintainer Reviewed-by on the v2 series
#13 lore raw
In reply to Javier Martinez Canillas
Quoted 7 lines · Javier Martinez Canillas

Several DRM drivers define their own local macros or use magic numbers for the standard HDMI TMDS character rate limits. Maxime Ripard suggested that instead these common rate constants could be included to a shared header.

This series introduces these constants to the <linux/hdmi.h> header and

[ ... ]

Thanks!
Maxime

#14 lore raw
In reply to Javier Martinez Canillas
Quoted 17 lines · Javier Martinez Canillas

Several DRM drivers define their own local macros or use magic numbers for the standard HDMI TMDS character rate limits. Maxime Ripard suggested that instead these common rate constants could be included to a shared header.

This series introduces these constants to the <linux/hdmi.h> header and replaces the local defined constants or magic numbers in drivers.

I split the changes as one patch per driver, so that these can be reviewed individually and merged at their own pace.

This is a version 2 that addresses issues pointed out by Maxime Ripard and Dmitry Baryshkov.

Changes in v2:
- Change naming convention to HDMI_$SPEC_TMDS_CHAR_RATE_MAX_HZ (Maxime).
- Define the constants in <linux/hdmi.h> (Dmitry).

Quoted 10 lines

Javier Martinez Canillas (8):
video/hdmi: Add common TMDS character rate constants drm/bridge: dw-hdmi: Use the common TMDS char rate constant drm/bridge: dw-hdmi-qp: Use the common TMDS char rate constant drm/bridge: inno-hdmi: Use the common TMDS char rate constant drm/sti: hdmi: Use the common TMDS char rate constants drm/sun4i: hdmi: Use the common TMDS char rate constant drm/msm/hdmi: Use the common TMDS char rate constants in 8996 PHY drm/msm/hdmi: Use the common TMDS char rate constants in 8998 PHY

Pushed to drm-misc (drm-misc-next). Thanks everyone for the feedback and review!

Signature · 5 lines
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat