Skip to contentSkip to conversation

i915: initialize CADL in opregion

PATCH Applied Lekensteyn 4 participants 13 messages Jun 25, 2012 – Sep 13, 2012 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Lekensteyn

author
#0 lore raw

PATCH 1/1 i915: initialize CADL in opregion

This is rather a hack to fix brightness hotkeys on a Clevo laptop. CADL is not used anywhere in the driver code at the moment, but it could be used in BIOS as is the case with the Clevo laptop.

The Clevo B7130 requires the CADL field to contain at least the ID of the LCD device. If this field is empty, the ACPI methods that are called on pressing brightness / display switching hotkeys will not trigger a notification. As a result, it appears as no hotkey has been pressed.

Reference: https://bugs.freedesktop.org/show_bug.cgi?id=45452

---
 drivers/gpu/drm/i915/intel_opregion.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_opregion.c +22 -1
index 18bd0af..adf6c79 100644
@@ -427,6 +427,25 @@ blind_set:
 	goto end;
 }
 
+static void intel_setup_cadls(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_opregion *opregion = &dev_priv->opregion;
+	int i = 0;
+	u32 disp_id;
+
+	/* Initialize the CADL field by duplicating the DIDL values.
+	 * Technically, this is not always correct as display outputs may exist,
+	 * but not active. This initialization is necessary for some Clevo
+	 * laptops that check this field before processing the brightness and
+	 * display switching hotkeys. Just like DIDL, CADL is NULL-terminated if
+	 * there are less than eight devices. */
+	do {
+		disp_id = ioread32(&opregion->acpi->didl[i]);
+		iowrite32(disp_id, &opregion->acpi->cadl[i]);
+	} while (++i < 8 && disp_id != 0);
+}
+
 void intel_opregion_init(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -436,8 +455,10 @@ void intel_opregion_init(struct drm_device *dev)
 		return;
 
 	if (opregion->acpi) {
-		if (drm_core_check_feature(dev, DRIVER_MODESET))
+		if (drm_core_check_feature(dev, DRIVER_MODESET)) {
 			intel_didl_outputs(dev);
+			intel_setup_cadls(dev);
+		}
 
 		/* Notify BIOS we are ready to handle ACPI video ext notifs.
 		 * Right now, all the events are handled by the ACPI video module.
Signature · 1 line
1.7.11
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · On Tue, 26 Jun 2012 00:36:24 +0200 Lekensteyn <[email protected]> wrote:

This is rather a hack to fix brightness hotkeys on a Clevo laptop. CADL is not used anywhere in the driver code at the moment, but it could be used in BIOS as is the case with the Clevo laptop.

The Clevo B7130 requires the CADL field to contain at least the ID of the LCD device. If this field is empty, the ACPI methods that are called on pressing brightness / display switching hotkeys will not trigger a notification. As a result, it appears as no hotkey has been pressed.

Not ideal, but definitely better than nothing.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#2 lore raw
Quoted 7 lines · Jesse Barnes
Quoted 4 lines · On Tue, 26 Jun 2012 00:36:24 +0200 Lekensteyn <[email protected]> wrote:

This is rather a hack to fix brightness hotkeys on a Clevo laptop. CADL is not used anywhere in the driver code at the moment, but it could be used in BIOS as is the case with the Clevo laptop.

Quoted 8 lines
Quoted 4 lines

The Clevo B7130 requires the CADL field to contain at least the ID of the LCD device. If this field is empty, the ACPI methods that are called on pressing brightness / display switching hotkeys will not trigger a notification. As a result, it appears as no hotkey has been pressed.

Not ideal, but definitely better than nothing.

Queued for -next, thanks for the patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#3 lore raw

Am Dienstag, den 26.06.2012, 23:07 +0200 schrieb Daniel Vetter:

Quoted 13 lines · Jesse Barnes
Quoted 12 lines
Quoted 8 lines · On Tue, 26 Jun 2012 00:36:24 +0200 Lekensteyn <[email protected]> wrote:

This is rather a hack to fix brightness hotkeys on a Clevo laptop. CADL is not used anywhere in the driver code at the moment, but it could be used in BIOS as is the case with the Clevo laptop.

The Clevo B7130 requires the CADL field to contain at least the ID of the LCD device. If this field is empty, the ACPI methods that are called on pressing brightness / display switching hotkeys will not trigger a notification. As a result, it appears as no hotkey has been pressed.

Quoted 4 lines
Quoted 3 lines

Not ideal, but definitely better than nothing.

Queued for -next, thanks for the patch.

Peter, I guess the Author field does not contain your real name and does not match the Signed-off-by line. To avoid that either set up the right name in KMail or add

From: Peter Wu <[email protected]>

as the first line of your message.

Thanks,

Paul

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw
In reply to Daniel Vetter
Quoted 13 lines · Daniel Vetter
Quoted 12 lines · Jesse Barnes
Quoted 8 lines · On Tue, 26 Jun 2012 00:36:24 +0200 Lekensteyn <[email protected]> wrote:

This is rather a hack to fix brightness hotkeys on a Clevo laptop. CADL is not used anywhere in the driver code at the moment, but it could be used in BIOS as is the case with the Clevo laptop.

The Clevo B7130 requires the CADL field to contain at least the ID of the LCD device. If this field is empty, the ACPI methods that are called on pressing brightness / display switching hotkeys will not trigger a notification. As a result, it appears as no hotkey has been pressed.

Quoted 4 lines
Quoted 3 lines

Not ideal, but definitely better than nothing.

Queued for -next, thanks for the patch.

Unfortunately this results in a neat black screen on my ivb zenbook. Until I've figured out what exactly's going on, I have to drop this from -next again.
-Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
author
#5 lore raw
Quoted 17 lines · On Wednesday 27 June 2012 17:03:02 Daniel Vetter wrote:
Quoted 16 lines · Daniel Vetter
Quoted 15 lines · Jesse Barnes

On Tue, 26 Jun 2012 00:36:24 +0200

Quoted 9 lines · Lekensteyn

This is rather a hack to fix brightness hotkeys on a Clevo laptop. CADL is not used anywhere in the driver code at the moment, but it could be used in BIOS as is the case with the Clevo laptop.

The Clevo B7130 requires the CADL field to contain at least the ID of the LCD device. If this field is empty, the ACPI methods that are called
on pressing brightness / display switching hotkeys will not trigger a notification. As a result, it appears as no hotkey has been pressed.

Not ideal, but definitely better than nothing.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Queued for -next, thanks for the patch.

Unfortunately this results in a neat black screen on my ivb zenbook. Until I've figured out what exactly's going on, I have to drop this from -next again.
-Daniel

Can you share your acpidump on
https://bugs.freedesktop.org/show_bug.cgi?id=45452 ? TIA
Peter

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#7 lore raw
Quoted 32 lines · On Wednesday 27 June 2012 18:27:37 Daniel Vetter wrote:
Quoted 31 lines · Lekensteyn
Quoted 29 lines · On Wednesday 27 June 2012 17:03:02 Daniel Vetter wrote:
Quoted 17 lines · Daniel Vetter
Quoted 16 lines · Jesse Barnes

On Tue, 26 Jun 2012 00:36:24 +0200

Quoted 12 lines · Lekensteyn

This is rather a hack to fix brightness hotkeys on a Clevo laptop. CADL is not used anywhere in the driver code at the moment, but it could be used in BIOS as is the case with the Clevo laptop.

The Clevo B7130 requires the CADL field to contain at least the ID of
the LCD device. If this field is empty, the ACPI methods that are called
on pressing brightness / display switching hotkeys will not trigger a
notification. As a result, it appears as no hotkey has been pressed.

Quoted 5 lines
Quoted 3 lines

Not ideal, but definitely better than nothing.

Queued for -next, thanks for the patch.

Unfortunately this results in a neat black screen on my ivb zenbook. Until
I've figured out what exactly's going on, I have to drop this from -next again.
-Daniel

Quoted 5 lines
Quoted 2 lines

Can you share your acpidump on
https://bugs.freedesktop.org/show_bug.cgi?id=45452 ?

Attached.
-Daniel

Thank you, I've now written a partial analysis which is available at
https://github.com/Lekensteyn/acpi-
stuff/blob/HEAD/dsl/Asus_Zenbook_DanielVetter/analysis.txt (note: URL is cut in two parts in this mail, concat them as needed).

Question: can you try disabling the asus-laptop module and try booting again w/ and w/o the CADL patch applied?
- Does it boot in both cases?
- Do the brightness hotkeys work?
- Can you change brightness via /sys/class/backlight?

Can you SSH in it and check the logs? Any ACPI warnings/errors or messages from the asus-laptop module? (or whatever asus module(s) is/are loaded)

Can you also generate dmidecode.txt? (peek in http://lekensteyn.nl/files/get-
acpi-info.sh, you do not have to run all of the commands since I already have your acpidump)

Thanks,
Peter

#8 lore raw
Quoted 13 lines · Lekensteyn

Thank you, I've now written a partial analysis which is available at
https://github.com/Lekensteyn/acpi-
stuff/blob/HEAD/dsl/Asus_Zenbook_DanielVetter/analysis.txt (note: URL is cut in two parts in this mail, concat them as needed).

Question: can you try disabling the asus-laptop module and try booting again w/ and w/o the CADL patch applied?
- Does it boot in both cases?
- Do the brightness hotkeys work?
- Can you change brightness via /sys/class/backlight?
Can you SSH in it and check the logs? Any ACPI warnings/errors or messages from the asus-laptop module? (or whatever asus module(s) is/are loaded)

Quoted 3 lines

Can you also generate dmidecode.txt? (peek in http://lekensteyn.nl/files/get-
acpi-info.sh, you do not have to run all of the commands since I already have your acpidump)

Ok, because I have an ecrypted root fs I've tried to reload the i915.ko with CADL after booting. Test-results:
- asus_wmi.ko doesn't seem to have any effect whatsoever on the endresult.
- asus_nb_wmi.ko doesn't load (ENODEV).
- brightness-keys (and also sound control) don't work, but controlling the backlight with /sys/class/backlight/acpi_video0/brightness works (if I can turn the panel on somehow, see below).
- When loading the i915.ko with the CADL patch the screen went black (like at boot), but with some excessive vt-switching and X restarting I've managed to light it up. Although it is flickery as hell, especially the lower part of the screen. And if the screen is somewhat stable, I just get the upper part of the screen duplicated in the lower part.
- dmidecode is attached.
- no errors in the logs anywhere (if you ignore some ACPI resource conflicts because ACPI reserves some pch stuff itself, which then conflicts with the native gpio, sensors, whatever drivers).

So I think this might be simply a timing issue that with CADL enabled we expose a pre-existing bug somewhere in our modeset sequence. I'm already chasing two issues on this machine:
- edp refuses to light up crtc 1/2, only works after having switched back to crtc 0.
- disabled pipes get stuck in the active state once having been used be edp.

I have a feeling that all these issues are related, so I guess until I've tracked down the above the things we won't make much progress with this CADL patch.

Still, if you have any insights or need more dumps/logs from my machine, I'll happily help out.

Cheers, Daniel

Signature · 2 lines
Daniel Vetter
[email protected] - +41 (0) 79 364 57 48 - http://blog.ffwll.ch

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#9 lore raw
Quoted 6 lines · Daniel Vetter

- When loading the i915.ko with the CADL patch the screen went black (like at boot), but with some excessive vt-switching and X restarting I've managed to light it up. Although it is flickery as hell, especially the lower part of the screen. And if the screen is somewhat stable, I just get the upper part of the screen duplicated in the lower part.

Just a small note: Reloading i915.ko without the CADL patch fixes things. No idea how that could happen ...
-Daniel

Signature · 2 lines
Daniel Vetter
[email protected] - +41 (0) 79 364 57 48 - http://blog.ffwll.ch
author
#10 lore raw
Quoted 11 lines · On Thursday 28 June 2012 13:22:02 Daniel Vetter wrote:
Quoted 6 lines · Daniel Vetter

- When loading the i915.ko with the CADL patch the screen went black (like at boot), but with some excessive vt-switching and X restarting I've managed to light it up. Although it is flickery as hell, especially the lower part of the screen. And if the screen is somewhat stable, I just get the upper part of the screen duplicated in the lower part.

Just a small note: Reloading i915.ko without the CADL patch fixes things. No idea how that could happen ...
-Daniel

Does CADL gets reinitialised to zeroes on module load? (I think so, but could you verify that by checking the contents of that field after loading the module w/ and w/o the CADL patch?)

Peter

#11 lore raw
Quoted 9 lines · Lekensteyn
Quoted 8 lines · On Thursday 28 June 2012 13:22:02 Daniel Vetter wrote:
Quoted 6 lines · Daniel Vetter

- When loading the i915.ko with the CADL patch the screen went black (like at boot), but with some excessive vt-switching and X restarting I've managed to light it up. Although it is flickery as hell, especially the lower part of the screen. And if the screen is somewhat stable, I just get the upper part of the screen duplicated in the lower part.

Quoted 7 lines
Quoted 3 lines

Just a small note: Reloading i915.ko without the CADL patch fixes things. No idea how that could happen ...
-Daniel

Does CADL gets reinitialised to zeroes on module load? (I think so, but could you verify that by checking the contents of that field after loading the module w/ and w/o the CADL patch?)

Yeah, the CADL is cleared out again.
-Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#12 lore raw
In reply to Daniel Vetter
Quoted 43 lines · Daniel Vetter
Quoted 13 lines · Lekensteyn

Thank you, I've now written a partial analysis which is available at
https://github.com/Lekensteyn/acpi-
stuff/blob/HEAD/dsl/Asus_Zenbook_DanielVetter/analysis.txt (note: URL is cut in two parts in this mail, concat them as needed).

Question: can you try disabling the asus-laptop module and try booting again w/ and w/o the CADL patch applied?
- Does it boot in both cases?
- Do the brightness hotkeys work?
- Can you change brightness via /sys/class/backlight?
Can you SSH in it and check the logs? Any ACPI warnings/errors or messages from the asus-laptop module? (or whatever asus module(s) is/are loaded)

Quoted 3 lines

Can you also generate dmidecode.txt? (peek in http://lekensteyn.nl/files/get-
acpi-info.sh, you do not have to run all of the commands since I already have your acpidump)

Ok, because I have an ecrypted root fs I've tried to reload the i915.ko with CADL after booting. Test-results:
- asus_wmi.ko doesn't seem to have any effect whatsoever on the endresult.
- asus_nb_wmi.ko doesn't load (ENODEV).
- brightness-keys (and also sound control) don't work, but controlling the backlight with /sys/class/backlight/acpi_video0/brightness works (if I can turn the panel on somehow, see below).
- When loading the i915.ko with the CADL patch the screen went black (like at boot), but with some excessive vt-switching and X restarting I've managed to light it up. Although it is flickery as hell, especially the lower part of the screen. And if the screen is somewhat stable, I just get the upper part of the screen duplicated in the lower part.
- dmidecode is attached.
- no errors in the logs anywhere (if you ignore some ACPI resource conflicts because ACPI reserves some pch stuff itself, which then conflicts with the native gpio, sensors, whatever drivers).

So I think this might be simply a timing issue that with CADL enabled we expose a pre-existing bug somewhere in our modeset sequence. I'm already chasing two issues on this machine:
- edp refuses to light up crtc 1/2, only works after having switched back to crtc 0.
- disabled pipes get stuck in the active state once having been used be edp.

Quoted 3 lines

I have a feeling that all these issues are related, so I guess until I've tracked down the above the things we won't make much progress with this CADL patch.

Good news: I've fixed my edp issues (switching crtcs works reliable now and nothing gets stuck in a half-disabled state) and now I don't get a black/flashing screen any more when applying your patch.

Bad news: We need to refactor a big chunk of our driver to properly fix this issue. Which means I can't merge your patch right away :(

Cheers, Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#13 lore raw
In reply to Jesse Barnes
Quoted 7 lines · Jesse Barnes
Quoted 4 lines · On Tue, 26 Jun 2012 00:36:24 +0200 Lekensteyn <[email protected]> wrote:

This is rather a hack to fix brightness hotkeys on a Clevo laptop. CADL is not used anywhere in the driver code at the moment, but it could be used in BIOS as is the case with the Clevo laptop.

Quoted 8 lines
Quoted 4 lines

The Clevo B7130 requires the CADL field to contain at least the ID of the LCD device. If this field is empty, the ACPI methods that are called on pressing brightness / display switching hotkeys will not trigger a notification. As a result, it appears as no hotkey has been pressed.

Not ideal, but definitely better than nothing.

Ok, 2nd try, I've merged this again to drm-intel-next. Let's hope it doesn't blow up again, now that the cpu edp fixes are merged.

Thanks for the patch,
Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch