From patchwork Thu Jul 19 00:43:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Donghwa Lee X-Patchwork-Id: 1213661 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 12C863FD4F for ; Thu, 19 Jul 2012 00:43:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751559Ab2GSAni (ORCPT ); Wed, 18 Jul 2012 20:43:38 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:61852 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751064Ab2GSAnh (ORCPT ); Wed, 18 Jul 2012 20:43:37 -0400 Received: from epcpsbgm1.samsung.com (mailout1.samsung.com [203.254.224.24]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M7D00LVKU0L1150@mailout1.samsung.com> for linux-fbdev@vger.kernel.org; Thu, 19 Jul 2012 09:43:36 +0900 (KST) X-AuditID: cbfee61a-b7f616d000004b7e-76-50075838a775 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 36.23.19326.83857005; Thu, 19 Jul 2012 09:43:36 +0900 (KST) Received: from [10.90.51.49] by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M7D00683U0OTK00@mmp1.samsung.com> for linux-fbdev@vger.kernel.org; Thu, 19 Jul 2012 09:43:36 +0900 (KST) Message-id: <50075835.2040703@samsung.com> Date: Thu, 19 Jul 2012 09:43:33 +0900 From: Donghwa Lee User-Agent: Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-version: 1.0 To: linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Florian Tobias Schandinat , Andrew Morton , Kyungmin Park , Inki Dae , Donghwa Lee Subject: [PATCH] video: ld9040: support early fb event of fb_blank() References: <500757AE.3010202@samsung.com> In-reply-to: <500757AE.3010202@samsung.com> X-Forwarded-Message-Id: <500757AE.3010202@samsung.com> Content-type: text/plain; charset=EUC-KR Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrFLMWRmVeSWpSXmKPExsVy+t9jAV2LCPYAg5s/xCxO9H1gdWD0+LxJ LoAxissmJTUnsyy1SN8ugStjxbXFzAUrhCpmTPnF0sD4jq+LkZNDQsBEYuqDXWwQtpjEhXvr gWwuDiGBRYwSrbtPMUM4nUwSnyefYAap4hXQkrh2eCMTiM0ioCpxb8pxsDibgIbE6Xv32UFs UYEAiY2tZ9gh6gUlfky+xwIySERgHtCgOT/BEsICLhJ3ey6A2UJAQ2c9f8sIYnMKaEvM+TgR qIED6CQzifuPXUHCzEDzp74+zQhhy0tsXvOWeQKjwCwkK2YhKZuFpGwBI/MqRtHUguSC4qT0 XEO94sTc4tK8dL3k/NxNjOAQfCa1g3Flg8UhRgEORiUeXk019gAh1sSy4srcQ4wSHMxKIrzF YUAh3pTEyqrUovz4otKc1OJDjNIcLErivMbeX/2FBNITS1KzU1MLUotgskwcnFINjDU5zUvu 5AgfPVme3zTr8Wy5wkn75hhnHeBJ45l9YFGw8df8kn/b2zKXHRNVFVj8h7f9xSURve2bNZ/M ly4+YJfHb7964RrlHVMcOryMu8L/lJvnBdyJLmG1LOPd9/HT6vP3fT90zfhrrWLFeiXe5o5j MsOc4/NuR1w3/jPNfJrDNtk12vZ6y5RYijMSDbWYi4oTATNnpWk9AgAA X-TM-AS-MML: No Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org This patch supports early fb event of fb_blank(). - In case of lcd power off : call early_set_power() interface and lcd power is off. And then framebuffer is blanked. - In case of lcd power on : First, framebuffer is unblanked, and then call set_power() interface to turn lcd on. Signed-off-by: Donghwa Lee Signed-off-by: Inki Dae Signed-off-by: Kyungmin Park --- drivers/video/backlight/ld9040.c | 36 +++++++++++++++++++++++++++++++++++- 1 files changed, 35 insertions(+), 1 deletions(-) diff --git a/drivers/video/backlight/ld9040.c b/drivers/video/backlight/ld9040.c index efd352b..221c843 100644 --- a/drivers/video/backlight/ld9040.c +++ b/drivers/video/backlight/ld9040.c @@ -642,17 +642,50 @@ static int ld9040_power(struct ld9040 *lcd, int power) return ret; } +static int ld9040_early_set_power(struct lcd_device *ld, int power) +{ + struct ld9040 *lcd = lcd_get_data(ld); + int ret = 0; + + if (power != FB_BLANK_UNBLANK && power != FB_BLANK_POWERDOWN && + power != FB_BLANK_NORMAL) { + dev_err(lcd->dev, "power value should be 0, 1 or 4.\n"); + + return -EINVAL; + } + + if (!power_is_on(power) && power_is_on(lcd->power)) { + ret = ld9040_power(lcd, power); + if (!ret) + lcd->power = power; + } + + return ret; +} + static int ld9040_set_power(struct lcd_device *ld, int power) { struct ld9040 *lcd = lcd_get_data(ld); + struct backlight_device *bd = lcd->bd; + int ret = 0; if (power != FB_BLANK_UNBLANK && power != FB_BLANK_POWERDOWN && power != FB_BLANK_NORMAL) { dev_err(lcd->dev, "power value should be 0, 1 or 4.\n"); + return -EINVAL; } - return ld9040_power(lcd, power); + if (power_is_on(power) && !power_is_on(lcd->power)) { + ret = ld9040_power(lcd, power); + if (!ret) + lcd->power = power; + + ld9040_gamma_ctl(lcd, bd->props.brightness); + } else + ld9040_early_set_power(ld, power); + + return ret; } static int ld9040_get_power(struct lcd_device *ld) @@ -689,6 +722,7 @@ static int ld9040_set_brightness(struct backlight_device *bd) } static struct lcd_ops ld9040_lcd_ops = { + .early_set_power = ld9040_early_set_power, .set_power = ld9040_set_power, .get_power = ld9040_get_power, };