public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: dh09.lee@samsung•com (Donghwa Lee)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH] video: ld9040: support early fb event of fb_blank()
Date: Thu, 19 Jul 2012 09:43:33 +0900	[thread overview]
Message-ID: <50075835.2040703@samsung.com> (raw)
In-Reply-To: <500757AE.3010202@samsung.com>

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 <dh09.lee@samsung•com>
Signed-off-by: Inki Dae <inki.dae@samsung•com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung•com>
---
 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,
 };
-- 
1.7.4.1

           reply	other threads:[~2012-07-19  0:43 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <500757AE.3010202@samsung.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50075835.2040703@samsung.com \
    --to=dh09.lee@samsung$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox