All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI: ibm-acpi: improve backlight power handling
@ 2007-02-27  1:01 Henrique de Moraes Holschuh
  0 siblings, 0 replies; 10+ messages in thread
From: Henrique de Moraes Holschuh @ 2007-02-27  1:01 UTC (permalink / raw)
  To: Len Brown; +Cc: ibm-acpi-devel, linux-acpi

Improve the backlight code to emulate as much as possible the power
management events, as we are unable to really power on or power off the
backlight.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Acked-by: Richard Purdie <rpurdie@rpsys.net>
---

 Len, I have added this to the for-upstream/acpi-test branch
 of git://repo.or.cz/linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git
 for when you pull it.

 drivers/acpi/ibm_acpi.c |    5 ++++-
 drivers/acpi/ibm_acpi.h |    1 +
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index dd36be0..6573d01 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -1664,7 +1664,10 @@ static void brightness_exit(void)
 
 static int brightness_update_status(struct backlight_device *bd)
 {
-	return brightness_set(bd->props.brightness);
+	return brightness_set(
+		(bd->props.fb_blank == FB_BLANK_UNBLANK &&
+		 bd->props.power == FB_BLANK_UNBLANK) ?
+				bd->props.brightness : 0);
 }
 
 static int brightness_get(struct backlight_device *bd)
diff --git a/drivers/acpi/ibm_acpi.h b/drivers/acpi/ibm_acpi.h
index 4d0387a..b63c014 100644
--- a/drivers/acpi/ibm_acpi.h
+++ b/drivers/acpi/ibm_acpi.h
@@ -32,6 +32,7 @@
 
 #include <linux/proc_fs.h>
 #include <linux/backlight.h>
+#include <linux/fb.h>
 #include <asm/uaccess.h>
 
 #include <linux/dmi.h>
-- 
1.5.0.1

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

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

* Re: [PATCH] ACPI: ibm-acpi: improve backlight power handling
  2007-03-08  8:28   ` [PATCH] ACPI: ibm-acpi: improve backlight power handling Henrique de Moraes Holschuh
@ 2007-03-09  1:25     ` Len Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Len Brown @ 2007-03-09  1:25 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh; +Cc: linux-acpi

Applied.

thanks,
-Len

