Hi Heikki,
On 2023-03-18 03:04, Samuel Čavoj wrote:
...
Unfortunately nothing seems to work... I'm attaching the DMI quirk
patch here. Can you test it?
I'll definitely try it out, I hope sometime next week!
I'm not sure if the DMI_PRODUCT_NAME is just "ZenBook" so you may
need to fix that in the patch!!
You can get the correct value by running dmidecode. This should work:
% dmidecode -s system-product-name
This returns "ZenBook UX325UA_UM325UA", so the DMI_MATCH would work.
However my DMI_SYS_VENDOR is "ASUSTeK COMPUTER INC.", uppercase.
All in all, the patch works after some modifications which I'm
attaching below. In summary:
- The DMI_MATCH SYS_VENDOR was changed to uppercase
- The DMI_MATCH PRODUCT_NAME was changed to be more specific, although
I'm not sure what the best value is here.
- The conditional in ucsi_zenbook_read was fixed.
- ua->cmd cannot be reset to 0 after read because the reset
procedure repeatedly calls read without performing
any other commands. I don't think this should cause any problems
- ucsi_acpi_notify needs to call the quirked variant
as well, so I put an indirect call there.
Otherwise maybe ucsi_acpi_async_write should only set cmd if the offset
is UCSI_CONTROL.
I'm occasionally getting some other errors later on, but I think
those might be specific to a certain cheap USB-C hub I have. They
don't occur with it unplugged.
Thanks,
Sam
diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c
b/drivers/usb/typec/ucsi/ucsi_acpi.c
index a5cb4b89573f..3b872cb3808b 100644
--- a/drivers/usb/typec/ucsi/ucsi_acpi.c
+++ b/drivers/usb/typec/ucsi/ucsi_acpi.c
@@ -102,14 +102,13 @@ ucsi_zenbook_read(struct ucsi *ucsi, unsigned int
offset, void *val, size_t val_
struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi);
int ret;
- if (ua->cmd & (UCSI_VERSION | UCSI_PPM_RESET)) {
+ if (offset == UCSI_VERSION || UCSI_COMMAND(ua->cmd) == UCSI_PPM_RESET)
{
ret = ucsi_acpi_dsm(ua, UCSI_DSM_FUNC_READ);
if (ret)
return ret;
}
memcpy(val, ua->base + offset, val_len);
- ua->cmd = 0;
return 0;
}
@@ -123,8 +122,8 @@ static const struct ucsi_operations ucsi_zenbook_ops
= {
static const struct dmi_system_id zenbook_dmi_id[] = {
{
.matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
- DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook"),
+ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX325UA_UM325UA"),
},
},
{ }
@@ -136,7 +135,7 @@ static void ucsi_acpi_notify(acpi_handle handle, u32
event, void *data)
u32 cci;
int ret;
- ret = ucsi_acpi_read(ua->ucsi, UCSI_CCI, &cci, sizeof(cci));
+ ret = ua->ucsi->ops->read(ua->ucsi, UCSI_CCI, &cci, sizeof(cci));
if (ret)
return;
--
2.40.0