[Bug 280290] hms(4): Broken fresh after boot, fixed by resume

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 28 Oct 2024 14:53:10 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280290

--- Comment #34 from Vladimir Kondratyev <wulf@freebsd.org> ---
Try this patch (untested):

diff --git a/sys/dev/iicbus/iichid.c b/sys/dev/iicbus/iichid.c
index 6f0563d4e55..397c0917d43 100644
--- a/sys/dev/iicbus/iichid.c
+++ b/sys/dev/iicbus/iichid.c
@@ -1250,8 +1250,12 @@ iichid_attach(device_t dev)
                iichid_detach(dev);
        }
 done:
-       (void)iichid_set_power(sc, I2C_HID_POWER_OFF);
-       sc->power_on = false;
+       iicbus_request_bus(device_get_parent(dev), dev, IIC_WAIT);
+       if (!sc->open) {
+               (void)iichid_set_power(sc, I2C_HID_POWER_OFF);
+               sc->power_on = false;
+       }
+       iicbus_release_bus(device_get_parent(dev), dev);
        return (error);
 }

-- 
You are receiving this mail because:
You are the assignee for the bug.