drm/i915/bios: Clamp VBT HDMI level shift on BDW
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 13 Oct 2023 14:02:14 +0000 (17:02 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 31 Oct 2023 06:25:59 +0000 (08:25 +0200)
Apparently some BDW machines (eg. HP Pavilion 15-ab) shipped with
a VBT inherited from some earlier HSW model. On HSW the HDMI level
shift value could go up to 11, whereas on BDW the maximum value is
9.

The DDI code does clamp the bogus value, but it does so with
a WARN which we don't really want. To avoid that let's just sanitize
the bogus VBT HDMI level shift value ahead of time for all BDW machines.

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/9461
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231013140214.1713-1-ville.syrjala@linux.intel.com
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
drivers/gpu/drm/i915/display/intel_bios.c

index 69db1a3a1499e30d23c975f59a90f17f5d4f8e13..719fb550342b5de44fdddfac15c967897b1ccd86 100644 (file)
@@ -2473,6 +2473,27 @@ static void sanitize_device_type(struct intel_bios_encoder_data *devdata,
        devdata->child.device_type |= DEVICE_TYPE_NOT_HDMI_OUTPUT;
 }
 
+static void sanitize_hdmi_level_shift(struct intel_bios_encoder_data *devdata,
+                                     enum port port)
+{
+       struct drm_i915_private *i915 = devdata->i915;
+
+       if (!intel_bios_encoder_supports_dvi(devdata))
+               return;
+
+       /*
+        * Some BDW machines (eg. HP Pavilion 15-ab) shipped
+        * with a HSW VBT where the level shifter value goes
+        * up to 11, whereas the BDW max is 9.
+        */
+       if (IS_BROADWELL(i915) && devdata->child.hdmi_level_shifter_value > 9) {
+               drm_dbg_kms(&i915->drm, "Bogus port %c VBT HDMI level shift %d, adjusting to %d\n",
+                           port_name(port), devdata->child.hdmi_level_shifter_value, 9);
+
+               devdata->child.hdmi_level_shifter_value = 9;
+       }
+}
+
 static bool
 intel_bios_encoder_supports_crt(const struct intel_bios_encoder_data *devdata)
 {
@@ -2652,6 +2673,7 @@ static void parse_ddi_port(struct intel_bios_encoder_data *devdata)
        }
 
        sanitize_device_type(devdata, port);
+       sanitize_hdmi_level_shift(devdata, port);
 }
 
 static bool has_ddi_port_info(struct drm_i915_private *i915)