diff mbox series

[3/6] drm/exynos: hdmi: convert to struct drm_edid

Message ID be15dce66a5373a7aed797a4ef63b0ba90b231e9.1724348429.git.jani.nikula@intel.com (mailing list archive)
State New
Headers show
Series None | expand

Commit Message

Jani Nikula Aug. 22, 2024, 5:42 p.m. UTC
Prefer the struct drm_edid based functions for reading the EDID and
updating the connector.

The functional change is that the CEC physical address gets invalidated
when the EDID could not be read.

v2:
- display info usage was split to a separate patch
- check drm_edid_connector_update() return value

Signed-off-by: Jani Nikula <jani.nikula@intel.com>

---

Cc: Inki Dae <inki.dae@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-samsung-soc@vger.kernel.org
---
 drivers/gpu/drm/exynos/exynos_hdmi.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

Comments

Daniel Vetter Aug. 28, 2024, 12:45 p.m. UTC | #1
On Thu, Aug 22, 2024 at 08:42:49PM +0300, Jani Nikula wrote:
> Prefer the struct drm_edid based functions for reading the EDID and
> updating the connector.
> 
> The functional change is that the CEC physical address gets invalidated
> when the EDID could not be read.
> 
> v2:
> - display info usage was split to a separate patch
> - check drm_edid_connector_update() return value
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> 
> ---
> 
> Cc: Inki Dae <inki.dae@samsung.com>
> Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: Krzysztof Kozlowski <krzk@kernel.org>
> Cc: Alim Akhtar <alim.akhtar@samsung.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-samsung-soc@vger.kernel.org
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c | 20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 25d508b25921..c9d4b9146df9 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -884,14 +884,21 @@ static int hdmi_get_modes(struct drm_connector *connector)
>  {
>  	struct hdmi_context *hdata = connector_to_hdmi(connector);
>  	const struct drm_display_info *info = &connector->display_info;
> -	struct edid *edid;
> +	const struct drm_edid *drm_edid;
>  	int ret;
>  
>  	if (!hdata->ddc_adpt)
>  		goto no_edid;
>  
> -	edid = drm_get_edid(connector, hdata->ddc_adpt);
> -	if (!edid)
> +	drm_edid = drm_edid_read_ddc(connector, hdata->ddc_adpt);

hdmi_create_connector seems to set up the right ddc already, so I think
drm_edid_read should be working. With that:

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> +
> +	ret = drm_edid_connector_update(connector, drm_edid);
> +	if (ret)
> +		return 0;
> +
> +	cec_notifier_set_phys_addr(hdata->notifier, info->source_physical_address);
> +
> +	if (!drm_edid)
>  		goto no_edid;
>  
>  	hdata->dvi_mode = !info->is_hdmi;
> @@ -899,12 +906,9 @@ static int hdmi_get_modes(struct drm_connector *connector)
>  			  (hdata->dvi_mode ? "dvi monitor" : "hdmi monitor"),
>  			  info->width_mm / 10, info->height_mm / 10);
>  
> -	drm_connector_update_edid_property(connector, edid);
> -	cec_notifier_set_phys_addr_from_edid(hdata->notifier, edid);
> -
> -	ret = drm_add_edid_modes(connector, edid);
> +	ret = drm_edid_connector_add_modes(connector);
>  
> -	kfree(edid);
> +	drm_edid_free(drm_edid);
>  
>  	return ret;
>  
> -- 
> 2.39.2
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 25d508b25921..c9d4b9146df9 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -884,14 +884,21 @@  static int hdmi_get_modes(struct drm_connector *connector)
 {
 	struct hdmi_context *hdata = connector_to_hdmi(connector);
 	const struct drm_display_info *info = &connector->display_info;
-	struct edid *edid;
+	const struct drm_edid *drm_edid;
 	int ret;
 
 	if (!hdata->ddc_adpt)
 		goto no_edid;
 
-	edid = drm_get_edid(connector, hdata->ddc_adpt);
-	if (!edid)
+	drm_edid = drm_edid_read_ddc(connector, hdata->ddc_adpt);
+
+	ret = drm_edid_connector_update(connector, drm_edid);
+	if (ret)
+		return 0;
+
+	cec_notifier_set_phys_addr(hdata->notifier, info->source_physical_address);
+
+	if (!drm_edid)
 		goto no_edid;
 
 	hdata->dvi_mode = !info->is_hdmi;
@@ -899,12 +906,9 @@  static int hdmi_get_modes(struct drm_connector *connector)
 			  (hdata->dvi_mode ? "dvi monitor" : "hdmi monitor"),
 			  info->width_mm / 10, info->height_mm / 10);
 
-	drm_connector_update_edid_property(connector, edid);
-	cec_notifier_set_phys_addr_from_edid(hdata->notifier, edid);
-
-	ret = drm_add_edid_modes(connector, edid);
+	ret = drm_edid_connector_add_modes(connector);
 
-	kfree(edid);
+	drm_edid_free(drm_edid);
 
 	return ret;