[Intel-gfx] [PATCH 27/29] drm: Scan EDID for an audio-capable HDMI output

Adam Jackson ajax at redhat.com
Mon Aug 23 17:05:55 CEST 2010


On Sun, 2010-08-22 at 12:05 +0100, Chris Wilson wrote:
> Parse the EDID looking for a CEA-extension block that details whether
> the connected monitor has audio support over HDMI.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Dave Airlie <airlied at redhat.com>
> ---
>  drivers/gpu/drm/drm_edid.c |   27 +++++++++++++++++++++++++++
>  include/drm/drm_crtc.h     |    1 +
>  2 files changed, 28 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 96e9631..922b325 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -1326,6 +1326,33 @@ end:
>  EXPORT_SYMBOL(drm_detect_hdmi_monitor);
>  
>  /**
> + * drm_edid_supports_audio - detect whether monitor supports audio.
> + * @edid: monitor EDID information
> + *
> + * Parse the CEA extension according to CEA-861-B.
> + * Return true if a monitor is connected that supports basic audio,
> + * false if not or unknown.
> + */
> +bool drm_edid_supports_audio(struct edid *edid)
> +{
> +	int i;
> +
> +	/* No EDID or EDID extensions */
> +	if (edid == NULL || edid->extensions == 0)
> +		return false;
> +
> +	/* Find CEA extension */
> +	for (i = 0; i < edid->extensions; i++) {
> +		const char *edid_ext = (char *)edid + EDID_LENGTH * (i + 1);
> +		if (edid_ext[0] == 0x02)
> +			return edid_ext[3] & (1 << 6);
> +	}
> +
> +	return false;
> +}

Nack, CEA is worse than that.  What you have here is "does the zero'th
CEA subblock's type field have this one bit set", which isn't a
particularly meaningful thing to check.  In particular this will say
_any_ HDMI sink (with the HDMI vendor-specific block first in the CEA
block collection) is an audio sink.

You have to:
- check that the CEA version field is high enough
- scan for a vendor-specific data block
- check that its OUI matches the HDMI association OUI
- check that its length is 6 or greater so that you know the byte
containing the audio feature field is present
- check whether the top bit of that byte is set (indicating it can
consume ACP, ISRC1, or ISRC2 packets)

Refer to:

http://cgit.freedesktop.org/xorg/app/edid-decode/tree/edid-decode.c#n564

in particular the calls down to cea_block() and then cea_hdmi_block().

- ajax
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20100823/ed0ce4d5/attachment.sig>


More information about the Intel-gfx mailing list