From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (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 7605439DBC0 for ; Mon, 22 Jun 2026 09:39:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782121157; cv=none; b=T1QePh+JC0TwsJUDCI7Et0Q+cxiKnhIwNSZqW/KhiBrDlMNESEFgqfmpbknoQV+0/OX51UxTqHUNQ5M3G0zhSmKU5UCohO0YqaVpLaaoojKVhUH+mVpo6JW2E6vkpETd+SfAUNEriRP//yYaP1NOtvo7bSZF7yayGbw3/yAIwag= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782121157; c=relaxed/simple; bh=eu+GJeFnTcnrRH/YTV+AB/tyehPblnosPlo9b7R03oM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=l1IVoe0w42YvpmlN/AyGB01E22m9c4Mj/wJGDj833XpbHpVJw9j9Hw6erWt9pGC1Jd6FumMvPSWygjRc6fak2Z22tUUGiBy8kSYbC8NVamYzahCsKb50LVh/yLQz2ASkIt2boPGCDYgvzcWwz+DaM8HLQVZWgt5Q3Gc9kFoMMy0= 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=mj1U1VGq; arc=none smtp.client-ip=209.85.218.49 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="mj1U1VGq" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-bed19623d6eso595331966b.1 for ; Mon, 22 Jun 2026 02:39:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1782121155; x=1782725955; 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=QCi9OiSqIs4619EHraKpkIBeaT7EInxvbeZ757OwJfI=; b=mj1U1VGqYk0oLwv27cwFRH8edetc334NTF9Daey4D8lgyCNA3NzyYRjXfqLORcKKlp pRmdhogHoHgtidwhOB0SupqfuUR9VWz4ZX6EpERwc8sHTMNr4OIwH86v9GOqbohamiq9 uO3hOljDty4e8OURiO+k7JFy8/SkeDCxMxK88= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782121155; x=1782725955; 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=QCi9OiSqIs4619EHraKpkIBeaT7EInxvbeZ757OwJfI=; b=MpauX2Cpn1o5TDfbngWFXywdYKj7YcYwwk1WDmSzLEN7YLbSUSi2zdQ3cMLeF+dhIW NSx/kF2DoD5AA4vZzSozXrGnGfKkoHUNKsspT9CguuF2XeUHvVA/GJ/67GuTYJAMmF/k G0nQkxtx95kRI0jyT9w2OttZ1MqPw4oHimaczH1DkOyvCCI13dYQ9ZxfSPBLSdOACjx5 gFwLNrsPJwreGpYSsN8YqxN84kjlcYmcEU6M26srYcUKUiJlGjl61MX0bBIczygucs4M ItTtWdwygBF0TIo2c2d85936+7pWehDFehzZQz6+okjAZhGoK6j8TfxRziKP4e9+aeKM r2rg== X-Forwarded-Encrypted: i=1; AFNElJ8QxNv/ey0oc4Hrh3/olGhudDfDm4t+0E57ZyCdGc8ufyFJ0GlDpQ3JB+en3H3QwT0+Tr7JQIBlTWcOFdo=@vger.kernel.org X-Gm-Message-State: AOJu0YxJ8dK5auWs/CPts1Ca1uMJlttbtlXSPnp4IpJqWlDOIeqQOjL7 XN/ulqg+7NV1j3vxOVKVXFCbrKaFhZ8SiFdqEonUbuV+IjhZMw6ahDqKmPcL1684ZQ== X-Gm-Gg: AfdE7cnrJnP62UJSPYqxqX82Y9zEz1Zxm+JhI4MWYb8o+LS7wFq3iCZ5V6Wv7wo7Fi2 76U28Y5IA3bia3qjKf0+5YAYH9YeX0mzRQCBPcw2ZqDedXgSfSWoCN3/15zpEmHL1ahvI/E6cAz tpnnh1he0pc0olhLAvta3udXKQQeq5SJaho4s77C839mfy+Zl7t+2CnRh8EHhf7luWjKPOyFzlE yigZe6IO2swWy/zOtubETeOq/M4JUNHcqqITK5H8EwZSreqOFS4V2HU3fPUUNjX+4f3bccdRV6S +Q5xHG6gFyOeCRX1fyrTQGkSwE8kNIVPUazBNcCyHnVCxH0LndoxTV5U+bMNyU/VFoCSKyzMI7O eBWbwslEh8j06nAR6rN0R0fLTnjRzM/OK6JK3sJRK6Dgjg8/JeU5m/0/tlNHydeaCzr1TuYdlh4 g+cqqw1iNzOqevVSa6TeS8AnLX6oJ6iv8uEzAwshrAlXOiBZnaNwIAdfmX2pL+PwxVGbaBubpON VOvk8XiWA== X-Received: by 2002:a17:907:e84a:b0:be2:208a:a8ae with SMTP id a640c23a62f3a-c0b60602f38mr633263366b.22.1782121154828; Mon, 22 Jun 2026 02:39:14 -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-c0c610e526asm324855566b.51.2026.06.22.02.39.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2026 02:39:14 -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 v2 0/3] Restrict alternate modes based on cable capabilities Date: Mon, 22 Jun 2026 09:39:07 +0000 Message-ID: <20260622093910.1210089-1-akuchynski@chromium.org> X-Mailer: git-send-email 2.55.0.rc0.738.g0c8ab3ebcc-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 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 | 65 ++++++++++++++++++++++++ include/linux/usb/typec.h | 1 + 4 files changed, 74 insertions(+), 1 deletion(-) -- 2.55.0.rc0.738.g0c8ab3ebcc-goog