AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Joshua Peisach" <jpeisach@ubuntu.com>
To: "Joshua Peisach" <jpeisach@ubuntu.com>,
	<amd-gfx@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>, <alexander.deucher@amd.com>,
	<christian.koenig@amd.com>
Subject: Re: [PATCH] amdgpu_connector: use struct drm_edid instead of struct edid
Date: Wed, 11 Feb 2026 09:07:32 -0500	[thread overview]
Message-ID: <DGC6W6ISK6DK.2B9VCFCGAJ2TH@ubuntu.com> (raw)
In-Reply-To: <20260207200550.42315-1-jpeisach@ubuntu.com>

On Sat Feb 7, 2026 at 3:04 PM EST, Joshua Peisach wrote:
> Some amdgpu code is still using deprecated edid functions. Switch to
> the newer functions and update the amdgpu_connector struct's edid type
> to the drm_edid type.
>
> At the same time, use the raw EDID when we need to for speaker
> allocations and for determining if the input is digital.
>
> Signed-off-by: Joshua Peisach <jpeisach@ubuntu.com>

I think this patch actually has the wrong naming convention: should I
resubmit and say drm/amdgpu/connectors to be more clear?

> ---
>  .../gpu/drm/amd/amdgpu/amdgpu_connectors.c    | 32 +++++++++----------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h      |  2 +-
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        |  4 +--
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         |  4 +--
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         |  4 +--
>  5 files changed, 23 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> index d3e312bda..ab83b3a87 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> @@ -246,10 +246,10 @@ amdgpu_connector_find_encoder(struct drm_connector *connector,
>  	return NULL;
>  }
>  
> -static struct edid *
> +static const struct drm_edid *
>  amdgpu_connector_get_hardcoded_edid(struct amdgpu_device *adev)
>  {
> -	return drm_edid_duplicate(drm_edid_raw(adev->mode_info.bios_hardcoded_edid));
> +	return drm_edid_dup(adev->mode_info.bios_hardcoded_edid);
>  }
>  
>  static void amdgpu_connector_get_edid(struct drm_connector *connector)
> @@ -268,8 +268,8 @@ static void amdgpu_connector_get_edid(struct drm_connector *connector)
>  	if ((amdgpu_connector_encoder_get_dp_bridge_encoder_id(connector) !=
>  	     ENCODER_OBJECT_ID_NONE) &&
>  	    amdgpu_connector->ddc_bus->has_aux) {
> -		amdgpu_connector->edid = drm_get_edid(connector,
> -						      &amdgpu_connector->ddc_bus->aux.ddc);
> +		amdgpu_connector->edid = drm_edid_read_ddc(connector,
> +							  &amdgpu_connector->ddc_bus->aux.ddc);
>  	} else if ((connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) ||
>  		   (connector->connector_type == DRM_MODE_CONNECTOR_eDP)) {
>  		struct amdgpu_connector_atom_dig *dig = amdgpu_connector->con_priv;
> @@ -277,14 +277,14 @@ static void amdgpu_connector_get_edid(struct drm_connector *connector)
>  		if ((dig->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT ||
>  		     dig->dp_sink_type == CONNECTOR_OBJECT_ID_eDP) &&
>  		    amdgpu_connector->ddc_bus->has_aux)
> -			amdgpu_connector->edid = drm_get_edid(connector,
> -							      &amdgpu_connector->ddc_bus->aux.ddc);
> +			amdgpu_connector->edid = drm_edid_read_ddc(connector,
> +								  &amdgpu_connector->ddc_bus->aux.ddc);
>  		else if (amdgpu_connector->ddc_bus)
> -			amdgpu_connector->edid = drm_get_edid(connector,
> -							      &amdgpu_connector->ddc_bus->adapter);
> +			amdgpu_connector->edid = drm_edid_read_ddc(connector,
> +								  &amdgpu_connector->ddc_bus->adapter);
>  	} else if (amdgpu_connector->ddc_bus) {
> -		amdgpu_connector->edid = drm_get_edid(connector,
> -						      &amdgpu_connector->ddc_bus->adapter);
> +		amdgpu_connector->edid = drm_edid_read_ddc(connector,
> +							  &amdgpu_connector->ddc_bus->adapter);
>  	}
>  
>  	if (!amdgpu_connector->edid) {
> @@ -292,7 +292,7 @@ static void amdgpu_connector_get_edid(struct drm_connector *connector)
>  		if (((connector->connector_type == DRM_MODE_CONNECTOR_LVDS) ||
>  		     (connector->connector_type == DRM_MODE_CONNECTOR_eDP))) {
>  			amdgpu_connector->edid = amdgpu_connector_get_hardcoded_edid(adev);
> -			drm_connector_update_edid_property(connector, amdgpu_connector->edid);
> +			drm_edid_connector_update(connector, amdgpu_connector->edid);
>  		}
>  	}
>  }
> @@ -311,11 +311,11 @@ static int amdgpu_connector_ddc_get_modes(struct drm_connector *connector)
>  	int ret;
>  
>  	if (amdgpu_connector->edid) {
> -		drm_connector_update_edid_property(connector, amdgpu_connector->edid);
> -		ret = drm_add_edid_modes(connector, amdgpu_connector->edid);
> +		drm_edid_connector_update(connector, amdgpu_connector->edid);
> +		ret = drm_edid_connector_add_modes(connector);
>  		return ret;
>  	}
> -	drm_connector_update_edid_property(connector, NULL);
> +	drm_edid_connector_update(connector, NULL);
>  	return 0;
>  }
>  
> @@ -883,7 +883,7 @@ amdgpu_connector_vga_detect(struct drm_connector *connector, bool force)
>  			ret = connector_status_connected;
>  		} else {
>  			amdgpu_connector->use_digital =
> -				!!(amdgpu_connector->edid->input & DRM_EDID_INPUT_DIGITAL);
> +				drm_edid_is_digital(amdgpu_connector->edid);
>  
>  			/* some oems have boards with separate digital and analog connectors
>  			 * with a shared ddc line (often vga + hdmi)
> @@ -1063,7 +1063,7 @@ amdgpu_connector_dvi_detect(struct drm_connector *connector, bool force)
>  			broken_edid = true; /* defer use_digital to later */
>  		} else {
>  			amdgpu_connector->use_digital =
> -				!!(amdgpu_connector->edid->input & DRM_EDID_INPUT_DIGITAL);
> +				drm_edid_is_digital(amdgpu_connector->edid);
>  
>  			/* some oems have boards with separate digital and analog connectors
>  			 * with a shared ddc line (often vga + hdmi)
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> index dc8d2f52c..c4e025581 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> @@ -624,7 +624,7 @@ struct amdgpu_connector {
>  	bool use_digital;
>  	/* we need to mind the EDID between detect
>  	   and get modes due to analog/digital/tvencoder */
> -	struct edid *edid;
> +	const struct drm_edid *edid;
>  	void *con_priv;
>  	bool dac_load_detect;
>  	bool detected_by_load; /* if the connection status was determined by load */
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index 61302204e..3346494c3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -1298,7 +1298,7 @@ static void dce_v10_0_audio_write_speaker_allocation(struct drm_encoder *encoder
>  		return;
>  	}
>  
> -	sad_count = drm_edid_to_speaker_allocation(amdgpu_connector->edid, &sadb);
> +	sad_count = drm_edid_to_speaker_allocation(drm_edid_raw(amdgpu_connector->edid), &sadb);
>  	if (sad_count < 0) {
>  		DRM_ERROR("Couldn't read Speaker Allocation Data Block: %d\n", sad_count);
>  		sad_count = 0;
> @@ -1368,7 +1368,7 @@ static void dce_v10_0_audio_write_sad_regs(struct drm_encoder *encoder)
>  		return;
>  	}
>  
> -	sad_count = drm_edid_to_sad(amdgpu_connector->edid, &sads);
> +	sad_count = drm_edid_to_sad(drm_edid_raw(amdgpu_connector->edid), &sads);
>  	if (sad_count < 0)
>  		DRM_ERROR("Couldn't read SADs: %d\n", sad_count);
>  	if (sad_count <= 0)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index 8f4b4c2e3..508cfe6a8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -1265,7 +1265,7 @@ static void dce_v6_0_audio_write_speaker_allocation(struct drm_encoder *encoder)
>  		return;
>  	}
>  
> -	sad_count = drm_edid_to_speaker_allocation(amdgpu_connector->edid, &sadb);
> +	sad_count = drm_edid_to_speaker_allocation(drm_edid_raw(amdgpu_connector->edid), &sadb);
>  	if (sad_count < 0) {
>  		DRM_ERROR("Couldn't read Speaker Allocation Data Block: %d\n", sad_count);
>  		sad_count = 0;
> @@ -1346,7 +1346,7 @@ static void dce_v6_0_audio_write_sad_regs(struct drm_encoder *encoder)
>  		return;
>  	}
>  
> -	sad_count = drm_edid_to_sad(amdgpu_connector->edid, &sads);
> +	sad_count = drm_edid_to_sad(drm_edid_raw(amdgpu_connector->edid), &sads);
>  	if (sad_count < 0)
>  		DRM_ERROR("Couldn't read SADs: %d\n", sad_count);
>  	if (sad_count <= 0)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 9d1853c41..3a6a22926 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -1271,7 +1271,7 @@ static void dce_v8_0_audio_write_speaker_allocation(struct drm_encoder *encoder)
>  		return;
>  	}
>  
> -	sad_count = drm_edid_to_speaker_allocation(amdgpu_connector->edid, &sadb);
> +	sad_count = drm_edid_to_speaker_allocation(drm_edid_raw(amdgpu_connector->edid), &sadb);
>  	if (sad_count < 0) {
>  		DRM_ERROR("Couldn't read Speaker Allocation Data Block: %d\n", sad_count);
>  		sad_count = 0;
> @@ -1339,7 +1339,7 @@ static void dce_v8_0_audio_write_sad_regs(struct drm_encoder *encoder)
>  		return;
>  	}
>  
> -	sad_count = drm_edid_to_sad(amdgpu_connector->edid, &sads);
> +	sad_count = drm_edid_to_sad(drm_edid_raw(amdgpu_connector->edid), &sads);
>  	if (sad_count < 0)
>  		DRM_ERROR("Couldn't read SADs: %d\n", sad_count);
>  	if (sad_count <= 0)


      reply	other threads:[~2026-02-11 14:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-07 20:04 [PATCH] amdgpu_connector: use struct drm_edid instead of struct edid Joshua Peisach
2026-02-11 14:07 ` Joshua Peisach [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DGC6W6ISK6DK.2B9VCFCGAJ2TH@ubuntu.com \
    --to=jpeisach@ubuntu.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox