From patchwork Tue Oct 1 12:32:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imre Deak X-Patchwork-Id: 13817917 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 1ABD6CE7D19 for ; Tue, 1 Oct 2024 12:32:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9514210E2E8; Tue, 1 Oct 2024 12:32:36 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="IVRaeUN1"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 11A6F10E2E8 for ; Tue, 1 Oct 2024 12:32:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727785953; x=1759321953; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=ebkbEoBD0bmuAG/mP8rPe8vF/TiVHwdgerwLYHIe22U=; b=IVRaeUN1dfkN+dC0tQUGK3gdFelaCWMKod3knAJU/L5No/Y1xyav1gf2 SrUE/q4irO5kcjUGYB5di8vK/JAsDJgQeZe62kh3QvXN563mJA9HFwjO/ 9VZrnmTxbMdIPTFuxdk3zUhNI6ndKKyOHpRl5Z0qIUDu6xtyeTmlJLHEr qqvufTZRfBhYHUAAK9muqFV4aXLnPUyjAMVoHLvd8Hrlaesl3P9ezoR2c hxE3SbMCndB5Hd/Ur1xMIFZuLQPCA+gTrrhUWSYAj190rRpz1I/HIobOe IrqqPfwlS1wdKXenh3Ww2IvvuXCOg/vRoxgj9UgohpvOcmhXUm8wliUI6 w==; X-CSE-ConnectionGUID: MfptCAv4STiRKnCJpfQ3kQ== X-CSE-MsgGUID: ZENqSrFITzmPjvaTVp83rg== X-IronPort-AV: E=McAfee;i="6700,10204,11212"; a="30624383" X-IronPort-AV: E=Sophos;i="6.11,167,1725346800"; d="scan'208";a="30624383" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2024 05:32:33 -0700 X-CSE-ConnectionGUID: cWh3IaJjRROAMSuixzhJFA== X-CSE-MsgGUID: qOdbozV6Qhyz87V/EEUnuA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,167,1725346800"; d="scan'208";a="74448035" Received: from ideak-desk.fi.intel.com ([10.237.72.78]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2024 05:32:32 -0700 From: Imre Deak To: intel-gfx@lists.freedesktop.org Subject: [PATCH v2 1/3] drm/i915/dp: Initialize the source OUI write timestamp always Date: Tue, 1 Oct 2024 15:32:57 +0300 Message-ID: <20241001123259.616486-1-imre.deak@intel.com> X-Mailer: git-send-email 2.44.2 MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" If the source OUI DPCD register value matches the expected Intel OUI value, the write timestamp doesn't get updated leaving it at the 0 initial value if the OUI wasn't written before. This can lead to an incorrect wait duration in intel_dp_wait_source_oui(), since jiffies is not inited to 0 in general (on a 32 bit system INITIAL_JIFFIES is set to 5 minutes ahead of wrap-around). Fix this by intializing the write timestamp in the above case as well. Signed-off-by: Imre Deak --- drivers/gpu/drm/i915/display/intel_dp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 16dc1d26d2a25..b7661529f1927 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -3349,8 +3349,11 @@ intel_edp_init_source_oui(struct intel_dp *intel_dp, bool careful) if (drm_dp_dpcd_read(&intel_dp->aux, DP_SOURCE_OUI, buf, sizeof(buf)) < 0) drm_err(&i915->drm, "Failed to read source OUI\n"); - if (memcmp(oui, buf, sizeof(oui)) == 0) + if (memcmp(oui, buf, sizeof(oui)) == 0) { + /* Assume the OUI was written now. */ + intel_dp->last_oui_write = jiffies; return; + } } if (drm_dp_dpcd_write(&intel_dp->aux, DP_SOURCE_OUI, oui, sizeof(oui)) < 0) From patchwork Tue Oct 1 12:32:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imre Deak X-Patchwork-Id: 13817918 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 990F9CE7D12 for ; Tue, 1 Oct 2024 12:32:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9AA2B10E313; Tue, 1 Oct 2024 12:32:36 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="aUzBmpVX"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 173D710E313 for ; Tue, 1 Oct 2024 12:32:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727785954; x=1759321954; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=OUzUneOZE6ixvgrrM9doxo2KZ5qea1pYrBlKfs4sQNg=; b=aUzBmpVX+or+/uGMbjI4zNf91wKpqD7TFY8/YxA9SmlLFycOHxi9Vv6L Q91lHj3jVrpNB+Ad1xKyXbn61igcmIBXtRxL+bHSFiOF41eXPAM4Aj6gl 6Llafxf7mTWd2cpfLCgh+tM8He/gknrn9HyQDvm2YTBI4JhN3WEnxE1j2 QZwY1+m4FoTlfvwQkoJktQeTu16S1MOUFmVYCSZLQLWHW1D51b4QnvVdD Lp9WlzjRPiZ5mviS+3wxHcCDGXUJwNKrtoSj/txmof01pdFP6/+4sAhlp nD7NHyGLDGBia/xbycClVZ4lApb7yF7/mtBoS4o+68/4oDq/S8dVQFyWS g==; X-CSE-ConnectionGUID: QLFdZMQpT1yVPAFKZ8l2rw== X-CSE-MsgGUID: /R7c2vSRRE6+MmfDY2eu2g== X-IronPort-AV: E=McAfee;i="6700,10204,11212"; a="30624384" X-IronPort-AV: E=Sophos;i="6.11,167,1725346800"; d="scan'208";a="30624384" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2024 05:32:34 -0700 X-CSE-ConnectionGUID: +Y2HR9NzSMyX4THmcdZ++g== X-CSE-MsgGUID: dYN4QuHHTjWg7LEdbZx5vg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,167,1725346800"; d="scan'208";a="74448038" Received: from ideak-desk.fi.intel.com ([10.237.72.78]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2024 05:32:33 -0700 From: Imre Deak To: intel-gfx@lists.freedesktop.org Subject: [PATCH v2 2/3] drm/i915/dp: Track source OUI validity explicitly Date: Tue, 1 Oct 2024 15:32:58 +0300 Message-ID: <20241001123259.616486-2-imre.deak@intel.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20241001123259.616486-1-imre.deak@intel.com> References: <20241001123259.616486-1-imre.deak@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" While updating the source OUI on the sink the driver should avoid writing the OUI if it's already up-to-date to prevent the sink from resetting itself in response to the update. On eDP - the only output type where the OUI was updated so far - the driver ensured this by comparing the current source OUI DPCD register values with the expected Intel OUI value, skipping the update in case of a match. On some non-eDP sinks - at least on Synaptics branch devices - this method doesn't work, since the source OUI DPCD registers read back as all 0, even after updating the registers. Handle the above kind of sinks by tracking when the OUI was updated and so should be valid, regardless of what the DPCD registers contain. This is required by the next patch updating the source OUI on non-eDP sink types as well. Signed-off-by: Imre Deak --- drivers/gpu/drm/i915/display/g4x_dp.c | 1 + drivers/gpu/drm/i915/display/intel_ddi.c | 1 + .../drm/i915/display/intel_display_types.h | 1 + drivers/gpu/drm/i915/display/intel_dp.c | 25 ++++++++++++++----- drivers/gpu/drm/i915/display/intel_dp.h | 1 + 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/display/g4x_dp.c b/drivers/gpu/drm/i915/display/g4x_dp.c index 440fb3002f286..596e926ef0894 100644 --- a/drivers/gpu/drm/i915/display/g4x_dp.c +++ b/drivers/gpu/drm/i915/display/g4x_dp.c @@ -1251,6 +1251,7 @@ static void intel_dp_encoder_reset(struct drm_encoder *encoder) intel_dp->DP = intel_de_read(display, intel_dp->output_reg); intel_dp->reset_link_params = true; + intel_dp_invalidate_source_oui(intel_dp); if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) vlv_pps_pipe_reset(intel_dp); diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c index fe1ded6707f90..465f245a53c48 100644 --- a/drivers/gpu/drm/i915/display/intel_ddi.c +++ b/drivers/gpu/drm/i915/display/intel_ddi.c @@ -4392,6 +4392,7 @@ static void intel_ddi_encoder_reset(struct drm_encoder *encoder) struct intel_digital_port *dig_port = enc_to_dig_port(to_intel_encoder(encoder)); intel_dp->reset_link_params = true; + intel_dp_invalidate_source_oui(intel_dp); intel_pps_encoder_reset(intel_dp); diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index 7ff97e5b83dd5..ad84ffa31c97f 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -1757,6 +1757,7 @@ struct intel_dp { /* When we last wrote the OUI for eDP */ unsigned long last_oui_write; + bool oui_valid; bool colorimetry_support; diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index b7661529f1927..2d6ffbeae07a0 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -3335,31 +3335,43 @@ void intel_dp_sink_disable_decompression(struct intel_atomic_state *state, } static void -intel_edp_init_source_oui(struct intel_dp *intel_dp, bool careful) +intel_dp_init_source_oui(struct intel_dp *intel_dp) { struct drm_i915_private *i915 = dp_to_i915(intel_dp); u8 oui[] = { 0x00, 0xaa, 0x01 }; u8 buf[3] = {}; + if (!intel_dp_is_edp(intel_dp)) + return; + /* * During driver init, we want to be careful and avoid changing the source OUI if it's * already set to what we want, so as to avoid clearing any state by accident */ - if (careful) { + if (!intel_dp->oui_valid) { if (drm_dp_dpcd_read(&intel_dp->aux, DP_SOURCE_OUI, buf, sizeof(buf)) < 0) drm_err(&i915->drm, "Failed to read source OUI\n"); if (memcmp(oui, buf, sizeof(oui)) == 0) { /* Assume the OUI was written now. */ intel_dp->last_oui_write = jiffies; - return; + intel_dp->oui_valid = true; } } + if (intel_dp->oui_valid) + return; + if (drm_dp_dpcd_write(&intel_dp->aux, DP_SOURCE_OUI, oui, sizeof(oui)) < 0) drm_err(&i915->drm, "Failed to write source OUI\n"); intel_dp->last_oui_write = jiffies; + intel_dp->oui_valid = true; +} + +void intel_dp_invalidate_source_oui(struct intel_dp *intel_dp) +{ + intel_dp->oui_valid = false; } void intel_dp_wait_source_oui(struct intel_dp *intel_dp) @@ -3390,6 +3402,8 @@ void intel_dp_set_power(struct intel_dp *intel_dp, u8 mode) if (downstream_hpd_needs_d0(intel_dp)) return; + intel_dp_invalidate_source_oui(intel_dp); + ret = drm_dp_dpcd_writeb(&intel_dp->aux, DP_SET_POWER, mode); } else { struct intel_lspcon *lspcon = dp_to_lspcon(intel_dp); @@ -3397,8 +3411,7 @@ void intel_dp_set_power(struct intel_dp *intel_dp, u8 mode) lspcon_resume(dp_to_dig_port(intel_dp)); /* Write the source OUI as early as possible */ - if (intel_dp_is_edp(intel_dp)) - intel_edp_init_source_oui(intel_dp, false); + intel_dp_init_source_oui(intel_dp); /* * When turning on, we need to retry for 1ms to give the sink @@ -4115,7 +4128,7 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp, struct intel_connector *connector * If needed, program our source OUI so we can make various Intel-specific AUX services * available (such as HDR backlight controls) */ - intel_edp_init_source_oui(intel_dp, true); + intel_dp_init_source_oui(intel_dp); return true; } diff --git a/drivers/gpu/drm/i915/display/intel_dp.h b/drivers/gpu/drm/i915/display/intel_dp.h index 3b869429e5756..0449d1d3f175d 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.h +++ b/drivers/gpu/drm/i915/display/intel_dp.h @@ -189,6 +189,7 @@ void intel_dp_check_frl_training(struct intel_dp *intel_dp); void intel_dp_pcon_dsc_configure(struct intel_dp *intel_dp, const struct intel_crtc_state *crtc_state); +void intel_dp_invalidate_source_oui(struct intel_dp *intel_dp); void intel_dp_wait_source_oui(struct intel_dp *intel_dp); int intel_dp_output_bpp(enum intel_output_format output_format, int bpp); From patchwork Tue Oct 1 12:32:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imre Deak X-Patchwork-Id: 13817919 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 83E38CE7D1B for ; Tue, 1 Oct 2024 12:32:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D649E10E318; Tue, 1 Oct 2024 12:32:36 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="AtHI/DWg"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id E25CB10E317 for ; Tue, 1 Oct 2024 12:32:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727785955; x=1759321955; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=I5Kp8Nn93LBKYCSrwqeMH+VH9NfUm7YnjApmEHYBEjs=; b=AtHI/DWg3wwuFf+zj5QDmVPu2e4uNIuzdG/C2WRgrRJXT/KQJEX55eRL FutuSo4Hq5TFoSFIJ4S5HfLJvdKuAxhXV0yzrfC7xqv9SdcTG2ZMelmSW HfviWJ5p/CQf6TivDLSvPFecgPng+uyNELKQa1bAaeuOnxjf8gy48HsqC aNVTvwqUqFwVLADLckp7NfczCzxMzGoH4mds2kVQ/pJmawuEm4S0yRZP5 Ruw585+huw8BzGlXzLpJePscuIzE/3cKqPR/Jjk5H0DQxmJstfsTFS/LX XqyfOWrT8LOsdaUe4VmSP6q1xWTEHEn5vK0edbWyT/FW0ePo30dQ7mxOP g==; X-CSE-ConnectionGUID: kP48Gm23RE6hrYoo7cdtPg== X-CSE-MsgGUID: 86qaGDOWQ2KJ3ZhTweTrUg== X-IronPort-AV: E=McAfee;i="6700,10204,11212"; a="30624385" X-IronPort-AV: E=Sophos;i="6.11,167,1725346800"; d="scan'208";a="30624385" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2024 05:32:35 -0700 X-CSE-ConnectionGUID: r/efW5sLTfemQ81TQRm5qQ== X-CSE-MsgGUID: 7k8Z0K1ORxi2Hq5qX3P/Jw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,167,1725346800"; d="scan'208";a="74448048" Received: from ideak-desk.fi.intel.com ([10.237.72.78]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2024 05:32:35 -0700 From: Imre Deak To: intel-gfx@lists.freedesktop.org Subject: [PATCH v2 3/3] drm/i915/dp: Write the source OUI for non-eDP sinks as well Date: Tue, 1 Oct 2024 15:32:59 +0300 Message-ID: <20241001123259.616486-3-imre.deak@intel.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20241001123259.616486-1-imre.deak@intel.com> References: <20241001123259.616486-1-imre.deak@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" At least the i-tec USB-C Nano 2x Display Docking Station (containing a Synaptics MST branch device) requires the driver to update the source OUI DPCD registers to expose its DSC capability. Accordingly update the OUI for all sink types (besides eDP where this has been done already). Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11776 Signed-off-by: Imre Deak --- drivers/gpu/drm/i915/display/intel_dp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 2d6ffbeae07a0..3cc4ef8744f88 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -3341,9 +3341,6 @@ intel_dp_init_source_oui(struct intel_dp *intel_dp) u8 oui[] = { 0x00, 0xaa, 0x01 }; u8 buf[3] = {}; - if (!intel_dp_is_edp(intel_dp)) - return; - /* * During driver init, we want to be careful and avoid changing the source OUI if it's * already set to what we want, so as to avoid clearing any state by accident @@ -4159,6 +4156,8 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp) if (intel_dp_init_lttpr_and_dprx_caps(intel_dp) < 0) return false; + intel_dp_init_source_oui(intel_dp); + /* * Don't clobber cached eDP rates. Also skip re-reading * the OUI/ID since we know it won't change. @@ -6035,6 +6034,8 @@ intel_dp_hpd_pulse(struct intel_digital_port *dig_port, bool long_hpd) if (long_hpd) { intel_dp->reset_link_params = true; + intel_dp_invalidate_source_oui(intel_dp); + return IRQ_NONE; }