diff mbox series

[2/2] drm/i915/vlv_dsi: Add DMI quirk for wrong panel size on Lenovo Yoga Tablet 2 series

Message ID 20220221220608.12131-2-hdegoede@redhat.com (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/i915/vlv_dsi: Add DMI quirk for wrong panel modeline in BIOS on Asus TF103C | expand

Commit Message

Hans de Goede Feb. 21, 2022, 10:06 p.m. UTC
On the Lenovo Yoga Tablet 2 830 / 1050 the VBT contains a bogus
192mm x 120mm size. This is especially a problem on the 8" 830 version
which uses a 10:16 portrait screen where as the bogus size is 16:10.

Add a DMI quirk to override the wrong panel size with the correct one.
Note both the 10" 1050 models as well as the 8" 830 models use the same
mainboard and thus the same DMI strings. The 10" 1050 uses a 1920x1200
landscape screen, where as the 8" 830 uses a 1200x1920 portrait screen,
so the quirk handling uses the display resolution to detect the model.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/gpu/drm/i915/display/vlv_dsi.c | 37 ++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

Comments

Javier Martinez Canillas Feb. 22, 2022, 8:58 a.m. UTC | #1
On 2/21/22 23:06, Hans de Goede wrote:
> On the Lenovo Yoga Tablet 2 830 / 1050 the VBT contains a bogus
> 192mm x 120mm size. This is especially a problem on the 8" 830 version
> which uses a 10:16 portrait screen where as the bogus size is 16:10.
> 
> Add a DMI quirk to override the wrong panel size with the correct one.
> Note both the 10" 1050 models as well as the 8" 830 models use the same
> mainboard and thus the same DMI strings. The 10" 1050 uses a 1920x1200
> landscape screen, where as the 8" 830 uses a 1200x1920 portrait screen,
> so the quirk handling uses the display resolution to detect the model.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

Best regards,
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/vlv_dsi.c b/drivers/gpu/drm/i915/display/vlv_dsi.c
index 66f5cf32bb66..e370a039e991 100644
--- a/drivers/gpu/drm/i915/display/vlv_dsi.c
+++ b/drivers/gpu/drm/i915/display/vlv_dsi.c
@@ -1847,6 +1847,29 @@  static void vlv_dsi_asus_tf103c_mode_fixup(struct drm_connector *connector,
 	fixed_mode->crtc_vtotal = 816;
 }
 
+/*
+ * On the Lenovo Yoga Tablet 2 830 / 1050 width_/height_mm contain a bogus
+ * 192mm x 120mm size. This is especially a problem on the 8" 830 version which
+ * uses a 10:16 portrait screen where as the bogus size is 16:10.
+ */
+static void vlv_dsi_lenovo_yoga_tab2_mode_fixup(struct drm_connector *connector,
+						struct drm_display_mode *fixed_mode)
+{
+	struct drm_display_info *info = &connector->display_info;
+
+	/*
+	 * The 10" 1050 uses a 1920x1200 landscape screen, where as the 8" 830
+	 * uses a 1200x1920 portrait screen.
+	 */
+	if (fixed_mode->hdisplay == 1920) {
+		info->width_mm = 216;
+		info->height_mm = 135;
+	} else {
+		info->width_mm = 107;
+		info->height_mm = 171;
+	}
+}
+
 static const struct dmi_system_id dmi_mode_fixup_table[] = {
 	{
 		/* Asus Transformer Pad TF103C */
@@ -1856,6 +1879,20 @@  static const struct dmi_system_id dmi_mode_fixup_table[] = {
 		},
 		.driver_data = (void *)vlv_dsi_asus_tf103c_mode_fixup,
 	},
+	{
+		/*
+		 * Lenovo Yoga Tablet 2 830F/L or 1050F/L (The 8" and 10"
+		 * Lenovo Yoga Tablet 2 use the same mainboard)
+		 */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Intel Corp."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "VALLEYVIEW C0 PLATFORM"),
+			DMI_MATCH(DMI_BOARD_NAME, "BYT-T FFD8"),
+			/* Partial match on beginning of BIOS version */
+			DMI_MATCH(DMI_BIOS_VERSION, "BLADE_21"),
+		},
+		.driver_data = (void *)vlv_dsi_lenovo_yoga_tab2_mode_fixup,
+	},
 	{ }
 };