From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E3D83F888B for ; Fri, 26 Jun 2026 14:27:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782484033; cv=none; b=RdU3O9qHlanX4kTYuoUk4P3c30gPLqS5PmCwEtPp9mDk7fFOxU9QTitwIjFVND1/IdmIDqiUyZ7cMnyXjJxcaGvhjLH9/mqddqM+RQd/yxqcAw2giOOxB+aTz+JEz6CLFjtGJjdb2LX+Kj1nTsQC6vML3ctpdeW8KmxPmYPllVw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782484033; c=relaxed/simple; bh=e7W7XK+si28LPdcTi/yKM+HfuhRf04velbB6bmBCDEE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=BPUAC59dR7Tv70VoJgxDUc9X6EgLWoF0kz6lBpbXTJxpqHBrfZwPZLv4fW6aKgp48IbkoMf6nuZHLaVuC/5xp9v/+mnwwpRQCYV/5EOwQTcj8MhdzVUC5ejqDhsXzW9Ru/ULb53se4txg2BqC2T98MtzrU+hSAOIK2llCCCskIE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=ipJAteeK; arc=none smtp.client-ip=209.85.208.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ipJAteeK" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-697b8540279so1652975a12.0 for ; Fri, 26 Jun 2026 07:27:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1782484026; x=1783088826; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=IMJRii6zV79IzIpWO4mvAa5Wtzk+HYUJ+L7a7vjxsXc=; b=ipJAteeKDx7dc2q6lX+tVOmDpeGQX/Ve0W3zxTUVulhzpIT5/an/gLEaZHSyol+YQm JiNt1Fxul4uX1cnnPD1Nt5AA8J5GWrBjfU1iR1ImulJRSTrefvaaJpUA5hXePQVr5az/ XVxt+R9Y+cdR8PaY6WlM5hPZr39j06FpKWlHk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782484026; x=1783088826; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=IMJRii6zV79IzIpWO4mvAa5Wtzk+HYUJ+L7a7vjxsXc=; b=HDfGKxXiNBTwR5Kgiyy7Vf1L4bvLVoEgSwgjY0ZujkPcg4PuHYfhcyzcUPpxnp+YiI h33ORWR+rwRX0CmF0/xuec0iOmiLqCjIySQz4Ymx5S5NSmm3Qt14iz5hnUjYKkswDMXP CgpiZj46m0rHVJ7KQcMSB1oPyNG6B7qrmZVhV1QueHnsmgASVoamPwOz4atiHl0WQ8ZJ AFaEIHwhDNdLIdcEIYhAXgLWfQsYf0jicLzH4PJbqXDY3ZC5XPViOsRjE879sEjFW2yB /TbcpKeK1Fd+B/na4aJ35GhLZQQUMICZxpbZdcZ/P4HDce4mWiKNxmtN0zS3BMMvDpoy Ej6w== X-Forwarded-Encrypted: i=1; AHgh+RrO5t4k2t6hVFY6ACQa9PSRByhwsk02uvI1R/w8sKFUmGG55HIWnTeiVRukOQl/1Xs5iEr2bPIwaQom7qQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxOoT7PJZugEubJJlZ/eMXZzeUwhz4dF79wfcEp8k88+47tb4Dr goU2/zVfS6aJWpzXdoYyLoHrQ0DEA7VKR233GspRwF8AksKvVpJ8W34rIW3Zp54x0Q== X-Gm-Gg: AfdE7clzIfRLab9oKTZq6/oWT+JnirBFxDGjJoOtwiQEieZX5elEal6T7uFt5LMgF1x VrXBGT2kipnWa7bHRRbvAva/mQlgGaFP3twMzIafhI05OlYnIjHeGQmk6F85DH0/jievDRWa+bF HRtBam1W7msK4YXftNq5jAs7xHL9e5fhnaTrWzSCupwwkLs2eWOCFMgIEf+PSsP/Tpc3n2/f2EJ zjarVbBCIuzO34SDpgPCpEY8deUrd1Pp9B/XsUA1+FfahK9rfnSqfOoMyQvYk7j3JpqaQbRrgEA yd8mF2e+39ZiZMUtqp7M+RPpvdYH9WemoJI2DqY6e9uOHfcpmtOmkLgayHIYaB1/jsJxWoTwAGw c5jdT3mFbrokqy9RGe3rA1io+t74mtAVcbuF/EcBjCqQPM60I3NXhMuvvFqFg98/yhDi9YLjlq/ 7MHxDp8aiDCbdR4pjTUjpry/dylQfPLVg3aBxlP9wq9XLL1bNTiUFRnL67O0yWpLSZ8KksczR5N wmQATyrpA== X-Received: by 2002:a17:907:e143:b0:c12:b32:5651 with SMTP id a640c23a62f3a-c120b3256cemr244716366b.13.1782484026489; Fri, 26 Jun 2026 07:27:06 -0700 (PDT) Received: from akuchynski.c.googlers.com.com (208.220.32.34.bc.googleusercontent.com. [34.32.220.208]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c11fbba6787sm355968666b.6.2026.06.26.07.27.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2026 07:27:06 -0700 (PDT) From: Andrei Kuchynski To: Heikki Krogerus , Benson Leung , Jameson Thies Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Andrei Kuchynski Subject: [PATCH v3 0/3] Restrict alternate modes based on cable capabilities Date: Fri, 26 Jun 2026 14:26:59 +0000 Message-ID: <20260626142702.1941182-1-akuchynski@chromium.org> X-Mailer: git-send-email 2.55.0.rc0.799.gd6f94ed593-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Currently, alternate mode drivers (like DisplayPort and Thunderbolt) automatically assign operational callbacks (`typec_altmode_set_ops`) during probing, even if the underlying cable capabilities cannot support them. This can lead to incorrectly advertised state configurations or initialization failures later on. The first patch introduces the core helper function, and the subsequent patches update the DisplayPort and Thunderbolt altmode drivers to utilize this check during their respective probe phases. Changes in v3: - Extracted core verification logic into a static helper function - Added an enum to handle supported, unsupported, and unknown cable states - Patches 2 and 3 remain unchanged from the previous version. Changes in v2: - Updated patch 1/3 to use a switch-case statement, added detailed inline comments, and separated the non-e-marked cable validation logic. - Patches 2 and 3 remain unchanged from the previous version. Andrei Kuchynski (3): usb: typec: Add helper to check cable altmode support usb: typec: thunderbolt: Check cable altmode support usb: typec: displayport: Check cable altmode support drivers/usb/typec/altmodes/displayport.c | 5 +- drivers/usb/typec/altmodes/thunderbolt.c | 4 ++ drivers/usb/typec/class.c | 71 ++++++++++++++++++++++++ include/linux/usb/typec.h | 1 + 4 files changed, 80 insertions(+), 1 deletion(-) -- 2.55.0.rc0.799.gd6f94ed593-goog