From patchwork Fri Feb 25 21:49:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 12761003 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E993CC433F5 for ; Fri, 25 Feb 2022 21:50:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0788410EA10; Fri, 25 Feb 2022 21:50:00 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id B803B10E229 for ; Fri, 25 Feb 2022 21:49:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645825796; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AbGxeSXFBVDBJkexbTyEgFiLLSTKssRShbzZVnpdfyE=; b=IoJWFc1+WoaknWAIAW4FpFw/kfXBK6+ium1qgG2kn/FXgLf5Plgowvd32n8/sC6jgzZrJd CWfsQEDuoBb880u2l4f0WKw8DYPalCvy46fASTLsdZAr/DhGp70kqJZosmFIHTiu/DXdPU KPTSF0ThUF/QtDmjcZy+FLz2lavXft0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-675-L67PbGpCPB-DHI7R91BM2g-1; Fri, 25 Feb 2022 16:49:53 -0500 X-MC-Unique: L67PbGpCPB-DHI7R91BM2g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EE7B71006AA7; Fri, 25 Feb 2022 21:49:51 +0000 (UTC) Received: from x1.localdomain (unknown [10.39.192.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id B07E887BB5; Fri, 25 Feb 2022 21:49:37 +0000 (UTC) From: Hans de Goede To: Jani Nikula , Joonas Lahtinen , =?utf-8?b?VmlsbGUgU3ly?= =?utf-8?b?asOkbMOk?= Subject: [PATCH 1/5] drm/i915/vlv_dsi: Add DMI quirk for wrong panel modeline in BIOS on Asus TF103C (v2) Date: Fri, 25 Feb 2022 22:49:30 +0100 Message-Id: <20220225214934.383168-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hdegoede@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, Vivek Kasireddy , Hans de Goede Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Signed-off-by: Hans de Goede --- 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 */ +#include #include #include @@ -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); From patchwork Fri Feb 25 21:49:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 12761004 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0345CC433F5 for ; Fri, 25 Feb 2022 21:50:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EBE1A10E37F; Fri, 25 Feb 2022 21:50:07 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id C922310E974 for ; Fri, 25 Feb 2022 21:50:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645825801; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M5Q0aZxL/HvCOpVLF1z1+VzDRQJZ96k0KvBU7wnO280=; b=KPd2QDooK/dBzxYJPrJndBr2s8zJIVJLA7lc9CccWY8soxfkQ3eISSgGIczx1bvKAJLq5A nr5axSxISQyyjvVtj9KqgTvfF6eeh49Q8ss/loMvb6cZq7xjCqtmD0UxT2l0CcrLSa//QI ec/8GocGj4KQpB7fpb3lg7rvnJ7ZsVw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-163-c1VbCK3HPvmSJGQYU-v9-g-1; Fri, 25 Feb 2022 16:49:58 -0500 X-MC-Unique: c1VbCK3HPvmSJGQYU-v9-g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A17A51091DA1; Fri, 25 Feb 2022 21:49:56 +0000 (UTC) Received: from x1.localdomain (unknown [10.39.192.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 586D587BB5; Fri, 25 Feb 2022 21:49:52 +0000 (UTC) From: Hans de Goede To: Jani Nikula , Joonas Lahtinen , =?utf-8?b?VmlsbGUgU3ly?= =?utf-8?b?asOkbMOk?= Subject: [PATCH 2/5] drm/i915/vlv_dsi: Add DMI quirk for wrong panel size on Lenovo Yoga Tablet 2 series Date: Fri, 25 Feb 2022 22:49:31 +0100 Message-Id: <20220225214934.383168-2-hdegoede@redhat.com> In-Reply-To: <20220225214934.383168-1-hdegoede@redhat.com> References: <20220225214934.383168-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hdegoede@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, Vivek Kasireddy , Hans de Goede Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Signed-off-by: Hans de Goede --- 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, + }, { } }; From patchwork Fri Feb 25 21:49:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 12761005 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2BC41C4332F for ; Fri, 25 Feb 2022 21:50:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C68BA10E980; Fri, 25 Feb 2022 21:50:36 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 907BC10E957 for ; Fri, 25 Feb 2022 21:50:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645825833; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Dy2T/qK/l4Qm/1tXB2oDxtdVoj2vfg4TjNqn9kq5m9Q=; b=FbIawBvLGcFbqqqd+GJ3YglDAvsHH+rY4bFYxXz+fCxd1zakAoW0FDV5bAIXmxw0uZt4eA KniqdBEdA36FVUgCvzh4KdbLacMtmf7gxMiQS0MQmtLWgPPfdhUBC8ltjV678grj5ZfWT/ 7TUEfHShH/uGH/viOWyj1fQCIocRZN4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-569-WC_f2qU4PqGnCa8xgzooUA-1; Fri, 25 Feb 2022 16:50:30 -0500 X-MC-Unique: WC_f2qU4PqGnCa8xgzooUA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0A3A7180FD71; Fri, 25 Feb 2022 21:50:29 +0000 (UTC) Received: from x1.localdomain (unknown [10.39.192.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB7B487BB5; Fri, 25 Feb 2022 21:49:56 +0000 (UTC) From: Hans de Goede To: Jani Nikula , Joonas Lahtinen , =?utf-8?b?VmlsbGUgU3ly?= =?utf-8?b?asOkbMOk?= Subject: [PATCH 3/5] drm/i915/dsi: Add some debug logging to mipi_exec_i2c Date: Fri, 25 Feb 2022 22:49:32 +0100 Message-Id: <20220225214934.383168-3-hdegoede@redhat.com> In-Reply-To: <20220225214934.383168-1-hdegoede@redhat.com> References: <20220225214934.383168-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hdegoede@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, Vivek Kasireddy , Hans de Goede Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add some debug logging to mipi_exec_i2c, to make debugging various issues seen with it easier. Signed-off-by: Hans de Goede Reviewed-by: Javier Martinez Canillas --- 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); From patchwork Fri Feb 25 21:49:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 12761006 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 383A7C433EF for ; Fri, 25 Feb 2022 21:50:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3D96410E975; Fri, 25 Feb 2022 21:50:40 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 11C7110E9AC for ; Fri, 25 Feb 2022 21:50:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645825836; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M3295UBye6Oldy4KAgQHlEN6++tFFxU1UQIOAxjhTq4=; b=KD/11n14E/XFCPCLf6ezV5cjgEp/iq53lqwoPtBBv1dRBfoneunpJXIySSZ4O4YcdK98ZG EaO8nMiGbGmY5eeMMlF1RS4tofPrI6RLKSARHwFh2KGPnjcvlL6Dx6uCtk6x+r5jGKQ1dy PC/T+vRLIgTpzqa4JnyGGokajwVmxao= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-450-_cgAMBrSMrKQuYxlMGemBw-1; Fri, 25 Feb 2022 16:50:33 -0500 X-MC-Unique: _cgAMBrSMrKQuYxlMGemBw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AC337801DDB; Fri, 25 Feb 2022 21:50:31 +0000 (UTC) Received: from x1.localdomain (unknown [10.39.192.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6909F87BB5; Fri, 25 Feb 2022 21:50:29 +0000 (UTC) From: Hans de Goede To: Jani Nikula , Joonas Lahtinen , =?utf-8?b?VmlsbGUgU3ly?= =?utf-8?b?asOkbMOk?= Subject: [PATCH 4/5] drm/i915/dsi: Skip MIPI I2C sequences if not listed as a I2cSerialBus resource Date: Fri, 25 Feb 2022 22:49:33 +0100 Message-Id: <20220225214934.383168-4-hdegoede@redhat.com> In-Reply-To: <20220225214934.383168-1-hdegoede@redhat.com> References: <20220225214934.383168-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hdegoede@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, Vivek Kasireddy , Hans de Goede Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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"); From patchwork Fri Feb 25 21:49:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 12761007 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00C41C433EF for ; Fri, 25 Feb 2022 21:50:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0EECA10E9AC; Fri, 25 Feb 2022 21:50:50 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 509B610E989 for ; Fri, 25 Feb 2022 21:50:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645825846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CpsyqJPq2MznxP2J5dghU5/XW2pfoZw6gIMFRiSICa4=; b=Hv3LylwUcEUHbeVIgGj02S/aMbBvyK3wzNFQMvr1gAPI5wxIIvzVAXHRHppQuI37JiPvrJ nkBLTCHfRHaoYdEFv7fsKy62RP+b49AvF1RF8P0n8xGvfpY/q09FrHRBcl4ZCNGto8bAWB lpB8OrTM0bapsEOKIQOX2nARquQleCw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-65-N7PGusDaPruXf-YimEVX3Q-1; Fri, 25 Feb 2022 16:50:43 -0500 X-MC-Unique: N7PGusDaPruXf-YimEVX3Q-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E742F51DC; Fri, 25 Feb 2022 21:50:41 +0000 (UTC) Received: from x1.localdomain (unknown [10.39.192.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17DCC87BB5; Fri, 25 Feb 2022 21:50:31 +0000 (UTC) From: Hans de Goede To: Jani Nikula , Joonas Lahtinen , =?utf-8?b?VmlsbGUgU3ly?= =?utf-8?b?asOkbMOk?= Subject: [PATCH 5/5] drm/i915/vlv_dsi: Skip MIPI I2C sequences on Microsoft Surface 3 Date: Fri, 25 Feb 2022 22:49:34 +0100 Message-Id: <20220225214934.383168-5-hdegoede@redhat.com> In-Reply-To: <20220225214934.383168-1-hdegoede@redhat.com> References: <20220225214934.383168-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hdegoede@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, Vivek Kasireddy , Hans de Goede Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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, + }, { } };