From patchwork Thu Nov 25 10:10:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 1559605 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=WKEORJhM; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4J0DCp6tbwz9s5P for ; Thu, 25 Nov 2021 21:10:46 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1mqBi7-0005D6-5a; Thu, 25 Nov 2021 10:10:35 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1mqBi6-0005CE-5q for kernel-team@lists.ubuntu.com; Thu, 25 Nov 2021 10:10:34 +0000 Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id F1CF940029 for ; Thu, 25 Nov 2021 10:10:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1637835033; bh=OAXM0TBP3qqivzjAZuwFI9fowuUN/kYeiA0Sq55uai4=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=WKEORJhMy0jCG4QH0bkxyh/xfjgTJJfsTizTSKKUpQlJry47zPomslJWFEWVtBlSa odb7Ijeo/A5qv0GyXmT42eIbPeLtLaAjq72Y6N5lnv2coHZiP6SmfSyUCNAFOTnM2G 4VFy+nOFY4vHbWPnhAtCwRsGrY0ialhsr179wl/t0zgq0Goqd387zDQNHwK4W3PLHq L9c8fdeCy1K7L+kZ5h/oteZxFFn94KNInfsU0zM11YXbOqZxNx8S+b29Us84EL+f1X Jo4ku0QoypCF/z+PCCGR8YBBrZ/guhZtq8ED1EenntLccsUbK9mMAgBhqHKzB26Twv CDsgQr0jOsCIA== Received: by mail-pl1-f199.google.com with SMTP id f16-20020a170902ce9000b001436ba39b2bso1903669plg.3 for ; Thu, 25 Nov 2021 02:10:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OAXM0TBP3qqivzjAZuwFI9fowuUN/kYeiA0Sq55uai4=; b=dtbIzMCUdVMyJzIlcBl/JT2Q5KAlNShvs55mhJagU0yVD9Rdexvp9pxat/MaGs1KhN abT0AORDK35iJVglpdvJkfF8mqxeMSILU3obnBh/W0vmZ+aqtPg6cSmP7iY7PkNBIQtp ohfDxxoibULjt/C9VEH+hRfcnR51ea8IJMmVPywFta2w5/zsIh/ZGjtREYCMN6nnjaIq EaHRw/CiRqLBOLYGO8knFq4kzkp2YUMRHlltp3zsGJvKZRjZpNDnF1qHybsG1hTSmMjO J0d/07ZxpOexVrM7srMr5FaRydraQSJSzkI+icRIhQFeT6j3xfh6caX/evnHKmd/7ahe 2D/g== X-Gm-Message-State: AOAM532tJD3PDyGDqf4pcToC4QFVQbNuueUxJpNW4Spjh262SYV5kXOJ xvcC8K4Wg0squTvfutFdIfSuZ2ALtpdxKcH5UX5N0qlEEOvorscPTefYj1sQUbWrLAnRR/CgidC PV5vOeB7uzWMX58OqkBsAgds4ZN0gjTM4DSJX9g9EVQ== X-Received: by 2002:a17:903:2045:b0:142:3d07:2866 with SMTP id q5-20020a170903204500b001423d072866mr27488998pla.17.1637835032423; Thu, 25 Nov 2021 02:10:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHTnuckCeZh6FztMn560hUiJBVt2vhrroSsmpemKAIsGRjZKbHUQAETTZv1mrNyWpVljPykA== X-Received: by 2002:a17:903:2045:b0:142:3d07:2866 with SMTP id q5-20020a170903204500b001423d072866mr27488950pla.17.1637835032050; Thu, 25 Nov 2021 02:10:32 -0800 (PST) Received: from localhost.localdomain (111-240-133-170.dynamic-ip.hinet.net. [111.240.133.170]) by smtp.gmail.com with ESMTPSA id g18sm2621861pfb.103.2021.11.25.02.10.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Nov 2021 02:10:31 -0800 (PST) From: Chris Chiu To: kernel-team@lists.ubuntu.com Subject: [PATCH v2 03/12][SRU][OEM-5.14] drm/i915/tc: Check for DP-alt, legacy sinks before taking PHY ownership Date: Thu, 25 Nov 2021 18:10:16 +0800 Message-Id: <20211125101025.20214-4-chris.chiu@canonical.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211125101025.20214-1-chris.chiu@canonical.com> References: <20211125101025.20214-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Imre Deak BugLink: https://bugs.launchpad.net/bugs/1952041 On ADL-P the PHY ready/complete flag is always set even in TBT-alt mode. To avoid taking the PHY ownership and the following spurious "PHY sudden disconnect" messages on this platform when connecting the PHY in TBT mode, check if there is any DP-alt or legacy sink connected before taking the ownership. v2: (Jose) - Fix debug message clarifying that a TBT sink can be connected. - Add comments describing the PHY complete HW flag semantic differences between adl-p and other platforms. Cc: José Roberto de Souza Signed-off-by: Imre Deak Reviewed-by: José Roberto de Souza Link: https://patchwork.freedesktop.org/patch/msgid/20210929132833.2253961-2-imre.deak@intel.com (cherry picked from commit 30e114ef4b1620bd6768952279b53ea24e232efb) Signed-off-by: Chris Chiu --- drivers/gpu/drm/i915/display/intel_tc.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_tc.c b/drivers/gpu/drm/i915/display/intel_tc.c index 0d3555437b0b..4e5ff823a3a3 100644 --- a/drivers/gpu/drm/i915/display/intel_tc.c +++ b/drivers/gpu/drm/i915/display/intel_tc.c @@ -270,6 +270,14 @@ static u32 tc_port_live_status_mask(struct intel_digital_port *dig_port) return icl_tc_port_live_status_mask(dig_port); } +/* + * Return the PHY status complete flag indicating that display can acquire the + * PHY ownership. The IOM firmware sets this flag when a DP-alt or legacy sink + * is connected and it's ready to switch the ownership to display. The flag + * will be left cleared when a TBT-alt sink is connected, where the PHY is + * owned by the TBT subsystem and so switching the ownership to display is not + * required. + */ static bool icl_tc_phy_status_complete(struct intel_digital_port *dig_port) { struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); @@ -288,6 +296,13 @@ static bool icl_tc_phy_status_complete(struct intel_digital_port *dig_port) return val & DP_PHY_MODE_STATUS_COMPLETED(dig_port->tc_phy_fia_idx); } +/* + * Return the PHY status complete flag indicating that display can acquire the + * PHY ownership. The IOM firmware sets this flag when it's ready to switch + * the ownership to display, regardless of what sink is connected (TBT-alt, + * DP-alt, legacy or nothing). For TBT-alt sinks the PHY is owned by the TBT + * subsystem and so switching the ownership to display is not required. + */ static bool adl_tc_phy_status_complete(struct intel_digital_port *dig_port) { struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); @@ -424,6 +439,7 @@ static void icl_tc_phy_connect(struct intel_digital_port *dig_port, int required_lanes) { struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); + u32 live_status_mask; int max_lanes; if (!tc_phy_status_complete(dig_port)) { @@ -432,6 +448,13 @@ static void icl_tc_phy_connect(struct intel_digital_port *dig_port, goto out_set_tbt_alt_mode; } + live_status_mask = tc_port_live_status_mask(dig_port); + if (!(live_status_mask & (BIT(TC_PORT_DP_ALT) | BIT(TC_PORT_LEGACY)))) { + drm_dbg_kms(&i915->drm, "Port %s: PHY ownership not required (live status %02x)\n", + dig_port->tc_port_name, live_status_mask); + goto out_set_tbt_alt_mode; + } + if (!tc_phy_take_ownership(dig_port, true) && !drm_WARN_ON(&i915->drm, dig_port->tc_legacy_port)) goto out_set_tbt_alt_mode;