Commit 226af67a authored by Karthikeyan Ramasubramanian's avatar Karthikeyan Ramasubramanian Committed by Peng Zhang
Browse files

platform/chrome: cros_ec: Handle events during suspend after resume completion

stable inclusion
from stable-v6.6.34
commit 3d22872e7740460bc80e73d4a9b1bd4cee92540e
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAD6H2

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=3d22872e7740460bc80e73d4a9b1bd4cee92540e



--------------------------------

commit 2fbe479c0024e1c6b992184a799055e19932aa48 upstream.

Commit 47ea0ddb1f56 ("platform/chrome: cros_ec_lpc: Separate host
command and irq disable") re-ordered the resume sequence. Before that
change, cros_ec resume sequence is:
1) Enable IRQ
2) Send resume event
3) Handle events during suspend

After commit 47ea0ddb1f56 ("platform/chrome: cros_ec_lpc: Separate host
command and irq disable"), cros_ec resume sequence is:
1) Enable IRQ
2) Handle events during suspend
3) Send resume event.

This re-ordering leads to delayed handling of any events queued between
items 2) and 3) with the updated sequence. Also in certain platforms, EC
skips triggering interrupt for certain events eg. mkbp events until the
resume event is received. Such events are stuck in the host event queue
indefinitely. This change puts back the original order to avoid any
delay in handling the pending events.

Fixes: 47ea0ddb1f56 ("platform/chrome: cros_ec_lpc: Separate host command and irq disable")
Cc: <stable@vger.kernel.org>
Cc: Lalith Rajendran <lalithkraj@chromium.org>
Cc: <chrome-platform@lists.linux.dev>
Signed-off-by: default avatarKarthikeyan Ramasubramanian <kramasub@chromium.org>
Link: https://lore.kernel.org/r/20240429121343.v2.1.If2e0cef959f1f6df9f4d1ab53a97c54aa54208af@changeid


Signed-off-by: default avatarTzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarZhangPeng <zhangpeng362@huawei.com>
parent eccf28ee
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -432,6 +432,12 @@ static void cros_ec_send_resume_event(struct cros_ec_device *ec_dev)
void cros_ec_resume_complete(struct cros_ec_device *ec_dev)
{
	cros_ec_send_resume_event(ec_dev);

	/*
	 * Let the mfd devices know about events that occur during
	 * suspend. This way the clients know what to do with them.
	 */
	cros_ec_report_events_during_suspend(ec_dev);
}
EXPORT_SYMBOL(cros_ec_resume_complete);

@@ -442,12 +448,6 @@ static void cros_ec_enable_irq(struct cros_ec_device *ec_dev)

	if (ec_dev->wake_enabled)
		disable_irq_wake(ec_dev->irq);

	/*
	 * Let the mfd devices know about events that occur during
	 * suspend. This way the clients know what to do with them.
	 */
	cros_ec_report_events_during_suspend(ec_dev);
}

/**
@@ -475,8 +475,8 @@ EXPORT_SYMBOL(cros_ec_resume_early);
 */
int cros_ec_resume(struct cros_ec_device *ec_dev)
{
	cros_ec_enable_irq(ec_dev);
	cros_ec_send_resume_event(ec_dev);
	cros_ec_resume_early(ec_dev);
	cros_ec_resume_complete(ec_dev);
	return 0;
}
EXPORT_SYMBOL(cros_ec_resume);