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: ucsi: Do not call ACPI _DSM method for UCSI read operations

ACPI _DSM methods are needed only for UCSI write operations and for reading
CCI during RESET_PPM operation. So, remove _DSM calls from other places.
While there, remove the Zenbook quirk also since the default behavior
now aligns with the Zenbook quirk. With this change, GET_CONNECTOR_STATUS
returns at least 6 seconds faster than before in Arrowlake-S platforms.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Saranya Gopal <saranya.gopal@intel.com>
Reviewed-by: Christian A. Ehrhardt <lk@c--e.de>
Link: https://lore.kernel.org/r/20240830084342.460109-1-saranya.gopal@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Saranya Gopal and committed by
Greg Kroah-Hartman
fa48d7e8 64f3b5a6

+5 -51
+5 -51
drivers/usb/typec/ucsi/ucsi_acpi.c
··· 61 61 struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi); 62 62 int ret; 63 63 64 - ret = ucsi_acpi_dsm(ua, UCSI_DSM_FUNC_READ); 65 - if (ret) 66 - return ret; 64 + if (UCSI_COMMAND(ua->cmd) == UCSI_PPM_RESET) { 65 + ret = ucsi_acpi_dsm(ua, UCSI_DSM_FUNC_READ); 66 + if (ret) 67 + return ret; 68 + } 67 69 68 70 memcpy(cci, ua->base + UCSI_CCI, sizeof(*cci)); 69 71 ··· 75 73 static int ucsi_acpi_read_message_in(struct ucsi *ucsi, void *val, size_t val_len) 76 74 { 77 75 struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi); 78 - int ret; 79 - 80 - ret = ucsi_acpi_dsm(ua, UCSI_DSM_FUNC_READ); 81 - if (ret) 82 - return ret; 83 76 84 77 memcpy(val, ua->base + UCSI_MESSAGE_IN, val_len); 85 78 ··· 95 98 .read_version = ucsi_acpi_read_version, 96 99 .read_cci = ucsi_acpi_read_cci, 97 100 .read_message_in = ucsi_acpi_read_message_in, 98 - .sync_control = ucsi_sync_control_common, 99 - .async_control = ucsi_acpi_async_control 100 - }; 101 - 102 - static int 103 - ucsi_zenbook_read_cci(struct ucsi *ucsi, u32 *cci) 104 - { 105 - struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi); 106 - int ret; 107 - 108 - if (UCSI_COMMAND(ua->cmd) == UCSI_PPM_RESET) { 109 - ret = ucsi_acpi_dsm(ua, UCSI_DSM_FUNC_READ); 110 - if (ret) 111 - return ret; 112 - } 113 - 114 - memcpy(cci, ua->base + UCSI_CCI, sizeof(*cci)); 115 - 116 - return 0; 117 - } 118 - 119 - static int 120 - ucsi_zenbook_read_message_in(struct ucsi *ucsi, void *val, size_t val_len) 121 - { 122 - struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi); 123 - 124 - /* UCSI_MESSAGE_IN is never read for PPM_RESET, return stored data */ 125 - memcpy(val, ua->base + UCSI_MESSAGE_IN, val_len); 126 - 127 - return 0; 128 - } 129 - 130 - static const struct ucsi_operations ucsi_zenbook_ops = { 131 - .read_version = ucsi_acpi_read_version, 132 - .read_cci = ucsi_zenbook_read_cci, 133 - .read_message_in = ucsi_zenbook_read_message_in, 134 101 .sync_control = ucsi_sync_control_common, 135 102 .async_control = ucsi_acpi_async_control 136 103 }; ··· 151 190 }; 152 191 153 192 static const struct dmi_system_id ucsi_acpi_quirks[] = { 154 - { 155 - .matches = { 156 - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 157 - DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX325UA_UM325UA"), 158 - }, 159 - .driver_data = (void *)&ucsi_zenbook_ops, 160 - }, 161 193 { 162 194 .matches = { 163 195 DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"),