Skip to contentSkip to conversation

i915: Fix bug where screen brightness is not restored

PATCH In review Alex Davis 4 participants 6 messages Nov 15, 2011 – Nov 16, 2011

Subsystems (2)
lore
Share & tools
lore

Alex Davis

author
#0 lore raw

PATCH 1/1 i915: Fix bug where screen brightness is not restored

From: Alex Davis<[email protected]>

This patch fixes an issue where the screen would remain dark when

a key was pressed when the laptop lid was reopened or after the laptop had gone into power-save mode.

It seems that there are a number of people with different machines that have this problem:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/872652
https://launchpad.net/~kamalmostafa/+archive/stuck-backlight
and https://bugs.freedesktop.org/show_bug.cgi?id=41926

This patch is against Linux 3.1

Putting printk's in ./drivers/gpu/drm/i915/intel_panel.c showed that intel_get_brightness was being called after the panel was disabled, which caused a 0 to be saved as the value to restore the brightness. intel_panel_disable_backlight merely sets the brightness to 0. Commenting out this call allows the correct brightness value to be saved.

-----

drivers/gpu/drm/i915/intel_panel.c +0 -0
index a9e0c7b..6f56676 100644
@@ -262,8 +262,6 @@ void intel_panel_disable_backlight(struct drm_device *dev)

                dev_priv->backlight_level = intel_panel_get_backlight(dev); dev_priv->backlight_enabled = false;
        }
-
-       intel_panel_set_backlight(dev, 0);
 }

 void intel_panel_enable_backlight(struct drm_device *dev)

I code, therefore I am

#1 lore raw

PATCH 1/1 i915: Fix bug where screen brightness is not restored

Email sent to wrong people/list,

Linus

---------- Forwarded message ----------
From: Alex Davis <[email protected]>
Date: Tue, Nov 15, 2011 at 12:42 AM
Subject: [PATCH] i915: Fix bug where screen brightness is not restored
To: "[email protected]" <[email protected]>, "[email protected]" <[email protected]>

From: Alex Davis<[email protected]>

This patch fixes an issue where the screen would remain dark when

a key was pressed when the laptop lid was reopened or after the laptop had gone into power-save mode.

It seems that there are a number of people with different machines that have this problem:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/872652
https://launchpad.net/~kamalmostafa/+archive/stuck-backlight
and https://bugs.freedesktop.org/show_bug.cgi?id=41926

This patch is against Linux 3.1

Putting printk's in ./drivers/gpu/drm/i915/intel_panel.c showed that intel_get_brightness was being called after the panel was disabled, which caused a 0 to be saved as the value to restore the brightness. intel_panel_disable_backlight merely sets the brightness to 0. Commenting out this call allows the correct brightness value to be saved.

-----

(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_panel.c
index a9e0c7b..6f56676 100644

drivers/gpu/drm/i915/intel_panel.c +0 -0
@@ -262,8 +262,6 @@ void intel_panel_disable_backlight(struct drm_device *dev)

                dev_priv->backlight_level = intel_panel_get_backlight(dev); dev_priv->backlight_enabled = false;
        }
-
-       intel_panel_set_backlight(dev, 0);
 }

 void intel_panel_enable_backlight(struct drm_device *dev)

I code, therefore I am

#2 lore raw
In reply to Alex Davis
Quoted 6 lines · Alex Davis

From: Alex Davis<[email protected]>

This patch fixes an issue where the screen would remain dark when

a key was pressed when the laptop lid was reopened or after the laptop had gone into power-save mode.

[cross-posting to intel-gfx]

Keith, also note that Alex and I did respond to your request to test the already committed patch "drm/i915/panel: Always record the backlight level again (but cleverly)". We both determined that patch does *not* fix the problem. Alex's patch below does fix it.

Matthew, any comment on the question that I fielded?:

Quoted 5 lines
Quoted 5 lines

Why does intel_panel_disable_backlight even want to set the brightness to 0 anyway?... Its only caller is just about to turn off power to the panel. Is that call to intel_panel_{,actually_}set_backlight(dev, 0) really necessary or useful on *any* systems?

-Kamal

Quoted 34 lines

It seems that there are a number of people with different machines that have this problem:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/872652
https://launchpad.net/~kamalmostafa/+archive/stuck-backlight
and https://bugs.freedesktop.org/show_bug.cgi?id=41926

This patch is against Linux 3.1

