From patchwork Fri Jul 25 19:22:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kumar X-Patchwork-Id: 4630881 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CE011C0338 for ; Sun, 27 Jul 2014 11:49:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EF7752015D for ; Sun, 27 Jul 2014 11:49:48 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 1E4162012F for ; Sun, 27 Jul 2014 11:49:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2DFD36E226; Sun, 27 Jul 2014 04:49:41 -0700 (PDT) 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 86B116E19C for ; Fri, 25 Jul 2014 12:25:17 -0700 (PDT) Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N9A00LGF8M4RP70@mailout3.samsung.com> for dri-devel@lists.freedesktop.org; Sat, 26 Jul 2014 04:25:16 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.126]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id C8.A3.16580.C1FA2D35; Sat, 26 Jul 2014 04:25:16 +0900 (KST) X-AuditID: cbfee691-b7f2f6d0000040c4-4a-53d2af1c7e8e Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 47.C5.05196.C1FA2D35; Sat, 26 Jul 2014 04:25:16 +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 <0N9A00DP98LUTO60@mmp1.samsung.com>; Sat, 26 Jul 2014 04:25:16 +0900 (KST) From: Ajay Kumar To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH V6 1/8] drm/panel: Add prepare, unprepare and get_modes routines Date: Sat, 26 Jul 2014 00:52:03 +0530 Message-id: <1406316130-4744-2-git-send-email-ajaykumar.rs@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1406316130-4744-1-git-send-email-ajaykumar.rs@samsung.com> References: <1406316130-4744-1-git-send-email-ajaykumar.rs@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprGIsWRmVeSWpSXmKPExsWyRsSkTldm/aVgg7MXNSwOvD/IYrHhzUJm i4UP7zJbzD9yjtXiytf3bBaT7k9gsbi88BKrxfddX9gtZpzfx2Sx6vAGdovnC38wW8w9mGvx c9c8Fgdej73fFrB47Jx1l91jwaZSj/vdx5k8+rasYvT4vEkugC2KyyYlNSezLLVI3y6BK+PZ zeMsBYfEKw5fqW5gXCLcxcjJISFgItE68T0ThC0mceHeerYuRi4OIYGljBJLf7awwxS9XriF BSKxiFFi7+G/7BDOBCaJuTPus4BUsQloS2ybfhPI5uAQEUiReP6XD6SGWeAbo8SFhevYQGqE BQIkLlycxghiswioSvx48AtsNa+Au8T9badYQXolBBQk5kyyAQlzCnhINN18BzZeCKjk8Yrp rCAzJQTOsUvsXfmNHWKOgMS3yYdYIHplJTYdYIY4WlLi4IobLBMYhRcwMqxiFE0tSC4oTkov MtUrTswtLs1L10vOz93ECIyT0/+eTdzBeP+A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MOZBbIvLNaNr7jTzC1k4hJ7t1P5UsaPZY6KXl dGB7AbuIiMeP+ALG6VaZqrqMOWeDTTfcfn3DPWC6jq/djJ7KWyv83uksvma4ZrHnt1d7SkIW P/KamXIlWGvbhre8MkWtdzKVWIozEg21mIuKEwHQegCf2AIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Mailman-Approved-At: Sun, 27 Jul 2014 04:49:39 -0700 Cc: seanpaul@google.com, daniel.vetter@ffwll.ch, joshi@samsung.com, ajaynumb@gmail.com, 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.8 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 Also, a helper function for get_modes is added. Signed-off-by: Ajay Kumar --- include/drm/drm_panel.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index c2ab77a..efc63cc 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) @@ -62,6 +80,14 @@ static inline int drm_panel_enable(struct drm_panel *panel) return panel ? -ENOSYS : -EINVAL; } +static inline int drm_panel_get_modes(struct drm_panel *panel) +{ + if (panel && panel->funcs && panel->funcs->get_modes) + return panel->funcs->get_modes(panel); + + return 0; +} + void drm_panel_init(struct drm_panel *panel); int drm_panel_add(struct drm_panel *panel);