From nobody Mon Feb 9 19:04:47 2026 Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) (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 A5713368278 for ; Mon, 19 Jan 2026 13:18:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.66 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768828735; cv=none; b=KqOIjoI7ejMiHf8uwik9g1l+UFhS55F3/3ehlgA3Dc99STyeC3Vm+lajTfc2Ce/QS3eHd5w9RewImN8QC34RFcy89D0NBoCkSFq9Gh8shSfBhwXS9A6Fe+RV6kA/d3qzngFfj1ms9kCH+VVDegIJujL0xDAH2kRYGDh9DD6sgPA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768828735; c=relaxed/simple; bh=PvMl78Egz6bmb1PsfFjOs6AkxoGFu1IQkxwSzJj0RZk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fCgYHOWbx9b2gIDnLkmeyqHFDPxFzKWEw0VCj4ovPFyAM0Kt0g66K+YuCidB5OQzaur/T7/+ZpVbvLQ85dx3JtYZzy+DpEbqwjFtLmYlWSgs4uxVl/ifcRYXtaCbmGbDn1VO1fBi1mIpisG55loWCU8RE+PHf83WFMuGTouwQXo= 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=McMA2foG; arc=none smtp.client-ip=209.85.208.66 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="McMA2foG" Received: by mail-ed1-f66.google.com with SMTP id 4fb4d7f45d1cf-64d4d8b3ad7so6892607a12.2 for ; Mon, 19 Jan 2026 05:18:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1768828732; x=1769433532; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dDnniPjMK/sJQN7VPW7dqxpb712evvAY2y6naw6LGNE=; b=McMA2foG3PfY/bLG2smlB9DVMu3pMOuRfZ8qXgtSFRM3nraOyDAvHG6b4Bm2S9I0vh v05Wapeh+mgyQ7HxvMywrlyUjm6mb55UqMVow0IO1CWeXfGDwHasGCUCBXno4sEeZjRI 5Oxh6XfZPpPf8+quO1H/BwcO57FgudR9cbKj8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768828732; x=1769433532; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=dDnniPjMK/sJQN7VPW7dqxpb712evvAY2y6naw6LGNE=; b=u0/MGkfmacYnq3OTtOp4wlgndCyGTgjR1pAVci/oUHSNV2iF56dhroVB/6bi9dDQWP U/EjcRpPOFiqkb/IIkbuxgfK+OX50iFWa64H9UV/vX3WSFV6BQ9J6qXEiAAN3JpPwLiN +kfkMiX6QhipmcILWhJY/DldZxfWPu5kAm7QWOMZsRmV/O7lK00MgyOnFpAHNIV3/GpC 3mw33EYAyQ/XNiNq6IBrhUEiG+hbu2Lb1PvbALBliCiKLZBjpjMzI+bEoInw8qPtiEPC eC4mDr+9MtpI/2p76w4lW+UpK0TgKvNn5jcf2iZFxZUXLDoFZAKBuhfeRPlBGAGPaNjk yNUQ== X-Forwarded-Encrypted: i=1; AJvYcCVv+TDX3Te3pOUzcpPONe145cgdzXsMYpc3HNUYq9Kpt9xAE1EnYYnexKe6lNswGrGbYUMptspw7msSy4o=@vger.kernel.org X-Gm-Message-State: AOJu0YxeoMKRs7Cgj+QHz8lqjhXY/3pYn9dCPGIKrA1BE2Fk578Kgf4a D+NpOvL2pg60GTufD1RlEZOYiu0t10mHuFINYab+EtHczTo5CF2lyr7LnPIEqD8F7Q== X-Gm-Gg: AY/fxX5snz1RR6Y9L1kF1BsKm1wjFhGhsRHJHX3h/5NI5ef5zQzl2220N0VjnWV6HdI 8tNEJD/FEvHCYcBPD6Curzv+mjcoiCDCjvqIt76f9KBoG4aSj7qVDW6gxPJNCsxWJktf9E0gfri paALguqJvOruqmkBYJJaJFUcS6vqBERy4yLUFM83MZ1yQ3LWjsJngnpqBEyXgvOkaBgUHnZVpf4 18rIptjxwCRnerMTK2wWmg+ZBjkjimRPfe9WJQkhH+qMOMFRp0hcyGrFceNcbXY7PDOlgwkLU/0 z1LozrqXxe02fRp89JEddO0oaKIshIGPPuhnL/gs7E5VRX2adSj51p+RHvtvJSql+1Q1rVi+qWL hieNO1+OMPvVLXKAKgd4820E/MYHag5nSDqcdVZq6dzbcbLVFsCYkDRLCUp8aZjMYF8iMdFSgsi jJEmuKBYREPxH0UR7sav1oOhnlzZwuP4NvOcgk7xGoSB8qq039gPPLElsB/kF/PxZ1i2YDeWvXt hRQlfxy X-Received: by 2002:a17:907:d1f:b0:b77:2269:8df0 with SMTP id a640c23a62f3a-b8796a5a491mr862916266b.28.1768828731903; Mon, 19 Jan 2026 05:18:51 -0800 (PST) Received: from akuchynski.c.googlers.com.com (150.230.32.34.bc.googleusercontent.com. [34.32.230.150]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b87959c9a14sm1078801866b.45.2026.01.19.05.18.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jan 2026 05:18:51 -0800 (PST) From: Andrei Kuchynski To: Heikki Krogerus , Abhishek Pandit-Subedi , Benson Leung , Jameson Thies , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, chrome-platform@lists.linux.dev Cc: Tzung-Bi Shih , Guenter Roeck , Greg Kroah-Hartman , Dmitry Baryshkov , =?UTF-8?q?=C5=81ukasz=20Bartosik?= , Pooja Katiyar , Johan Hovold , Hsin-Te Yuan , Madhu M , Venkat Jayaraman , Andrei Kuchynski Subject: [PATCH v5 5/7] usb: typec: Introduce mode_selection bit Date: Mon, 19 Jan 2026 13:18:22 +0000 Message-ID: <20260119131824.2529334-6-akuchynski@chromium.org> X-Mailer: git-send-email 2.52.0.457.g6b5491de43-goog In-Reply-To: <20260119131824.2529334-1-akuchynski@chromium.org> References: <20260119131824.2529334-1-akuchynski@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The port driver sets this bit for an alternate mode description to indicate support for the mode selection feature. Once set, individual Alt Mode drivers will no longer attempt to activate their respective modes within their probe functions. This prevents race conditions and non-prioritized activation. The bit is not set by default. If left unset, the system retains the current behavior where Alt Mode drivers manage their own activation logic. Signed-off-by: Andrei Kuchynski Reviewed-by: Heikki Krogerus --- drivers/usb/typec/altmodes/displayport.c | 6 ++++-- drivers/usb/typec/altmodes/thunderbolt.c | 2 +- drivers/usb/typec/class.c | 1 + include/linux/usb/typec.h | 1 + include/linux/usb/typec_altmode.h | 1 + 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/a= ltmodes/displayport.c index d96ab106a980b..d185688a16b13 100644 --- a/drivers/usb/typec/altmodes/displayport.c +++ b/drivers/usb/typec/altmodes/displayport.c @@ -804,8 +804,10 @@ int dp_altmode_probe(struct typec_altmode *alt) if (plug) typec_altmode_set_drvdata(plug, dp); =20 - dp->state =3D plug ? DP_STATE_ENTER_PRIME : DP_STATE_ENTER; - schedule_work(&dp->work); + if (!alt->mode_selection) { + dp->state =3D plug ? DP_STATE_ENTER_PRIME : DP_STATE_ENTER; + schedule_work(&dp->work); + } =20 return 0; } diff --git a/drivers/usb/typec/altmodes/thunderbolt.c b/drivers/usb/typec/a= ltmodes/thunderbolt.c index 6eadf7835f8f6..c4c5da6154da9 100644 --- a/drivers/usb/typec/altmodes/thunderbolt.c +++ b/drivers/usb/typec/altmodes/thunderbolt.c @@ -307,7 +307,7 @@ static int tbt_altmode_probe(struct typec_altmode *alt) typec_altmode_set_drvdata(alt, tbt); typec_altmode_set_ops(alt, &tbt_altmode_ops); =20 - if (tbt_ready(alt)) { + if (!alt->mode_selection && tbt_ready(alt)) { if (tbt->plug[TYPEC_PLUG_SOP_P]) tbt->state =3D TBT_STATE_SOP_P_ENTER; else if (tbt->plug[TYPEC_PLUG_SOP_PP]) diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index a48c447125184..dbba53f024977 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -655,6 +655,7 @@ typec_register_altmode(struct device *parent, alt->adev.svid =3D desc->svid; alt->adev.mode =3D desc->mode; alt->adev.vdo =3D desc->vdo; + alt->adev.mode_selection =3D desc->mode_selection; alt->roles =3D desc->roles; alt->id =3D id; =20 diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h index dbb259d885266..d61ec38216fa9 100644 --- a/include/linux/usb/typec.h +++ b/include/linux/usb/typec.h @@ -155,6 +155,7 @@ struct typec_altmode_desc { /* Only used with ports */ enum typec_port_data roles; bool inactive; + bool mode_selection; }; =20 void typec_partner_set_pd_revision(struct typec_partner *partner, u16 pd_r= evision); diff --git a/include/linux/usb/typec_altmode.h b/include/linux/usb/typec_al= tmode.h index 70026f5f8f997..0513d333b7977 100644 --- a/include/linux/usb/typec_altmode.h +++ b/include/linux/usb/typec_altmode.h @@ -37,6 +37,7 @@ struct typec_altmode { u32 vdo; unsigned int active:1; u8 priority; + bool mode_selection; =20 char *desc; const struct typec_altmode_ops *ops; --=20 2.52.0.457.g6b5491de43-goog