* [PATCH 0/2] drm: Populate ELD Port_ID to identify audio endpoints
@ 2026-11-05 16:02 Kai Vehmanen
2026-11-05 16:02 ` [PATCH 1/2] drm/eld: Add drm_eld_set_port_id() helper Kai Vehmanen
2026-11-05 16:02 ` [PATCH 2/2] drm/i915/audio: Populate ELD Port_ID Kai Vehmanen
0 siblings, 2 replies; 5+ messages in thread
From: Kai Vehmanen @ 2026-11-05 16:02 UTC (permalink / raw)
To: intel-gfx, intel-xe, dri-devel
Cc: Jani Nikula, Ville Syrjälä,
Rodrigo Vivi, Joonas Lahtinen, Tvrtko Ursulin, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Takashi Iwai, Jaroslav Kysela, linux-sound, Harry Wentland,
Leo Li, Alex Deucher, amd-gfx, Lyude Paul, Danilo Krummrich,
Tomáš Hnyk, Wim Taymans, nouveau, linux-kernel,
Kai Vehmanen
The ELD Port_ID field (bytes 8..15 of the baseline block) is typically
zero on Linux today: drm_edid_to_eld() leaves it empty and no in-tree driver
fills it in. amdgpu, radeon and nouveau pass the raw connector->eld to
the audio component. On the amdgpu DC Azalia register path the value
is a hardcoded constant, the same for every port.
Only closed display drivers fill the value.
Pipewire added support for "Port_ID" in merge request:
https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/3025
As a result, when two identical monitors are connected their ELDs are
byte-identical, and userspace (e.g. PipeWire/WirePlumber) cannot
passively tell which HDMI/DP PCM belongs to which DRM connector.
This series adds a DRM helper that fills Port_ID with a common layout,
and uses it in i915:
bits 63:48 - PCI domain of the DRM device
bits 47:32 - PCI bus/device/function of the DRM device
bits 31:0 - DRM connector object ID
The upper half follows the layout documented for the AMD Azalia sink
info registers (dce_audio.c: "PORT_ID1 = 16bit BDF"). The aim is for
this to become a convention other drivers can opt into. For drivers
that copy connector->eld to the audio component (amdgpu DM, radeon,
nouveau), adopting it would be a one-line change. Comments from the
AMD and nouveau folks on whether the layout works for them are very
welcome.
An alternative would be to fill Port_ID directly in drm_edid_to_eld(),
so every driver gets it without changes. I went with an opt-in helper
to avoid changing the ELD contents seen by all drivers and existing
userspace at once.
The value is exposed to userspace via the ALSA ELD control and
/proc/asound/cardX/eld#Y.
Kai Vehmanen (2):
drm/eld: Add drm_eld_set_port_id() helper
drm/i915/audio: Populate ELD Port_ID
drivers/gpu/drm/drm_eld.c | 42 ++++++++++++++++++++++
drivers/gpu/drm/i915/display/intel_audio.c | 2 ++
include/drm/drm_eld.h | 3 ++
3 files changed, 47 insertions(+)
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] drm/eld: Add drm_eld_set_port_id() helper
2026-11-05 16:02 [PATCH 0/2] drm: Populate ELD Port_ID to identify audio endpoints Kai Vehmanen
@ 2026-11-05 16:02 ` Kai Vehmanen
2026-11-05 17:08 ` Ville Syrjälä
2026-11-05 16:02 ` [PATCH 2/2] drm/i915/audio: Populate ELD Port_ID Kai Vehmanen
1 sibling, 1 reply; 5+ messages in thread
From: Kai Vehmanen @ 2026-11-05 16:02 UTC (permalink / raw)
To: intel-gfx, intel-xe, dri-devel
Cc: Jani Nikula, Ville Syrjälä,
Rodrigo Vivi, Joonas Lahtinen, Tvrtko Ursulin, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Takashi Iwai, Jaroslav Kysela, linux-sound, Harry Wentland,
Leo Li, Alex Deucher, amd-gfx, Lyude Paul, Danilo Krummrich,
Tomáš Hnyk, Wim Taymans, nouveau, linux-kernel,
Kai Vehmanen
The ELD baseline block reserves bytes 8..15 for a 64-bit Port_ID that
identifies the source port of the audio endpoint. drm_edid_to_eld()
leaves the field zero, and no driver fills it in, so it carries no
information.
When two identical monitors are connected, their ELDs are then
byte-identical, and userspace has no passive way to tell which HDMI/DP
PCM belongs to which DRM connector. The only workaround is to toggle
the connector audio property and watch which ELD goes away, which
disrupts the endpoint.
Add a helper that drivers can use to fill in Port_ID with a common
layout:
bits 63:48 - PCI domain of the DRM device
bits 47:32 - PCI bus/device/function of the DRM device
bits 31:0 - DRM connector object ID
Userspace can read the connector object ID directly from KMS, and the
PCI address tells GPUs apart in multi-GPU systems. For non-PCI devices
the upper half is left zero.
The split between a 16-bit PCI BDF in the upper half and a per-device
display identifier in the lower half follows the Port_ID layout
documented for the AMD Azalia sink info registers in dce_audio.c.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
drivers/gpu/drm/drm_eld.c | 42 +++++++++++++++++++++++++++++++++++++++
include/drm/drm_eld.h | 3 +++
2 files changed, 45 insertions(+)
diff --git a/drivers/gpu/drm/drm_eld.c b/drivers/gpu/drm/drm_eld.c
index c0428d07de53..baebece7b4ed 100644
--- a/drivers/gpu/drm/drm_eld.c
+++ b/drivers/gpu/drm/drm_eld.c
@@ -4,7 +4,11 @@
*/
#include <linux/export.h>
+#include <linux/pci.h>
+#include <linux/unaligned.h>
+#include <drm/drm_connector.h>
+#include <drm/drm_device.h>
#include <drm/drm_edid.h>
#include <drm/drm_eld.h>
@@ -55,3 +59,41 @@ int drm_eld_sad_set(u8 *eld, int sad_index, const struct cea_sad *cta_sad)
return 0;
}
EXPORT_SYMBOL(drm_eld_sad_set);
+
+/**
+ * drm_eld_set_port_id - set the ELD Port_ID for a connector
+ * @eld: ELD buffer
+ * @connector: connector the ELD belongs to
+ *
+ * drm_edid_to_eld() leaves the 64-bit Port_ID field of the ELD baseline
+ * block zero. Drivers can use this helper to fill it in with a value
+ * that identifies the audio endpoint, so that userspace can associate an
+ * ELD, and the PCM device it belongs to, with a DRM connector, even when
+ * identical sinks are connected to multiple outputs.
+ *
+ * The Port_ID is stored in little-endian byte order, with the layout:
+ *
+ * - bits 63:48 - PCI domain of the DRM device, truncated to 16 bits
+ * - bits 47:32 - PCI bus/device/function of the DRM device
+ * - bits 31:0 - DRM connector object ID
+ *
+ * For non-PCI devices bits 63:32 are zero.
+ *
+ * The connector object ID is only stable for the lifetime of the
+ * connector, so userspace must look it up at runtime, and not store it.
+ */
+void drm_eld_set_port_id(u8 *eld, const struct drm_connector *connector)
+{
+ struct device *dev = connector->dev->dev;
+ u64 port_id = connector->base.id;
+
+ if (dev && dev_is_pci(dev)) {
+ struct pci_dev *pdev = to_pci_dev(dev);
+
+ port_id |= (u64)(pci_domain_nr(pdev->bus) & 0xffff) << 48 |
+ (u64)pci_dev_id(pdev) << 32;
+ }
+
+ put_unaligned_le64(port_id, &eld[DRM_ELD_PORT_ID]);
+}
+EXPORT_SYMBOL(drm_eld_set_port_id);
diff --git a/include/drm/drm_eld.h b/include/drm/drm_eld.h
index 0a88d10b28b0..de0478720721 100644
--- a/include/drm/drm_eld.h
+++ b/include/drm/drm_eld.h
@@ -9,6 +9,7 @@
#include <linux/types.h>
struct cea_sad;
+struct drm_connector;
/* ELD Header Block */
#define DRM_ELD_HEADER_BLOCK_SIZE 4
@@ -80,6 +81,8 @@ static inline int drm_eld_mnl(const u8 *eld)
int drm_eld_sad_get(const u8 *eld, int sad_index, struct cea_sad *cta_sad);
int drm_eld_sad_set(u8 *eld, int sad_index, const struct cea_sad *cta_sad);
+void drm_eld_set_port_id(u8 *eld, const struct drm_connector *connector);
+
/**
* drm_eld_sad - Get ELD SAD structures.
* @eld: pointer to an eld memory structure with sad_count set
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] drm/i915/audio: Populate ELD Port_ID
2026-11-05 16:02 [PATCH 0/2] drm: Populate ELD Port_ID to identify audio endpoints Kai Vehmanen
2026-11-05 16:02 ` [PATCH 1/2] drm/eld: Add drm_eld_set_port_id() helper Kai Vehmanen
@ 2026-11-05 16:02 ` Kai Vehmanen
2026-11-05 17:09 ` Ville Syrjälä
1 sibling, 1 reply; 5+ messages in thread
From: Kai Vehmanen @ 2026-11-05 16:02 UTC (permalink / raw)
To: intel-gfx, intel-xe, dri-devel
Cc: Jani Nikula, Ville Syrjälä,
Rodrigo Vivi, Joonas Lahtinen, Tvrtko Ursulin, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Takashi Iwai, Jaroslav Kysela, linux-sound, Harry Wentland,
Leo Li, Alex Deucher, amd-gfx, Lyude Paul, Danilo Krummrich,
Tomáš Hnyk, Wim Taymans, nouveau, linux-kernel,
Kai Vehmanen
i915 never fills in the ELD Port_ID field, so it is always zero, and
the ELDs of identical monitors connected to different outputs are
byte-identical. Userspace then cannot tell which HDMI/DP PCM belongs to
which DRM connector without toggling the connector audio property.
Use drm_eld_set_port_id() when computing the audio config, so the value
reaches the audio driver through every path: the audio component
get_eld() callback, the hardware ELD buffer, SDVO and LPE audio.
The value is fixed for the lifetime of the connector, so it does not
cause extra audio re-enables when the ELD is compared across commits,
and state readout stays consistent because it is copied from the
programmed ELD.
Link: https://gitlab.freedesktop.org/drm/i915/kernel/-/work_items/16693
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
drivers/gpu/drm/i915/display/intel_audio.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c
index 32f8c5e55319..3277e67748ee 100644
--- a/drivers/gpu/drm/i915/display/intel_audio.c
+++ b/drivers/gpu/drm/i915/display/intel_audio.c
@@ -881,6 +881,8 @@ bool intel_audio_compute_config(struct intel_encoder *encoder,
crtc_state->eld[6] = drm_av_sync_delay(connector, adjusted_mode) / 2;
mutex_unlock(&connector->eld_mutex);
+ drm_eld_set_port_id(crtc_state->eld, connector);
+
return true;
}
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] drm/eld: Add drm_eld_set_port_id() helper
2026-11-05 16:02 ` [PATCH 1/2] drm/eld: Add drm_eld_set_port_id() helper Kai Vehmanen
@ 2026-11-05 17:08 ` Ville Syrjälä
0 siblings, 0 replies; 5+ messages in thread
From: Ville Syrjälä @ 2026-11-05 17:08 UTC (permalink / raw)
To: Kai Vehmanen
Cc: intel-gfx, intel-xe, dri-devel, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Takashi Iwai, Jaroslav Kysela, linux-sound, Harry Wentland,
Leo Li, Alex Deucher, amd-gfx, Lyude Paul, Danilo Krummrich,
Tomáš Hnyk, Wim Taymans, nouveau, linux-kernel
On Thu, Nov 05, 2026 at 06:02:39PM +0200, Kai Vehmanen wrote:
> The ELD baseline block reserves bytes 8..15 for a 64-bit Port_ID that
> identifies the source port of the audio endpoint. drm_edid_to_eld()
> leaves the field zero, and no driver fills it in, so it carries no
> information.
>
> When two identical monitors are connected, their ELDs are then
> byte-identical, and userspace has no passive way to tell which HDMI/DP
> PCM belongs to which DRM connector. The only workaround is to toggle
> the connector audio property and watch which ELD goes away, which
> disrupts the endpoint.
>
> Add a helper that drivers can use to fill in Port_ID with a common
> layout:
>
> bits 63:48 - PCI domain of the DRM device
> bits 47:32 - PCI bus/device/function of the DRM device
> bits 31:0 - DRM connector object ID
>
> Userspace can read the connector object ID directly from KMS, and the
> PCI address tells GPUs apart in multi-GPU systems. For non-PCI devices
> the upper half is left zero.
>
> The split between a 16-bit PCI BDF in the upper half and a per-device
> display identifier in the lower half follows the Port_ID layout
> documented for the AMD Azalia sink info registers in dce_audio.c.
>
> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
> ---
> drivers/gpu/drm/drm_eld.c | 42 +++++++++++++++++++++++++++++++++++++++
> include/drm/drm_eld.h | 3 +++
> 2 files changed, 45 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_eld.c b/drivers/gpu/drm/drm_eld.c
> index c0428d07de53..baebece7b4ed 100644
> --- a/drivers/gpu/drm/drm_eld.c
> +++ b/drivers/gpu/drm/drm_eld.c
> @@ -4,7 +4,11 @@
> */
>
> #include <linux/export.h>
> +#include <linux/pci.h>
> +#include <linux/unaligned.h>
>
> +#include <drm/drm_connector.h>
> +#include <drm/drm_device.h>
> #include <drm/drm_edid.h>
> #include <drm/drm_eld.h>
>
> @@ -55,3 +59,41 @@ int drm_eld_sad_set(u8 *eld, int sad_index, const struct cea_sad *cta_sad)
> return 0;
> }
> EXPORT_SYMBOL(drm_eld_sad_set);
> +
> +/**
> + * drm_eld_set_port_id - set the ELD Port_ID for a connector
> + * @eld: ELD buffer
> + * @connector: connector the ELD belongs to
> + *
> + * drm_edid_to_eld() leaves the 64-bit Port_ID field of the ELD baseline
> + * block zero. Drivers can use this helper to fill it in with a value
> + * that identifies the audio endpoint, so that userspace can associate an
> + * ELD, and the PCM device it belongs to, with a DRM connector, even when
> + * identical sinks are connected to multiple outputs.
> + *
> + * The Port_ID is stored in little-endian byte order, with the layout:
> + *
> + * - bits 63:48 - PCI domain of the DRM device, truncated to 16 bits
> + * - bits 47:32 - PCI bus/device/function of the DRM device
> + * - bits 31:0 - DRM connector object ID
> + *
> + * For non-PCI devices bits 63:32 are zero.
> + *
> + * The connector object ID is only stable for the lifetime of the
> + * connector, so userspace must look it up at runtime, and not store it.
> + */
> +void drm_eld_set_port_id(u8 *eld, const struct drm_connector *connector)
> +{
> + struct device *dev = connector->dev->dev;
> + u64 port_id = connector->base.id;
> +
> + if (dev && dev_is_pci(dev)) {
> + struct pci_dev *pdev = to_pci_dev(dev);
> +
> + port_id |= (u64)(pci_domain_nr(pdev->bus) & 0xffff) << 48 |
> + (u64)pci_dev_id(pdev) << 32;
The numbers look correct.
> + }
> +
> + put_unaligned_le64(port_id, &eld[DRM_ELD_PORT_ID]);
Endianness agrees with the HDA spec.
The implementation looks good
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
But I'll leave it to someone else to judge the actual
usefulness of the provided information.
> +}
> +EXPORT_SYMBOL(drm_eld_set_port_id);
> diff --git a/include/drm/drm_eld.h b/include/drm/drm_eld.h
> index 0a88d10b28b0..de0478720721 100644
> --- a/include/drm/drm_eld.h
> +++ b/include/drm/drm_eld.h
> @@ -9,6 +9,7 @@
> #include <linux/types.h>
>
> struct cea_sad;
> +struct drm_connector;
>
> /* ELD Header Block */
> #define DRM_ELD_HEADER_BLOCK_SIZE 4
> @@ -80,6 +81,8 @@ static inline int drm_eld_mnl(const u8 *eld)
> int drm_eld_sad_get(const u8 *eld, int sad_index, struct cea_sad *cta_sad);
> int drm_eld_sad_set(u8 *eld, int sad_index, const struct cea_sad *cta_sad);
>
> +void drm_eld_set_port_id(u8 *eld, const struct drm_connector *connector);
> +
> /**
> * drm_eld_sad - Get ELD SAD structures.
> * @eld: pointer to an eld memory structure with sad_count set
> --
> 2.43.0
--
Ville Syrjälä
Intel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] drm/i915/audio: Populate ELD Port_ID
2026-11-05 16:02 ` [PATCH 2/2] drm/i915/audio: Populate ELD Port_ID Kai Vehmanen
@ 2026-11-05 17:09 ` Ville Syrjälä
0 siblings, 0 replies; 5+ messages in thread
From: Ville Syrjälä @ 2026-11-05 17:09 UTC (permalink / raw)
To: Kai Vehmanen
Cc: intel-gfx, intel-xe, dri-devel, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Takashi Iwai, Jaroslav Kysela, linux-sound, Harry Wentland,
Leo Li, Alex Deucher, amd-gfx, Lyude Paul, Danilo Krummrich,
Tomáš Hnyk, Wim Taymans, nouveau, linux-kernel
On Thu, Nov 05, 2026 at 06:02:40PM +0200, Kai Vehmanen wrote:
> i915 never fills in the ELD Port_ID field, so it is always zero, and
> the ELDs of identical monitors connected to different outputs are
> byte-identical. Userspace then cannot tell which HDMI/DP PCM belongs to
> which DRM connector without toggling the connector audio property.
>
> Use drm_eld_set_port_id() when computing the audio config, so the value
> reaches the audio driver through every path: the audio component
> get_eld() callback, the hardware ELD buffer, SDVO and LPE audio.
>
> The value is fixed for the lifetime of the connector, so it does not
> cause extra audio re-enables when the ELD is compared across commits,
> and state readout stays consistent because it is copied from the
> programmed ELD.
>
> Link: https://gitlab.freedesktop.org/drm/i915/kernel/-/work_items/16693
> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_audio.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c
> index 32f8c5e55319..3277e67748ee 100644
> --- a/drivers/gpu/drm/i915/display/intel_audio.c
> +++ b/drivers/gpu/drm/i915/display/intel_audio.c
> @@ -881,6 +881,8 @@ bool intel_audio_compute_config(struct intel_encoder *encoder,
> crtc_state->eld[6] = drm_av_sync_delay(connector, adjusted_mode) / 2;
> mutex_unlock(&connector->eld_mutex);
>
> + drm_eld_set_port_id(crtc_state->eld, connector);
> +
> return true;
> }
>
> --
> 2.43.0
--
Ville Syrjälä
Intel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-05 17:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 16:02 [PATCH 0/2] drm: Populate ELD Port_ID to identify audio endpoints Kai Vehmanen
2026-11-05 16:02 ` [PATCH 1/2] drm/eld: Add drm_eld_set_port_id() helper Kai Vehmanen
2026-11-05 17:08 ` Ville Syrjälä
2026-11-05 16:02 ` [PATCH 2/2] drm/i915/audio: Populate ELD Port_ID Kai Vehmanen
2026-11-05 17:09 ` Ville Syrjälä
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®