From patchwork Tue Apr 5 20:23:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jim.bride@linux.intel.com X-Patchwork-Id: 8754861 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 533139F336 for ; Tue, 5 Apr 2016 20:24:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8057A2035D for ; Tue, 5 Apr 2016 20:24:14 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 4C2C720351 for ; Tue, 5 Apr 2016 20:24:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A4D426E824; Tue, 5 Apr 2016 20:24:10 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 221356E824; Tue, 5 Apr 2016 20:24:10 +0000 (UTC) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 05 Apr 2016 13:23:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,445,1455004800"; d="scan'208";a="926121442" Received: from shiv.jf.intel.com ([10.7.198.162]) by orsmga001.jf.intel.com with ESMTP; 05 Apr 2016 13:23:41 -0700 From: Jim Bride To: intel-gfx@lists.freedesktop.org Date: Tue, 5 Apr 2016 13:23:39 -0700 Message-Id: <1459887821-8142-2-git-send-email-jim.bride@linux.intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1459887821-8142-1-git-send-email-jim.bride@linux.intel.com> References: <1459887821-8142-1-git-send-email-jim.bride@linux.intel.com> Cc: dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 1/3] drm/edid: Add drm_edid_get_monitor_name() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In order to include monitor name information in debugfs output we needed to add a function that would extract the monitor name from the EDID, and that function needed to reside in the file where the rest of the EDID helper functions are implemented. cc: dri-devel@lists.freedesktop.org Signed-off-by: Jim Bride --- drivers/gpu/drm/drm_edid.c | 28 ++++++++++++++++++++++++++++ include/drm/drm_crtc.h | 1 + 2 files changed, 29 insertions(+) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 558ef9f..fc69a46 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -3569,6 +3569,34 @@ struct drm_connector *drm_select_eld(struct drm_encoder *encoder) EXPORT_SYMBOL(drm_select_eld); /** + * drm_edid_get_monitor_name - fetch the monitor name from the edid + * @edid: monitor EDID information + * @name: pointer to a character array of at least 13 chars to hold the name + * + * Return: True if the name could be extracted, false otherwise + */ +bool drm_edid_get_monitor_name(struct edid *edid, char *name) +{ + char *edid_name = NULL; + int mnl; + + if (!edid || !name) + return false; + + drm_for_each_detailed_block((u8 *)edid, monitor_name, &edid_name); + for (mnl = 0; edid_name && mnl < 13; mnl++) { + if (edid_name[mnl] == 0x0a) { + name[mnl] = '\0'; + break; + } + name[mnl] = edid_name[mnl]; + } + + return mnl ? true : false; +} +EXPORT_SYMBOL(drm_edid_get_monitor_name); + +/** * drm_detect_hdmi_monitor - detect whether monitor is HDMI * @edid: monitor EDID information * diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 8cb377c..2590168 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -2500,6 +2500,7 @@ extern int drm_edid_header_is_valid(const u8 *raw_edid); extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid, bool *edid_corrupt); extern bool drm_edid_is_valid(struct edid *edid); +extern bool drm_edid_get_monitor_name(struct edid *edid, char *name); extern struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev, char topology[8]);