From patchwork Thu Jul 31 17:42:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kumar X-Patchwork-Id: 4659811 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 406F4C033D for ; Fri, 1 Aug 2014 01:05:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 63A0F201B9 for ; Fri, 1 Aug 2014 01:05:20 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 176D3201C8 for ; Fri, 1 Aug 2014 01:05:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 682016E6EB; Thu, 31 Jul 2014 18:05:13 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by gabe.freedesktop.org (Postfix) with ESMTP id 9B72C6E6A4 for ; Thu, 31 Jul 2014 10:45:53 -0700 (PDT) Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N9L00K5O80G6B10@mailout4.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 01 Aug 2014 02:45:52 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.123]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id 95.34.13863.0D08AD35; Fri, 01 Aug 2014 02:45:52 +0900 (KST) X-AuditID: cbfee690-b7f526d000003627-fd-53da80d00088 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 22.3E.05196.0D08AD35; Fri, 01 Aug 2014 02:45:52 +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:52 +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 Subject: [PATCH 11/15] drm/panel: simple: Add proper definition for prepare and unprepare Date: Thu, 31 Jul 2014 23:12:10 +0530 Message-id: <1406828534-10072-12-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+NgFmpnkeLIzCtJLcpLzFFi42JZI2JSrXuh4VawwftFxhYH3h9ksdjwZiGz xfwj51gtrnx9z2Yx6f4EFovLCy+xWnzf9YXdYsb5fUwWqw5vYLeYezDX4ueueSwO3B47Z91l 91iwqdTjfvdxJo++LasYPT5vkgtgjeKySUnNySxLLdK3S+DKmLtsO3vBReGKGWtnszcwThDo YuTgkBAwkXj7UK6LkRPIFJO4cG89WxcjF4eQwFJGiVmrLzJCJEwkJs46xQSRWMQocfnBNShn ApPExRfnmUGq2AS0JbZNv8kCYosI1EnsX36fEaSIWWAto8TTeZPBEsIC0RJte9YxgdgsAqoS O3etBrN5BTwlDt54yAZxkoLEnEk2IGFOoPDU3svsIGEhAQ+JZ8fTQEZKCGxjl+ifcIkRYoyA xLfJh1ggWmUlNh1ghjhaUuLgihssExiFFzAyrGIUTS1ILihOSi8y0StOzC0uzUvXS87P3cQI jITT/55N2MF474D1IcZko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faf3B7aeb1MkA5LFZGT5iuZc 6t/86EqsQ2dt5Z2z73NaJ3T7uqjXK0j+OF5++H1gW1+klfmuZT0+X59kzymTnNmV1bq0a7+a EktxRqKhFnNRcSIArD89J8oCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Mailman-Approved-At: Thu, 31 Jul 2014 18:05:11 -0700 Cc: seanpaul@google.com, 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.9 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 Move out code from enable and disable routines to prepare and unprepare routines, so that functionality is properly distributed across all the panel functions. Signed-off-by: Ajay Kumar --- drivers/gpu/drm/panel/panel-simple.c | 37 +++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 2e51c34..9801728 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -45,6 +45,7 @@ struct panel_desc { struct panel_simple { struct drm_panel base; + bool prepared; bool enabled; const struct panel_desc *desc; @@ -105,10 +106,6 @@ static int panel_simple_disable(struct drm_panel *panel) backlight_update_status(p->backlight); } - if (p->enable_gpio) - gpiod_set_value_cansleep(p->enable_gpio, 0); - - regulator_disable(p->supply); p->enabled = false; return 0; @@ -116,20 +113,27 @@ static int panel_simple_disable(struct drm_panel *panel) static int panel_simple_unprepare(struct drm_panel *panel) { - return 0; -} + struct panel_simple *p = to_panel_simple(panel); + + if (!p->prepared) + return 0; + + if (p->enable_gpio) + gpiod_set_value_cansleep(p->enable_gpio, 0); + + regulator_disable(p->supply); + + p->prepared = false; -static int panel_simple_prepare(struct drm_panel *panel) -{ return 0; } -static int panel_simple_enable(struct drm_panel *panel) +static int panel_simple_prepare(struct drm_panel *panel) { struct panel_simple *p = to_panel_simple(panel); int err; - if (p->enabled) + if (p->prepared) return 0; err = regulator_enable(p->supply); @@ -141,6 +145,18 @@ static int panel_simple_enable(struct drm_panel *panel) if (p->enable_gpio) gpiod_set_value_cansleep(p->enable_gpio, 1); + p->prepared = true; + + return 0; +} + +static int panel_simple_enable(struct drm_panel *panel) +{ + struct panel_simple *p = to_panel_simple(panel); + + if (p->enabled) + return 0; + if (p->backlight) { p->backlight->props.power = FB_BLANK_UNBLANK; backlight_update_status(p->backlight); @@ -191,6 +207,7 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) return -ENOMEM; panel->enabled = false; + panel->prepared = false; panel->desc = desc; panel->supply = devm_regulator_get(dev, "power");