Skip to content

Commit d627b62

Browse files
Lekensteyndanvet
authored andcommitted
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 Tested-by: Peter Wu <lekensteyn@gmail.com> Signed-off-by: Peter Wu <lekensteyn@gmail.com> Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent 3739850 commit d627b62

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

drivers/gpu/drm/i915/intel_opregion.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,25 @@ static void intel_didl_outputs(struct drm_device *dev)
427427
goto end;
428428
}
429429

430+
static void intel_setup_cadls(struct drm_device *dev)
431+
{
432+
struct drm_i915_private *dev_priv = dev->dev_private;
433+
struct intel_opregion *opregion = &dev_priv->opregion;
434+
int i = 0;
435+
u32 disp_id;
436+
437+
/* Initialize the CADL field by duplicating the DIDL values.
438+
* Technically, this is not always correct as display outputs may exist,
439+
* but not active. This initialization is necessary for some Clevo
440+
* laptops that check this field before processing the brightness and
441+
* display switching hotkeys. Just like DIDL, CADL is NULL-terminated if
442+
* there are less than eight devices. */
443+
do {
444+
disp_id = ioread32(&opregion->acpi->didl[i]);
445+
iowrite32(disp_id, &opregion->acpi->cadl[i]);
446+
} while (++i < 8 && disp_id != 0);
447+
}
448+
430449
void intel_opregion_init(struct drm_device *dev)
431450
{
432451
struct drm_i915_private *dev_priv = dev->dev_private;
@@ -436,8 +455,10 @@ void intel_opregion_init(struct drm_device *dev)
436455
return;
437456

438457
if (opregion->acpi) {
439-
if (drm_core_check_feature(dev, DRIVER_MODESET))
458+
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
440459
intel_didl_outputs(dev);
460+
intel_setup_cadls(dev);
461+
}
441462

442463
/* Notify BIOS we are ready to handle ACPI video ext notifs.
443464
* Right now, all the events are handled by the ACPI video module.

0 commit comments

Comments
 (0)