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

Merge tag 'tag-chrome-platform-for-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux

Pull chrome platform updates from Benson Leung:
"cros_ec_typec:

- Check for EC device - Fix a crash when using the cros_ec_typec
driver on older hardware not capable of typec commands

- Make try power role optional

- Mux configuration reorganization series from Prashant

cros_ec_debugfs:

- Fix use after free. Thanks Tzung-bi

sensorhub:

- cros_ec_sensorhub fixup - Split trace include file

misc:

- Add new mailing list for chrome-platform development:

chrome-platform@lists.linux.dev

Now with patchwork!"

* tag 'tag-chrome-platform-for-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
platform/chrome: cros_ec_debugfs: detach log reader wq from devm
platform: chrome: Split trace include file
platform/chrome: cros_ec_typec: Update mux flags during partner removal
platform/chrome: cros_ec_typec: Configure muxes at start of port update
platform/chrome: cros_ec_typec: Get mux state inside configure_mux
platform/chrome: cros_ec_typec: Move mux flag checks
platform/chrome: cros_ec_typec: Check for EC device
platform/chrome: cros_ec_typec: Make try power role optional
MAINTAINERS: platform-chrome: Add new chrome-platform@lists.linux.dev list

+186 -152
+5
MAINTAINERS
··· 4640 4640 4641 4641 CHROME HARDWARE PLATFORM SUPPORT 4642 4642 M: Benson Leung <bleung@chromium.org> 4643 + L: chrome-platform@lists.linux.dev 4643 4644 S: Maintained 4644 4645 T: git git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git 4645 4646 F: drivers/platform/chrome/ ··· 4649 4648 M: Cheng-Yi Chiang <cychiang@chromium.org> 4650 4649 M: Tzung-Bi Shih <tzungbi@google.com> 4651 4650 R: Guenter Roeck <groeck@chromium.org> 4651 + L: chrome-platform@lists.linux.dev 4652 4652 S: Maintained 4653 4653 F: Documentation/devicetree/bindings/sound/google,cros-ec-codec.yaml 4654 4654 F: sound/soc/codecs/cros_ec_codec.* ··· 4657 4655 CHROMEOS EC SUBDRIVERS 4658 4656 M: Benson Leung <bleung@chromium.org> 4659 4657 R: Guenter Roeck <groeck@chromium.org> 4658 + L: chrome-platform@lists.linux.dev 4660 4659 S: Maintained 4661 4660 F: drivers/power/supply/cros_usbpd-charger.c 4662 4661 N: cros_ec ··· 4665 4662 4666 4663 CHROMEOS EC USB TYPE-C DRIVER 4667 4664 M: Prashant Malani <pmalani@chromium.org> 4665 + L: chrome-platform@lists.linux.dev 4668 4666 S: Maintained 4669 4667 F: drivers/platform/chrome/cros_ec_typec.c 4670 4668 4671 4669 CHROMEOS EC USB PD NOTIFY DRIVER 4672 4670 M: Prashant Malani <pmalani@chromium.org> 4671 + L: chrome-platform@lists.linux.dev 4673 4672 S: Maintained 4674 4673 F: drivers/platform/chrome/cros_usbpd_notify.c 4675 4674 F: include/linux/platform_data/cros_usbpd_notify.h
+2 -1
drivers/platform/chrome/Makefile
··· 2 2 3 3 # tell define_trace.h where to find the cros ec trace header 4 4 CFLAGS_cros_ec_trace.o:= -I$(src) 5 + CFLAGS_cros_ec_sensorhub_ring.o:= -I$(src) 5 6 6 7 obj-$(CONFIG_CHROMEOS_LAPTOP) += chromeos_laptop.o 7 8 obj-$(CONFIG_CHROMEOS_PRIVACY_SCREEN) += chromeos_privacy_screen.o ··· 22 21 obj-$(CONFIG_CROS_EC_LIGHTBAR) += cros_ec_lightbar.o 23 22 obj-$(CONFIG_CROS_EC_VBC) += cros_ec_vbc.o 24 23 obj-$(CONFIG_CROS_EC_DEBUGFS) += cros_ec_debugfs.o 25 - cros-ec-sensorhub-objs := cros_ec_sensorhub.o cros_ec_sensorhub_ring.o cros_ec_trace.o 24 + cros-ec-sensorhub-objs := cros_ec_sensorhub.o cros_ec_sensorhub_ring.o 26 25 obj-$(CONFIG_CROS_EC_SENSORHUB) += cros-ec-sensorhub.o 27 26 obj-$(CONFIG_CROS_EC_SYSFS) += cros_ec_sysfs.o 28 27 obj-$(CONFIG_CROS_USBPD_LOGGER) += cros_usbpd_logger.o
+6 -6
drivers/platform/chrome/cros_ec_debugfs.c
··· 25 25 26 26 #define CIRC_ADD(idx, size, value) (((idx) + (value)) & ((size) - 1)) 27 27 28 + /* waitqueue for log readers */ 29 + static DECLARE_WAIT_QUEUE_HEAD(cros_ec_debugfs_log_wq); 30 + 28 31 /** 29 32 * struct cros_ec_debugfs - EC debugging information. 30 33 * ··· 36 33 * @log_buffer: circular buffer for console log information 37 34 * @read_msg: preallocated EC command and buffer to read console log 38 35 * @log_mutex: mutex to protect circular buffer 39 - * @log_wq: waitqueue for log readers 40 36 * @log_poll_work: recurring task to poll EC for new console log data 41 37 * @panicinfo_blob: panicinfo debugfs blob 42 38 */ ··· 46 44 struct circ_buf log_buffer; 47 45 struct cros_ec_command *read_msg; 48 46 struct mutex log_mutex; 49 - wait_queue_head_t log_wq; 50 47 struct delayed_work log_poll_work; 51 48 /* EC panicinfo */ 52 49 struct debugfs_blob_wrapper panicinfo_blob; ··· 108 107 buf_space--; 109 108 } 110 109 111 - wake_up(&debug_info->log_wq); 110 + wake_up(&cros_ec_debugfs_log_wq); 112 111 } 113 112 114 113 mutex_unlock(&debug_info->log_mutex); ··· 142 141 143 142 mutex_unlock(&debug_info->log_mutex); 144 143 145 - ret = wait_event_interruptible(debug_info->log_wq, 144 + ret = wait_event_interruptible(cros_ec_debugfs_log_wq, 146 145 CIRC_CNT(cb->head, cb->tail, LOG_SIZE)); 147 146 if (ret < 0) 148 147 return ret; ··· 174 173 struct cros_ec_debugfs *debug_info = file->private_data; 175 174 __poll_t mask = 0; 176 175 177 - poll_wait(file, &debug_info->log_wq, wait); 176 + poll_wait(file, &cros_ec_debugfs_log_wq, wait); 178 177 179 178 mutex_lock(&debug_info->log_mutex); 180 179 if (CIRC_CNT(debug_info->log_buffer.head, ··· 378 377 debug_info->log_buffer.tail = 0; 379 378 380 379 mutex_init(&debug_info->log_mutex); 381 - init_waitqueue_head(&debug_info->log_wq); 382 380 383 381 debugfs_create_file("console_log", S_IFREG | 0444, debug_info->dir, 384 382 debug_info, &cros_ec_console_log_fops);
+2 -1
drivers/platform/chrome/cros_ec_sensorhub_ring.c
··· 17 17 #include <linux/sort.h> 18 18 #include <linux/slab.h> 19 19 20 - #include "cros_ec_trace.h" 20 + #define CREATE_TRACE_POINTS 21 + #include "cros_ec_sensorhub_trace.h" 21 22 22 23 /* Precision of fixed point for the m values from the filter */ 23 24 #define M_PRECISION BIT(23)
+123
drivers/platform/chrome/cros_ec_sensorhub_trace.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Trace events for the ChromeOS Sensorhub kernel module 4 + * 5 + * Copyright 2021 Google LLC. 6 + */ 7 + 8 + #undef TRACE_SYSTEM 9 + #define TRACE_SYSTEM cros_ec 10 + 11 + #if !defined(_CROS_EC_SENSORHUB_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) 12 + #define _CROS_EC_SENSORHUB_TRACE_H_ 13 + 14 + #include <linux/types.h> 15 + #include <linux/platform_data/cros_ec_sensorhub.h> 16 + 17 + #include <linux/tracepoint.h> 18 + 19 + TRACE_EVENT(cros_ec_sensorhub_timestamp, 20 + TP_PROTO(u32 ec_sample_timestamp, u32 ec_fifo_timestamp, s64 fifo_timestamp, 21 + s64 current_timestamp, s64 current_time), 22 + TP_ARGS(ec_sample_timestamp, ec_fifo_timestamp, fifo_timestamp, current_timestamp, 23 + current_time), 24 + TP_STRUCT__entry( 25 + __field(u32, ec_sample_timestamp) 26 + __field(u32, ec_fifo_timestamp) 27 + __field(s64, fifo_timestamp) 28 + __field(s64, current_timestamp) 29 + __field(s64, current_time) 30 + __field(s64, delta) 31 + ), 32 + TP_fast_assign( 33 + __entry->ec_sample_timestamp = ec_sample_timestamp; 34 + __entry->ec_fifo_timestamp = ec_fifo_timestamp; 35 + __entry->fifo_timestamp = fifo_timestamp; 36 + __entry->current_timestamp = current_timestamp; 37 + __entry->current_time = current_time; 38 + __entry->delta = current_timestamp - current_time; 39 + ), 40 + TP_printk("ec_ts: %9u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld, curr_time: %12lld, delta %12lld", 41 + __entry->ec_sample_timestamp, 42 + __entry->ec_fifo_timestamp, 43 + __entry->fifo_timestamp, 44 + __entry->current_timestamp, 45 + __entry->current_time, 46 + __entry->delta 47 + ) 48 + ); 49 + 50 + TRACE_EVENT(cros_ec_sensorhub_data, 51 + TP_PROTO(u32 ec_sensor_num, u32 ec_fifo_timestamp, s64 fifo_timestamp, 52 + s64 current_timestamp, s64 current_time), 53 + TP_ARGS(ec_sensor_num, ec_fifo_timestamp, fifo_timestamp, current_timestamp, current_time), 54 + TP_STRUCT__entry( 55 + __field(u32, ec_sensor_num) 56 + __field(u32, ec_fifo_timestamp) 57 + __field(s64, fifo_timestamp) 58 + __field(s64, current_timestamp) 59 + __field(s64, current_time) 60 + __field(s64, delta) 61 + ), 62 + TP_fast_assign( 63 + __entry->ec_sensor_num = ec_sensor_num; 64 + __entry->ec_fifo_timestamp = ec_fifo_timestamp; 65 + __entry->fifo_timestamp = fifo_timestamp; 66 + __entry->current_timestamp = current_timestamp; 67 + __entry->current_time = current_time; 68 + __entry->delta = current_timestamp - current_time; 69 + ), 70 + TP_printk("ec_num: %4u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld, curr_time: %12lld, delta %12lld", 71 + __entry->ec_sensor_num, 72 + __entry->ec_fifo_timestamp, 73 + __entry->fifo_timestamp, 74 + __entry->current_timestamp, 75 + __entry->current_time, 76 + __entry->delta 77 + ) 78 + ); 79 + 80 + TRACE_EVENT(cros_ec_sensorhub_filter, 81 + TP_PROTO(struct cros_ec_sensors_ts_filter_state *state, s64 dx, s64 dy), 82 + TP_ARGS(state, dx, dy), 83 + TP_STRUCT__entry( 84 + __field(s64, dx) 85 + __field(s64, dy) 86 + __field(s64, median_m) 87 + __field(s64, median_error) 88 + __field(s64, history_len) 89 + __field(s64, x) 90 + __field(s64, y) 91 + ), 92 + TP_fast_assign( 93 + __entry->dx = dx; 94 + __entry->dy = dy; 95 + __entry->median_m = state->median_m; 96 + __entry->median_error = state->median_error; 97 + __entry->history_len = state->history_len; 98 + __entry->x = state->x_offset; 99 + __entry->y = state->y_offset; 100 + ), 101 + TP_printk("dx: %12lld. dy: %12lld median_m: %12lld median_error: %12lld len: %lld x: %12lld y: %12lld", 102 + __entry->dx, 103 + __entry->dy, 104 + __entry->median_m, 105 + __entry->median_error, 106 + __entry->history_len, 107 + __entry->x, 108 + __entry->y 109 + ) 110 + ); 111 + 112 + 113 + #endif /* _CROS_EC_SENSORHUB_TRACE_H_ */ 114 + 115 + /* this part must be outside header guard */ 116 + 117 + #undef TRACE_INCLUDE_PATH 118 + #define TRACE_INCLUDE_PATH . 119 + 120 + #undef TRACE_INCLUDE_FILE 121 + #define TRACE_INCLUDE_FILE cros_ec_sensorhub_trace 122 + 123 + #include <trace/define_trace.h>
-95
drivers/platform/chrome/cros_ec_trace.h
··· 15 15 #include <linux/types.h> 16 16 #include <linux/platform_data/cros_ec_commands.h> 17 17 #include <linux/platform_data/cros_ec_proto.h> 18 - #include <linux/platform_data/cros_ec_sensorhub.h> 19 18 20 19 #include <linux/tracepoint.h> 21 20 ··· 69 70 __print_symbolic(__entry->result, EC_RESULT), 70 71 __entry->retval) 71 72 ); 72 - 73 - TRACE_EVENT(cros_ec_sensorhub_timestamp, 74 - TP_PROTO(u32 ec_sample_timestamp, u32 ec_fifo_timestamp, s64 fifo_timestamp, 75 - s64 current_timestamp, s64 current_time), 76 - TP_ARGS(ec_sample_timestamp, ec_fifo_timestamp, fifo_timestamp, current_timestamp, 77 - current_time), 78 - TP_STRUCT__entry( 79 - __field(u32, ec_sample_timestamp) 80 - __field(u32, ec_fifo_timestamp) 81 - __field(s64, fifo_timestamp) 82 - __field(s64, current_timestamp) 83 - __field(s64, current_time) 84 - __field(s64, delta) 85 - ), 86 - TP_fast_assign( 87 - __entry->ec_sample_timestamp = ec_sample_timestamp; 88 - __entry->ec_fifo_timestamp = ec_fifo_timestamp; 89 - __entry->fifo_timestamp = fifo_timestamp; 90 - __entry->current_timestamp = current_timestamp; 91 - __entry->current_time = current_time; 92 - __entry->delta = current_timestamp - current_time; 93 - ), 94 - TP_printk("ec_ts: %9u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld, curr_time: %12lld, delta %12lld", 95 - __entry->ec_sample_timestamp, 96 - __entry->ec_fifo_timestamp, 97 - __entry->fifo_timestamp, 98 - __entry->current_timestamp, 99 - __entry->current_time, 100 - __entry->delta 101 - ) 102 - ); 103 - 104 - TRACE_EVENT(cros_ec_sensorhub_data, 105 - TP_PROTO(u32 ec_sensor_num, u32 ec_fifo_timestamp, s64 fifo_timestamp, 106 - s64 current_timestamp, s64 current_time), 107 - TP_ARGS(ec_sensor_num, ec_fifo_timestamp, fifo_timestamp, current_timestamp, current_time), 108 - TP_STRUCT__entry( 109 - __field(u32, ec_sensor_num) 110 - __field(u32, ec_fifo_timestamp) 111 - __field(s64, fifo_timestamp) 112 - __field(s64, current_timestamp) 113 - __field(s64, current_time) 114 - __field(s64, delta) 115 - ), 116 - TP_fast_assign( 117 - __entry->ec_sensor_num = ec_sensor_num; 118 - __entry->ec_fifo_timestamp = ec_fifo_timestamp; 119 - __entry->fifo_timestamp = fifo_timestamp; 120 - __entry->current_timestamp = current_timestamp; 121 - __entry->current_time = current_time; 122 - __entry->delta = current_timestamp - current_time; 123 - ), 124 - TP_printk("ec_num: %4u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld, curr_time: %12lld, delta %12lld", 125 - __entry->ec_sensor_num, 126 - __entry->ec_fifo_timestamp, 127 - __entry->fifo_timestamp, 128 - __entry->current_timestamp, 129 - __entry->current_time, 130 - __entry->delta 131 - ) 132 - ); 133 - 134 - TRACE_EVENT(cros_ec_sensorhub_filter, 135 - TP_PROTO(struct cros_ec_sensors_ts_filter_state *state, s64 dx, s64 dy), 136 - TP_ARGS(state, dx, dy), 137 - TP_STRUCT__entry( 138 - __field(s64, dx) 139 - __field(s64, dy) 140 - __field(s64, median_m) 141 - __field(s64, median_error) 142 - __field(s64, history_len) 143 - __field(s64, x) 144 - __field(s64, y) 145 - ), 146 - TP_fast_assign( 147 - __entry->dx = dx; 148 - __entry->dy = dy; 149 - __entry->median_m = state->median_m; 150 - __entry->median_error = state->median_error; 151 - __entry->history_len = state->history_len; 152 - __entry->x = state->x_offset; 153 - __entry->y = state->y_offset; 154 - ), 155 - TP_printk("dx: %12lld. dy: %12lld median_m: %12lld median_error: %12lld len: %lld x: %12lld y: %12lld", 156 - __entry->dx, 157 - __entry->dy, 158 - __entry->median_m, 159 - __entry->median_error, 160 - __entry->history_len, 161 - __entry->x, 162 - __entry->y 163 - ) 164 - ); 165 - 166 73 167 74 #endif /* _CROS_EC_TRACE_H_ */ 168 75
+48 -49
drivers/platform/chrome/cros_ec_typec.c
··· 115 115 return ret; 116 116 cap->data = ret; 117 117 118 + /* Try-power-role is optional. */ 118 119 ret = fwnode_property_read_string(fwnode, "try-power-role", &buf); 119 120 if (ret) { 120 - dev_err(dev, "try-power-role not found: %d\n", ret); 121 - return ret; 121 + dev_warn(dev, "try-power-role not found: %d\n", ret); 122 + cap->prefer_role = TYPEC_NO_PREFERRED_ROLE; 123 + } else { 124 + ret = typec_find_power_role(buf); 125 + if (ret < 0) 126 + return ret; 127 + cap->prefer_role = ret; 122 128 } 123 - 124 - ret = typec_find_power_role(buf); 125 - if (ret < 0) 126 - return ret; 127 - cap->prefer_role = ret; 128 129 129 130 cap->fwnode = fwnode; 130 131 ··· 228 227 cros_typec_unregister_altmodes(typec, port_num, true); 229 228 230 229 cros_typec_usb_disconnect_state(port); 230 + port->mux_flags = USB_PD_MUX_NONE; 231 231 232 232 typec_unregister_partner(port->partner); 233 233 port->partner = NULL; ··· 514 512 } 515 513 516 514 static int cros_typec_configure_mux(struct cros_typec_data *typec, int port_num, 517 - uint8_t mux_flags, 518 515 struct ec_response_usb_pd_control_v2 *pd_ctrl) 519 516 { 520 517 struct cros_typec_port *port = typec->ports[port_num]; 518 + struct ec_response_usb_pd_mux_info resp; 519 + struct ec_params_usb_pd_mux_info req = { 520 + .port = port_num, 521 + }; 521 522 struct ec_params_usb_pd_mux_ack mux_ack; 522 523 enum typec_orientation orientation; 523 524 int ret; 524 525 525 - if (mux_flags == USB_PD_MUX_NONE) { 526 + ret = cros_ec_command(typec->ec, 0, EC_CMD_USB_PD_MUX_INFO, 527 + &req, sizeof(req), &resp, sizeof(resp)); 528 + if (ret < 0) { 529 + dev_warn(typec->dev, "Failed to get mux info for port: %d, err = %d\n", 530 + port_num, ret); 531 + return ret; 532 + } 533 + 534 + /* No change needs to be made, let's exit early. */ 535 + if (port->mux_flags == resp.flags && port->role == pd_ctrl->role) 536 + return 0; 537 + 538 + port->mux_flags = resp.flags; 539 + port->role = pd_ctrl->role; 540 + 541 + if (port->mux_flags == USB_PD_MUX_NONE) { 526 542 ret = cros_typec_usb_disconnect_state(port); 527 543 goto mux_ack; 528 544 } 529 545 530 - if (mux_flags & USB_PD_MUX_POLARITY_INVERTED) 546 + if (port->mux_flags & USB_PD_MUX_POLARITY_INVERTED) 531 547 orientation = TYPEC_ORIENTATION_REVERSE; 532 548 else 533 549 orientation = TYPEC_ORIENTATION_NORMAL; ··· 560 540 if (ret) 561 541 return ret; 562 542 563 - if (mux_flags & USB_PD_MUX_USB4_ENABLED) { 543 + if (port->mux_flags & USB_PD_MUX_USB4_ENABLED) { 564 544 ret = cros_typec_enable_usb4(typec, port_num, pd_ctrl); 565 - } else if (mux_flags & USB_PD_MUX_TBT_COMPAT_ENABLED) { 545 + } else if (port->mux_flags & USB_PD_MUX_TBT_COMPAT_ENABLED) { 566 546 ret = cros_typec_enable_tbt(typec, port_num, pd_ctrl); 567 - } else if (mux_flags & USB_PD_MUX_DP_ENABLED) { 547 + } else if (port->mux_flags & USB_PD_MUX_DP_ENABLED) { 568 548 ret = cros_typec_enable_dp(typec, port_num, pd_ctrl); 569 - } else if (mux_flags & USB_PD_MUX_SAFE_MODE) { 549 + } else if (port->mux_flags & USB_PD_MUX_SAFE_MODE) { 570 550 ret = cros_typec_usb_safe_state(port); 571 - } else if (mux_flags & USB_PD_MUX_USB_ENABLED) { 551 + } else if (port->mux_flags & USB_PD_MUX_USB_ENABLED) { 572 552 port->state.alt = NULL; 573 553 port->state.mode = TYPEC_STATE_USB; 574 554 ret = typec_mux_set(port->mux, &port->state); 575 555 } else { 576 556 dev_dbg(typec->dev, 577 557 "Unrecognized mode requested, mux flags: %x\n", 578 - mux_flags); 558 + port->mux_flags); 579 559 } 580 560 581 561 mux_ack: ··· 648 628 cros_typec_remove_partner(typec, port_num); 649 629 cros_typec_remove_cable(typec, port_num); 650 630 } 651 - } 652 - 653 - static int cros_typec_get_mux_info(struct cros_typec_data *typec, int port_num, 654 - struct ec_response_usb_pd_mux_info *resp) 655 - { 656 - struct ec_params_usb_pd_mux_info req = { 657 - .port = port_num, 658 - }; 659 - 660 - return cros_ec_command(typec->ec, 0, EC_CMD_USB_PD_MUX_INFO, &req, 661 - sizeof(req), resp, sizeof(*resp)); 662 631 } 663 632 664 633 /* ··· 947 938 { 948 939 struct ec_params_usb_pd_control req; 949 940 struct ec_response_usb_pd_control_v2 resp; 950 - struct ec_response_usb_pd_mux_info mux_resp; 951 941 int ret; 952 942 953 943 if (port_num < 0 || port_num >= typec->num_ports) { ··· 966 958 if (ret < 0) 967 959 return ret; 968 960 961 + /* Update the switches if they exist, according to requested state */ 962 + ret = cros_typec_configure_mux(typec, port_num, &resp); 963 + if (ret) 964 + dev_warn(typec->dev, "Configure muxes failed, err = %d\n", ret); 965 + 969 966 dev_dbg(typec->dev, "Enabled %d: 0x%hhx\n", port_num, resp.enabled); 970 967 dev_dbg(typec->dev, "Role %d: 0x%hhx\n", port_num, resp.role); 971 968 dev_dbg(typec->dev, "Polarity %d: 0x%hhx\n", port_num, resp.polarity); ··· 986 973 if (typec->typec_cmd_supported) 987 974 cros_typec_handle_status(typec, port_num); 988 975 989 - /* Update the switches if they exist, according to requested state */ 990 - ret = cros_typec_get_mux_info(typec, port_num, &mux_resp); 991 - if (ret < 0) { 992 - dev_warn(typec->dev, 993 - "Failed to get mux info for port: %d, err = %d\n", 994 - port_num, ret); 995 - return 0; 996 - } 997 - 998 - /* No change needs to be made, let's exit early. */ 999 - if (typec->ports[port_num]->mux_flags == mux_resp.flags && 1000 - typec->ports[port_num]->role == resp.role) 1001 - return 0; 1002 - 1003 - typec->ports[port_num]->mux_flags = mux_resp.flags; 1004 - typec->ports[port_num]->role = resp.role; 1005 - ret = cros_typec_configure_mux(typec, port_num, mux_resp.flags, &resp); 1006 - if (ret) 1007 - dev_warn(typec->dev, "Configure muxes failed, err = %d\n", ret); 1008 - 1009 - return ret; 976 + return 0; 1010 977 } 1011 978 1012 979 static int cros_typec_get_cmd_version(struct cros_typec_data *typec) ··· 1068 1075 return -ENOMEM; 1069 1076 1070 1077 typec->dev = dev; 1078 + 1071 1079 typec->ec = dev_get_drvdata(pdev->dev.parent); 1080 + if (!typec->ec) { 1081 + dev_err(dev, "couldn't find parent EC device\n"); 1082 + return -ENODEV; 1083 + } 1084 + 1072 1085 platform_set_drvdata(pdev, typec); 1073 1086 1074 1087 ret = cros_typec_get_cmd_version(typec);