diff mbox series

[2/2] drm/i915/display: Increase Fast Wake Sync length as a quirk

Message ID 20240820161429.2213343-3-jouni.hogander@intel.com (mailing list archive)
State New, archived
Headers show
Series Increase fastwake sync pulse count as a quirk | expand

Commit Message

Hogander, Jouni Aug. 20, 2024, 4:14 p.m. UTC
In commit "drm/i915/display: Increase number of fast wake precharge pulses"
we were increasing Fast Wake sync pulse length to fix problems observed on
Dell Precision 5490 laptop with AUO panel. Later we have observed this is
causing problems on other panels.

Fix these problems by increasing Fast Wake sync pulse length as a quirk
applied for Dell Precision 5490 with problematic panel.

Fixes: f77772866385 ("drm/i915/display: Increase number of fast wake precharge pulses")
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Closes: http://gitlab.freedesktop.org/drm/i915/kernel/-/issues/9739
Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2246
Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11762
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
 drivers/gpu/drm/i915/display/intel_alpm.c   |  2 +-
 drivers/gpu/drm/i915/display/intel_dp_aux.c | 17 ++++++++++++-----
 drivers/gpu/drm/i915/display/intel_dp_aux.h |  2 +-
 drivers/gpu/drm/i915/display/intel_quirks.c |  9 +++++++++
 drivers/gpu/drm/i915/display/intel_quirks.h |  1 +
 5 files changed, 24 insertions(+), 7 deletions(-)

Comments

