Skip to content

Commit fa48d7e

Browse files
saranyagopal1gregkh
authored andcommitted
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>
1 parent 64f3b5a commit fa48d7e

File tree

1 file changed

+5
-51
lines changed

1 file changed

+5
-51
lines changed

drivers/usb/typec/ucsi/ucsi_acpi.c

Lines changed: 5 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,11 @@ static int ucsi_acpi_read_cci(struct ucsi *ucsi, u32 *cci)
6161
struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi);
6262
int ret;
6363

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+
}
6769

6870
memcpy(cci, ua->base + UCSI_CCI, sizeof(*cci));
6971

@@ -73,11 +75,6 @@ static int ucsi_acpi_read_cci(struct ucsi *ucsi, u32 *cci)
7375
static int ucsi_acpi_read_message_in(struct ucsi *ucsi, void *val, size_t val_len)
7476
{
7577
struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi);
76-
int ret;
77-
78-
ret = ucsi_acpi_dsm(ua, UCSI_DSM_FUNC_READ);
79-
if (ret)
80-
return ret;
8178

8279
memcpy(val, ua->base + UCSI_MESSAGE_IN, val_len);
8380

@@ -102,42 +99,6 @@ static const struct ucsi_operations ucsi_acpi_ops = {
10299
.async_control = ucsi_acpi_async_control
103100
};
104101

105-
static int
106-
ucsi_zenbook_read_cci(struct ucsi *ucsi, u32 *cci)
107-
{
108-
struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi);
109-
int ret;
110-
111-
if (UCSI_COMMAND(ua->cmd) == UCSI_PPM_RESET) {
112-
ret = ucsi_acpi_dsm(ua, UCSI_DSM_FUNC_READ);
113-
if (ret)
114-
return ret;
115-
}
116-
117-
memcpy(cci, ua->base + UCSI_CCI, sizeof(*cci));
118-
119-
return 0;
120-
}
121-
122-
static int
123-
ucsi_zenbook_read_message_in(struct ucsi *ucsi, void *val, size_t val_len)
124-
{
125-
struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi);
126-
127-
/* UCSI_MESSAGE_IN is never read for PPM_RESET, return stored data */
128-
memcpy(val, ua->base + UCSI_MESSAGE_IN, val_len);
129-
130-
return 0;
131-
}
132-
133-
static const struct ucsi_operations ucsi_zenbook_ops = {
134-
.read_version = ucsi_acpi_read_version,
135-
.read_cci = ucsi_zenbook_read_cci,
136-
.read_message_in = ucsi_zenbook_read_message_in,
137-
.sync_control = ucsi_sync_control_common,
138-
.async_control = ucsi_acpi_async_control
139-
};
140-
141102
static int ucsi_gram_read_message_in(struct ucsi *ucsi, void *val, size_t val_len)
142103
{
143104
u16 bogus_change = UCSI_CONSTAT_POWER_LEVEL_CHANGE |
@@ -190,13 +151,6 @@ static const struct ucsi_operations ucsi_gram_ops = {
190151
};
191152

192153
static const struct dmi_system_id ucsi_acpi_quirks[] = {
193-
{
194-
.matches = {
195-
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
196-
DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX325UA_UM325UA"),
197-
},
198-
.driver_data = (void *)&ucsi_zenbook_ops,
199-
},
200154
{
201155
.matches = {
202156
DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"),

0 commit comments

Comments
 (0)