Skip to contentSkip to conversation

drm/i915/opregion: proper handling of DIDL and CADL

PATCH Marcos Paulo de Souza 1 participant 1 message Aug 15, 2016

Subsystems (2)
lore
Share & tools
lore

Marcos Paulo de Souza

author Reviewed-by Maarten Lankhorst
#0 lore raw

Hi list,

I have an Asus laptop, and these two patches solved my problem with bright hot-keys not working[1].

I applied both patches on 4.8-rc1, and the only necessary fix was changing priv_dev->dev to priv_dev->drm in all places of for_each_* macros touched by these patches.

Is there any chance to get this merged before 4.8 is launched? And, if there are other problems still in need of fixes in this patch, please let me know.

Thanks!

[1] https://bugzilla.kernel.org/show_bug.cgi?id=152091

Quoted 1 line

From ae6d2f8916abe9573b91b3ecb565c9585dda579a Mon Sep 17 00:00:00 2001

From: Jani Nikula <[email protected]>
Date: Wed, 29 Jun 2016 18:36:41 +0300
Subject: [PATCH 1/2] drm/i915: make i915 the source of acpi device ids for
_DOD

The graphics driver is supposed to define the DIDL, which are used for _DOD, not the BIOS. Restore that behaviour.

This is basically a revert of

commit 3143751ff51a163b77f7efd389043e038f3e008e

Author: Zhang Rui <[email protected]>
Date:   Mon Mar 29 15:12:16 2010 +0800

drm/i915: set DIDL using the ACPI video output device _ADR method return.

which went out of its way to cater to a specific BIOS, setting up DIDL based on _ADR method. Perhaps that approach worked on that specific machine, but on the machines I checked the _ADR method invents the device identifiers out of thin air if DIDL has not been set. The source for _ADR is also supposed to be the DIDL set by the driver, not the other way around.

With this, we'll also limit the number of outputs to what the driver actually has.

v2: do not set ACPI_DEVICE_ID_SCHEME in the device id (Peter Wu)

---
 drivers/gpu/drm/i915/intel_drv.h      |  3 ++
 drivers/gpu/drm/i915/intel_opregion.c | 89 ++++++++++-------------------------
 2 files changed, 28 insertions(+), 64 deletions(-)
drivers/gpu/drm/i915/intel_drv.h +3 -0
index cc937a1..8656b4c 100644
@@ -263,6 +263,9 @@ struct intel_connector {
 	 */
 	struct intel_encoder *encoder;
 
+	/* ACPI device id for ACPI and driver cooperation */
+	u32 acpi_device_id;
+
 	/* Reads out the current hw, returning true if the connector is enabled
 	 * and active (i.e. dpms ON state). */
 	bool (*get_hw_state)(struct intel_connector *);
drivers/gpu/drm/i915/intel_opregion.c +25 -64

123 lines not on this page · raw message

Signature · 1 line
2.7.4
Quoted 1 line

From a3af328f8cb36b908d37f4af0dbeb8a03c75d35c Mon Sep 17 00:00:00 2001

From: Jani Nikula <[email protected]>
Date: Wed, 29 Jun 2016 18:36:42 +0300
Subject: [PATCH 2/2] drm/i915/opregion: update cadl based on actually active
outputs

Previously we've just shoved the first eight devices in DIDL to CADL (list of active outputs). Some of the active outputs may have been left outside of CADL. The problem is, some BIOS implementations prevent laptop brightness hotkey propagation if the flat panel is not active.

Now that we have connector to acpi device id mapping covered, we can update CADL based on which outputs are actually active.

v3: actually git add the dev->dev_priv change.

v4: update cadl in intel_shared_dpll_commit() if intel_state->modeset
(Maarten)

---
 drivers/gpu/drm/i915/i915_drv.h       |  2 +
 drivers/gpu/drm/i915/intel_display.c  |  4 ++
 drivers/gpu/drm/i915/intel_opregion.c | 71 +++++++++++++++++++----------------
 3 files changed, 44 insertions(+), 33 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 21f9390..062e5c3 100644
@@ -3741,6 +3741,7 @@ extern int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder,
 extern int intel_opregion_notify_adapter(struct drm_i915_private *dev_priv,
 					 pci_power_t state);
 extern int intel_opregion_get_panel_type(struct drm_i915_private *dev_priv);
+extern void intel_opregion_update_cadl(struct drm_i915_private *dev_priv);
 #else
 static inline int intel_opregion_setup(struct drm_i915_private *dev) { return 0; }
 static inline void intel_opregion_register(struct drm_i915_private *dev_priv) { }
@@ -3762,6 +3763,7 @@ static inline int intel_opregion_get_panel_type(struct drm_i915_private *dev)
 {
 	return -ENODEV;
 }
+static inline void intel_opregion_update_cadl(struct drm_i915_private *dev_priv) { }
 #endif
 
 /* intel_acpi.c */
drivers/gpu/drm/i915/intel_display.c +4 -0
index dcf93b3..4062a2f 100644
@@ -13856,6 +13856,10 @@ static int intel_atomic_commit(struct drm_device *dev,
 	dev_priv->wm.distrust_bios_wm = false;
 	dev_priv->wm.skl_results = intel_state->wm_results;
 	intel_shared_dpll_commit(state);
+
+	if (intel_state->modeset)
+		intel_opregion_update_cadl(dev_priv);
+
 	intel_atomic_track_fbs(state);
 
 	if (nonblock)
drivers/gpu/drm/i915/intel_opregion.c +38 -33

97 lines not on this page · raw message

Signature · 1 line
2.7.4

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