From patchwork Fri Nov 9 16:21:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Sharma X-Patchwork-Id: 1726521 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 B1E603FCAE for ; Mon, 12 Nov 2012 08:05:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A36659EFA7 for ; Mon, 12 Nov 2012 00:05:21 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by gabe.freedesktop.org (Postfix) with ESMTP id E86BE9E8B5 for ; Fri, 9 Nov 2012 08:00:27 -0800 (PST) Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MD800JS19S7R540@mailout3.samsung.com> for dri-devel@lists.freedesktop.org; Sat, 10 Nov 2012 01:00:27 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.125]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 0C.9D.12699.A982D905; Sat, 10 Nov 2012 01:00:27 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-16-509d289a142b Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 4B.9D.12699.A982D905; Sat, 10 Nov 2012 01:00:26 +0900 (KST) Received: from localhost.localdomain ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MD800F3V9RKZ3B0@mmp1.samsung.com> for dri-devel@lists.freedesktop.org; Sat, 10 Nov 2012 01:00:26 +0900 (KST) From: Rahul Sharma To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/2] drm: get cea video id code for a given display mode Date: Fri, 09 Nov 2012 21:51:05 +0530 Message-id: <1352478066-1077-2-git-send-email-rahul.sharma@samsung.com> X-Mailer: git-send-email 1.7.0.4 In-reply-to: <1352478066-1077-1-git-send-email-rahul.sharma@samsung.com> References: <1352478066-1077-1-git-send-email-rahul.sharma@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNLMWRmVeSWpSXmKPExsWyRsSkVne2xtwAgzk7mC2ufH3P5sDocb/7 OFMAYxSXTUpqTmZZapG+XQJXxuPuOUwF5wUqVr++ztTA+IO3i5GTQ0LARKJh21lGCFtM4sK9 9WxdjFwcQgJLGSXuXXrMBFM0v/8OE0RiEaPE+anv2CGc1UwSzz59ZAWpYhPQlZh98BnYKBEB ZYm/E1eB2cwCBRL3fh8AqxEW8JD413ObGcRmEVCV2LhtLtBUDg5eAXeJ9e9UIZYpSLQuO8QO EuYEKl+42BskLARUMWPhGlaITgGJb5MPsYCUSAjISmw6wAxyjYTAZTaJfU/WQt0sKXFwxQ2W CYzCCxgZVjGKphYkFxQnpeca6RUn5haX5qXrJefnbmIEhuDpf8+kdzCuarA4xCjAwajEw5v4 YHaAEGtiWXFl7iFGCQ5mJRHeyUxzA4R4UxIrq1KL8uOLSnNSiw8x+gBdMpFZSjQ5HxgfeSXx hsYm5qbGppZGRmampjiElcR5mz1SAoQE0hNLUrNTUwtSi2DGMXFwSjUwZt01+L5eK86XP6Um 4Yeo9+ZzL9YtZVTgUY2y+Xmp7q7dPg/DpY9DIywmdzO8fTPhbeRS8ybXCZ0n7qisePXfZHP7 gs7WrJT2x8LTOd9/1lk7Y4tO6fJWO2PJWzMezP6+Mf/ZzxL5KQck7l5b1uYg+JH5wTSD3OPL nSxeMZXF6UaKzON480K0TomlOCPRUIu5qDgRAJuluZRuAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupikeLIzCtJLcpLzFFi42I5/e+xgO4sjbkBBtuv6Vhc+fqezYHR4373 caYAxqgGRpuM1MSU1CKF1Lzk/JTMvHRbJe/geOd4UzMDQ11DSwtzJYW8xNxUWyUXnwBdt8wc oLFKCmWJOaVAoYDE4mIlfTtME0JD3HQtYBojdH1DguB6jAzQQMIaxozH3XOYCs4LVKx+fZ2p gfEHbxcjJ4eEgInE/P47TBC2mMSFe+vZuhi5OIQEFjFKnJ/6jh3CWc0k8ezTR1aQKjYBXYnZ B58xgtgiAsoSfyeuArOZBQok7v0+AFYjLOAh8a/nNjOIzSKgKrFx21ygDRwcvALuEuvfqUIs U5BoXXaIHSTMCVS+cLE3SFgIqGLGwjWsExh5FzAyrGIUTS1ILihOSs810itOzC0uzUvXS87P 3cQIDvBn0jsYVzVYHGIU4GBU4uFNfDA7QIg1say4MvcQowQHs5II72SmuQFCvCmJlVWpRfnx RaU5qcWHGH2AbprILCWanA+MvrySeENjE3NTY1NLEwsTM0scwkrivM0eKQFCAumJJanZqakF qUUw45g4OKUaGJtfuX+axRr9se7khC9p+/I0j2hzhtzL/5ZskO8UdmXR1cQ1ov8y+SwNI1u5 rFIUzOVdbfotO5a/lzuqIX+xI6/mYvXs++fupMdM2Hq3rPvBrG96Uz9t8TrhIHvgNP8Zye4Y jrwIZ/W7bCvFixpv3gszSqiINa7an8Ai+7VIqOjZ6Ze2K7X0lViKMxINtZiLihMBHLvpZJ0C AAA= X-CFilter-Loop: Reflected X-Mailman-Approved-At: Mon, 12 Nov 2012 00:00:28 -0800 Cc: airlied@redhat.com, kgene.kim@samsung.com, marcheu@chromium.org 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: Stephane Marchesin This patch adds support for getting CEA Video ID Code for a given display mode after matching with edid_cea_modes list. Its index in the list added with one, gives the desired code. This exported function will be used by hdmi drivers for composing AVI info frame data. Signed-off-by: Stephane Marchesin Signed-off-by: Rahul Sharma --- drivers/gpu/drm/drm_edid.c | 20 ++++++++++++++++++++ include/drm/drm_crtc.h | 1 + 2 files changed, 21 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index fadcd44..856dcd9 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1516,6 +1516,26 @@ u8 *drm_find_cea_extension(struct edid *edid) } EXPORT_SYMBOL(drm_find_cea_extension); +/* + * Looks for a CEA mode matching given drm_display_mode. + * Returns its CEA Video ID code, or 0 if not found. + */ +u8 drm_match_cea_mode(struct drm_display_mode *to_match) +{ + struct drm_display_mode *cea_mode; + u8 mode; + + for (mode = 0; mode < drm_num_cea_modes; mode++) { + cea_mode = (struct drm_display_mode *)&edid_cea_modes[mode]; + + if (drm_mode_equal(to_match, cea_mode)) + return mode + 1; + } + return 0; +} +EXPORT_SYMBOL(drm_match_cea_mode); + + static int do_cea_modes (struct drm_connector *connector, u8 *db, u8 len) { diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 92889be..467a327 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -1038,6 +1038,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev, extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv); extern u8 *drm_find_cea_extension(struct edid *edid); +extern u8 drm_match_cea_mode(struct drm_display_mode *to_match); extern bool drm_detect_hdmi_monitor(struct edid *edid); extern bool drm_detect_monitor_audio(struct edid *edid); extern int drm_mode_page_flip_ioctl(struct drm_device *dev,