linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: denis@eukrea.com (Denis Carikli)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] video: imxfb: Fix lcd_ops .set_power on/off inversion
Date: Tue, 17 Jun 2014 12:46:39 +0200	[thread overview]
Message-ID: <1403001999-12316-3-git-send-email-denis@eukrea.com> (raw)
In-Reply-To: <1403001999-12316-1-git-send-email-denis@eukrea.com>

.set_power takes the blank level as argument instead
of an on/off parameter:
fb_blank calls fb_notifier_call_chain with the blank
level encoded in its parameters, which is then sent
as-is to the set_power callback.

imxfb_lcd_set_power was expecting an on/off parameter
instead.
This resulted in the inversion of the on/off behaviour.

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
 drivers/video/fbdev/imxfb.c |   20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c
index 121cbd7..2ffbd5e 100644
--- a/drivers/video/fbdev/imxfb.c
+++ b/drivers/video/fbdev/imxfb.c
@@ -764,15 +764,25 @@ static int imxfb_lcd_get_power(struct lcd_device *lcddev)
 	return 1;
 }
 
-static int imxfb_lcd_set_power(struct lcd_device *lcddev, int power)
+static int imxfb_lcd_set_power(struct lcd_device *lcddev, int blank)
 {
 	struct imxfb_info *fbi = dev_get_drvdata(&lcddev->dev);
 
 	if (!IS_ERR(fbi->lcd_pwr)) {
-		if (power && !regulator_is_enabled(fbi->lcd_pwr))
-			return regulator_enable(fbi->lcd_pwr);
-		else if (regulator_is_enabled(fbi->lcd_pwr))
-			return regulator_disable(fbi->lcd_pwr);
+		switch (blank) {
+		case FB_BLANK_VSYNC_SUSPEND:
+		case FB_BLANK_HSYNC_SUSPEND:
+		case FB_BLANK_NORMAL:
+		case FB_BLANK_POWERDOWN:
+			if (regulator_is_enabled(fbi->lcd_pwr))
+				return regulator_disable(fbi->lcd_pwr);
+			break;
+
+		case FB_BLANK_UNBLANK:
+			if (!regulator_is_enabled(fbi->lcd_pwr))
+				return regulator_enable(fbi->lcd_pwr);
+			break;
+		}
 	}
 
 	return 0;
-- 
1.7.9.5

  parent reply	other threads:[~2014-06-17 10:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-17 10:46 [PATCH 1/3] ARM: dts: mbimxsd25: cmo-qvga: Fix lcd regulator Denis Carikli
2014-06-17 10:46 ` [PATCH 2/3] video: imxfb: Fix unbalanced regulators Denis Carikli
2014-06-17 10:46 ` Denis Carikli [this message]
2014-06-19  9:24   ` [PATCH 3/3] video: imxfb: Fix lcd_ops .set_power on/off inversion Alexander Shiyan
2014-06-21  4:54 ` [PATCH 1/3] ARM: dts: mbimxsd25: cmo-qvga: Fix lcd regulator Shawn Guo

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=1403001999-12316-3-git-send-email-denis@eukrea.com \
    --to=denis@eukrea.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).