* [PATCH 2/5] drm/i915/vlv_dsi: Add DMI quirk for wrong panel size on Lenovo Yoga Tablet 2 series
2022-02-25 21:49 [PATCH 1/5] drm/i915/vlv_dsi: Add DMI quirk for wrong panel modeline in BIOS on Asus TF103C (v2) Hans de Goede
@ 2022-02-25 21:49 ` Hans de Goede
2022-02-25 21:49 ` [PATCH 3/5] drm/i915/dsi: Add some debug logging to mipi_exec_i2c Hans de Goede
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Hans de Goede @ 2022-02-25 21:49 UTC (permalink / raw)
To: Jani Nikula, Joonas Lahtinen, Ville Syrjälä
Cc: intel-gfx, Javier Martinez Canillas, dri-devel, Vivek Kasireddy,
Hans de Goede
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,
+ },
{ }
};
--
2.35.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/5] drm/i915/dsi: Add some debug logging to mipi_exec_i2c
2022-02-25 21:49 [PATCH 1/5] drm/i915/vlv_dsi: Add DMI quirk for wrong panel modeline in BIOS on Asus TF103C (v2) Hans de Goede
2022-02-25 21:49 ` [PATCH 2/5] drm/i915/vlv_dsi: Add DMI quirk for wrong panel size on Lenovo Yoga Tablet 2 series Hans de Goede
@ 2022-02-25 21:49 ` Hans de Goede
2022-02-25 22:04 ` Javier Martinez Canillas
2022-03-03 10:22 ` Jani Nikula
2022-02-25 21:49 ` [PATCH 4/5] drm/i915/dsi: Skip MIPI I2C sequences if not listed as a I2cSerialBus resource Hans de Goede
2022-02-25 21:49 ` [PATCH 5/5] drm/i915/vlv_dsi: Skip MIPI I2C sequences on Microsoft Surface 3 Hans de Goede
3 siblings, 2 replies; 7+ messages in thread
From: Hans de Goede @ 2022-02-25 21:49 UTC (permalink / raw)
To: Jani Nikula, Joonas Lahtinen, Ville Syrjälä
Cc: intel-gfx, Javier Martinez Canillas, dri-devel, Vivek Kasireddy,
Hans de Goede
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);
--
2.35.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 3/5] drm/i915/dsi: Add some debug logging to mipi_exec_i2c
2022-02-25 21:49 ` [PATCH 3/5] drm/i915/dsi: Add some debug logging to mipi_exec_i2c Hans de Goede
@ 2022-02-25 22:04 ` Javier Martinez Canillas
2022-03-03 10:22 ` Jani Nikula
1 sibling, 0 replies; 7+ messages in thread
From: Javier Martinez Canillas @ 2022-02-25 22:04 UTC (permalink / raw)
To: Hans de Goede, Jani Nikula, Joonas Lahtinen,
Ville Syrjälä
Cc: intel-gfx, Vivek Kasireddy, dri-devel
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>
--
Best regards,
Javier Martinez Canillas
Linux Engineering
Red Hat
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/5] drm/i915/dsi: Add some debug logging to mipi_exec_i2c
2022-02-25 21:49 ` [PATCH 3/5] drm/i915/dsi: Add some debug logging to mipi_exec_i2c Hans de Goede
2022-02-25 22:04 ` Javier Martinez Canillas
@ 2022-03-03 10:22 ` Jani Nikula
1 sibling, 0 replies; 7+ messages in thread
From: Jani Nikula @ 2022-03-03 10:22 UTC (permalink / raw)
To: Hans de Goede, Joonas Lahtinen, Ville Syrjälä
Cc: intel-gfx, Javier Martinez Canillas, dri-devel, Vivek Kasireddy,
Hans de Goede
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);
--
Jani Nikula, Intel Open Source Graphics Center
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 4/5] drm/i915/dsi: Skip MIPI I2C sequences if not listed as a I2cSerialBus resource
2022-02-25 21:49 [PATCH 1/5] drm/i915/vlv_dsi: Add DMI quirk for wrong panel modeline in BIOS on Asus TF103C (v2) Hans de Goede
2022-02-25 21:49 ` [PATCH 2/5] drm/i915/vlv_dsi: Add DMI quirk for wrong panel size on Lenovo Yoga Tablet 2 series Hans de Goede
2022-02-25 21:49 ` [PATCH 3/5] drm/i915/dsi: Add some debug logging to mipi_exec_i2c Hans de Goede
@ 2022-02-25 21:49 ` Hans de Goede
2022-02-25 21:49 ` [PATCH 5/5] drm/i915/vlv_dsi: Skip MIPI I2C sequences on Microsoft Surface 3 Hans de Goede
3 siblings, 0 replies; 7+ messages in thread
From: Hans de Goede @ 2022-02-25 21:49 UTC (permalink / raw)
To: Jani Nikula, Joonas Lahtinen, Ville Syrjälä
Cc: intel-gfx, Javier Martinez Canillas, dri-devel, Vivek Kasireddy,
Hans de Goede
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");
--
2.35.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 5/5] drm/i915/vlv_dsi: Skip MIPI I2C sequences on Microsoft Surface 3
2022-02-25 21:49 [PATCH 1/5] drm/i915/vlv_dsi: Add DMI quirk for wrong panel modeline in BIOS on Asus TF103C (v2) Hans de Goede
` (2 preceding siblings ...)
2022-02-25 21:49 ` [PATCH 4/5] drm/i915/dsi: Skip MIPI I2C sequences if not listed as a I2cSerialBus resource Hans de Goede
@ 2022-02-25 21:49 ` Hans de Goede
3 siblings, 0 replies; 7+ messages in thread
From: Hans de Goede @ 2022-02-25 21:49 UTC (permalink / raw)
To: Jani Nikula, Joonas Lahtinen, Ville Syrjälä
Cc: intel-gfx, Javier Martinez Canillas, dri-devel, Vivek Kasireddy,
Hans de Goede
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,
+ },
{ }
};
--
2.35.1
^ permalink raw reply related [flat|nested] 7+ messages in thread