From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C743D2E92B7 for ; Thu, 27 Nov 2025 21:41:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764279666; cv=none; b=nD57hFfgKwiYJOZxDZTaA1K++Ci/OCK1lGDwM1dEgdGE94nehgWcRAnFvUO1zDqMBM81ubS+GVCxpLUCe5jDT0FpsJPLXc6EC6BZtUvLQAYGPPPqGcSHV15Q0/hZZB69lNEqCCZrKyr1TShQE+F7gzR8KJKdJWr0xEaA7FS98LM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764279666; c=relaxed/simple; bh=WnN83mCaafJox+zBKDVGUYk7Inwux9T4I2nQLsrJr5U=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Lx65DHjy+vfJuDVc+czobmeOuKwsYkz92cNVp3MooUTPMDsWuJ19v8uHw4ps3KNdSh7P5g8OOIUluL8C8Sv1OTVJzRArFqpGkgd5+foB5ZTfZACwMCrxBA+rfKwTrDlTYVTgTX8QB4JcTrJH8IAKkS653mvDlZz6SbKmBS4G3aE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=nOM+HE8C; arc=none smtp.client-ip=198.175.65.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="nOM+HE8C" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1764279662; x=1795815662; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=WnN83mCaafJox+zBKDVGUYk7Inwux9T4I2nQLsrJr5U=; b=nOM+HE8Ct9jlg9FMlMJ0LLMKVSjeWL8LGeiO9iVhvdrFyx4bvNp4Tdae eMbNUTEUL6Glr/pyqbiAmeQeMEdSpwdiJ1tFxn5bXpbWlpZ7fiKi9vchi MVriKeZ8x6Ggs35cNKGwtwVwTF6Yap2ZOAj6TGQfyy0QxOlJWg5/6aQkv J3b4d4gkNq2EPKiNb6ZKm3siIqPe8xkWPJGpq2KYLohl5fgF+3SBb54By 3zffDINX24Geg2kGcUGbr97/tTNr8UqlQt+uTZdc/xuDKM//NeuPq3skz 6njHbi3/9yU+eOPfR+nsT8cn2eE2fQzR87ytTlt0hncBS3qBggbE53Lc3 Q==; X-CSE-ConnectionGUID: DVrtg0ZfRPqFY1Pcj3fdkg== X-CSE-MsgGUID: bSgB41YzR8+BJGu/XAJC3A== X-IronPort-AV: E=McAfee;i="6800,10657,11626"; a="66285051" X-IronPort-AV: E=Sophos;i="6.20,232,1758610800"; d="scan'208";a="66285051" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2025 13:41:00 -0800 X-CSE-ConnectionGUID: Uv65/nuDSWisXOcygyCIKw== X-CSE-MsgGUID: Ok4RRYFYTAecC+KLOTwRaw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.20,232,1758610800"; d="scan'208";a="192439915" Received: from mjarzebo-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.244.140]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2025 13:40:57 -0800 Date: Thu, 27 Nov 2025 23:40:54 +0200 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: "Chia-Lin Kao (AceLan)" Cc: Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , David Airlie , Simona Vetter , intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/i915/dp: Add byte-by-byte fallback for broken USB-C adapters Message-ID: References: <20251127044406.618543-1-acelan.kao@canonical.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20251127044406.618543-1-acelan.kao@canonical.com> X-Patchwork-Hint: comment Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Thu, Nov 27, 2025 at 12:44:06PM +0800, Chia-Lin Kao (AceLan) wrote: > Some USB-C hubs and adapters have buggy firmware where multi-byte AUX > reads from DPCD address 0x00000 consistently timeout, while single-byte > reads from the same address work correctly. > > Known affected devices that exhibit this issue: > - Lenovo USB-C to VGA adapter (VIA VL817 chipset) > idVendor=17ef, idProduct=7217 > - Dell DA310 USB-C mobile adapter hub > idVendor=413c, idProduct=c010 > > Analysis of the failure pattern shows: > - Single-byte probes to 0xf0000 (LTTPR) succeed > - Single-byte probes to 0x00102 (TRAINING_AUX_RD_INTERVAL) succeed > - 15-byte reads from 0x00000 (DPCD capabilities) timeout with -ETIMEDOUT > - Retrying does not help - the failure is consistent across all attempts I thought we changed that to the more sensible 16 bytes. Anyone know what happened to that patch? Anyways, does 16 bytes work better than 15 bytes? > > The issue appears to be a firmware bug in the AUX transaction handling > that specifically affects multi-byte reads from the base DPCD address. > > Add a fallback mechanism that attempts byte-by-byte reading when the > normal multi-byte drm_dp_read_dpcd_caps() fails. This workaround only > activates for adapters that fail the standard read path, ensuring no > impact on correctly functioning hardware. > > The byte-by-byte read uses drm_dp_dpcd_readb() to read each of the 15 > DPCD capability bytes individually, working around the firmware bug > while maintaining compatibility with all other adapters. > > Tested with: > - Lenovo USB-C to VGA adapter (VIA VL817) - now works with fallback > - Dell DA310 USB-C hub - now works with fallback > - Dell/Analogix Slimport adapter - continues to work with normal path > > Signed-off-by: Chia-Lin Kao (AceLan) > --- > .../drm/i915/display/intel_dp_link_training.c | 21 ++++++++++++++++++- > 1 file changed, 20 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c > index aad5fe14962f..738a5bb4adb3 100644 > --- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c > +++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c > @@ -213,6 +213,7 @@ static int intel_dp_init_lttpr(struct intel_dp *intel_dp, const u8 dpcd[DP_RECEI > int intel_dp_read_dprx_caps(struct intel_dp *intel_dp, u8 dpcd[DP_RECEIVER_CAP_SIZE]) > { > struct intel_display *display = to_intel_display(intel_dp); > + int ret, i; > > if (intel_dp_is_edp(intel_dp)) > return 0; > @@ -226,7 +227,25 @@ int intel_dp_read_dprx_caps(struct intel_dp *intel_dp, u8 dpcd[DP_RECEIVER_CAP_S > DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV)) > return -EIO; > > - if (drm_dp_read_dpcd_caps(&intel_dp->aux, dpcd)) > + ret = drm_dp_read_dpcd_caps(&intel_dp->aux, dpcd); > + if (ret == 0) > + return 0; > + > + /* > + * Workaround for USB-C hubs/adapters with buggy firmware that fail > + * multi-byte AUX reads from DPCD address 0x00000 but work with > + * single-byte reads. Known affected devices: > + * - Lenovo USB-C to VGA adapter (VIA VL817, idVendor=17ef, idProduct=7217) > + * - Dell DA310 USB-C hub (idVendor=413c, idProduct=c010) > + * Read the DPCD capabilities byte-by-byte as a fallback. > + */ > + for (i = 0; i < DP_RECEIVER_CAP_SIZE; i++) { > + ret = drm_dp_dpcd_readb(&intel_dp->aux, DP_DPCD_REV + i, &dpcd[i]); > + if (ret < 0) > + return -EIO; > + } Doing this in i915 specific code doesn't make sense. > + > + if (dpcd[DP_DPCD_REV] == 0) > return -EIO; > > return 0; > -- > 2.43.0 -- Ville Syrjälä Intel