On Thursday 08 March 2007 03:28, Henrique de Moraes Holschuh wrote:
> Improve the backlight code to emulate as much as possible the power
> management events, as we are unable to really power on or power off the
> backlight.
> 
> Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
> Acked-by: Richard Purdie <rpurdie@rpsys.net>
> ---
>  drivers/acpi/ibm_acpi.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
> index 7c1b418..63d7a85 100644
> --- a/drivers/acpi/ibm_acpi.c
> +++ b/drivers/acpi/ibm_acpi.c
> @@ -86,6 +86,7 @@
>  
>  #include <linux/proc_fs.h>
>  #include <linux/backlight.h>
> +#include <linux/fb.h>
>  #include <asm/uaccess.h>
>  
>  #include <linux/dmi.h>
> @@ -1701,7 +1702,10 @@ static int brightness_write(char *buf)
>  
>  static int brightness_update_status(struct backlight_device *bd)
>  {
> -	return brightness_set(bd->props.brightness);
> +	return brightness_set(
> +		(bd->props.fb_blank == FB_BLANK_UNBLANK &&
> +		 bd->props.power == FB_BLANK_UNBLANK) ?
> +				bd->props.brightness : 0);
>  }
>  
>  static struct backlight_ops ibm_backlight_data = {

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

* [PATCH] ACPI: ibm-acpi: improve backlight power handling
  2007-03-08  7:43 ` [GIT PULL] ibm-acpi 2.6.21-rc3 regression fixes Henrique de Moraes Holschuh
@ 2007-03-08  8:28   ` Henrique de Moraes Holschuh
  2007-03-09  1:25     ` Len Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Henrique de Moraes Holschuh @ 2007-03-08  8:28 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, Henrique de Moraes Holschuh

Improve the backlight code to emulate as much as possible the power
management events, as we are unable to really power on or power off the
backlight.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Acked-by: Richard Purdie <rpurdie@rpsys.net>
---
 drivers/acpi/ibm_acpi.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index 7c1b418..63d7a85 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -86,6 +86,7 @@
 
 #include <linux/proc_fs.h>
 #include <linux/backlight.h>
+#include <linux/fb.h>
 #include <asm/uaccess.h>
 
 #include <linux/dmi.h>
@@ -1701,7 +1702,10 @@ static int brightness_write(char *buf)
 
 static int brightness_update_status(struct backlight_device *bd)
 {
-	return brightness_set(bd->props.brightness);
+	return brightness_set(
+		(bd->props.fb_blank == FB_BLANK_UNBLANK &&
+		 bd->props.power == FB_BLANK_UNBLANK) ?
+				bd->props.brightness : 0);
 }
 
 static struct backlight_ops ibm_backlight_data = {
-- 
1.5.0.3


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

* Re: [PATCH] ACPI: ibm-acpi: improve backlight power handling
  2007-02-27  1:01 Henrique de Moraes Holschuh
@ 2007-02-27  1:05 ` Henrique de Moraes Holschuh
  0 siblings, 0 replies; 10+ messages in thread
From: Henrique de Moraes Holschuh @ 2007-02-27  1:05 UTC (permalink / raw)
  To: alsa-devel

EWRONGLIST.

Sorry about this, it won't happen again.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

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

* [PATCH] ACPI: ibm-acpi: improve backlight power handling
@ 2007-02-27  1:01 Henrique de Moraes Holschuh
  2007-02-27  1:05 ` Henrique de Moraes Holschuh
  0 siblings, 1 reply; 10+ messages in thread
From: Henrique de Moraes Holschuh @ 2007-02-27  1:01 UTC (permalink / raw)
  To: Len Brown; +Cc: ibm-acpi-devel, alsa-devel

Improve the backlight code to emulate as much as possible the power
management events, as we are unable to really power on or power off the
backlight.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Acked-by: Richard Purdie <rpurdie@rpsys.net>
---

 Len, I have added this to the for-upstream/acpi-test branch
 of git://repo.or.cz/linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git
 for when you pull it.

 drivers/acpi/ibm_acpi.c |    5 ++++-
 drivers/acpi/ibm_acpi.h |    1 +
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index dd36be0..6573d01 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -1664,7 +1664,10 @@ static void brightness_exit(void)
 
 static int brightness_update_status(struct backlight_device *bd)
 {
-	return brightness_set(bd->props.brightness);
+	return brightness_set(
+		(bd->props.fb_blank == FB_BLANK_UNBLANK &&
+		 bd->props.power == FB_BLANK_UNBLANK) ?
+				bd->props.brightness : 0);
 }
 
 static int brightness_get(struct backlight_device *bd)
diff --git a/drivers/acpi/ibm_acpi.h b/drivers/acpi/ibm_acpi.h
index 4d0387a..b63c014 100644
--- a/drivers/acpi/ibm_acpi.h
+++ b/drivers/acpi/ibm_acpi.h
@@ -32,6 +32,7 @@
 
 #include <linux/proc_fs.h>
 #include <linux/backlight.h>
+#include <linux/fb.h>
 #include <asm/uaccess.h>
 
 #include <linux/dmi.h>
-- 
1.5.0.1

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

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

* Re: [PATCH] ACPI: ibm-acpi: improve backlight power handling
  2007-02-26 17:21             ` Jiri Kosina
@ 2007-02-26 18:17               ` Henrique de Moraes Holschuh
  0 siblings, 0 replies; 10+ messages in thread
From: Henrique de Moraes Holschuh @ 2007-02-26 18:17 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: Richard Purdie, linux-kernel

On Mon, 26 Feb 2007, Jiri Kosina wrote:
> On Mon, 26 Feb 2007, Henrique de Moraes Holschuh wrote:
> > Improve the backlight code to emulate as much as possible the power
> > management events, as we are unable to really power on or power off the
> > backlight.
> 
> This still easily leads to confusing behavior, doesn't it? As there are 
> power-related calls from backlight driver, which won't get handled 

I failed to notice the power thing, I will update the patch to handle it.
Thanks.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

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

* Re: [PATCH] ACPI: ibm-acpi: improve backlight power handling
  2007-02-26 16:38             ` Richard Purdie
@ 2007-02-26 18:12               ` Henrique de Moraes Holschuh
  0 siblings, 0 replies; 10+ messages in thread
From: Henrique de Moraes Holschuh @ 2007-02-26 18:12 UTC (permalink / raw)
  To: Richard Purdie; +Cc: Jiri Kosina, linux-kernel

On Mon, 26 Feb 2007, Richard Purdie wrote:
> On Mon, 2007-02-26 at 13:12 -0300, Henrique de Moraes Holschuh wrote:
> > @@ -1707,7 +1708,8 @@ static int brightness_write(char *buf)
> >  
> >  static int brightness_update_status(struct backlight_device *bd)
> >  {
> > -	return brightness_set(bd->props.brightness);
> > +	return brightness_set((bd->props.fb_blank == FB_BLANK_UNBLANK)? 
> > +				bd->props.brightness : 0);
> >  }
> >  
> >  static struct backlight_ops ibm_backlight_data = {
> 
> Should we be looking at bd->props.power here too?

Probably.  I will update the patch.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

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

* Re: [PATCH] ACPI: ibm-acpi: improve backlight power handling
  2007-02-26 16:12           ` [PATCH] ACPI: ibm-acpi: improve backlight power handling Henrique de Moraes Holschuh
  2007-02-26 16:38             ` Richard Purdie
@ 2007-02-26 17:21             ` Jiri Kosina
  2007-02-26 18:17               ` Henrique de Moraes Holschuh
  1 sibling, 1 reply; 10+ messages in thread
From: Jiri Kosina @ 2007-02-26 17:21 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh; +Cc: Richard Purdie, linux-kernel

On Mon, 26 Feb 2007, Henrique de Moraes Holschuh wrote:

> Improve the backlight code to emulate as much as possible the power
> management events, as we are unable to really power on or power off the
> backlight.

This still easily leads to confusing behavior, doesn't it? As there are 
power-related calls from backlight driver, which won't get handled 
properly by your code, in result confusing the brightness status.

I would suggest applying something like the patch below instead, if you 
find it OK.



From: Jiri Kosina <jkosina@suse.cz>

[PATCH] ibm-acpi: handle power calls from backlight class

Don't ignore the power-related calls from backlight class driver
and always adjust the brightness accordingly.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>

--- 

 drivers/acpi/ibm_acpi.c             |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index 7c1b418..4cfa5f8 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -87,6 +87,7 @@
 #include <linux/proc_fs.h>
 #include <linux/backlight.h>
 #include <asm/uaccess.h>
+#include <linux/fb.h>
 
 #include <linux/dmi.h>
 #include <linux/jiffies.h>
@@ -1701,7 +1702,12 @@ static int brightness_write(char *buf)
 
 static int brightness_update_status(struct backlight_device *bd)
 {
-	return brightness_set(bd->props.brightness);
+	int brightness = 0;
+
+	if (bd->props.fb_blank == FB_BLANK_UNBLANK || bd->props.power == FB_BLANK_UNBLANK)
+		brightness = bd->props.brightness;
+	return brightness_set(brightness); 
+
 }
 
 static struct backlight_ops ibm_backlight_data = {

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

* Re: [PATCH] ACPI: ibm-acpi: improve backlight power handling
  2007-02-26 16:12           ` [PATCH] ACPI: ibm-acpi: improve backlight power handling Henrique de Moraes Holschuh
@ 2007-02-26 16:38             ` Richard Purdie
  2007-02-26 18:12               ` Henrique de Moraes Holschuh
  2007-02-26 17:21             ` Jiri Kosina
  1 sibling, 1 reply; 10+ messages in thread
From: Richard Purdie @ 2007-02-26 16:38 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh; +Cc: Jiri Kosina, linux-kernel

On Mon, 2007-02-26 at 13:12 -0300, Henrique de Moraes Holschuh wrote:
> @@ -1707,7 +1708,8 @@ static int brightness_write(char *buf)
>  
>  static int brightness_update_status(struct backlight_device *bd)
>  {
> -	return brightness_set(bd->props.brightness);
> +	return brightness_set((bd->props.fb_blank == FB_BLANK_UNBLANK)? 
> +				bd->props.brightness : 0);
>  }
>  
>  static struct backlight_ops ibm_backlight_data = {

Should we be looking at bd->props.power here too?

Richard


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

* [PATCH] ACPI: ibm-acpi: improve backlight power handling
  2007-02-26 15:20         ` Henrique de Moraes Holschuh
@ 2007-02-26 16:12           ` Henrique de Moraes Holschuh
  2007-02-26 16:38             ` Richard Purdie
  2007-02-26 17:21             ` Jiri Kosina
  0 siblings, 2 replies; 10+ messages in thread
From: Henrique de Moraes Holschuh @ 2007-02-26 16:12 UTC (permalink / raw)
  To: Richard Purdie; +Cc: Jiri Kosina, linux-kernel

Improve the backlight code to emulate as much as possible the power
management events, as we are unable to really power on or power off the
backlight.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Richard Purdie <rpurdie@rpsys.net>
---

 Status: waiting ACK from Richard Purdie <rpurdie@rpsys.net>

 drivers/acpi/ibm_acpi.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index e7309a6..cb5885e 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -86,6 +86,7 @@
 
 #include <linux/proc_fs.h>
 #include <linux/backlight.h>
+#include <linux/fb.h>
 #include <asm/uaccess.h>
 
 #include <linux/dmi.h>
@@ -1707,7 +1708,8 @@ static int brightness_write(char *buf)
 
 static int brightness_update_status(struct backlight_device *bd)
 {
-	return brightness_set(bd->props.brightness);
+	return brightness_set((bd->props.fb_blank == FB_BLANK_UNBLANK)? 
+				bd->props.brightness : 0);
 }
 
 static struct backlight_ops ibm_backlight_data = {
-- 
1.5.0.1

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

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

end of thread, other threads:[~2007-03-09  1:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-27  1:01 [PATCH] ACPI: ibm-acpi: improve backlight power handling Henrique de Moraes Holschuh
  -- strict thread matches above, loose matches on Subject: below --
2007-03-08  8:28 [PATCH] ACPI: ibm-acpi: fix initial status of backlight device Henrique de Moraes Holschuh
2007-03-08  7:43 ` [GIT PULL] ibm-acpi 2.6.21-rc3 regression fixes Henrique de Moraes Holschuh
2007-03-08  8:28   ` [PATCH] ACPI: ibm-acpi: improve backlight power handling Henrique de Moraes Holschuh
2007-03-09  1:25     ` Len Brown
2007-02-27  1:01 Henrique de Moraes Holschuh
2007-02-27  1:05 ` Henrique de Moraes Holschuh
2007-02-26  0:59 2.6.21-rc1 dims my LCD Jiri Kosina
2007-02-26 11:41 ` Richard Purdie
2007-02-26 12:35   ` Jiri Kosina
2007-02-26 14:21     ` Henrique de Moraes Holschuh
2007-02-26 14:49       ` Richard Purdie
2007-02-26 15:20         ` Henrique de Moraes Holschuh
2007-02-26 16:12           ` [PATCH] ACPI: ibm-acpi: improve backlight power handling Henrique de Moraes Holschuh
2007-02-26 16:38             ` Richard Purdie
2007-02-26 18:12               ` Henrique de Moraes Holschuh
2007-02-26 17:21             ` Jiri Kosina
2007-02-26 18:17               ` Henrique de Moraes Holschuh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.