From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Jackson Subject: Re: [PATCH 27/29] drm: Scan EDID for an audio-capable HDMI output Date: Mon, 23 Aug 2010 11:05:55 -0400 Message-ID: <1282575955.17843.34740.camel@atropine> References: <1282475148-15951-1-git-send-email-chris@chris-wilson.co.uk> <1282475148-15951-28-git-send-email-chris@chris-wilson.co.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1256822431==" Return-path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by gabe.freedesktop.org (Postfix) with ESMTP id 23B239EB05 for ; Mon, 23 Aug 2010 08:06:03 -0700 (PDT) In-Reply-To: <1282475148-15951-28-git-send-email-chris@chris-wilson.co.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Chris Wilson Cc: Dave Airlie , intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org --===============1256822431== Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-XGa7GJqJEa00rCsA3x+i" --=-XGa7GJqJEa00rCsA3x+i Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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. >=20 > Signed-off-by: Chris Wilson > Cc: Dave Airlie > --- > drivers/gpu/drm/drm_edid.c | 27 +++++++++++++++++++++++++++ > include/drm/drm_crtc.h | 1 + > 2 files changed, 28 insertions(+), 0 deletions(-) >=20 > 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); > =20 > /** > + * 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 =3D=3D NULL || edid->extensions =3D=3D 0) > + return false; > + > + /* Find CEA extension */ > + for (i =3D 0; i < edid->extensions; i++) { > + const char *edid_ext =3D (char *)edid + EDID_LENGTH * (i + 1); > + if (edid_ext[0] =3D=3D 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 --=-XGa7GJqJEa00rCsA3x+i Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEABECAAYFAkxyjlMACgkQW4otUKDs0NO3iACfaF4B+H5E4XXk3L1kY6H3Iojy fDEAoNYgSwY5Rg0wdPbNA/oA8BNvQG+t =KOZj -----END PGP SIGNATURE----- --=-XGa7GJqJEa00rCsA3x+i-- --===============1256822431== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx --===============1256822431==--