diff mbox series

[RFC,4/4] drm/i915: Apply CDCLK quirk only on QS parts

Message ID 20230102062005.720964-5-chaitanya.kumar.borah@intel.com (mailing list archive)
State New, archived
Headers show
Series Add new CDCLK step for RPL-U | expand

Commit Message

Chaitanya Kumar Borah Jan. 2, 2023, 6:20 a.m. UTC
RPL-U boards with ES silicon does not support the 480Mhz step of
CDCLK. To differentiate between QS and ES part CPU brand string
is the only feasible way as of now. ES parts have "Genuine Intel"
in their brand string while QS parts have a more specific brand
string, for ex. "13th Gen Intel(R) Core(TM) i5-1345U"

BSpec: 55409

Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
---
 drivers/gpu/drm/i915/display/intel_quirks.c | 32 +++++++++++++++++++--
 1 file changed, 29 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_quirks.c b/drivers/gpu/drm/i915/display/intel_quirks.c
index 0a30499835b3..a6d7a2430626 100644
--- a/drivers/gpu/drm/i915/display/intel_quirks.c
+++ b/drivers/gpu/drm/i915/display/intel_quirks.c
@@ -14,6 +14,25 @@  static void intel_set_quirk(struct drm_i915_private *i915, enum intel_quirk_id q
 	i915->display.quirks.mask |= BIT(quirk);
 }
 
+/*
+ * To differentiate between QS and ES part CPU brand string is the only feasible way
+ * as of now. ES parts have "Genuine Intel" in their brand string while QS parts have a more
+ * specific brand string, for ex. "13th Gen Intel(R) Core(TM) i5-1345U"
+ */
+static bool is_QS_part(void)
+{
+	struct cpuinfo_x86 *c;
+	unsigned int cpu = get_cpu();
+
+	c = &cpu_data(cpu);
+	put_cpu();
+
+	if (c->x86_model_id[0] && !strstr(c->x86_model_id, "Genuine Intel"))
+		return true;
+
+	return false;
+}
+
 /*
  * Some machines (Lenovo U160) do not work with SSC on LVDS for some reason
  */
@@ -67,12 +86,19 @@  static void quirk_no_pps_backlight_power_hook(struct drm_i915_private *i915)
 
 /*
  * A new step of 480MHz has been added on SKUs that have a RPL-U device id.
- * This particular step is to better support 120Hz panels.
+ * This particular step is to better support 120Hz panels. In addition to
+ * identifying RPL-U device id, we need to make a distinction between ES and
+ * QS parts as this change comes only to QS parts. For this CPUID Brand
+ * string is used. 480Mhz step is only supported in SKUs which does not
+ * contain the string "Genuine Intel" in the Brand string.
  */
+
 static void quirk_480mhz_cdclk_step_hook(struct drm_i915_private *i915)
 {
-	intel_set_quirk(i915, QUIRK_480MHZ_CDCLK_STEP);
-	drm_info(&i915->drm, "Applying 480MHz CDCLK step quirk\n");
+	if (is_QS_part()) {
+		intel_set_quirk(i915, QUIRK_480MHZ_CDCLK_STEP);
+		drm_info(&i915->drm, "Applying 480MHz CDCLK step quirk\n");
+	}
 }
 
 struct intel_quirk {