Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: typec: Add mode_control field to port property

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 <akuchynski@chromium.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Benson Leung <bleung@chromium.org>
Link: https://patch.msgid.link/20260119131824.2529334-2-akuchynski@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Andrei Kuchynski and committed by
Greg Kroah-Hartman
dfd7b082 1360eb44

+9 -3
+6 -3
drivers/usb/typec/class.c
··· 457 457 struct attribute *attr, int n) 458 458 { 459 459 struct typec_altmode *adev = to_typec_altmode(kobj_to_dev(kobj)); 460 + struct typec_port *port = typec_altmode2port(adev); 460 461 461 462 if (attr == &dev_attr_active.attr) 462 - if (!is_typec_port(adev->dev.parent) && 463 - (!adev->ops || !adev->ops->activate)) 464 - return 0444; 463 + if (!is_typec_port(adev->dev.parent)) { 464 + if (!port->mode_control || !adev->ops || !adev->ops->activate) 465 + return 0444; 466 + } 465 467 466 468 return attr->mode; 467 469 } ··· 2710 2708 } 2711 2709 2712 2710 port->pd = cap->pd; 2711 + port->mode_control = !cap->no_mode_control; 2713 2712 2714 2713 ret = device_add(&port->dev); 2715 2714 if (ret) {
+1
drivers/usb/typec/class.h
··· 62 62 struct mutex partner_link_lock; 63 63 64 64 enum typec_orientation orientation; 65 + bool mode_control; 65 66 struct typec_switch *sw; 66 67 struct typec_mux *mux; 67 68 struct typec_retimer *retimer;
+2
include/linux/usb/typec.h
··· 290 290 * @prefer_role: Initial role preference (DRP ports). 291 291 * @accessory: Supported Accessory Modes 292 292 * @usb_capability: Supported USB Modes 293 + * @no_mode_control: Ability to manage Alternate Modes 293 294 * @fwnode: Optional fwnode of the port 294 295 * @driver_data: Private pointer for driver specific info 295 296 * @pd: Optional USB Power Delivery Support ··· 308 307 enum typec_accessory accessory[TYPEC_MAX_ACCESSORY]; 309 308 unsigned int orientation_aware:1; 310 309 u8 usb_capability; 310 + bool no_mode_control; 311 311 312 312 struct fwnode_handle *fwnode; 313 313 void *driver_data;