From patchwork Thu Jul 31 17:42:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kumar X-Patchwork-Id: 4658371 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 7DD279F2B8 for ; Thu, 31 Jul 2014 17:45:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A503920138 for ; Thu, 31 Jul 2014 17:45:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 36D6720145 for ; Thu, 31 Jul 2014 17:45:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752977AbaGaRpd (ORCPT ); Thu, 31 Jul 2014 13:45:33 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:34886 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752483AbaGaRpa (ORCPT ); Thu, 31 Jul 2014 13:45:30 -0400 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N9L00IZJ7ZSXBB0@mailout1.samsung.com>; Fri, 01 Aug 2014 02:45:28 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.122]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id B1.39.14752.8B08AD35; Fri, 01 Aug 2014 02:45:28 +0900 (KST) X-AuditID: cbfee68f-b7fa26d0000039a0-a6-53da80b81fa1 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 04.AA.04943.8B08AD35; Fri, 01 Aug 2014 02:45:28 +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 <0N9L00GWZ7ZJ9070@mmp1.samsung.com>; Fri, 01 Aug 2014 02:45:28 +0900 (KST) From: Ajay Kumar To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, thierry.reding@gmail.com Cc: inki.dae@samsung.com, seanpaul@google.com, ajaynumb@gmail.com, jg1.han@samsung.com, joshi@samsung.com, prashanth.g@samsung.com, Ajay Kumar Subject: [PATCH 01/15] drm/panel: add prepare and unprepare routines Date: Thu, 31 Jul 2014 23:12:00 +0530 Message-id: <1406828534-10072-2-git-send-email-ajaykumar.rs@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1406828534-10072-1-git-send-email-ajaykumar.rs@samsung.com> References: <1406828534-10072-1-git-send-email-ajaykumar.rs@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpnkeLIzCtJLcpLzFFi42JZI2JSpbuj4VawwYkVahYH3h9ksdjwZiGz xfwj51gtrnx9z2Yx6f4EFovLCy+xWnzf9YXdYsb5fUwWqw5vYLeYezDX4ueueSwO3B47Z91l 91iwqdTjfvdxJo++LasYPT5vkgtgjeKySUnNySxLLdK3S+DK+LZoHnPBK+GKD09vsTcwLhDo YuTkkBAwkZj3Yz8bhC0mceHeeiCbi0NIYCmjxIFvb9hhilpu/GGGSCxilDi79zorhDOBSWL2 u3VgVWwC2hLbpt9kAbFFBOok9i+/zwhSxCywllHi6bzJYAlhAReJde8XMYHYLAKqElcvrASy OTh4BTwkvt73BzElBBQk5kyyAangFPCUmNp7mR0kLARU8ex4GshECYFd7BKrJmxmhJgiIPFt 8iEWiFZZiU0HmCFulpQ4uOIGywRG4QWMDKsYRVMLkguKk9KLjPWKE3OLS/PS9ZLz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jOcivhvCZfsfW6ys/E+y1Jjw5Q7/hbn olueFc00/NfX/zMqQWWvQeztIjbfEuEnUw8f0JrkcPCfwK+CX3fTK//MyOq1+iWXauG6JeeL gacSS3FGoqEWc1FxIgDnVFwryQIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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)