From mboxrd@z Thu Jan 1 00:00:00 1970 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 1A614C44508 for ; Tue, 14 Jul 2026 15:27:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BDAF410EAFF; Tue, 14 Jul 2026 15:27:38 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Z2JN+Zqh"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id D31FE10E96C; Tue, 14 Jul 2026 15:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1784042857; x=1815578857; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=5ewM3UnpTGZZt89Wg8h0chw9gKRrbXKZnudfcOsTaNs=; b=Z2JN+ZqhwM/nfUyRLMdIi3TTRY4WM/r7QmSrx5mOQcPwqUEBYNYsh9zO GA96BrnTNmSXbr1zSxd0akDhon/K/CcQj2tpBNWiOCfDVjtsq2JkASLZO g/yLG6nYqlO5n9te9UINoD7d2k1ZOnI4Mi7AXJudKzy4mXqjpABP4v2qr AjFr61IdLL/aj9p2QcfOYP6FkzaxNpj3PnULGUf87d5bKvuvJ3VV5S+Aq 1xJ3wrfU2DkA1uMGsGp8SauvxPCjwLx04HSAI8j28ZviBfEZdGTVs3tGX 9svP6yJH40GQrcFvTmuxIyxhauZ+QCJQ4iP3pkkgBWAxRWd7MB/vQbZxi w==; X-CSE-ConnectionGUID: 8SXQHmBLToGRKgcHmFYrtg== X-CSE-MsgGUID: 9a3rRWW2Rr+c46nqSfwIAQ== X-IronPort-AV: E=McAfee;i="6800,10657,11846"; a="84547996" X-IronPort-AV: E=Sophos;i="6.25,164,1779174000"; d="scan'208";a="84547996" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2026 08:27:37 -0700 X-CSE-ConnectionGUID: jEWtmYxVRiOwzHoqmNrhEA== X-CSE-MsgGUID: uZHkWe4rQOWSjay/VIJa2g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,164,1779174000"; d="scan'208";a="285962040" Received: from orsmsx902.amr.corp.intel.com ([10.22.229.24]) by orviesa002.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2026 08:27:38 -0700 Received: from ORSMSX901.amr.corp.intel.com (10.22.229.23) by ORSMSX902.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.43; Tue, 14 Jul 2026 08:27:36 -0700 Received: from ORSEDG903.ED.cps.intel.com (10.7.248.13) by ORSMSX901.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.43 via Frontend Transport; Tue, 14 Jul 2026 08:27:36 -0700 Received: from SJ2PR03CU001.outbound.protection.outlook.com (52.101.43.59) by edgegateway.intel.com (134.134.137.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.43; Tue, 14 Jul 2026 08:27:35 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Cl5nl+pBW4WzeoMp/n1bri/XhK0snB26oqlq+oddsMTYmGtff/aU4LeRsJNPJCVdeS4nxyWE2FtAFBfsQ+nxJhqIJEpq5zdRraPM5aZh10NDKDDBgHuB03QsJm5mYKAl1+rY+PQUvSZlAd/Fdk81+exaXSB/fE4tEsvE8JFcAWKW2XeDHSPKqnyOCuVf/7huyyIXDhXZgyyho2UKgul94vE5IkWEeEJSfwepNY4a3fjL5V68Uf6hNMGnOOYWrBeWWJBA1CBjaDcnXTASLvKV9ZF7ckPj3Fi8iGM7zOeHk93fi/UZyspq2N3rNhRM83bPaG93/M047rgrw2PfDlSlAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6VrchEL88z19x3yK8HA/3JkveHtg2vfldjCFUSYsVN0=; b=S1AROSP1umoRcfXdxEHoaZaDWa7Zq/YivWA9rEU1gkwzToornSyMlCuCpzzx44ktlnRCJ2o5KlU0iMMOyN5Bzr4k+t27YAsZrurxtQHooEGGcv/zL/Ih4KBj74B+3jxBYaYpuFQ9X52fszjMKzGKSOVV6nBi/kARHxjf2jBzw0/QNwEoSDEt1GlzpyShQmaPTagMciP7XdIioL35fRblUL2vPxbCVMmACGsaqcV7lGzq4ZA/mDNDU/2ktV8vgj6LOPCBLsqQK8ipIINbuiSZqpOW6CHA3bMZPAF9oFKEegpL6EyqSCRNTOFfA32WUCE+2BeAzVFRtz80EAnmI4qYVQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from IA3PR11MB9273.namprd11.prod.outlook.com (2603:10b6:208:573::17) by IA0PR11MB7354.namprd11.prod.outlook.com (2603:10b6:208:434::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.202.18; Tue, 14 Jul 2026 15:27:31 +0000 Received: from IA3PR11MB9273.namprd11.prod.outlook.com ([fe80::31a4:58c:e3b5:43fa]) by IA3PR11MB9273.namprd11.prod.outlook.com ([fe80::31a4:58c:e3b5:43fa%4]) with mapi id 15.21.0202.014; Tue, 14 Jul 2026 15:27:31 +0000 From: Imre Deak To: , CC: Subject: [PATCH 1/6] drm/dp_tunnel: Add UHBR tunneling support Date: Tue, 14 Jul 2026 18:26:55 +0300 Message-ID: <20260714152700.555527-2-imre.deak@intel.com> X-Mailer: git-send-email 2.49.1 In-Reply-To: <20260714152700.555527-1-imre.deak@intel.com> References: <20260714152700.555527-1-imre.deak@intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs Bertel Jungin Aukio 5, 02600 Espoo, Finland Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: GVX0EPF00073CE8.SWEP280.PROD.OUTLOOK.COM (2603:10a6:158:400::1d1) To IA3PR11MB9273.namprd11.prod.outlook.com (2603:10b6:208:573::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA3PR11MB9273:EE_|IA0PR11MB7354:EE_ X-MS-Office365-Filtering-Correlation-Id: 987a0726-d37c-41d5-bc7e-08dee1bc6a02 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|23010399003|366016|1800799024|376014|6133799003|11063799006|56012099006|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: a2vTGDDPEtsUrYKLYfvohQef218VWrIONKqA12Titcsfw3u0wz4H7Mbhj8IetIy2V0NV0TPc4E2p+NaYGaEtzUPF3atRnr3CZjAQ3HASleToS7bFmqoTxTdET01kfZsmVjyd4DYb9lCLCMIIMFb7e4OMFAh2ML6F/hx15HlxDRLutAhx08YzxU1bIfv3aXF+5YKsmiW5WfrQdO6vo9RoCWbhPqWL2SyDI76PA5yMMkaucTlbW6MC4gmMflziD0OW1FekKem4GqCWPLqrxnc8l3Zo/v4bjgOqxc4lPpM8G7+qeLpUNJnaPnsWMDdrgFnvEocC4l7WiqyS4djzCNP8t18mlfefipOvic07ZJJ2g40UBXGZNt6yjRqf1bYsHGIYjO9x094FC8O7rYdeZMVTbF4zzwLgy0jSpsH+fDZx+0zUwt682nQtxRmw6IXnCfCZeTQloUHxXzBxHrjKZelGKVMNbxU54nrKC7bkik5JgTyLsv0m5+67L9lz9IGwZek++IzCopUaa8HXq/kKPfv4OC5WIGWhARnzwdoquCrLwosZEgE8Da7+fngYF8viTaL/7wAIuPjg7V4aoXvmLTSl27hWAcFqvkUOyxO1DXcOtNbvWmlKsPC8Ry5S8aNL6uFiUEp1ZYeh7rs2NCB+mPv+BOL/J/gR+FIZCk5FeABR1ec= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:IA3PR11MB9273.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(23010399003)(366016)(1800799024)(376014)(6133799003)(11063799006)(56012099006)(18002099003)(22082099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Zs/glShu1eKCAHhQTXOzeH+QlyW4DnUlKpKSyxABN5oMzoXtlIH35sbLTG2x?= =?us-ascii?Q?5O0ZJiwtk8UAsPSjw30zH1ORo+rN+vokBZCxsj7bDptDG2cgud8HEhncfOT9?= =?us-ascii?Q?7pZqdugwhbVFAdJaS+7UCkmzywc1R+oIQPFI/wBTOH98rmRb9kFFrvqtQoET?= =?us-ascii?Q?NM0MMY6mJcIpjJtxtOYZ+b/yA7bFxny0uhopJO/LNC2joFqAJ3gxvFpuHUmQ?= =?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XMZkDZLCpG9f6m8DGNvSALp/e+B2aBXcRxLfFT1QeG4zEABzHRfGQLGLKNghdOP0niNQ8Q== X-MS-Exchange-CrossTenant-Network-Message-Id: 987a0726-d37c-41d5-bc7e-08dee1bc6a02 X-MS-Exchange-CrossTenant-AuthSource: IA3PR11MB9273.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jul 2026 15:27:31.5731 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mF59scI1KbKGOcvEHTjH0mKeHFCzsULBLpmEDOamKUZtt0ct61HIsY6wCX4gGBeN+xmlFAbAhcjuIM59QTRM5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR11MB7354 X-OriginatorOrg: intel.com X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" Add the DPCD registers and detection required to support UHBR link rates over Thunderbolt tunnels. Cc: dri-devel@lists.freedesktop.org Signed-off-by: Imre Deak --- drivers/gpu/drm/display/drm_dp_tunnel.c | 116 +++++++++++++++++++++++- include/drm/display/drm_dp.h | 12 +++ include/drm/display/drm_dp_tunnel.h | 21 +++++ 3 files changed, 148 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/display/drm_dp_tunnel.c b/drivers/gpu/drm/display/drm_dp_tunnel.c index 76c6bc84a806f..d29ad4116e641 100644 --- a/drivers/gpu/drm/display/drm_dp_tunnel.c +++ b/drivers/gpu/drm/display/drm_dp_tunnel.c @@ -111,6 +111,8 @@ DPTUN_REG(DP_ALLOCATED_BW) | \ DPTUN_REG(DP_TUNNELING_MAX_LINK_RATE) | \ DPTUN_REG(DP_TUNNELING_MAX_LANE_COUNT) | \ + DPTUN_REG(DP_TUNNELING_MAIN_LINK_CHANNEL_CODING) | \ + DPTUN_REG(DP_TUNNELING_128B132B_LINK_RATE) | \ DPTUN_REG(DP_DPTX_BW_ALLOCATION_MODE_CONTROL)) static const DECLARE_BITMAP(dptun_info_regs, 64) = { @@ -140,11 +142,14 @@ struct drm_dp_tunnel { int estimated_bw; int allocated_bw; + u8 dprx_128b132b_rates; int max_dprx_rate; u8 max_dprx_lane_count; u8 adapter_id; + bool dprx_128b132b_support:1; + bool dprx_128b132b_lane0_mapping_support:1; bool bw_alloc_supported:1; bool bw_alloc_enabled:1; bool has_io_error:1; @@ -260,9 +265,46 @@ static int tunnel_reg_bw_granularity(const struct drm_dp_tunnel_regs *regs) return (250000 << gr) / 8; } +static bool tunnel_reg_dprx_128b132b_support(const struct drm_dp_tunnel_regs *regs) +{ + return tunnel_reg(regs, DP_TUNNELING_MAIN_LINK_CHANNEL_CODING) & DP_128B132B_DP_SUPPORTED; +} + +static bool tunnel_reg_dprx_128b132b_lane0_mapping_support(const struct drm_dp_tunnel_regs *regs) +{ + return tunnel_reg(regs, DP_TUNNELING_128B132B_LINK_RATE) & + DP_TUNNELING_128B132B_LL_LANE0_MAPPING_SUPPORT; +} + +static u8 tunnel_reg_dprx_128b132b_rates(const struct drm_dp_tunnel_regs *regs) +{ + if (!tunnel_reg_dprx_128b132b_support(regs)) + return 0; + + return tunnel_reg(regs, DP_TUNNELING_128B132B_LINK_RATE) & + DP_TUNNELING_128B132B_LINK_RATE_MASK; +} + +static u8 max_128b132b_rate(u8 rates) +{ + if (rates & DP_TUNNELING_20GBPS_PER_LANE_SUPPORT) + return DP_TUNNELING_20GBPS_PER_LANE_SUPPORT; + else if (rates & DP_TUNNELING_13_5GBPS_PER_LANE_SUPPORT) + return DP_TUNNELING_13_5GBPS_PER_LANE_SUPPORT; + else if (rates & DP_TUNNELING_10GBPS_PER_LANE_SUPPORT) + return DP_TUNNELING_10GBPS_PER_LANE_SUPPORT; + + WARN_ON(rates); + + return 0; +} + static int tunnel_reg_max_dprx_rate(const struct drm_dp_tunnel_regs *regs) { - u8 bw_code = tunnel_reg(regs, DP_TUNNELING_MAX_LINK_RATE); + u8 bw_code = max_128b132b_rate(tunnel_reg_dprx_128b132b_rates(regs)); + + if (!bw_code) + bw_code = tunnel_reg(regs, DP_TUNNELING_MAX_LINK_RATE); return drm_dp_bw_code_to_link_rate(bw_code); } @@ -706,6 +748,23 @@ static bool update_dprx_caps(struct drm_dp_tunnel *tunnel, const struct drm_dp_t { bool changed = false; + if (tunnel_reg_dprx_128b132b_support(regs) != tunnel->dprx_128b132b_support) { + tunnel->dprx_128b132b_support = tunnel_reg_dprx_128b132b_support(regs); + changed = true; + } + + if (tunnel_reg_dprx_128b132b_lane0_mapping_support(regs) != + tunnel->dprx_128b132b_lane0_mapping_support) { + tunnel->dprx_128b132b_lane0_mapping_support = + tunnel_reg_dprx_128b132b_lane0_mapping_support(regs); + changed = true; + } + + if (tunnel_reg_dprx_128b132b_rates(regs) != tunnel->dprx_128b132b_rates) { + tunnel->dprx_128b132b_rates = tunnel_reg_dprx_128b132b_rates(regs); + changed = true; + } + if (tunnel_reg_max_dprx_rate(regs) != tunnel->max_dprx_rate) { tunnel->max_dprx_rate = tunnel_reg_max_dprx_rate(regs); changed = true; @@ -1331,6 +1390,61 @@ int drm_dp_tunnel_handle_irq(struct drm_dp_tunnel_mgr *mgr, struct drm_dp_aux *a } EXPORT_SYMBOL(drm_dp_tunnel_handle_irq); +/** + * drm_dp_tunnel_128b132b_supported - Query if 128b132b is supported by the tunnel's DPRX + * @tunnel: Tunnel object + * + * The function is used to query if 128b132b is supported by the DPRX connected + * to @tunnel. + * + * Returns %true if 128b132b is supported by the DPRX. + */ +bool drm_dp_tunnel_128b132b_supported(const struct drm_dp_tunnel *tunnel) +{ + return tunnel->dprx_128b132b_support; +} +EXPORT_SYMBOL(drm_dp_tunnel_128b132b_supported); + +/** + * drm_dp_tunnel_128b132b_lane0_mapping_supported - Check 128b/132b lane 0 mapping support + * @tunnel: Tunnel object + * + * Check whether the DP-out adapter always maps lane 0 as expected by the + * DPRX on a tunneled 128b/132b link. If the function returns %true, one- and + * two-lane configurations with UHBR link rates can always be used. If it + * returns %false, using one or two lanes with UHBR link rates may cause a + * lane-count conversion failure in the DPRX, requiring corrective action by + * the source during link training. See DP Standard v2.1b, section + * 3.5.2.16.3, 128b/132b DPRX Lane Count Conversion Failure Indication and + * Corrective Action. + * + * A four-lane configuration can always be used, provided that the DPRX + * supports it, regardless of the function's return value. + * + * Returns %true if the DP-out adapter supports the 128b/132b lane 0 mapping. + */ +bool drm_dp_tunnel_128b132b_lane0_mapping_supported(const struct drm_dp_tunnel *tunnel) +{ + return tunnel->dprx_128b132b_lane0_mapping_support; +} +EXPORT_SYMBOL(drm_dp_tunnel_128b132b_lane0_mapping_supported); + +/** + * drm_dp_tunnel_128b132b_dprx_rates - Query the supported 128b132b rates of the tunnel's DPRX + * @tunnel: Tunnel object + * + * The function is used to query the supported 128b132b rates of the DPRX connected + * to @tunnel. Note that the related DP_128B132B_SUPPROTED_LINK_RATES DPCD + * register will indicate no supported 128B132B rates for a tunneled DPRX. + * + * Returns the mask of supported 128b132b rates. + */ +u8 drm_dp_tunnel_128b132b_dprx_rates(const struct drm_dp_tunnel *tunnel) +{ + return tunnel->dprx_128b132b_rates; +} +EXPORT_SYMBOL(drm_dp_tunnel_128b132b_dprx_rates); + /** * drm_dp_tunnel_max_dprx_rate - Query the maximum rate of the tunnel's DPRX * @tunnel: Tunnel object diff --git a/include/drm/display/drm_dp.h b/include/drm/display/drm_dp.h index 7154216e0aff9..8b0ca36083dd1 100644 --- a/include/drm/display/drm_dp.h +++ b/include/drm/display/drm_dp.h @@ -1506,6 +1506,18 @@ #define DP_TUNNELING_MAX_LANE_COUNT 0xe0029 #define DP_TUNNELING_MAX_LANE_COUNT_MASK 0x1f +#define DP_TUNNELING_MAIN_LINK_CHANNEL_CODING 0xe002b +#define DP_128B132B_DP_SUPPORTED (1 << 0) + +#define DP_TUNNELING_128B132B_LINK_RATE 0xe002c +#define DP_TUNNELING_13_5GBPS_PER_LANE_SUPPORT (1 << 2) +#define DP_TUNNELING_20GBPS_PER_LANE_SUPPORT (1 << 1) +#define DP_TUNNELING_10GBPS_PER_LANE_SUPPORT (1 << 0) +#define DP_TUNNELING_128B132B_LINK_RATE_MASK (DP_TUNNELING_10GBPS_PER_LANE_SUPPORT | \ + DP_TUNNELING_13_5GBPS_PER_LANE_SUPPORT | \ + DP_TUNNELING_20GBPS_PER_LANE_SUPPORT) +#define DP_TUNNELING_128B132B_LL_LANE0_MAPPING_SUPPORT (1 << 7) + #define DP_DPTX_BW_ALLOCATION_MODE_CONTROL 0xe0030 #define DP_DISPLAY_DRIVER_BW_ALLOCATION_MODE_ENABLE (1 << 7) #define DP_UNMASK_BW_ALLOCATION_IRQ (1 << 6) diff --git a/include/drm/display/drm_dp_tunnel.h b/include/drm/display/drm_dp_tunnel.h index 57f5e90ba8fda..b5e665560a47e 100644 --- a/include/drm/display/drm_dp_tunnel.h +++ b/include/drm/display/drm_dp_tunnel.h @@ -63,6 +63,9 @@ void drm_dp_tunnel_set_io_error(struct drm_dp_tunnel *tunnel); int drm_dp_tunnel_handle_irq(struct drm_dp_tunnel_mgr *mgr, struct drm_dp_aux *aux); +bool drm_dp_tunnel_128b132b_supported(const struct drm_dp_tunnel *tunnel); +bool drm_dp_tunnel_128b132b_lane0_mapping_supported(const struct drm_dp_tunnel *tunnel); +u8 drm_dp_tunnel_128b132b_dprx_rates(const struct drm_dp_tunnel *tunnel); int drm_dp_tunnel_max_dprx_rate(const struct drm_dp_tunnel *tunnel); int drm_dp_tunnel_max_dprx_lane_count(const struct drm_dp_tunnel *tunnel); int drm_dp_tunnel_available_bw(const struct drm_dp_tunnel *tunnel); @@ -173,6 +176,24 @@ drm_dp_tunnel_handle_irq(struct drm_dp_tunnel_mgr *mgr, return -EOPNOTSUPP; } +static inline bool +drm_dp_tunnel_128b132b_supported(const struct drm_dp_tunnel *tunnel) +{ + return false; +} + +static inline bool +drm_dp_tunnel_128b132b_lane0_mapping_supported(const struct drm_dp_tunnel *tunnel) +{ + return false; +} + +static inline u8 +drm_dp_tunnel_128b132b_dprx_rates(const struct drm_dp_tunnel *tunnel) +{ + return 0; +} + static inline int drm_dp_tunnel_max_dprx_rate(const struct drm_dp_tunnel *tunnel) { -- 2.49.1