linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] ARM: dts: mbimxsd25: cmo-qvga: Fix lcd regulator
@ 2014-06-17 10:46 Denis Carikli
  2014-06-17 10:46 ` [PATCH 2/3] video: imxfb: Fix unbalanced regulators Denis Carikli
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Denis Carikli @ 2014-06-17 10:46 UTC (permalink / raw)
  To: linux-arm-kernel

The fixed-regulator's enable-active-high property
is needed to indicate that the GPIO regulator is
active high.

Before that the regulator state was inverted.

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
 .../imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dts  |    1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dts b/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dts
index 9797280..68d0834 100644
--- a/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dts
+++ b/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dts
@@ -52,6 +52,7 @@
 			regulator-min-microvolt = <3300000>;
 			regulator-max-microvolt = <3300000>;
 			gpio = <&gpio1 26 GPIO_ACTIVE_HIGH>;
+			enable-active-high;
 		};
 	};
 };
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] video: imxfb: Fix unbalanced regulators
  2014-06-17 10:46 [PATCH 1/3] ARM: dts: mbimxsd25: cmo-qvga: Fix lcd regulator Denis Carikli
@ 2014-06-17 10:46 ` Denis Carikli
  2014-06-17 10:46 ` [PATCH 3/3] video: imxfb: Fix lcd_ops .set_power on/off inversion Denis Carikli
  2014-06-21  4:54 ` [PATCH 1/3] ARM: dts: mbimxsd25: cmo-qvga: Fix lcd regulator Shawn Guo
  2 siblings, 0 replies; 5+ messages in thread
From: Denis Carikli @ 2014-06-17 10:46 UTC (permalink / raw)
  To: linux-arm-kernel

Both regulator_enable and regulator_disable's comments
say that they must be balanced with its counterpart
enable/disable function.

Not doing it result in kernel warnings each time
the lcd is powered off twice, for instance trough sysfs.

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

diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c
index f6e6216..121cbd7 100644
--- a/drivers/video/fbdev/imxfb.c
+++ b/drivers/video/fbdev/imxfb.c
@@ -769,9 +769,9 @@ static int imxfb_lcd_set_power(struct lcd_device *lcddev, int power)
 	struct imxfb_info *fbi = dev_get_drvdata(&lcddev->dev);
 
 	if (!IS_ERR(fbi->lcd_pwr)) {
-		if (power)
+		if (power && !regulator_is_enabled(fbi->lcd_pwr))
 			return regulator_enable(fbi->lcd_pwr);
-		else
+		else if (regulator_is_enabled(fbi->lcd_pwr))
 			return regulator_disable(fbi->lcd_pwr);
 	}
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] video: imxfb: Fix lcd_ops .set_power on/off inversion
  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
  2014-06-19  9:24   ` Alexander Shiyan
  2014-06-21  4:54 ` [PATCH 1/3] ARM: dts: mbimxsd25: cmo-qvga: Fix lcd regulator Shawn Guo
  2 siblings, 1 reply; 5+ messages in thread
From: Denis Carikli @ 2014-06-17 10:46 UTC (permalink / raw)
  To: linux-arm-kernel

.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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/3] video: imxfb: Fix lcd_ops .set_power on/off inversion
  2014-06-17 10:46 ` [PATCH 3/3] video: imxfb: Fix lcd_ops .set_power on/off inversion Denis Carikli
@ 2014-06-19  9:24   ` Alexander Shiyan
  0 siblings, 0 replies; 5+ messages in thread
From: Alexander Shiyan @ 2014-06-19  9:24 UTC (permalink / raw)
  To: linux-arm-kernel

Tue, 17 Jun 2014 12:46:39 +0200 ?? Denis Carikli <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;

I think, the patch is correct, but we should update imxfb_lcd_get_power() in the same way.

Like as:
if (!IS_ERR_OR_NULL(fbi->lcd_pwr))
  if (!regulator_is_enabled(fbi->lcd_pwr))
    return FB_BLANK_NORMAL;

return FB_BLANK_UNBLANK;

---

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] ARM: dts: mbimxsd25: cmo-qvga: Fix lcd regulator
  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 ` [PATCH 3/3] video: imxfb: Fix lcd_ops .set_power on/off inversion Denis Carikli
@ 2014-06-21  4:54 ` Shawn Guo
  2 siblings, 0 replies; 5+ messages in thread
From: Shawn Guo @ 2014-06-21  4:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jun 17, 2014 at 12:46:37PM +0200, Denis Carikli wrote:
> The fixed-regulator's enable-active-high property
> is needed to indicate that the GPIO regulator is
> active high.
> 
> Before that the regulator state was inverted.
> 
> Signed-off-by: Denis Carikli <denis@eukrea.com>

Applied this one, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-06-21  4:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 3/3] video: imxfb: Fix lcd_ops .set_power on/off inversion Denis Carikli
2014-06-19  9:24   ` Alexander Shiyan
2014-06-21  4:54 ` [PATCH 1/3] ARM: dts: mbimxsd25: cmo-qvga: Fix lcd regulator Shawn Guo

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).