diff mbox series

drm/i915/bios: Clamp VBT HDMI level shift on BDW

Message ID 20231013140214.1713-1-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/bios: Clamp VBT HDMI level shift on BDW | expand

Commit Message

Ville Syrjälä Oct. 13, 2023, 2:02 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

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>
---
 drivers/gpu/drm/i915/display/intel_bios.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

Comments

Ankit Nautiyal Oct. 27, 2023, 6:35 a.m. UTC | #1
On 10/13/2023 7:32 PM, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> 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>
> ---
>   drivers/gpu/drm/i915/display/intel_bios.c | 22 ++++++++++++++++++++++
>   1 file changed, 22 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index 4e8f1e91bb08..8f83f0ead27f 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -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.

I hope this is just one off case, where incorrect VBT is used.

Verified from Bspec:4299 and _bdw_trans_hdmi entries.

Change looks good to me.

Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>


> +	 */
> +	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)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
index 4e8f1e91bb08..8f83f0ead27f 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -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)