From patchwork Thu Aug 29 01:51:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Hackmann X-Patchwork-Id: 19602 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f198.google.com (mail-ve0-f198.google.com [209.85.128.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 97A1725E63 for ; Thu, 29 Aug 2013 01:51:55 +0000 (UTC) Received: by mail-ve0-f198.google.com with SMTP id 15sf7826922vea.9 for ; Wed, 28 Aug 2013 18:51:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=delivered-to:from:to:date:message-id:in-reply-to:references:cc :subject:precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=e16SqMtFG6mcKHXm7sDeqXd8cgxCakT/8pCAH+O/Sng=; b=STIxWAX+4X37TEyx2gDUZgi78rjtAjLCAPm9qdXrPqREv1eGWEkz3x3KRu3WmTw+jF foxrnHYSrPjlkLtVQgLf3gUl4+37dkyScD0JWvB8dLVVulDrGHsYNFwAYOTL2PEgXpbV YBgdN4dkkxLzrV4dLr12o9Q9IA9aGfMytabbBI6d0XvySrGfa4z1hRzMFkr76v7bxctN 38GWh+IEmT5lGK3loRjJXQwrcizlMOy2A2vQnsmDE/aQpemXhbw55JO0pRwD7h+Nijn+ 3zeuaJWxvRhSMaDUNuQ7gfjbaalKKYbMsNuUxNSfcT+psVPWmb/ciJsDJO2zPm8XR+Pt qoMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=e16SqMtFG6mcKHXm7sDeqXd8cgxCakT/8pCAH+O/Sng=; b=SYQBhgB3fRVQ4umDaQpR+rKcxzyEjgKzNKBizSRkOGk7rMtV+MOHgbBHtZqfTtSTeN 3C851IRLQR4hI973+6lciDpme1ijG50MT6h3L4eJnaI0katkGXmx1ka/VsPaRq9OO8z4 9qwOZS4GxzAVm6w5HeMv89uBVXfRo+6291MQxHc+KnQfJwIpNVaYU8ak2C8iza82/9l2 51KX/8bxJO8sH87HEtHktmeOiC/X4NzJKlBFr983su/AwR8IdqsCewhtgzn9iPW/Bxa0 WpMCtLpGXCXcnm0GFnGA8OEk62aca7HLUODiSQVM+Fse4rpQ3JhLO2QeA3lOe7LRZ3ev 6fmQ== X-Received: by 10.236.68.2 with SMTP id k2mr329446yhd.16.1377741115366; Wed, 28 Aug 2013 18:51:55 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.97.199 with SMTP id ec7ls648329qeb.26.gmail; Wed, 28 Aug 2013 18:51:55 -0700 (PDT) X-Received: by 10.58.237.105 with SMTP id vb9mr665190vec.2.1377741115251; Wed, 28 Aug 2013 18:51:55 -0700 (PDT) Received: from mail-vc0-x22c.google.com (mail-vc0-x22c.google.com [2607:f8b0:400c:c03::22c]) by mx.google.com with ESMTPS id fw17si7448597vec.104.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 28 Aug 2013 18:51:54 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c03::22c is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c03::22c; Received: by mail-vc0-f172.google.com with SMTP id m17so4747797vca.3 for ; Wed, 28 Aug 2013 18:51:54 -0700 (PDT) X-Gm-Message-State: ALoCoQkCpyrI34QZ26c6rT1njglWq1utQyXuQ3iRmhWQU3eeym1HfbzIbf0+qq5sjZI/5iaTEO36 X-Received: by 10.220.174.200 with SMTP id u8mr505344vcz.6.1377741113487; Wed, 28 Aug 2013 18:51:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp389553vcz; Wed, 28 Aug 2013 18:51:53 -0700 (PDT) X-Received: by 10.58.152.3 with SMTP id uu3mr640451veb.16.1377741113030; Wed, 28 Aug 2013 18:51:53 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id rx1si5538399vdc.99.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 28 Aug 2013 18:51:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1VErO0-0003W9-8q; Thu, 29 Aug 2013 01:51:00 +0000 Received: from mail-vb0-f73.google.com ([209.85.212.73]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1VErNy-0003VQ-Oe for linaro-mm-sig@lists.linaro.org; Thu, 29 Aug 2013 01:50:58 +0000 Received: by mail-vb0-f73.google.com with SMTP id e12so729903vbg.0 for ; Wed, 28 Aug 2013 18:51:39 -0700 (PDT) X-Received: by 10.236.172.34 with SMTP id s22mr308672yhl.25.1377741099916; Wed, 28 Aug 2013 18:51:39 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id z45si1786025yha.7.1969.12.31.16.00.00 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Wed, 28 Aug 2013 18:51:39 -0700 (PDT) Received: from ghackmann.mtv.corp.google.com (ghackmann.mtv.corp.google.com [172.18.120.106]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id B0D5B5A407C; Wed, 28 Aug 2013 18:51:39 -0700 (PDT) Received: by ghackmann.mtv.corp.google.com (Postfix, from userid 163046) id 6F3B01005DB; Wed, 28 Aug 2013 18:51:39 -0700 (PDT) From: Greg Hackmann To: dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org Date: Wed, 28 Aug 2013 18:51:20 -0700 Message-Id: <1377741081-30189-4-git-send-email-ghackmann@google.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1377741081-30189-1-git-send-email-ghackmann@google.com> References: <1377741081-30189-1-git-send-email-ghackmann@google.com> Cc: konkers@google.com Subject: [Linaro-mm-sig] [RFC 3/4] video: adf: add display core helper X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-mm-sig-bounces@lists.linaro.org Sender: linaro-mm-sig-bounces@lists.linaro.org X-Original-Sender: ghackmann@google.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c03::22c is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (bad format) header.i=@google.com; dmarc=fail (p=REJECT dis=NONE) d=google.com Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Optional helper which implements some ADF interface ops for displays using the Display Core framework Signed-off-by: Greg Hackmann --- drivers/video/adf/Kconfig | 5 ++ drivers/video/adf/Makefile | 2 + drivers/video/adf/adf.c | 28 ++++++++- drivers/video/adf/adf.h | 1 + drivers/video/adf/adf_display.c | 123 ++++++++++++++++++++++++++++++++++++++++ include/video/adf_display.h | 31 ++++++++++ 6 files changed, 189 insertions(+), 1 deletion(-) create mode 100644 drivers/video/adf/adf_display.c create mode 100644 include/video/adf_display.h diff --git a/drivers/video/adf/Kconfig b/drivers/video/adf/Kconfig index 0b64408..30b0611 100644 --- a/drivers/video/adf/Kconfig +++ b/drivers/video/adf/Kconfig @@ -3,3 +3,8 @@ menuconfig ADF depends on SW_SYNC depends on DMA_SHARED_BUFFER tristate "Atomic Display Framework" + +menuconfig ADF_DISPLAY_CORE + depends on ADF + depends on DISPLAY_CORE + tristate "Helper for implementing ADF interface ops with Display Core devices" diff --git a/drivers/video/adf/Makefile b/drivers/video/adf/Makefile index 2af5f79..30164ee 100644 --- a/drivers/video/adf/Makefile +++ b/drivers/video/adf/Makefile @@ -8,3 +8,5 @@ obj-$(CONFIG_ADF) += adf.o \ adf_sysfs.o obj-$(CONFIG_COMPAT) += adf_fops32.o + +obj-$(CONFIG_ADF_DISPLAY_CORE) += adf_display.o diff --git a/drivers/video/adf/adf.c b/drivers/video/adf/adf.c index 5dc04af..b3b57dd 100644 --- a/drivers/video/adf/adf.c +++ b/drivers/video/adf/adf.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2013 Google, Inc. - * adf_modeinfo_set_name modified from drm_mode_set_name in + * adf_modeinfo_{set_name,set_vrefresh} modified from * drivers/gpu/drm/drm_modes.c * * This software is licensed under the terms of the GNU General Public @@ -966,6 +966,32 @@ void adf_modeinfo_set_name(struct drm_mode_modeinfo *mode) interlaced ? "i" : ""); } +void adf_modeinfo_set_vrefresh(struct drm_mode_modeinfo *mode) +{ + int refresh = 0; + unsigned int calc_val; + + if (mode->vrefresh > 0) + return; + else if (mode->htotal > 0 && mode->vtotal > 0) { + int vtotal; + vtotal = mode->vtotal; + /* work out vrefresh the value will be x1000 */ + calc_val = (mode->clock * 1000); + calc_val /= mode->htotal; + refresh = (calc_val + vtotal / 2) / vtotal; + + if (mode->flags & DRM_MODE_FLAG_INTERLACE) + refresh *= 2; + if (mode->flags & DRM_MODE_FLAG_DBLSCAN) + refresh /= 2; + if (mode->vscan > 1) + refresh /= mode->vscan; + + mode->vrefresh = refresh; + } +} + static void __exit adf_exit(void); static int __init adf_init(void) { diff --git a/drivers/video/adf/adf.h b/drivers/video/adf/adf.h index acad631..5f7260d 100644 --- a/drivers/video/adf/adf.h +++ b/drivers/video/adf/adf.h @@ -44,5 +44,6 @@ struct adf_event_refcount *adf_obj_find_refcount(struct adf_obj *obj, enum adf_event_type type); void adf_modeinfo_set_name(struct drm_mode_modeinfo *mode); +void adf_modeinfo_set_vrefresh(struct drm_mode_modeinfo *mode); #endif /* __ADF_H */ diff --git a/drivers/video/adf/adf_display.c b/drivers/video/adf/adf_display.c new file mode 100644 index 0000000..c87f6a5 --- /dev/null +++ b/drivers/video/adf/adf_display.c @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2013 Google, Inc. + * adf_modeinfo_from_videomode modified from drm_display_mode_from_videomode in + * drivers/gpu/drm/drm_modes.c + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include