public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* ACPI: ibm-acpi: fix initial status of backlight device
       [not found]               ` <20070222011017.GA8845@khazad-dum.debian.net>
@ 2007-02-22  1:16                 ` Henrique de Moraes Holschuh
  2007-02-22 10:03                   ` Richard Purdie
  0 siblings, 1 reply; 4+ messages in thread
From: Henrique de Moraes Holschuh @ 2007-02-22  1:16 UTC (permalink / raw)
  To: Richard Purdie; +Cc: linux-kernel, linux-fbdev-devel, linux-acpi

The brightness class core does not update the initial status of
the device's brightness at register time.  Do it by ourselves
before we register the class device.

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

NOTE: This patch needs an ACK from Richard Purdie before it can be merged,
as he might want to change the backlight class code instead.

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

diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index 2429e11..6875421 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -1713,6 +1713,13 @@ static struct backlight_properties ibm_backlight_data = {
 
 static int brightness_init(void)
 {
+	int b;
+
+	b = brightness_get(NULL);
+	if (b < 0)
+		return b;
+	ibm_backlight_data.brightness = b;
+
 	ibm_backlight_device = backlight_device_register("ibm", NULL, NULL,
 							 &ibm_backlight_data);
 	if (IS_ERR(ibm_backlight_device)) {
-- 
1.4.4.4

-- 
  "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] 4+ messages in thread

* Re: ACPI: ibm-acpi: fix initial status of backlight device
  2007-02-22  1:16                 ` ACPI: ibm-acpi: fix initial status of backlight device Henrique de Moraes Holschuh
@ 2007-02-22 10:03                   ` Richard Purdie
  2007-02-22 14:45                     ` Henrique de Moraes Holschuh
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Purdie @ 2007-02-22 10:03 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh; +Cc: linux-kernel, linux-fbdev-devel, linux-acpi

On Wed, 2007-02-21 at 23:16 -0200, Henrique de Moraes Holschuh wrote:
> NOTE: This patch needs an ACK from Richard Purdie before it can be merged,
> as he might want to change the backlight class code instead.

As mentioned elsewhere, we can't do this in the class itself.

> --- a/drivers/acpi/ibm_acpi.c
> +++ b/drivers/acpi/ibm_acpi.c
> @@ -1713,6 +1713,13 @@ static struct backlight_properties ibm_backlight_data = {
>  
>  static int brightness_init(void)
>  {
> +	int b;
> +
> +	b = brightness_get(NULL);
> +	if (b < 0)
> +		return b;
> +	ibm_backlight_data.brightness = b;
> +
>  	ibm_backlight_device = backlight_device_register("ibm", NULL, NULL,
>  							 &ibm_backlight_data);

This isn't against 2.6.21-rc1 which changed the backlight class a bit.
Basically, you need to set the brightness variable after
backlight_device_register(). It should be simple enough to do and fix
the problem the same way though.

Richard



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

* ACPI: ibm-acpi: fix initial status of backlight device
  2007-02-22 10:03                   ` Richard Purdie
@ 2007-02-22 14:45                     ` Henrique de Moraes Holschuh
  2007-02-22 18:19                       ` Henrique de Moraes Holschuh
  0 siblings, 1 reply; 4+ messages in thread
From: Henrique de Moraes Holschuh @ 2007-02-22 14:45 UTC (permalink / raw)
  To: Richard Purdie; +Cc: linux-kernel, linux-fbdev-devel, linux-acpi

The brightness class core does not update the initial status of the
device's brightness at register time.  Do it by ourselves.

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

Waiting ACK from Richard Purdie, applies on top of 2.6.21-rc1.  Also fixes a
whitespace problem.

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

diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index 4cc534e..c59ebff 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -1711,6 +1711,12 @@ static struct backlight_ops ibm_backlight_data = {
 
 static int brightness_init(void)
 {
+	int b;
+
+	b = brightness_get(NULL);
+	if (b < 0)
+		return b;
+
 	ibm_backlight_device = backlight_device_register("ibm", NULL, NULL,
 							 &ibm_backlight_data);
 	if (IS_ERR(ibm_backlight_device)) {
@@ -1718,7 +1724,8 @@ static int brightness_init(void)
 		return PTR_ERR(ibm_backlight_device);
 	}
 
-        ibm_backlight_device->props.max_brightness = 7;
+	ibm_backlight_device->props.max_brightness = 7;
+	ibm_backlight_device->props.brightness = b;
 
 	return 0;
 }
-- 
1.4.4.4

-- 
  "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] 4+ messages in thread

* Re: ACPI: ibm-acpi: fix initial status of backlight device
  2007-02-22 14:45                     ` Henrique de Moraes Holschuh
@ 2007-02-22 18:19                       ` Henrique de Moraes Holschuh
  0 siblings, 0 replies; 4+ messages in thread
From: Henrique de Moraes Holschuh @ 2007-02-22 18:19 UTC (permalink / raw)
  To: Richard Purdie; +Cc: linux-kernel, linux-fbdev-devel, linux-acpi

Here's the final version.  I will request a pull from Len Brown to get it
into acpi-test, from where it will eventually reach mainline at Len's
discretion.

-- 
  "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

From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>

ACPI: ibm-acpi: fix initial status of backlight device

The brightness class core does not update the initial status of the
device's brightness at register time.  Do it by ourselves.

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

diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index 4cc534e..7c1b418 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -1711,6 +1711,12 @@ static struct backlight_ops ibm_backlight_data = {
 
 static int brightness_init(void)
 {
+	int b;
+
+	b = brightness_get(NULL);
+	if (b < 0)
+		return b;
+
 	ibm_backlight_device = backlight_device_register("ibm", NULL, NULL,
 							 &ibm_backlight_data);
 	if (IS_ERR(ibm_backlight_device)) {
@@ -1718,7 +1724,9 @@ static int brightness_init(void)
 		return PTR_ERR(ibm_backlight_device);
 	}
 
-        ibm_backlight_device->props.max_brightness = 7;
+	ibm_backlight_device->props.max_brightness = 7;
+	ibm_backlight_device->props.brightness = b;
+	backlight_update_status(ibm_backlight_device);
 
 	return 0;
 }
-- 
1.4.4.4


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

end of thread, other threads:[~2007-02-22 18:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20070219044616.GC25659@washoe.onerussian.com>
     [not found] ` <20070219000412.acad13de.akpm@linux-foundation.org>
     [not found]   ` <1171876788.6046.3.camel@localhost.localdomain>
     [not found]     ` <877iub9mu2.fsf@sycorax.lbl.gov>
     [not found]       ` <1172097718.5790.29.camel@localhost.localdomain>
     [not found]         ` <20070221231706.GA3336@khazad-dum.debian.net>
     [not found]           ` <1172103159.5790.45.camel@localhost.localdomain>
     [not found]             ` <20070222005122.GA7928@khazad-dum.debian.net>
     [not found]               ` <20070222011017.GA8845@khazad-dum.debian.net>
2007-02-22  1:16                 ` ACPI: ibm-acpi: fix initial status of backlight device Henrique de Moraes Holschuh
2007-02-22 10:03                   ` Richard Purdie
2007-02-22 14:45                     ` Henrique de Moraes Holschuh
2007-02-22 18:19                       ` Henrique de Moraes Holschuh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox