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 B1B23EE57D1 for ; Wed, 31 Dec 2025 05:23:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4904110E97A; Wed, 31 Dec 2025 05:23:27 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="PFPkaz7G"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3C95910E978; Wed, 31 Dec 2025 05:23:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1767158606; x=1798694606; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GOG7UmNOSpXufRAtUBk94vQJoCYW0YqHISUimB0WgNM=; b=PFPkaz7Gum5QU7cXF1hOHcDPjUi8fNKsnmXIpm5NWzifNZYaTOzjxGYF Ad8e2+RwNGpOYA7cOowV0r7I0Msu5TcHkd9vWsH0Kn0Uw03LQ5pnbcEmf K3vt1T4jbLMrNAW/LCf3CeYUYr0s2eY0XDCyF9cW23HxSXfcuKSPHCdPX DBrzEstzC3x7FMw7tXyCBDNWS9h8xCUROWtKN5jY8Vo+pPJCBepRuNjKl dDtVAEeXzABg08PX7cyZvOlJx6sJAfH3GyJNV89B2TBccN7lPlCwD37ad 8LvMixcBSMuWNwAkCgjj+0+EnNGWFLjJ/Kek7cjBA0f6kr6khghBuwdL4 Q==; X-CSE-ConnectionGUID: jZNm7uKxTCeakP0C9A7xtg== X-CSE-MsgGUID: chW4KUPnS0uxL8Iknjg1aA== X-IronPort-AV: E=McAfee;i="6800,10657,11657"; a="68486247" X-IronPort-AV: E=Sophos;i="6.21,191,1763452800"; d="scan'208";a="68486247" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Dec 2025 21:23:25 -0800 X-CSE-ConnectionGUID: xmqJr0vJTgazqx9eiT+1vw== X-CSE-MsgGUID: BbV365+vREihRIWRK6q5Mw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,191,1763452800"; d="scan'208";a="232450989" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.10]) by fmviesa001.fm.intel.com with ESMTP; 30 Dec 2025 21:23:23 -0800 From: Suraj Kandpal To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: ankit.k.nautiyal@intel.com, Suraj Kandpal Subject: [PATCH 3/3] drm/i915/ltphy: Provide protection against unsupported modes Date: Wed, 31 Dec 2025 10:53:15 +0530 Message-Id: <20251231052315.77828-3-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251231052315.77828-1-suraj.kandpal@intel.com> References: <20251231052315.77828-1-suraj.kandpal@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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" We need to make sure we return some port clock in case we have unsupported LT PHY modes or if we were not able to read the LT PHY state for whatever reason and the mode ends up being 0. Signed-off-by: Suraj Kandpal --- drivers/gpu/drm/i915/display/intel_lt_phy.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_lt_phy.c b/drivers/gpu/drm/i915/display/intel_lt_phy.c index cc85818c2b7e..54d1c68cf83a 100644 --- a/drivers/gpu/drm/i915/display/intel_lt_phy.c +++ b/drivers/gpu/drm/i915/display/intel_lt_phy.c @@ -31,6 +31,7 @@ #define INTEL_LT_PHY_BOTH_LANES (INTEL_LT_PHY_LANE1 |\ INTEL_LT_PHY_LANE0) #define MODE_DP 3 +#define MODE_HDMI_20 4 #define Q32_TO_INT(x) ((x) >> 32) #define Q32_TO_FRAC(x) ((x) & 0xFFFFFFFF) #define DCO_MIN_FREQ_MHZ 11850 @@ -1751,6 +1752,7 @@ int intel_lt_phy_calc_port_clock(struct intel_encoder *encoder, const struct intel_crtc_state *crtc_state) { + struct intel_display *display = to_intel_display(encoder); int clk; const struct intel_lt_phy_pll_state *lt_state = &crtc_state->dpll_hw_state.ltpll; @@ -1768,8 +1770,11 @@ intel_lt_phy_calc_port_clock(struct intel_encoder *encoder, rate = REG_FIELD_GET8(LT_PHY_VDR_RATE_ENCODING_MASK, lt_state->config[0]); clk = intel_lt_phy_get_dp_clock(rate); - } else { + } else if (mode == MODE_HDMI_20) { clk = intel_lt_phy_calc_hdmi_port_clock(crtc_state); + } else { + drm_WARN_ON(display->drm, "Unsupported LT PHY Mode!\n"); + clk = xe3plpd_lt_hdmi_252.clock; } return clk; -- 2.34.1