Index: tipmic.c =================================================================== RCS file: /cvs/src/sys/dev/acpi/tipmic.c,v retrieving revision 1.7 diff -u -p -r1.7 tipmic.c --- tipmic.c 6 Apr 2022 18:59:27 -0000 1.7 +++ tipmic.c 26 Feb 2023 23:56:04 -0000 @@ -276,6 +276,25 @@ struct tipmic_regmap tipmic_thermal_regm { 0x18, TIPMIC_SYSTEMP_HI, TIPMIC_SYSTEMP_LO } }; +static int +tipmic_wait_adc(struct tipmic_softc *sc) +{ + int i; + + if (!cold) { + return (tsleep_nsec(&sc->sc_stat_adc, PRIBIO, "tipmic", + SEC_TO_NSEC(1))); + } + + for (i = 0; i < 1000; i++) { + delay(1000); + if (tipmic_intr(sc) == 1) + return (0); + } + + return (EWOULDBLOCK); +} + int tipmic_thermal_opreg_handler(void *cookie, int iodir, uint64_t address, int size, uint64_t *value) @@ -333,8 +352,7 @@ tipmic_thermal_opreg_handler(void *cooki splx(s); while (sc->sc_stat_adc == 0) { - if (tsleep_nsec(&sc->sc_stat_adc, PRIBIO, "tipmic", - SEC_TO_NSEC(1))) { + if (tipmic_wait_adc(sc)) { printf("%s: ADC timeout\n", sc->sc_dev.dv_xname); break; }