Putting printk's in ./drivers/gpu/drm/i915/intel_panel.c showed that intel_get_brightness was being called after the panel was disabled, which caused a 0 to be saved as the value to restore the brightness. intel_panel_disable_backlight merely sets the brightness to 0. Commenting out this call allows the correct brightness value to be saved.

-----

drivers/gpu/drm/i915/intel_panel.c +0 -2
index a9e0c7b..6f56676 100644
@@ -262,8 +262,6 @@ void intel_panel_disable_backlight(struct drm_device *dev)
                dev_priv->backlight_level = intel_panel_get_backlight(dev);
                dev_priv->backlight_enabled = false;
        }
-
-       intel_panel_set_backlight(dev, 0);
 }
 
 void intel_panel_enable_backlight(struct drm_device *dev)
Quoted 7 lines

I code, therefore I am
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

At Tue, 15 Nov 2011 11:58:38 -0800,

Quoted 11 lines · Kamal Mostafa

[1 <multipart/signed (7bit)>]
[1.1 <text/plain; UTF-8 (quoted-printable)>]

Quoted 6 lines · Alex Davis

From: Alex Davis<[email protected]>

This patch fixes an issue where the screen would remain dark when

a key was pressed when the laptop lid was reopened or after the laptop had gone into power-save mode.

Quoted 6 lines

[cross-posting to intel-gfx]

Keith, also note that Alex and I did respond to your request to test the already committed patch "drm/i915/panel: Always record the backlight level again (but cleverly)". We both determined that patch does *not* fix the problem. Alex's patch below does fix it.

My rough guess is the inconsistency of property taken during the backlight disabled. How about the patch below (untested!) in addition to the fix in 3.2?

Takashi

---

drivers/gpu/drm/i915/intel_panel.c +2 -1
index 499d4c0..21f60b7 100644
@@ -326,7 +326,8 @@ static int intel_panel_update_status(struct backlight_device *bd)
 static int intel_panel_get_brightness(struct backlight_device *bd)
 {
 	struct drm_device *dev = bl_get_data(bd);
-	return intel_panel_get_backlight(dev);
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	return dev_priv->backlight_level;
 }
 
 static const struct backlight_ops intel_panel_bl_ops = {
Tested-by
#4 lore raw
Quoted 6 lines · Takashi Iwai

My rough guess is the inconsistency of property taken during the backlight disabled. How about the patch below (untested!) in addition to the fix in 3.2?

Takashi

Yes Takashi, your patch below (plus the already committed fix[0]) does indeed fix the problem[1] for me. Thanks!

-Kamal

[0] f52c619a590fa75276c07dfcaf380dee53e4ea4c
drm/i915/panel: Always record the backlight level again (but cleverly)

[1] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/872652

Quoted 16 lines

---

drivers/gpu/drm/i915/intel_panel.c +2 -1
index 499d4c0..21f60b7 100644
@@ -326,7 +326,8 @@ static int intel_panel_update_status(struct backlight_device *bd)
 static int intel_panel_get_brightness(struct backlight_device *bd)
 {
 	struct drm_device *dev = bl_get_data(bd);
-	return intel_panel_get_backlight(dev);
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	return dev_priv->backlight_level;
 }
 
 static const struct backlight_ops intel_panel_bl_ops = {
#5 lore raw

At Tue, 15 Nov 2011 13:54:44 -0800,

Quoted 7 lines · Kamal Mostafa
Quoted 5 lines · Takashi Iwai

My rough guess is the inconsistency of property taken during the backlight disabled. How about the patch below (untested!) in addition to the fix in 3.2?

Quoted 6 lines
Quoted 1 line

Takashi

Yes Takashi, your patch below (plus the already committed fix[0]) does indeed fix the problem[1] for me. Thanks!

OK, I'll resend the patch with proper sign-off, etc.

thanks,

Takashi

Quoted 27 lines

-Kamal

[0] f52c619a590fa75276c07dfcaf380dee53e4ea4c
drm/i915/panel: Always record the backlight level again (but cleverly)

[1] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/872652

Quoted 16 lines

---

drivers/gpu/drm/i915/intel_panel.c +2 -1
index 499d4c0..21f60b7 100644
@@ -326,7 +326,8 @@ static int intel_panel_update_status(struct backlight_device *bd)
 static int intel_panel_get_brightness(struct backlight_device *bd)
 {
 	struct drm_device *dev = bl_get_data(bd);
-	return intel_panel_get_backlight(dev);
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	return dev_priv->backlight_level;
 }
 
 static const struct backlight_ops intel_panel_bl_ops = {