From nobody Tue Feb 10 05:27:35 2026 Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 A3413368287 for ; Mon, 19 Jan 2026 13:18:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768828727; cv=none; b=qQTFqdN1+tRbQNjRWZZnuLZ8OKxGLIGEQizvvGJCRZdrofvZ18J3sqBdyUKF1YwD9cXCExNp8cQPiPIobO6zzGE2oJgYscWMkhdCv5SI5X/+MKGd6OYYh7JkKtKPUGY60DLfdF581MEyV1/WlxkDyoiCoHhFwLp7s4IvUAEHiOs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768828727; c=relaxed/simple; bh=V1jmUzlQs0mqeDEI06ZenpYXU3urQAv3hO+yVPpB20c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FgyAwx+SB67ZUQOuX3CKSJ43mrXbxgSeWuIl00yJdgUB9o25obsS5KQgAXniNnfpA+nvoyBNRGs/K/Tr96jcQwqZ+GUiLZ6BFhg+ngFjpMU64KyZVUlQgX5KH4RoJa4oFdNFo4fIvYuQg+KlSrndter2WKKJgM+gjY7mR/g30bY= 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=bFPvJrPL; arc=none smtp.client-ip=209.85.208.43 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="bFPvJrPL" Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-64c893f3a94so9256723a12.0 for ; Mon, 19 Jan 2026 05:18:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1768828722; x=1769433522; 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=cLqa5LSPMe82XqVLviPNjog13TrBNYmx2vAnL8Z9NGE=; b=bFPvJrPLR1mSUfB1JPSjU3Zm0EmWTrNGyJmdr8h/4bCNt3gO4VDRV3VASov/dyXePk O+9J/5tScCq30NK9yaK7pY0Lhf3JamA45WBguVudWzg6SFlK3roLpqEOsul1kDv77qtH wyl8Mb5q1p7brZawTOEB56UzGB1PgSyyOmnCc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768828722; x=1769433522; 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=cLqa5LSPMe82XqVLviPNjog13TrBNYmx2vAnL8Z9NGE=; b=RfRC741OIiTZrxvlz7pEzFwPkOqzSRZINFX8RMD1kwRESyKVCYwA1FlrZ7fghEzK0p eLE+b50h6+xBh9Ny/0fLtc1tADcHwa+oa2ktXgFMN4fHQ/kjSafGQaKJ8dYboU1mBm0u ZpeyIh08SW9QLk81+DukXUOFpoMUDL9ZA1KuUfX8gXnliaR4nHzTaOdPILtMaH4bPdh/ /dZpKzwQaXTC2cSw6UU06q6aJNOM+aq5HCwEThz9DeEwZygkCz/JRm/SNIZl8mKYPScN oUXBI8c8Ssd7YmPajSIus2HNjTpQ7GxiI1wRgu94poXgS8hOAQXUIXT8rqn/XNE7hQya ClfA== X-Forwarded-Encrypted: i=1; AJvYcCXuM1otOKC278CDqY+wNuKXqspYhzafTlpuB2/h8hvi1bBUuQxmWyhjbbXsDtEE0bpQfZhdmtm079X9HJo=@vger.kernel.org X-Gm-Message-State: AOJu0YzcNmxxMetLJTQwWlyavUmGLnCbYDvlN+3ebSfAjrpZR5wuqG7R 1taOfZ5bypuBFf8s1oosJUQuGFlNSzOAGH/b5GoocPkLBLsA7Q/6418JNwOZG75PKQ== X-Gm-Gg: AY/fxX6pTuZQKs8E/u8SYkEB+EXkhKJrSmA4Lh4WRpSEWPfpv2wFTkRf7D1R7Er+eDq ctAnuexC3KjWTeiagwmZ5KzdiS7YLYn8544b6N6YwsQj1c46sFwNsuRw5jYk1EU33KOB5ceQRn0 3QJzPrTi5725IPip1oKSoYGTua+hb7T+88JVUVOe5JLfqSDApdXSXsDJXArp2ePfhjoWr5PPS14 dPpL/Y6ta/pZ1GdRx2097cCevDsiLioIMPC2Uer0ig8+VslGBCGIMIhnhht3ZeTL3x37BHC9aDg X2mZk7irz7qi1GbDVjNalQrgjhhwUQTCTR+H4/rVipQAIFeSZl9LhaAs3EFgpKXIUkdDgwLr26S LfWYcM278CQoib2DB4KIPW6cprHKDPdZR/tmVSESk6ZEujhQ9JmHaX77FsiBSiwz4g15haLs+Zb X/s7fyAD5zkCOIs2jBnY7bGC4fLPSnPd2zXuQhXi9ukm7bAHKOgz1EAH2aEC6yBdcto8kfFJ4z+ krOhmJ1 X-Received: by 2002:a17:907:971e:b0:b7c:cc8d:14f4 with SMTP id a640c23a62f3a-b8777a09915mr1291724366b.4.1768828722003; Mon, 19 Jan 2026 05:18:42 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jan 2026 05:18:41 -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 1/7] usb: typec: Add mode_control field to port property Date: Mon, 19 Jan 2026 13:18:18 +0000 Message-ID: <20260119131824.2529334-2-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" This new field in the port properties dictates whether the Platform Policy Manager (PPM) allows the OS Policy Manager (OPM) to change the currently active, negotiated alternate mode. Signed-off-by: Andrei Kuchynski Reviewed-by: Heikki Krogerus Reviewed-by: Benson Leung --- drivers/usb/typec/class.c | 9 ++++++--- drivers/usb/typec/class.h | 1 + include/linux/usb/typec.h | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index c4ff4310ff58a..0f12d6120511b 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -457,11 +457,13 @@ static umode_t typec_altmode_attr_is_visible(struct k= object *kobj, struct attribute *attr, int n) { struct typec_altmode *adev =3D to_typec_altmode(kobj_to_dev(kobj)); + struct typec_port *port =3D typec_altmode2port(adev); =20 if (attr =3D=3D &dev_attr_active.attr) - if (!is_typec_port(adev->dev.parent) && - (!adev->ops || !adev->ops->activate)) - return 0444; + if (!is_typec_port(adev->dev.parent)) { + if (!port->mode_control || !adev->ops || !adev->ops->activate) + return 0444; + } =20 return attr->mode; } @@ -2708,6 +2710,7 @@ struct typec_port *typec_register_port(struct device = *parent, } =20 port->pd =3D cap->pd; + port->mode_control =3D !cap->no_mode_control; =20 ret =3D device_add(&port->dev); if (ret) { diff --git a/drivers/usb/typec/class.h b/drivers/usb/typec/class.h index db2fe96c48ff0..2e89a83c2eb70 100644 --- a/drivers/usb/typec/class.h +++ b/drivers/usb/typec/class.h @@ -62,6 +62,7 @@ struct typec_port { struct mutex partner_link_lock; =20 enum typec_orientation orientation; + bool mode_control; struct typec_switch *sw; struct typec_mux *mux; struct typec_retimer *retimer; diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h index c6fd46902fce7..dbb259d885266 100644 --- a/include/linux/usb/typec.h +++ b/include/linux/usb/typec.h @@ -290,6 +290,7 @@ enum usb_pd_svdm_ver { * @prefer_role: Initial role preference (DRP ports). * @accessory: Supported Accessory Modes * @usb_capability: Supported USB Modes + * @no_mode_control: Ability to manage Alternate Modes * @fwnode: Optional fwnode of the port * @driver_data: Private pointer for driver specific info * @pd: Optional USB Power Delivery Support @@ -307,6 +308,7 @@ struct typec_capability { enum typec_accessory accessory[TYPEC_MAX_ACCESSORY]; unsigned int orientation_aware:1; u8 usb_capability; + bool no_mode_control; =20 struct fwnode_handle *fwnode; void *driver_data; --=20 2.52.0.457.g6b5491de43-goog