]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
UBUNTU: SAUCE: drm/i915: Force DPCD backlight mode on X1 Extreme 2nd Gen 4K AMOLED...
authorLyude Paul <lyude@redhat.com>
Wed, 4 Mar 2020 06:00:49 +0000 (14:00 +0800)
committerSeth Forshee <seth.forshee@canonical.com>
Fri, 6 Mar 2020 21:23:20 +0000 (15:23 -0600)
BugLink: https://bugs.launchpad.net/bugs/1861521
The X1 Extreme is one of the systems that lies about which backlight
interface that it uses in its VBIOS as PWM backlight controls don't work
at all on this machine. It's possible that this panel could be one of
the infamous ones that can switch between PWM mode and DPCD backlight
control mode, but we haven't gotten any more details on this from Lenovo
just yet. For the time being though, making sure the backlight 'just
works' is a bit more important.

So, add a quirk to force DPCD backlight controls on for these systems
based on EDID (since this panel doesn't appear to fill in the device ID).
Hopefully in the future we'll figure out a better way of probing this.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: Jani Nikula <jani.nikula@intel.com>
(backported from https://patchwork.kernel.org/patch/11376671/)
Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/gpu/drm/drm_dp_helper.c
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
include/drm/drm_dp_helper.h

index a5151b31fd3532d652430a62091cbafe65de8103..b49473bbb50574403074b8ff169613ab2d28e562 100644 (file)
@@ -1317,6 +1317,10 @@ struct edid_quirk {
  * DP quirks in such cases.
  */
 static const struct edid_quirk edid_quirk_list[] = {
+       /* Optional 4K AMOLED panel in the ThinkPad X1 Extreme 2nd Generation
+        * only supports DPCD backlight controls
+        */
+       { MFG(0x4c, 0x83), PROD_ID(0x41, 0x41), BIT(DP_QUIRK_FORCE_DPCD_BACKLIGHT) },
 };
 
 #undef MFG
index 87b59db9ffe3e2f729d92fa1a8e318688a91914b..af6ee93aaed4897a26e927cdc0a9e36b04f9474f 100644 (file)
@@ -325,15 +325,32 @@ intel_dp_aux_display_control_capable(struct intel_connector *connector)
 int intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector)
 {
        struct intel_panel *panel = &intel_connector->panel;
-       struct drm_i915_private *dev_priv = to_i915(intel_connector->base.dev);
+       struct intel_dp *intel_dp = enc_to_intel_dp(&intel_connector->encoder->base);
+       struct drm_device *dev = intel_connector->base.dev;
+       struct drm_i915_private *dev_priv = to_i915(dev);
 
        if (i915_modparams.enable_dpcd_backlight == 0 ||
-           (i915_modparams.enable_dpcd_backlight == -1 &&
-           dev_priv->vbt.backlight.type != INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFACE))
+           !intel_dp_aux_display_control_capable(intel_connector))
                return -ENODEV;
 
-       if (!intel_dp_aux_display_control_capable(intel_connector))
+       /*
+        * There are a lot of machines that don't advertise the backlight
+        * control interface to use properly in their VBIOS, :\
+        */
+       if (dev_priv->vbt.backlight.type !=
+           INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFACE &&
+           !drm_dp_has_quirk(&intel_dp->desc, intel_dp->edid_quirks,
+                             DP_QUIRK_FORCE_DPCD_BACKLIGHT)) {
+               DRM_DEV_INFO(dev->dev,
+                            "Panel advertises DPCD backlight support, but "
+                            "VBT disagrees. If your backlight controls "
+                            "don't work try booting with "
+                            "i915.enable_dpcd_backlight=1. If your machine "
+                            "needs this, please file a _new_ bug report on "
+                            "bugs.freedesktop.org against DRI -> "
+                            "DRM/Intel\n");
                return -ENODEV;
+       }
 
        panel->backlight.setup = intel_dp_aux_setup_backlight;
        panel->backlight.enable = intel_dp_aux_enable_backlight;
index 34c5d615e646a59e5103c5321037ac252a2289be..5bcb3f7d5d8e8bf367942efd3aa128b6bb2ac309 100644 (file)
@@ -1437,6 +1437,16 @@ enum drm_dp_quirk {
         * The driver should ignore SINK_COUNT during detection.
         */
        DP_DPCD_QUIRK_NO_SINK_COUNT,
+       /**
+        * @DP_QUIRK_FORCE_DPCD_BACKLIGHT:
+        *
+        * The device is telling the truth when it says that it uses DPCD
+        * backlight controls, even if the system's firmware disagrees. This
+        * quirk should be checked against both the ident and panel EDID.
+        * When present, the driver should honor the DPCD backlight
+        * capabilities advertised.
+        */
+       DP_QUIRK_FORCE_DPCD_BACKLIGHT,
 };
 
 /**