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 Tested-by: Peter Wu lekensteyn@gmail.com Signed-off-by: Peter Wu lekensteyn@gmail.com --- drivers/gpu/drm/i915/intel_opregion.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c index 18bd0af..adf6c79 100644 --- a/drivers/gpu/drm/i915/intel_opregion.c +++ b/drivers/gpu/drm/i915/intel_opregion.c @@ -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.
On Tue, 26 Jun 2012 00:36:24 +0200 Lekensteyn lekensteyn@gmail.com 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.
Acked-by: Jesse Barnes jbarnes@virtuousgeek.org
On Tue, Jun 26, 2012 at 02:04:00PM -0700, Jesse Barnes wrote:
On Tue, 26 Jun 2012 00:36:24 +0200 Lekensteyn lekensteyn@gmail.com 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.
Acked-by: Jesse Barnes jbarnes@virtuousgeek.org
Queued for -next, thanks for the patch. -Daniel
Am Dienstag, den 26.06.2012, 23:07 +0200 schrieb Daniel Vetter:
On Tue, Jun 26, 2012 at 02:04:00PM -0700, Jesse Barnes wrote:
On Tue, 26 Jun 2012 00:36:24 +0200 Lekensteyn lekensteyn@gmail.com 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.
Acked-by: Jesse Barnes jbarnes@virtuousgeek.org
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 lekensteyn@gmail.com
as the first line of your message.
Thanks,
Paul
On Tue, Jun 26, 2012 at 11:07:55PM +0200, Daniel Vetter wrote:
On Tue, Jun 26, 2012 at 02:04:00PM -0700, Jesse Barnes wrote:
On Tue, 26 Jun 2012 00:36:24 +0200 Lekensteyn lekensteyn@gmail.com 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.
Acked-by: Jesse Barnes jbarnes@virtuousgeek.org
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
On Wednesday 27 June 2012 17:03:02 Daniel Vetter wrote:
On Tue, Jun 26, 2012 at 11:07:55PM +0200, Daniel Vetter wrote:
On Tue, Jun 26, 2012 at 02:04:00PM -0700, Jesse Barnes wrote:
On Tue, 26 Jun 2012 00:36:24 +0200
Lekensteyn lekensteyn@gmail.com 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.
Acked-by: Jesse Barnes jbarnes@virtuousgeek.org
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
On Tue, Jun 26, 2012 at 02:04:00PM -0700, Jesse Barnes wrote:
On Tue, 26 Jun 2012 00:36:24 +0200 Lekensteyn lekensteyn@gmail.com 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.
Acked-by: Jesse Barnes jbarnes@virtuousgeek.org
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
dri-devel@lists.freedesktop.org