Skip to content

Commit b45be66

Browse files
paulmenzelgregkh
authored andcommitted
usb: typec: ucsi: cancel pending work on system suspend
commit 7c4a234 upstream. On a Dell XPS 13 9360 (BIOS 2.21.0), entering system suspend (deep/S3) races a pending UCSI connector-change worker against the ACPI EC teardown. The worker evaluates the UCSI _DSM (GET_CONNECTOR_STATUS), whose AML accesses the Embedded Controller. By that point the ACPI EC has already been stopped for suspend, so the EC address space handler rejects the access with AE_BAD_PARAMETER, aborting the AML and failing the connector query: [22314.689495] ACPI: EC: interrupt blocked [22314.711981] ACPI: PM: Preparing to enter system sleep state S3 [22314.743260] ACPI: EC: event blocked [22314.743265] ACPI: EC: EC stopped [22314.743267] ACPI: PM: Saving platform NVS memory [22314.744241] ACPI Error: AE_BAD_PARAMETER, Returned by Handler for [EmbeddedControl] (20260408/evregion-303) [22314.744432] ACPI Error: Aborting method \_SB.PCI0.LPCB.ECDV.ECW1 due to previous error (AE_BAD_PARAMETER) (20260408/psparse-543) [22314.744673] ACPI Error: Aborting method \ECWB due to previous error (AE_BAD_PARAMETER) (20260408/psparse-543) [22314.745201] ACPI Error: Aborting method \_SB.UBTC._DSM due to previous error (AE_BAD_PARAMETER) (20260408/psparse-543) [22314.745394] ACPI: \_SB_.UBTC: failed to evaluate _DSM c298836f-a47c-e411-ad36-631042b5008f rev:1 func:1 (0x1001) [22314.745414] ucsi_acpi USBC000:00: ucsi_acpi_dsm: failed to evaluate _DSM 1 [22314.745424] ucsi_acpi USBC000:00: ucsi_handle_connector_change: GET_CONNECTOR_STATUS failed (-5) ucsi_acpi implements a resume callback but no suspend callback, so nothing cancels the connector-change work before the firmware/EC is torn down. Add a `ucsi_suspend()` core helper that cancels the pending init and connector-change work, and wire it into ucsi_acpi's PM ops. The connector state is re-read on resume by `ucsi_resume()`, so cancelling the work loses nothing. Fixes: 4e3a502 ("usb: typec: ucsi: acpi: Implement resume callback") Cc: stable <stable@kernel.org> Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de> Assisted-by: Claude Opus 4.8 Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://patch.msgid.link/20260703110738.8457-2-pmenzel@molgen.mpg.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f5c772b commit b45be66

3 files changed

Lines changed: 30 additions & 1 deletion

File tree

drivers/usb/typec/ucsi/ucsi.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,6 +1918,26 @@ static void ucsi_resume_work(struct work_struct *work)
19181918
}
19191919
}
19201920

1921+
int ucsi_suspend(struct ucsi *ucsi)
1922+
{
1923+
int i;
1924+
1925+
/*
1926+
* Cancel pending work so it cannot access the firmware after the ACPI
1927+
* EC is stopped for suspend; state is re-read on resume.
1928+
*/
1929+
cancel_delayed_work_sync(&ucsi->work);
1930+
1931+
if (!ucsi->connector)
1932+
return 0;
1933+
1934+
for (i = 0; i < ucsi->cap.num_connectors; i++)
1935+
cancel_work_sync(&ucsi->connector[i].work);
1936+
1937+
return 0;
1938+
}
1939+
EXPORT_SYMBOL_GPL(ucsi_suspend);
1940+
19211941
int ucsi_resume(struct ucsi *ucsi)
19221942
{
19231943
if (ucsi->connector)

drivers/usb/typec/ucsi/ucsi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,7 @@ int ucsi_send_command(struct ucsi *ucsi, u64 command,
551551
void *retval, size_t size);
552552

553553
void ucsi_altmode_update_active(struct ucsi_connector *con);
554+
int ucsi_suspend(struct ucsi *ucsi);
554555
int ucsi_resume(struct ucsi *ucsi);
555556

556557
void ucsi_notify_common(struct ucsi *ucsi, u32 cci);

drivers/usb/typec/ucsi/ucsi_acpi.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,22 @@ static void ucsi_acpi_remove(struct platform_device *pdev)
245245
ucsi_acpi_notify);
246246
}
247247

248+
static int ucsi_acpi_suspend(struct device *dev)
249+
{
250+
struct ucsi_acpi *ua = dev_get_drvdata(dev);
251+
252+
return ucsi_suspend(ua->ucsi);
253+
}
254+
248255
static int ucsi_acpi_resume(struct device *dev)
249256
{
250257
struct ucsi_acpi *ua = dev_get_drvdata(dev);
251258

252259
return ucsi_resume(ua->ucsi);
253260
}
254261

255-
static DEFINE_SIMPLE_DEV_PM_OPS(ucsi_acpi_pm_ops, NULL, ucsi_acpi_resume);
262+
static DEFINE_SIMPLE_DEV_PM_OPS(ucsi_acpi_pm_ops, ucsi_acpi_suspend,
263+
ucsi_acpi_resume);
256264

257265
static const struct acpi_device_id ucsi_acpi_match[] = {
258266
{ "PNP0CA0", 0 },

0 commit comments

Comments
 (0)