Vtotal is wrong in the BIOS supplied modeline for the DSI panel on the Asus TF103C leading to the last line of the display being shown as the first line.
Original: "1280x800": 60 67700 1280 1312 1328 1376 800 808 812 820 0x8 0xa Fixed: "1280x800": 60 67700 1280 1312 1328 1376 800 808 812 816 0x8 0xa
The factory installed Android has a hardcoded modeline in its kernel, causing it to not suffer from this BIOS bug; and the Android boot-splash which uses the EFI FB which does have this bug has the last line all black causing the bug to not be visible.
This commit introduces a generic DMI based quirk mechanism to vlv_dsi for doing various fixups, and uses this to correct the modeline.
v2: - s/mode_fixup/dmi_quirk/ to make the new DMI quirk mechanism more generic - Add a comment with the old and new modelines to the patch and commit msg
Reviewed-by: Javier Martinez Canillas javierm@redhat.com Signed-off-by: Hans de Goede hdegoede@redhat.com --- drivers/gpu/drm/i915/display/vlv_dsi.c | 40 ++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
diff --git a/drivers/gpu/drm/i915/display/vlv_dsi.c b/drivers/gpu/drm/i915/display/vlv_dsi.c index 06ef822c27bd..831ca6401c51 100644 --- a/drivers/gpu/drm/i915/display/vlv_dsi.c +++ b/drivers/gpu/drm/i915/display/vlv_dsi.c @@ -23,6 +23,7 @@ * Author: Jani Nikula jani.nikula@intel.com */
+#include <linux/dmi.h> #include <linux/slab.h>
#include <drm/drm_atomic_helper.h> @@ -1831,6 +1832,36 @@ static void vlv_dphy_param_init(struct intel_dsi *intel_dsi) intel_dsi_log_params(intel_dsi); }
+typedef void (*vlv_dsi_dmi_quirk_func)(struct intel_dsi *intel_dsi, + struct drm_display_mode *fixed_mode); + +/* + * Vtotal is wrong on the Asus TF103C leading to the last line of the display + * being shown as the first line. The factory installed Android has a hardcoded + * modeline, causing it to not suffer from this BIOS bug. + * + * Original mode: "1280x800": 60 67700 1280 1312 1328 1376 800 808 812 820 0x8 0xa + * Fixed mode: "1280x800": 60 67700 1280 1312 1328 1376 800 808 812 816 0x8 0xa + */ +static void vlv_dsi_asus_tf103c_mode_fixup(struct intel_dsi *intel_dsi, + struct drm_display_mode *fixed_mode) +{ + if (fixed_mode->vtotal == 820) + fixed_mode->vtotal -= 4; +} + +static const struct dmi_system_id vlv_dsi_dmi_quirk_table[] = { + { + /* Asus Transformer Pad TF103C */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "TF103C"), + }, + .driver_data = (void *)vlv_dsi_asus_tf103c_mode_fixup, + }, + { } +}; + void vlv_dsi_init(struct drm_i915_private *dev_priv) { struct drm_device *dev = &dev_priv->drm; @@ -1840,6 +1871,7 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv) struct intel_connector *intel_connector; struct drm_connector *connector; struct drm_display_mode *current_mode, *fixed_mode; + const struct dmi_system_id *dmi_id; enum port port; enum pipe pipe;
@@ -1968,6 +2000,14 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv) goto err_cleanup_connector; }
+ dmi_id = dmi_first_match(vlv_dsi_dmi_quirk_table); + if (dmi_id) { + vlv_dsi_dmi_quirk_func quirk_func = + (vlv_dsi_dmi_quirk_func)dmi_id->driver_data; + + quirk_func(intel_dsi, fixed_mode); + } + intel_panel_init(&intel_connector->panel, fixed_mode, NULL); intel_backlight_setup(intel_connector, INVALID_PIPE);
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.
Reviewed-by: Javier Martinez Canillas javierm@redhat.com Signed-off-by: Hans de Goede hdegoede@redhat.com --- drivers/gpu/drm/i915/display/vlv_dsi.c | 37 ++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
diff --git a/drivers/gpu/drm/i915/display/vlv_dsi.c b/drivers/gpu/drm/i915/display/vlv_dsi.c index 831ca6401c51..0ddc0c8cd4f7 100644 --- a/drivers/gpu/drm/i915/display/vlv_dsi.c +++ b/drivers/gpu/drm/i915/display/vlv_dsi.c @@ -1850,6 +1850,29 @@ static void vlv_dsi_asus_tf103c_mode_fixup(struct intel_dsi *intel_dsi, fixed_mode->vtotal -= 4; }
+/* + * 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_size_fixup(struct intel_dsi *intel_dsi, + struct drm_display_mode *fixed_mode) +{ + struct drm_display_info *info = &intel_dsi->attached_connector->base.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 vlv_dsi_dmi_quirk_table[] = { { /* Asus Transformer Pad TF103C */ @@ -1859,6 +1882,20 @@ static const struct dmi_system_id vlv_dsi_dmi_quirk_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_size_fixup, + }, { } };
Add some debug logging to mipi_exec_i2c, to make debugging various issues seen with it easier.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c index 0da91849efde..215dbfc0af0f 100644 --- a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c +++ b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c @@ -464,6 +464,10 @@ static const u8 *mipi_exec_i2c(struct intel_dsi *intel_dsi, const u8 *data) u8 payload_size = *(data + 6); u8 *payload_data;
+ drm_dbg_kms(&i915->drm, "%s bus %d client-addr 0x%02x reg 0x%02x data %*ph\n", + __func__, vbt_i2c_bus_num, slave_addr, reg_offset, + payload_size, data + 7); + if (intel_dsi->i2c_bus_num < 0) { intel_dsi->i2c_bus_num = vbt_i2c_bus_num; i2c_acpi_find_adapter(intel_dsi, slave_addr);
Hello Hans,
On 2/25/22 22:49, Hans de Goede wrote:
Add some debug logging to mipi_exec_i2c, to make debugging various issues seen with it easier.
Signed-off-by: Hans de Goede hdegoede@redhat.com
drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 4 ++++ 1 file changed, 4 insertions(+)
Reviewed-by: Javier Martinez Canillas javierm@redhat.com
On Fri, 25 Feb 2022, Hans de Goede hdegoede@redhat.com wrote:
Add some debug logging to mipi_exec_i2c, to make debugging various issues seen with it easier.
Signed-off-by: Hans de Goede hdegoede@redhat.com
drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c index 0da91849efde..215dbfc0af0f 100644 --- a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c +++ b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c @@ -464,6 +464,10 @@ static const u8 *mipi_exec_i2c(struct intel_dsi *intel_dsi, const u8 *data) u8 payload_size = *(data + 6); u8 *payload_data;
- drm_dbg_kms(&i915->drm, "%s bus %d client-addr 0x%02x reg 0x%02x data %*ph\n",
__func__, vbt_i2c_bus_num, slave_addr, reg_offset,
__func__ is redundant with drm_dbg_kms.
BR, Jani.
payload_size, data + 7);
- if (intel_dsi->i2c_bus_num < 0) { intel_dsi->i2c_bus_num = vbt_i2c_bus_num; i2c_acpi_find_adapter(intel_dsi, slave_addr);
The current mipi_exec_i2c code uses 2 methods to find the I2C bus / adapter to use:
1) Search for an ACPI I2cSerialBus resource matching the client address from the MIPI sequence
2) Fall back to searching the adapter by the I2C bus number from the MIPI sequence if 1) fails.
1 is fine, 2 however is problematic Linux does not have a fixed enumeration order for I2C busses, so Linux numbers don't necessary line up with the VBT numbers. On the Lenovo Yoga Tablet 2 830/1050 this causes these errors:
i2c_designware 80860F41:03: controller timed out i915 0000:00:02.0: [drm] *ERROR* Failed to xfer payload of size (1) to reg (169) i2c_designware 80860F41:03: controller timed out i915 0000:00:02.0: [drm] *ERROR* Failed to xfer payload of size (1) to reg (165) i2c_designware 80860F41:03: controller timed out i915 0000:00:02.0: [drm] *ERROR* Failed to xfer payload of size (1) to reg (167)
Fix these errors by turning mipi_exec_i2c calls into no-ops if there is no matching ACPI I2cSerialBus resource, restoring the behavior from before the current mipi_exec_i2c implementation. This change should not cause any issues because:
1) Most DSDT correctly list an I2cSerialBus resource matching the client VBT MIPI sequence address, so we never hit scenario 2.
2) The current mipi_exec_i2c implementation was added to fix a backlight issue on an Aava Mobile's Inari 10 tablet, which is Bay Trail based. Most BYT based devices have worked fine with a no-op implementation of mipi_exec_i2c since 2014.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- drivers/gpu/drm/i915/display/intel_dsi.h | 3 +++ drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_dsi.h b/drivers/gpu/drm/i915/display/intel_dsi.h index a3a906cb097e..69e3f7b6fdaf 100644 --- a/drivers/gpu/drm/i915/display/intel_dsi.h +++ b/drivers/gpu/drm/i915/display/intel_dsi.h @@ -32,6 +32,9 @@ #define INTEL_DSI_VIDEO_MODE 0 #define INTEL_DSI_COMMAND_MODE 1
+#define INTEL_DSI_I2C_BUS_UNINITIALIZED -1 +#define INTEL_DSI_I2C_BUS_INVALID -2 + /* Dual Link support */ #define DSI_DUAL_LINK_NONE 0 #define DSI_DUAL_LINK_FRONT_BACK 1 diff --git a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c index 215dbfc0af0f..f7273c0cae90 100644 --- a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c +++ b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c @@ -468,11 +468,17 @@ static const u8 *mipi_exec_i2c(struct intel_dsi *intel_dsi, const u8 *data) __func__, vbt_i2c_bus_num, slave_addr, reg_offset, payload_size, data + 7);
- if (intel_dsi->i2c_bus_num < 0) { - intel_dsi->i2c_bus_num = vbt_i2c_bus_num; + if (intel_dsi->i2c_bus_num == INTEL_DSI_I2C_BUS_UNINITIALIZED) { + intel_dsi->i2c_bus_num = INTEL_DSI_I2C_BUS_INVALID; i2c_acpi_find_adapter(intel_dsi, slave_addr); + if (intel_dsi->i2c_bus_num < 0) + drm_warn(&i915->drm, "Cannot find I2C bus %d client-addr 0x%02x, skipping MIPI I2C sequences\n", + vbt_i2c_bus_num, slave_addr); }
+ if (intel_dsi->i2c_bus_num < 0) + goto err_bus; + adapter = i2c_get_adapter(intel_dsi->i2c_bus_num); if (!adapter) { drm_err(&i915->drm, "Cannot find a valid i2c bus for xfer\n");
The VBT DSI MIPI sequences of the panel on the Microsoft Surface 3 contain a couple of I2c writes to what seems to be a non existing TI LP855x backlight controller, leading to the following errors:
i915 0000:00:02.0: [drm] mipi_exec_i2c bus 5 client-addr 0x2c reg 0x01 data 01 i2c_designware 808622C1:04: controller timed out i915 0000:00:02.0: [drm] *ERROR* Failed to xfer payload of size (1) to reg (1) i915 0000:00:02.0: [drm] mipi_exec_i2c bus 5 client-addr 0x2c reg 0x16 data 07 i2c_designware 808622C1:04: controller timed out i915 0000:00:02.0: [drm] *ERROR* Failed to xfer payload of size (1) to reg (22)
Besides these errors this also causes the screen turning on to be delayed by 2 seconds. At a DMI based quirk to ignore VBT DSI MIPI I2C writes on the Microsoft Surface 3.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- drivers/gpu/drm/i915/display/vlv_dsi.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/drivers/gpu/drm/i915/display/vlv_dsi.c b/drivers/gpu/drm/i915/display/vlv_dsi.c index 0ddc0c8cd4f7..9ba45a928719 100644 --- a/drivers/gpu/drm/i915/display/vlv_dsi.c +++ b/drivers/gpu/drm/i915/display/vlv_dsi.c @@ -1873,6 +1873,16 @@ static void vlv_dsi_lenovo_yoga_tab2_size_fixup(struct intel_dsi *intel_dsi, } }
+/* + * The VBT DSI MIPI sequences on the MS Surface 3 contain I2C writes to + * a non existing TI LP855x backlight controller which time out. + */ +static void vlv_dsi_ms_surface3_disable_mipi_i2c(struct intel_dsi *intel_dsi, + struct drm_display_mode *fixed_mode) +{ + intel_dsi->i2c_bus_num = INTEL_DSI_I2C_BUS_INVALID; +} + static const struct dmi_system_id vlv_dsi_dmi_quirk_table[] = { { /* Asus Transformer Pad TF103C */ @@ -1896,6 +1906,14 @@ static const struct dmi_system_id vlv_dsi_dmi_quirk_table[] = { }, .driver_data = (void *)vlv_dsi_lenovo_yoga_tab2_size_fixup, }, + { + /* Microsoft Surface 3 */ + .matches = { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface 3"), + }, + .driver_data = (void *)vlv_dsi_ms_surface3_disable_mipi_i2c, + }, { } };
dri-devel@lists.freedesktop.org