git: 77ec8dd61cb7 - stable/13 - iichid(4): Perform acknowledgement of I2C device interrupt after RESET command

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Thu, 24 Feb 2022 01:06:37 UTC
The branch stable/13 has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=77ec8dd61cb77ce7471dc0009bc8ec48b5e2cf81

commit 77ec8dd61cb77ce7471dc0009bc8ec48b5e2cf81
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2021-11-30 21:29:50 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2022-02-24 01:05:33 +0000

    iichid(4): Perform acknowledgement of I2C device interrupt after RESET command
    
    in sampling mode to workaround firmware bug.
    
    This fixes reboot or poweroff on frame.work laptops after first touch.
    
    (cherry picked from commit c508b0818b245ea136d6538d68868cb3541f8f8f)
---
 sys/dev/iicbus/iichid.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/dev/iicbus/iichid.c b/sys/dev/iicbus/iichid.c
index d95ffb8add88..a36ed9bb8538 100644
--- a/sys/dev/iicbus/iichid.c
+++ b/sys/dev/iicbus/iichid.c
@@ -1134,6 +1134,11 @@ iichid_attach(device_t dev)
 		&sc->sampling_hysteresis, 0,
 		"number of missing samples before enabling of slow mode");
 	hid_add_dynamic_quirk(&sc->hw, HQ_IICHID_SAMPLING);
+
+	if (sc->sampling_rate_slow >= 0) {
+		pause("iichid", (hz + 999) / 1000);
+		(void)iichid_cmd_read(sc, NULL, 0, NULL);
+	}
 #endif /* IICHID_SAMPLING */
 
 	child = device_add_child(dev, "hidbus", -1);