From patchwork Fri Nov 23 14:09:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 1795661 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 78F253FC23 for ; Fri, 23 Nov 2012 14:10:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6A1EFE66A7 for ; Fri, 23 Nov 2012 06:10:02 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-gh0-f177.google.com (mail-gh0-f177.google.com [209.85.160.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 37AF4E667A; Fri, 23 Nov 2012 06:09:45 -0800 (PST) Received: by mail-gh0-f177.google.com with SMTP id g22so1681230ghb.36 for ; Fri, 23 Nov 2012 06:09:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=GNRJ/KfA8D5OFxXnEtsfkf4S6r9bF0oDw7yXFPC9AAE=; b=vGRC6g8nQS1Tx6hh0J96PQ7Vz8p9KZtRw9eBGJ5HAdElsaw1Ron8WbaTsd+ciXxKop 6Hgmi5rztDIJQh/QOI9epZVXPGR3tYuqK+X+aNZYtF8qs8WdeOyNWsTH20CfAARzqzIw yfGG9CnUHjH2P81ZyUbzMF22bqZ2SSo2vd61hlazB1kuElZKCrYR7EhxN0o8coxeI+sz TSOo5gyOgRfRXeOHFfiiIt+dG7LgXmCrRrYpfWJHrS0owJI3af0jL3I8uw90IWYvzYYy z4unWS5QhbnFDv/mtUEMKSQlg38CkDWRSBESkIH00xwruZnpu9q3riJ4fApnlGX++BDz 75zw== Received: by 10.100.245.16 with SMTP id s16mr1140663anh.49.1353679784552; Fri, 23 Nov 2012 06:09:44 -0800 (PST) Received: from vicky.domain.invalid ([187.112.188.105]) by mx.google.com with ESMTPS id t46sm6503725yhi.3.2012.11.23.06.09.39 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 23 Nov 2012 06:09:42 -0800 (PST) From: Paulo Zanoni To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/2] drm: add drm_mode_cea_vic Date: Fri, 23 Nov 2012 12:09:26 -0200 Message-Id: <1353679767-3737-1-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 1.7.10.4 Cc: intel-gfx@lists.freedesktop.org, Paulo Zanoni X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: Paulo Zanoni This function returns the VIC of the mode. This value can be used when creating AVI InfoFrames. Cc: Thierry Reding Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50371 Signed-off-by: Paulo Zanoni Reviewed-by: Thierry Reding --- drivers/gpu/drm/drm_edid.c | 19 +++++++++++++++++++ include/drm/drm_crtc.h | 1 + 2 files changed, 20 insertions(+) Since drm-intel-next-queued is too old for this patch, I am rebasing it against drm-next and splitting into 2 patches: one drm-only and the other i915-only, so I imagine the first will be merged by Dave and the second by Daniel. New version: - Based on Dave's drm-next - Fix function name inside the comments - Remove the i915 chunk - Constification of other functions is no more required as they are already const here. diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 1648200..011bd4f 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -2079,3 +2079,22 @@ int drm_add_modes_noedid(struct drm_connector *connector, return num_modes; } EXPORT_SYMBOL(drm_add_modes_noedid); + +/** + * drm_mode_cea_vic - return the CEA-861 VIC of a given mode + * @mode: mode + * + * RETURNS: + * The VIC number, 0 in case it's not a CEA-861 mode. + */ +uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode) +{ + uint8_t i; + + for (i = 0; i < drm_num_cea_modes; i++) + if (drm_mode_equal(mode, &edid_cea_modes[i])) + return i + 1; + + return 0; +} +EXPORT_SYMBOL(drm_mode_cea_vic); diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index c0635b7..3538eda 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -1055,6 +1055,7 @@ extern struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev, int GTF_2C, int GTF_K, int GTF_2J); extern int drm_add_modes_noedid(struct drm_connector *connector, int hdisplay, int vdisplay); +extern uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode); 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);