[v10,55/69] drm/sun4i: hdmi: Convert to drmm_connector_hdmi_init()

Message ID 20260731-dw-hdmi-qp-scramb-v10-55-294364b2cf15@collabora.com (mailing list archive)
State New
Headers
Series Add HDMI 2.0 support to DW HDMI QP TX |

Commit Message

Cristian Ciocaltea July 31, 2026, 4:20 p.m. UTC
Switch driver over to the new drmm_connector_hdmi_init() signature and
advertise HDMI 1.2 support.  The vendor, product, supported_formats and
max_bpc values previously passed as arguments are now provided through
struct drm_connector_hdmi_funcs, together with the new
supported_hdmi_ver field.

The HDMI connector helpers infer the 165 MHz TMDS character rate ceiling
from supported_hdmi_ver and reject modes exceeding it before invoking
the driver's .tmds_char_rate_valid() hook.  This makes the explicit mode
clock check in sun4i_hdmi_connector_clock_valid() redundant, so drop it.

No functional change intended.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
 drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
  

Comments

sashiko-bot@kernel.org July 31, 2026, 11:47 p.m. UTC | #1
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] A comment originally describing the vendor and product strings was left behind after the strings were moved to a struct, making it confusing.
--

--- Patch [55]: [PATCH v10 55/69] drm/sun4i: hdmi: Convert to drmm_connector_hdmi_init() ---
commit b114fe117b3fdd374cdabeb7a675643189411792
Author: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
drm/sun4i: hdmi: Convert to drmm_connector_hdmi_init()

This patch switches the sun4i HDMI driver to use the new
drmm_connector_hdmi_init() signature. The vendor, product, format
capabilities, and max bpc are moved into the drm_connector_hdmi_funcs
structure.

> diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
> --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c

[ ... ]

> @@ -653,19 +654,16 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master,
>  
>  	drm_connector_helper_add(&hdmi->connector,
>  				 &sun4i_hdmi_connector_helper_funcs);
> -	ret = drmm_connector_hdmi_ini2(drm, &hdmi->connector,
> +	ret = drmm_connector_hdmi_init(drm, &hdmi->connector,
>  				       /*
>  					* NOTE: Those are likely to be
>  					* wrong, but I couldn't find the
>  					* actual ones in the BSP.
>  					*/
> -				       "AW", "HDMI",
>  				       &sun4i_hdmi_connector_funcs,

[Severity: Low]
This isn't a bug, but should this comment be moved along with the "AW" and
"HDMI" strings to sun4i_hdmi_hdmi_connector_funcs? Leaving it here makes it
appear as if it refers to the sun4i_hdmi_connector_funcs argument.

>  				       &sun4i_hdmi_hdmi_connector_funcs,
>  				       DRM_MODE_CONNECTOR_HDMIA,
> -				       hdmi->ddc_i2c,
> -				       BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444),
> -				       8);
> +				       hdmi->ddc_i2c);
>  	if (ret) {
>  		dev_err(dev,
>  			"Couldn't initialise the HDMI connector\n");
  
Maxime Ripard Aug. 13, 2026, 1:29 p.m. UTC | #2
On Fri, 31 Jul 2026 19:20:02 +0300, Cristian Ciocaltea wrote:
> Switch driver over to the new drmm_connector_hdmi_init() signature and
> advertise HDMI 1.2 support.  The vendor, product, supported_formats and
> max_bpc values previously passed as arguments are now provided through
> struct drm_connector_hdmi_funcs, together with the new
> supported_hdmi_ver field.
> 
> [ ... ]

Reviewed-by: Maxime Ripard <mripard@kernel.org>

Thanks!
Maxime
  

Patch

diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
index 96b2b597caa6..850a8fecf0b5 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
@@ -192,10 +192,6 @@  sun4i_hdmi_connector_clock_valid(const struct drm_connector *connector,
 	if (mode->flags & DRM_MODE_FLAG_DBLCLK)
 		return MODE_BAD;
 
-	/* 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);
 	if (rounded_rate > 0 &&
 	    max_t(unsigned long, rounded_rate, clock) -
@@ -253,6 +249,11 @@  static struct i2c_adapter *sun4i_hdmi_get_ddc(struct device *dev)
 }
 
 static const struct drm_connector_hdmi_funcs sun4i_hdmi_hdmi_connector_funcs = {
+	.vendor = "AW",
+	.product = "HDMI",
+	.supported_hdmi_ver = HDMI_VERSION_1_2,
+	.supported_formats = BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444),
+	.max_bpc = 8,
 	.tmds_char_rate_valid	= sun4i_hdmi_connector_clock_valid,
 	.avi = {
 		.clear_infoframe	= sun4i_hdmi_clear_avi_infoframe,
@@ -653,19 +654,16 @@  static int sun4i_hdmi_bind(struct device *dev, struct device *master,
 
 	drm_connector_helper_add(&hdmi->connector,
 				 &sun4i_hdmi_connector_helper_funcs);
-	ret = drmm_connector_hdmi_ini2(drm, &hdmi->connector,
+	ret = drmm_connector_hdmi_init(drm, &hdmi->connector,
 				       /*
 					* NOTE: Those are likely to be
 					* wrong, but I couldn't find the
 					* actual ones in the BSP.
 					*/
-				       "AW", "HDMI",
 				       &sun4i_hdmi_connector_funcs,
 				       &sun4i_hdmi_hdmi_connector_funcs,
 				       DRM_MODE_CONNECTOR_HDMIA,
-				       hdmi->ddc_i2c,
-				       BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444),
-				       8);
+				       hdmi->ddc_i2c);
 	if (ret) {
 		dev_err(dev,
 			"Couldn't initialise the HDMI connector\n");