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: 1213671 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id ABD27DFFFD for ; Thu, 19 Jul 2012 00:51:54 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Sreqp-00075f-7H; Thu, 19 Jul 2012 00:44:19 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SreqF-00075R-Db for linux-arm-kernel@lists.infradead.org; Thu, 19 Jul 2012 00:43:45 +0000 Received: from epcpsbgm2.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 <0M7D008HKTZRG170@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 19 Jul 2012 09:43:36 +0900 (KST) X-AuditID: cbfee61b-b7f566d000005c8a-ba-50075838bf3a Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 96.76.23690.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-arm-kernel@lists.infradead.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> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJLMWRmVeSWpSXmKPExsVy+t9jAV2LCPYAg6ufxSw2Pb7G6sDosXlJ fQBjFJdNSmpOZllqkb5dAlfGimuLmQtWCFXMmPKLpYHxHV8XIyeHhICJxMstvewQtpjEhXvr 2UBsIYFFjBJtzWZdjFxA9iQmiRf3FjOCJHgFtCSuHd7IBGKzCKhK3JtynBnEZhPQkDh97z7Y IFGBAImNrWfYIeoFJX5MvscCMkhEYB6TxOc5P8ESwgIuEnd7LrBDbNOSmPX8LdgCTgFtiTkf JwI1cABdZCZx/7ErSJgZaP7U16cZIWx5ic1r3jJPYBSYhWTFLCRls5CULWBkXsUomlqQXFCc lJ5rpFecmFtcmpeul5yfu4kRHIDPpHcwrmqwOMQowMGoxMPboc8eIMSaWFZcmXuIUYKDWUmE tzgMKMSbklhZlVqUH19UmpNafIhRmoNFSZzXxPurv5BAemJJanZqakFqEUyWiYNTqoGxLWzv 8popsb8bu07MDLny3lb8w33R8LnT/00ruBW89El0SZDAicX3gt8ayjrc+tHeEagbGZ53fifT owVTcj7O0dU1+vepK4XjvdDmU6+WnFw6X1Oq8AFH9Snd9ZzyqukGvItkGwquHWiQ5npwxMj6 5x32WTmdhar+fFXm/6WuBrj/T7Y7xVCuxFKckWioxVxUnAgABmHGZDwCAAA= X-TM-AS-MML: No X-Spam-Note: CRM114 invocation failed X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.24 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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, };