Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753327AbbEHLZ5 (ORCPT ); Fri, 8 May 2015 07:25:57 -0400 Received: from smtp5-g21.free.fr ([212.27.42.5]:52067 "EHLO smtp5-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752045AbbEHLZv (ORCPT ); Fri, 8 May 2015 07:25:51 -0400 X-Mailbox-Line: From 61f4eab5f21cc5eea1b74858852c4569dd839ac8 Mon Sep 17 00:00:00 2001 Message-Id: <61f4eab5f21cc5eea1b74858852c4569dd839ac8.1431083916.git.moinejf@free.fr> In-Reply-To: References: From: Jean-Francois Moine Date: Fri, 8 May 2015 09:39:33 +0200 Subject: [PATCH v12 1/6] drm/edid: add function to help find SADs To: Mark Brown , Russell King - ARM Linux Cc: Dave Airlie , Andrew Jackson , Jyri Sarha , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1338 Lines: 48 From: Russell King - ARM Linux Add a function to find the start of the SADs in the ELD. This complements the helper to retrieve the SAD count. Signed-off-by: Jean-Francois Moine --- include/drm/drm_edid.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 7990501..53c53c4 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -348,6 +348,25 @@ static inline int drm_eld_mnl(const uint8_t *eld) } /** + * drm_eld_sad - Get ELD SAD structures. + * @eld: pointer to an eld memory structure with sad_count set + */ +static inline const uint8_t *drm_eld_sad(const uint8_t *eld) +{ + unsigned int ver, mnl; + + ver = (eld[DRM_ELD_VER] & DRM_ELD_VER_MASK) >> DRM_ELD_VER_SHIFT; + if (ver != 2 && ver != 31) + return NULL; + + mnl = drm_eld_mnl(eld); + if (mnl > 16) + return NULL; + + return eld + DRM_ELD_CEA_SAD(mnl, 0); +} + +/** * drm_eld_sad_count - Get ELD SAD count. * @eld: pointer to an eld memory structure with sad_count set */ -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/