From patchwork Thu Jul 17 20:43:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kumar X-Patchwork-Id: 4587101 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 131BA9F37C for ; Fri, 18 Jul 2014 18:13:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 31DE7201BA for ; Fri, 18 Jul 2014 18:13:46 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 6CF952018E for ; Fri, 18 Jul 2014 18:13:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 35E3B6E7DD; Fri, 18 Jul 2014 11:13:31 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by gabe.freedesktop.org (Postfix) with ESMTP id 4F7636E6AD for ; Thu, 17 Jul 2014 13:46:59 -0700 (PDT) Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N8V0077HJ2ARB70@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 18 Jul 2014 05:46:58 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.122]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 10.99.16580.24638C35; Fri, 18 Jul 2014 05:46:58 +0900 (KST) X-AuditID: cbfee691-b7f2f6d0000040c4-96-53c83642870b Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 17.6C.04943.14638C35; Fri, 18 Jul 2014 05:46:58 +0900 (KST) Received: from chromebld-server.sisodomain.com ([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 <0N8V002BCJ1T7D60@mmp1.samsung.com>; Fri, 18 Jul 2014 05:46:57 +0900 (KST) From: Ajay Kumar To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [RESEND PATCH V5 02/12] drm/panel: add prepare and unprepare routines Date: Fri, 18 Jul 2014 02:13:48 +0530 Message-id: <1405629839-12086-3-git-send-email-ajaykumar.rs@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1405629839-12086-1-git-send-email-ajaykumar.rs@samsung.com> References: <1405629839-12086-1-git-send-email-ajaykumar.rs@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprDIsWRmVeSWpSXmKPExsWyRsSkStfJ7ESwwe4pfBYH3h9ksdjwZiGz xcKHd5ktrnx9z2Yx6f4EFotrv2ewWVxeeInV4vuuL+wWM87vY7JYdXgDu8XzhT+YLeYezLX4 uWseiwOvx9/Zrcwee78tYPHYOesuu8eCTaUe97uPM3n0bVnF6PF5k1wAexSXTUpqTmZZapG+ XQJXxrdF85gLXglXfHh6i72BcYFAFyMnh4SAicSO3zuZIGwxiQv31rN1MXJxCAksZZSYf2YG C0zRs3WnmCASixglrjx5zQzhTGCS2LDmJCtIFZuAtsS26TfBOkQE3CSaDs9kBSliFuhmkth3 7yxQgoNDWMBP4u8BTpAaFgFViVm73zGC2LwCHhIbJh1jBymREFCQmDPJBiTMKeApMbPzB9hI IaCSn7u/g+2VELjGLrGsaS8LxBwBiW+TD7FA9MpKbDrADHG0pMTBFTdYJjAKL2BkWMUomlqQ XFCclF5kqlecmFtcmpeul5yfu4kRGDOn/z2buIPx/gHrQ4zJ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/s6nbvDy8J7+61veO749pVTJivhqC onnij6/aaD5a1N4x6cWSsD/ntQSqJjp1epzqEzlpUSW4tsv9hr/HiahbdcunaMSZv3q3aL5Y Z43J6bzvYm11U1szGC/8/hxfflnaPXOGEktxRqKhFnNRcSIARqMOm94CAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Mailman-Approved-At: Fri, 18 Jul 2014 11:13:28 -0700 Cc: seanpaul@google.com, daniel.vetter@ffwll.ch, joshi@samsung.com, ajaynumb@gmail.com, javier@dowhile0.org, prashanth.g@samsung.com, Ajay Kumar X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.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 Most of the panels need an init sequence as mentioned below: -- poweron LCD unit/LCD_EN -- start video data -- poweron LED unit/BACKLIGHT_EN And, a de-init sequence as mentioned below: -- poweroff LED unit/BACKLIGHT_EN -- stop video data -- poweroff LCD unit/LCD_EN With existing callbacks for drm panel, we cannot accomodate such panels, since only two callbacks, i.e "panel_enable" and panel_disable are supported. This patch adds: -- "prepare" callback which can be called before the actual video data is on, and then call the "enable" callback after the video data is available. -- "unprepare" callback which can be called after the video data is off, and use "disable" callback to do something before switching off the video data. Now, we can easily map the above scenario as shown below: poweron LCD unit/LCD_EN = "prepare" callback poweron LED unit/BACKLIGHT_EN = "enable" callback poweroff LED unit/BACKLIGHT_EN = "disable" callback poweroff LCD unit/LCD_EN = "unprepare" callback Signed-off-by: Ajay Kumar --- include/drm/drm_panel.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index c2ab77a..9addc69 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -31,7 +31,9 @@ struct drm_device; struct drm_panel; struct drm_panel_funcs { + int (*unprepare)(struct drm_panel *panel); int (*disable)(struct drm_panel *panel); + int (*prepare)(struct drm_panel *panel); int (*enable)(struct drm_panel *panel); int (*get_modes)(struct drm_panel *panel); }; @@ -46,6 +48,14 @@ struct drm_panel { struct list_head list; }; +static inline int drm_panel_unprepare(struct drm_panel *panel) +{ + if (panel && panel->funcs && panel->funcs->unprepare) + return panel->funcs->unprepare(panel); + + return panel ? -ENOSYS : -EINVAL; +} + static inline int drm_panel_disable(struct drm_panel *panel) { if (panel && panel->funcs && panel->funcs->disable) @@ -54,6 +64,14 @@ static inline int drm_panel_disable(struct drm_panel *panel) return panel ? -ENOSYS : -EINVAL; } +static inline int drm_panel_prepare(struct drm_panel *panel) +{ + if (panel && panel->funcs && panel->funcs->prepare) + return panel->funcs->prepare(panel); + + return panel ? -ENOSYS : -EINVAL; +} + static inline int drm_panel_enable(struct drm_panel *panel) { if (panel && panel->funcs && panel->funcs->enable)