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.

Merge tag 'chrome-platform-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux

Pull chrome platform updates from Tzung-Bi Shih:

- Support ACPI match for Framework systems

- Expose new sysfs for:
- PD mux status for each EC-managed Type-C port
- EC feature of AP mode entry
- Setting USB mode of EC Type-C

* tag 'chrome-platform-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
platform/chrome: cros_ec_typec: Add support for setting USB mode via sysfs
platform/chrome: cros_ec_sysfs: Expose AP_MODE_ENTRY feature state
platform/chrome: cros_ec_sysfs: Expose PD mux status
platform/chrome: cros_ec_lpc: Match on Framework ACPI device
MAINTAINERS: Update maintainers for ChromeOS USBC related drivers

+141 -10
+20
Documentation/ABI/testing/sysfs-class-chromeos
··· 31 31 KernelVersion: 4.2 32 32 Description: 33 33 Show the information about the EC software and hardware. 34 + 35 + What: /sys/class/chromeos/cros_ec/usbpdmuxinfo 36 + Date: February 2025 37 + Description: 38 + Show PD mux status for each typec port with following flags: 39 + - "USB": USB connected 40 + - "DP": DP connected 41 + - "POLARITY": CC line Polarity inverted 42 + - "HPD_IRQ": Hot Plug Detect interrupt is asserted 43 + - "HPD_LVL": Hot Plug Detect level is asserted 44 + - "SAFE": DP is in safe mode 45 + - "TBT": TBT enabled 46 + - "USB4": USB4 enabled 47 + 48 + What: /sys/class/chromeos/cros_ec/ap_mode_entry 49 + Date: February 2025 50 + Description: 51 + Show if the AP mode entry EC feature is supported. 52 + It indicates whether the EC waits for direction from the AP 53 + to enter Type-C altmodes or USB4 mode.
+7 -2
MAINTAINERS
··· 5485 5485 F: drivers/platform/chrome/cros_ec_uart.c 5486 5486 5487 5487 CHROMEOS EC USB PD NOTIFY DRIVER 5488 - M: Prashant Malani <pmalani@chromium.org> 5488 + M: Łukasz Bartosik <ukaszb@chromium.org> 5489 + M: Andrei Kuchynski <akuchynski@chromium.org> 5490 + M: Jameson Thies <jthies@google.com> 5489 5491 L: chrome-platform@lists.linux.dev 5490 5492 S: Maintained 5491 5493 F: drivers/platform/chrome/cros_usbpd_notify.c 5492 5494 F: include/linux/platform_data/cros_usbpd_notify.h 5493 5495 5494 5496 CHROMEOS EC USB TYPE-C DRIVER 5495 - M: Prashant Malani <pmalani@chromium.org> 5496 5497 M: Benson Leung <bleung@chromium.org> 5497 5498 M: Abhishek Pandit-Subedi <abhishekpandit@chromium.org> 5499 + M: Jameson Thies <jthies@google.com> 5500 + M: Andrei Kuchynski <akuchynski@chromium.org> 5498 5501 L: chrome-platform@lists.linux.dev 5499 5502 S: Maintained 5500 5503 F: drivers/platform/chrome/cros_ec_typec.* ··· 5520 5517 CHROMEOS UCSI DRIVER 5521 5518 M: Abhishek Pandit-Subedi <abhishekpandit@chromium.org> 5522 5519 M: Łukasz Bartosik <ukaszb@chromium.org> 5520 + M: Jameson Thies <jthies@google.com> 5521 + M: Andrei Kuchynski <akuchynski@chromium.org> 5523 5522 L: chrome-platform@lists.linux.dev 5524 5523 S: Maintained 5525 5524 F: drivers/usb/typec/ucsi/cros_ec_ucsi.c
+14 -8
drivers/platform/chrome/cros_ec_lpc.c
··· 30 30 31 31 #define DRV_NAME "cros_ec_lpcs" 32 32 #define ACPI_DRV_NAME "GOOG0004" 33 + #define FRMW_ACPI_DRV_NAME "FRMWC004" 33 34 34 35 /* True if ACPI device is present */ 35 36 static bool cros_ec_lpc_acpi_device_found; ··· 515 514 acpi_status status; 516 515 struct cros_ec_device *ec_dev; 517 516 struct cros_ec_lpc *ec_lpc; 518 - struct lpc_driver_data *driver_data; 517 + const struct lpc_driver_data *driver_data; 519 518 u8 buf[2] = {}; 520 519 int irq, ret; 521 520 u32 quirks; ··· 527 526 ec_lpc->mmio_memory_base = EC_LPC_ADDR_MEMMAP; 528 527 529 528 driver_data = platform_get_drvdata(pdev); 529 + if (!driver_data) 530 + driver_data = acpi_device_get_match_data(dev); 531 + 530 532 if (driver_data) { 531 533 quirks = driver_data->quirks; 532 534 ··· 700 696 cros_ec_unregister(ec_dev); 701 697 } 702 698 703 - static const struct acpi_device_id cros_ec_lpc_acpi_device_ids[] = { 704 - { ACPI_DRV_NAME, 0 }, 705 - { } 706 - }; 707 - MODULE_DEVICE_TABLE(acpi, cros_ec_lpc_acpi_device_ids); 708 - 709 699 static const struct lpc_driver_data framework_laptop_npcx_lpc_driver_data __initconst = { 710 700 .quirks = CROS_EC_LPC_QUIRK_REMAP_MEMORY, 711 701 .quirk_mmio_memory_base = 0xE00, ··· 710 712 .quirk_acpi_id = "PNP0C09", 711 713 .quirk_aml_mutex_name = "ECMT", 712 714 }; 715 + 716 + static const struct acpi_device_id cros_ec_lpc_acpi_device_ids[] = { 717 + { ACPI_DRV_NAME, 0 }, 718 + { FRMW_ACPI_DRV_NAME, (kernel_ulong_t)&framework_laptop_npcx_lpc_driver_data }, 719 + { } 720 + }; 721 + MODULE_DEVICE_TABLE(acpi, cros_ec_lpc_acpi_device_ids); 713 722 714 723 static const struct dmi_system_id cros_ec_lpc_dmi_table[] __initconst = { 715 724 { ··· 871 866 int ret; 872 867 const struct dmi_system_id *dmi_match; 873 868 874 - cros_ec_lpc_acpi_device_found = !!cros_ec_lpc_get_device(ACPI_DRV_NAME); 869 + cros_ec_lpc_acpi_device_found = !!cros_ec_lpc_get_device(ACPI_DRV_NAME) || 870 + !!cros_ec_lpc_get_device(FRMW_ACPI_DRV_NAME); 875 871 876 872 dmi_match = dmi_first_match(cros_ec_lpc_dmi_table); 877 873
+71
drivers/platform/chrome/cros_ec_sysfs.c
··· 296 296 return count; 297 297 } 298 298 299 + static ssize_t usbpdmuxinfo_show(struct device *dev, 300 + struct device_attribute *attr, 301 + char *buf) 302 + { 303 + struct cros_ec_dev *ec = to_cros_ec_dev(dev); 304 + ssize_t count = 0; 305 + struct ec_response_usb_pd_ports resp_pd_ports; 306 + int ret; 307 + int i; 308 + 309 + ret = cros_ec_cmd(ec->ec_dev, 0, EC_CMD_USB_PD_PORTS, NULL, 0, 310 + &resp_pd_ports, sizeof(resp_pd_ports)); 311 + if (ret < 0) 312 + return -EIO; 313 + 314 + for (i = 0; i < resp_pd_ports.num_ports; i++) { 315 + struct ec_response_usb_pd_mux_info resp_mux; 316 + struct ec_params_usb_pd_mux_info req = { 317 + .port = i, 318 + }; 319 + 320 + ret = cros_ec_cmd(ec->ec_dev, 0, EC_CMD_USB_PD_MUX_INFO, 321 + &req, sizeof(req), &resp_mux, sizeof(resp_mux)); 322 + 323 + if (ret >= 0) { 324 + count += sysfs_emit_at(buf, count, "Port %d:", i); 325 + count += sysfs_emit_at(buf, count, " USB=%d", 326 + !!(resp_mux.flags & USB_PD_MUX_USB_ENABLED)); 327 + count += sysfs_emit_at(buf, count, " DP=%d", 328 + !!(resp_mux.flags & USB_PD_MUX_DP_ENABLED)); 329 + count += sysfs_emit_at(buf, count, " POLARITY=%s", 330 + (resp_mux.flags & USB_PD_MUX_POLARITY_INVERTED) ? 331 + "INVERTED" : "NORMAL"); 332 + count += sysfs_emit_at(buf, count, " HPD_IRQ=%d", 333 + !!(resp_mux.flags & USB_PD_MUX_HPD_IRQ)); 334 + count += sysfs_emit_at(buf, count, " HPD_LVL=%d", 335 + !!(resp_mux.flags & USB_PD_MUX_HPD_LVL)); 336 + count += sysfs_emit_at(buf, count, " SAFE=%d", 337 + !!(resp_mux.flags & USB_PD_MUX_SAFE_MODE)); 338 + count += sysfs_emit_at(buf, count, " TBT=%d", 339 + !!(resp_mux.flags & USB_PD_MUX_TBT_COMPAT_ENABLED)); 340 + count += sysfs_emit_at(buf, count, " USB4=%d\n", 341 + !!(resp_mux.flags & USB_PD_MUX_USB4_ENABLED)); 342 + } 343 + } 344 + 345 + return count ? : -EIO; 346 + } 347 + 348 + static ssize_t ap_mode_entry_show(struct device *dev, 349 + struct device_attribute *attr, char *buf) 350 + { 351 + struct cros_ec_dev *ec = to_cros_ec_dev(dev); 352 + const bool ap_driven_altmode = cros_ec_check_features( 353 + ec, EC_FEATURE_TYPEC_REQUIRE_AP_MODE_ENTRY); 354 + 355 + return sysfs_emit(buf, "%s\n", ap_driven_altmode ? "yes" : "no"); 356 + } 357 + 299 358 /* Module initialization */ 300 359 301 360 static DEVICE_ATTR_RW(reboot); 302 361 static DEVICE_ATTR_RO(version); 303 362 static DEVICE_ATTR_RO(flashinfo); 304 363 static DEVICE_ATTR_RW(kb_wake_angle); 364 + static DEVICE_ATTR_RO(usbpdmuxinfo); 365 + static DEVICE_ATTR_RO(ap_mode_entry); 305 366 306 367 static struct attribute *__ec_attrs[] = { 307 368 &dev_attr_kb_wake_angle.attr, 308 369 &dev_attr_reboot.attr, 309 370 &dev_attr_version.attr, 310 371 &dev_attr_flashinfo.attr, 372 + &dev_attr_usbpdmuxinfo.attr, 373 + &dev_attr_ap_mode_entry.attr, 311 374 NULL, 312 375 }; 313 376 ··· 382 319 383 320 if (a == &dev_attr_kb_wake_angle.attr && !ec->has_kb_wake_angle) 384 321 return 0; 322 + 323 + if (a == &dev_attr_usbpdmuxinfo.attr || 324 + a == &dev_attr_ap_mode_entry.attr) { 325 + struct cros_ec_platform *ec_platform = dev_get_platdata(ec->dev); 326 + 327 + if (strcmp(ec_platform->ec_name, CROS_EC_DEV_NAME)) 328 + return 0; 329 + } 385 330 386 331 return a->mode; 387 332 }
+28
drivers/platform/chrome/cros_ec_typec.c
··· 42 42 #endif 43 43 } 44 44 45 + static int cros_typec_enter_usb_mode(struct typec_port *tc_port, enum usb_mode mode) 46 + { 47 + struct cros_typec_port *port = typec_get_drvdata(tc_port); 48 + struct ec_params_typec_control req = { 49 + .port = port->port_num, 50 + .command = (mode == USB_MODE_USB4) ? 51 + TYPEC_CONTROL_COMMAND_ENTER_MODE : TYPEC_CONTROL_COMMAND_EXIT_MODES, 52 + .mode_to_enter = CROS_EC_ALTMODE_USB4 53 + }; 54 + 55 + return cros_ec_cmd(port->typec_data->ec, 0, EC_CMD_TYPEC_CONTROL, 56 + &req, sizeof(req), NULL, 0); 57 + } 58 + 59 + static const struct typec_operations cros_typec_usb_mode_ops = { 60 + .enter_usb_mode = cros_typec_enter_usb_mode 61 + }; 62 + 45 63 static int cros_typec_parse_port_props(struct typec_capability *cap, 46 64 struct fwnode_handle *fwnode, 47 65 struct device *dev) ··· 101 83 return ret; 102 84 cap->prefer_role = ret; 103 85 } 86 + 87 + if (fwnode_property_present(fwnode, "usb2-port")) 88 + cap->usb_capability |= USB_CAPABILITY_USB2; 89 + if (fwnode_property_present(fwnode, "usb3-port")) 90 + cap->usb_capability |= USB_CAPABILITY_USB3; 91 + if (fwnode_property_present(fwnode, "usb4-port")) 92 + cap->usb_capability |= USB_CAPABILITY_USB4; 104 93 105 94 cros_typec_role_switch_quirk(fwnode); 106 95 ··· 403 378 ret = cros_typec_parse_port_props(cap, fwnode, dev); 404 379 if (ret < 0) 405 380 goto unregister_ports; 381 + 382 + cap->driver_data = cros_port; 383 + cap->ops = &cros_typec_usb_mode_ops; 406 384 407 385 cros_port->port = typec_register_port(dev, cap); 408 386 if (IS_ERR(cros_port->port)) {
+1
drivers/platform/chrome/cros_ec_typec.h
··· 18 18 enum { 19 19 CROS_EC_ALTMODE_DP = 0, 20 20 CROS_EC_ALTMODE_TBT, 21 + CROS_EC_ALTMODE_USB4, 21 22 CROS_EC_ALTMODE_MAX, 22 23 }; 23 24