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 'tag-chrome-platform-for-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux

Pull chrome platform updates from Benson Leung:
"cros_ec_typec:

- Changes around DP mode check, hard reset, tracking port change.

cros_ec misc:

- wilco_ec: Convert stream-like files from nonseekable to stream open

- cros_usbpd_notify: Listen to EC_HSOT_EVENT_USB_MUX host event

- fix format warning in cros_ec_typec"

* tag 'tag-chrome-platform-for-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
platform/chrome: cros_ec_lpc: Use DEFINE_MUTEX() for mutex lock
platform/chrome: cros_usbpd_notify: Listen to EC_HOST_EVENT_USB_MUX host event
platform/chrome: cros_ec_typec: Add DP mode check
platform/chrome: cros_ec_typec: Handle hard reset
platform/chrome: cros_ec: Add Type C hard reset
platform/chrome: cros_ec_typec: Track port role
platform/chrome: cros_ec_typec: fix clang -Wformat warning
platform/chrome: cros_ec_typec: Check for device within remove function
platform/chrome: wilco_ec: convert stream-like files from nonseekable_open -> stream_open

+39 -17
+1 -2
drivers/platform/chrome/cros_ec_lpc_mec.c
··· 14 14 * This mutex must be held while accessing the EMI unit. We can't rely on the 15 15 * EC mutex because memmap data may be accessed without it being held. 16 16 */ 17 - static struct mutex io_mutex; 17 + static DEFINE_MUTEX(io_mutex); 18 18 static u16 mec_emi_base, mec_emi_end; 19 19 20 20 /** ··· 142 142 143 143 void cros_ec_lpc_mec_init(unsigned int base, unsigned int end) 144 144 { 145 - mutex_init(&io_mutex); 146 145 mec_emi_base = base; 147 146 mec_emi_end = end; 148 147 }
+34 -13
drivers/platform/chrome/cros_ec_typec.c
··· 58 58 /* Variables keeping track of switch state. */ 59 59 struct typec_mux_state state; 60 60 uint8_t mux_flags; 61 + uint8_t role; 61 62 62 63 /* Port alt modes. */ 63 64 struct typec_altmode p_altmode[CROS_EC_ALTMODE_MAX]; ··· 221 220 { 222 221 struct cros_typec_port *port = typec->ports[port_num]; 223 222 223 + if (!port->partner) 224 + return; 225 + 224 226 cros_typec_unregister_altmodes(typec, port_num, true); 225 227 226 228 cros_typec_usb_disconnect_state(port); ··· 238 234 int port_num) 239 235 { 240 236 struct cros_typec_port *port = typec->ports[port_num]; 237 + 238 + if (!port->cable) 239 + return; 241 240 242 241 cros_typec_unregister_altmodes(typec, port_num, false); 243 242 ··· 260 253 if (!typec->ports[i]) 261 254 continue; 262 255 263 - if (typec->ports[i]->partner) 264 - cros_typec_remove_partner(typec, i); 265 - 266 - if (typec->ports[i]->cable) 267 - cros_typec_remove_cable(typec, i); 256 + cros_typec_remove_partner(typec, i); 257 + cros_typec_remove_cable(typec, i); 268 258 269 259 usb_role_switch_put(typec->ports[i]->role_sw); 270 260 typec_switch_put(typec->ports[i]->ori_sw); ··· 487 483 return -ENOTSUPP; 488 484 } 489 485 486 + if (!pd_ctrl->dp_mode) { 487 + dev_err(typec->dev, "No valid DP mode provided.\n"); 488 + return -EINVAL; 489 + } 490 + 490 491 /* Status VDO. */ 491 492 dp_data.status = DP_STATUS_ENABLED; 492 493 if (port->mux_flags & USB_PD_MUX_HPD_IRQ) ··· 656 647 "Failed to register partner on port: %d\n", 657 648 port_num); 658 649 } else { 659 - if (typec->ports[port_num]->partner) 660 - cros_typec_remove_partner(typec, port_num); 661 - 662 - if (typec->ports[port_num]->cable) 663 - cros_typec_remove_cable(typec, port_num); 650 + cros_typec_remove_partner(typec, port_num); 651 + cros_typec_remove_cable(typec, port_num); 664 652 } 665 653 } 666 654 ··· 911 905 return; 912 906 } 913 907 908 + /* If we got a hard reset, unregister everything and return. */ 909 + if (resp.events & PD_STATUS_EVENT_HARD_RESET) { 910 + cros_typec_remove_partner(typec, port_num); 911 + cros_typec_remove_cable(typec, port_num); 912 + 913 + ret = cros_typec_send_clear_event(typec, port_num, 914 + PD_STATUS_EVENT_HARD_RESET); 915 + if (ret < 0) 916 + dev_warn(typec->dev, 917 + "Failed hard reset event clear, port: %d\n", port_num); 918 + return; 919 + } 920 + 914 921 /* Handle any events appropriately. */ 915 922 if (resp.events & PD_STATUS_EVENT_SOP_DISC_DONE && !typec->ports[port_num]->sop_disc_done) { 916 923 u16 sop_revision; ··· 1014 995 } 1015 996 1016 997 /* No change needs to be made, let's exit early. */ 1017 - if (typec->ports[port_num]->mux_flags == mux_resp.flags) 998 + if (typec->ports[port_num]->mux_flags == mux_resp.flags && 999 + typec->ports[port_num]->role == resp.role) 1018 1000 return 0; 1019 1001 1020 1002 typec->ports[port_num]->mux_flags = mux_resp.flags; 1003 + typec->ports[port_num]->role = resp.role; 1021 1004 ret = cros_typec_configure_mux(typec, port_num, mux_resp.flags, &resp); 1022 1005 if (ret) 1023 1006 dev_warn(typec->dev, "Configure muxes failed, err = %d\n", ret); ··· 1048 1027 else 1049 1028 typec->pd_ctrl_ver = 0; 1050 1029 1051 - dev_dbg(typec->dev, "PD Control has version mask 0x%hhx\n", 1052 - typec->pd_ctrl_ver); 1030 + dev_dbg(typec->dev, "PD Control has version mask 0x%02x\n", 1031 + typec->pd_ctrl_ver & 0xff); 1053 1032 1054 1033 return 0; 1055 1034 }
+2 -1
drivers/platform/chrome/cros_usbpd_notify.c
··· 220 220 if (!host_event) 221 221 return NOTIFY_DONE; 222 222 223 - if (host_event & EC_HOST_EVENT_MASK(EC_HOST_EVENT_PD_MCU)) { 223 + if (host_event & (EC_HOST_EVENT_MASK(EC_HOST_EVENT_PD_MCU) | 224 + EC_HOST_EVENT_MASK(EC_HOST_EVENT_USB_MUX))) { 224 225 cros_usbpd_get_event_and_notify(pdnotify->dev, ec_dev); 225 226 return NOTIFY_OK; 226 227 }
+1 -1
drivers/platform/chrome/wilco_ec/telemetry.c
··· 256 256 sess_data->dev_data = dev_data; 257 257 sess_data->has_msg = false; 258 258 259 - nonseekable_open(inode, filp); 259 + stream_open(inode, filp); 260 260 filp->private_data = sess_data; 261 261 262 262 return 0;
+1
include/linux/platform_data/cros_ec_commands.h
··· 5679 5679 5680 5680 #define PD_STATUS_EVENT_SOP_DISC_DONE BIT(0) 5681 5681 #define PD_STATUS_EVENT_SOP_PRIME_DISC_DONE BIT(1) 5682 + #define PD_STATUS_EVENT_HARD_RESET BIT(2) 5682 5683 5683 5684 struct ec_params_typec_status { 5684 5685 uint8_t port;