Jani Nikula Aug. 21, 2024, 2:01 p.m. UTC | #1
On Tue, 20 Aug 2024, Jouni Högander <jouni.hogander@intel.com> wrote:
> In commit "drm/i915/display: Increase number of fast wake precharge pulses"
> we were increasing Fast Wake sync pulse length to fix problems observed on
> Dell Precision 5490 laptop with AUO panel. Later we have observed this is
> causing problems on other panels.
>
> Fix these problems by increasing Fast Wake sync pulse length as a quirk
> applied for Dell Precision 5490 with problematic panel.
>
> Fixes: f77772866385 ("drm/i915/display: Increase number of fast wake precharge pulses")
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Closes: http://gitlab.freedesktop.org/drm/i915/kernel/-/issues/9739
> Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2246
> Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11762
> Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_alpm.c   |  2 +-
>  drivers/gpu/drm/i915/display/intel_dp_aux.c | 17 ++++++++++++-----
>  drivers/gpu/drm/i915/display/intel_dp_aux.h |  2 +-
>  drivers/gpu/drm/i915/display/intel_quirks.c |  9 +++++++++
>  drivers/gpu/drm/i915/display/intel_quirks.h |  1 +
>  5 files changed, 24 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_alpm.c b/drivers/gpu/drm/i915/display/intel_alpm.c
> index 82ee778b2efe9..186cf4833f716 100644
> --- a/drivers/gpu/drm/i915/display/intel_alpm.c
> +++ b/drivers/gpu/drm/i915/display/intel_alpm.c
> @@ -228,7 +228,7 @@ bool intel_alpm_compute_params(struct intel_dp *intel_dp,
>  	int tfw_exit_latency = 20; /* eDP spec */
>  	int phy_wake = 4;	   /* eDP spec */
>  	int preamble = 8;	   /* eDP spec */
> -	int precharge = intel_dp_aux_fw_sync_len() - preamble;
> +	int precharge = intel_dp_aux_fw_sync_len(intel_dp) - preamble;
>  	u8 max_wake_lines;
>  
>  	io_wake_time = max(precharge, io_buffer_wake_time(crtc_state)) +
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux.c b/drivers/gpu/drm/i915/display/intel_dp_aux.c
> index b8a53bb174dab..7adb1af252678 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_aux.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_aux.c
> @@ -13,6 +13,7 @@
>  #include "intel_dp_aux.h"
>  #include "intel_dp_aux_regs.h"
>  #include "intel_pps.h"
> +#include "intel_quirks.h"
>  #include "intel_tc.h"
>  
>  #define AUX_CH_NAME_BUFSIZE	6
> @@ -142,16 +143,22 @@ static int intel_dp_aux_sync_len(void)
>  	return precharge + preamble;
>  }
>  
> -int intel_dp_aux_fw_sync_len(void)
> +int intel_dp_aux_fw_sync_len(struct intel_dp *intel_dp)
>  {
> +	int precharge = 10; /* 10-16 */
> +	int preamble = 8;
> +
>  	/*
>  	 * We faced some glitches on Dell Precision 5490 MTL laptop with panel:
>  	 * "Manufacturer: AUO, Model: 63898" when using HW default 18. Using 20
>  	 * is fixing these problems with the panel. It is still within range
> -	 * mentioned in eDP specification.
> +	 * mentioned in eDP specification. Increasing Fast Wake sync length is
> +	 * causing problems with other panels: increase length as a quirk for
> +	 * this specific laptop.
>  	 */
> -	int precharge = 12; /* 10-16 */
> -	int preamble = 8;
> +	if (intel_has_quirk(__intel_dp_to_intel_display(intel_dp),

Please don't use __intel_dp_to_intel_display() or *any* of the
__xxx_to_intel_display() directly. to_intel_display() is magic and
handles them all via _Generic().

Also add the local variable:

	struct intel_display *display = to_intel_display(intel_dp);

Anyway, as I noted before, what if one sink has the issue, then it's
applied to all sinks here. Yeah it's unlikely with an eDP panel, but
let's not add such a mechanism. It should be sink specific, because we
may just end up having to do that anyway for some sinks.

> +			    QUIRK_FW_SYNC_LEN))
> +		precharge += 2;
>  
>  	return precharge + preamble;
>  }
> @@ -211,7 +218,7 @@ static u32 skl_get_aux_send_ctl(struct intel_dp *intel_dp,
>  		DP_AUX_CH_CTL_TIME_OUT_MAX |
>  		DP_AUX_CH_CTL_RECEIVE_ERROR |
>  		DP_AUX_CH_CTL_MESSAGE_SIZE(send_bytes) |
> -		DP_AUX_CH_CTL_FW_SYNC_PULSE_SKL(intel_dp_aux_fw_sync_len()) |
> +		DP_AUX_CH_CTL_FW_SYNC_PULSE_SKL(intel_dp_aux_fw_sync_len(intel_dp)) |
>  		DP_AUX_CH_CTL_SYNC_PULSE_SKL(intel_dp_aux_sync_len());
>  
>  	if (intel_tc_port_in_tbt_alt_mode(dig_port))
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux.h b/drivers/gpu/drm/i915/display/intel_dp_aux.h
> index 76d1f2ed7c2f4..593f58fafab71 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_aux.h
> +++ b/drivers/gpu/drm/i915/display/intel_dp_aux.h
> @@ -20,6 +20,6 @@ enum aux_ch intel_dp_aux_ch(struct intel_encoder *encoder);
>  
>  void intel_dp_aux_irq_handler(struct drm_i915_private *i915);
>  u32 intel_dp_aux_pack(const u8 *src, int src_bytes);
> -int intel_dp_aux_fw_sync_len(void);
> +int intel_dp_aux_fw_sync_len(struct intel_dp *intel_dp);
>  
>  #endif /* __INTEL_DP_AUX_H__ */
> diff --git a/drivers/gpu/drm/i915/display/intel_quirks.c b/drivers/gpu/drm/i915/display/intel_quirks.c
> index d9045b317cd16..acdd2ff1dd422 100644
> --- a/drivers/gpu/drm/i915/display/intel_quirks.c
> +++ b/drivers/gpu/drm/i915/display/intel_quirks.c
> @@ -65,6 +65,12 @@ static void quirk_no_pps_backlight_power_hook(struct intel_display *display)
>  	drm_info(display->drm, "Applying no pps backlight power quirk\n");
>  }
>  
> +static void quirk_fw_sync_len(struct intel_display *display)
> +{
> +	intel_set_quirk(display, QUIRK_FW_SYNC_LEN);
> +	drm_info(display->drm, "Applying Fast Wake sync pulse count quirk\n");
> +}
> +
>  struct intel_quirk {
>  	int device;
>  	int subsystem_vendor;
> @@ -196,6 +202,9 @@ static struct intel_quirk intel_quirks[] = {
>  	/* Dell Chromebook 11 (2015 version) */
>  	{ 0x0a16, 0x1028, 0x0a35, SINK_OUI_ANY, SINK_DEVICE_ID_ANY, quirk_backlight_present },
>  
> +	/* Dell Precision 5490 */
> +	{ 0x7d55, 0x1028, 0x0cc7, SINK_OUI(0x38, 0xec, 0x11), SINK_DEVICE_ID_ANY, quirk_fw_sync_len },
> +
>  	/* Toshiba Satellite P50-C-18C */
>  	{ 0x191B, 0x1179, 0xF840, SINK_OUI_ANY, SINK_DEVICE_ID_ANY, quirk_increase_t12_delay },
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_quirks.h b/drivers/gpu/drm/i915/display/intel_quirks.h
> index 2d664af7e89f7..3c3e74310b7f2 100644
> --- a/drivers/gpu/drm/i915/display/intel_quirks.h
> +++ b/drivers/gpu/drm/i915/display/intel_quirks.h
> @@ -18,6 +18,7 @@ enum intel_quirk_id {
>  	QUIRK_INVERT_BRIGHTNESS,
>  	QUIRK_LVDS_SSC_DISABLE,
>  	QUIRK_NO_PPS_BACKLIGHT_POWER_HOOK,
> +	QUIRK_FW_SYNC_LEN,
>  };
>  
>  void intel_init_quirks(struct intel_display *display);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_alpm.c b/drivers/gpu/drm/i915/display/intel_alpm.c
index 82ee778b2efe9..186cf4833f716 100644
--- a/drivers/gpu/drm/i915/display/intel_alpm.c
+++ b/drivers/gpu/drm/i915/display/intel_alpm.c
@@ -228,7 +228,7 @@  bool intel_alpm_compute_params(struct intel_dp *intel_dp,
 	int tfw_exit_latency = 20; /* eDP spec */
 	int phy_wake = 4;	   /* eDP spec */
 	int preamble = 8;	   /* eDP spec */
-	int precharge = intel_dp_aux_fw_sync_len() - preamble;
+	int precharge = intel_dp_aux_fw_sync_len(intel_dp) - preamble;
 	u8 max_wake_lines;
 
 	io_wake_time = max(precharge, io_buffer_wake_time(crtc_state)) +
diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux.c b/drivers/gpu/drm/i915/display/intel_dp_aux.c
index b8a53bb174dab..7adb1af252678 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_aux.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_aux.c
@@ -13,6 +13,7 @@ 
 #include "intel_dp_aux.h"
 #include "intel_dp_aux_regs.h"
 #include "intel_pps.h"
+#include "intel_quirks.h"
 #include "intel_tc.h"
 
 #define AUX_CH_NAME_BUFSIZE	6
@@ -142,16 +143,22 @@  static int intel_dp_aux_sync_len(void)
 	return precharge + preamble;
 }
 
-int intel_dp_aux_fw_sync_len(void)
+int intel_dp_aux_fw_sync_len(struct intel_dp *intel_dp)
 {
+	int precharge = 10; /* 10-16 */
+	int preamble = 8;
+
 	/*
 	 * We faced some glitches on Dell Precision 5490 MTL laptop with panel:
 	 * "Manufacturer: AUO, Model: 63898" when using HW default 18. Using 20
 	 * is fixing these problems with the panel. It is still within range
-	 * mentioned in eDP specification.
+	 * mentioned in eDP specification. Increasing Fast Wake sync length is
+	 * causing problems with other panels: increase length as a quirk for
+	 * this specific laptop.
 	 */
-	int precharge = 12; /* 10-16 */
-	int preamble = 8;
+	if (intel_has_quirk(__intel_dp_to_intel_display(intel_dp),
+			    QUIRK_FW_SYNC_LEN))
+		precharge += 2;
 
 	return precharge + preamble;
 }
@@ -211,7 +218,7 @@  static u32 skl_get_aux_send_ctl(struct intel_dp *intel_dp,
 		DP_AUX_CH_CTL_TIME_OUT_MAX |
 		DP_AUX_CH_CTL_RECEIVE_ERROR |
 		DP_AUX_CH_CTL_MESSAGE_SIZE(send_bytes) |
-		DP_AUX_CH_CTL_FW_SYNC_PULSE_SKL(intel_dp_aux_fw_sync_len()) |
+		DP_AUX_CH_CTL_FW_SYNC_PULSE_SKL(intel_dp_aux_fw_sync_len(intel_dp)) |
 		DP_AUX_CH_CTL_SYNC_PULSE_SKL(intel_dp_aux_sync_len());
 
 	if (intel_tc_port_in_tbt_alt_mode(dig_port))
diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux.h b/drivers/gpu/drm/i915/display/intel_dp_aux.h
index 76d1f2ed7c2f4..593f58fafab71 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_aux.h
+++ b/drivers/gpu/drm/i915/display/intel_dp_aux.h
@@ -20,6 +20,6 @@  enum aux_ch intel_dp_aux_ch(struct intel_encoder *encoder);
 
 void intel_dp_aux_irq_handler(struct drm_i915_private *i915);
 u32 intel_dp_aux_pack(const u8 *src, int src_bytes);
-int intel_dp_aux_fw_sync_len(void);
+int intel_dp_aux_fw_sync_len(struct intel_dp *intel_dp);
 
 #endif /* __INTEL_DP_AUX_H__ */
diff --git a/drivers/gpu/drm/i915/display/intel_quirks.c b/drivers/gpu/drm/i915/display/intel_quirks.c
index d9045b317cd16..acdd2ff1dd422 100644
--- a/drivers/gpu/drm/i915/display/intel_quirks.c
+++ b/drivers/gpu/drm/i915/display/intel_quirks.c
@@ -65,6 +65,12 @@  static void quirk_no_pps_backlight_power_hook(struct intel_display *display)
 	drm_info(display->drm, "Applying no pps backlight power quirk\n");
 }
 
+static void quirk_fw_sync_len(struct intel_display *display)
+{
+	intel_set_quirk(display, QUIRK_FW_SYNC_LEN);
+	drm_info(display->drm, "Applying Fast Wake sync pulse count quirk\n");
+}
+
 struct intel_quirk {
 	int device;
 	int subsystem_vendor;
@@ -196,6 +202,9 @@  static struct intel_quirk intel_quirks[] = {
 	/* Dell Chromebook 11 (2015 version) */
 	{ 0x0a16, 0x1028, 0x0a35, SINK_OUI_ANY, SINK_DEVICE_ID_ANY, quirk_backlight_present },
 
+	/* Dell Precision 5490 */
+	{ 0x7d55, 0x1028, 0x0cc7, SINK_OUI(0x38, 0xec, 0x11), SINK_DEVICE_ID_ANY, quirk_fw_sync_len },
+
 	/* Toshiba Satellite P50-C-18C */
 	{ 0x191B, 0x1179, 0xF840, SINK_OUI_ANY, SINK_DEVICE_ID_ANY, quirk_increase_t12_delay },
 
diff --git a/drivers/gpu/drm/i915/display/intel_quirks.h b/drivers/gpu/drm/i915/display/intel_quirks.h
index 2d664af7e89f7..3c3e74310b7f2 100644
--- a/drivers/gpu/drm/i915/display/intel_quirks.h
+++ b/drivers/gpu/drm/i915/display/intel_quirks.h
@@ -18,6 +18,7 @@  enum intel_quirk_id {
 	QUIRK_INVERT_BRIGHTNESS,
 	QUIRK_LVDS_SSC_DISABLE,
 	QUIRK_NO_PPS_BACKLIGHT_POWER_HOOK,
+	QUIRK_FW_SYNC_LEN,
 };
 
 void intel_init_quirks(struct intel_display *display);