timeout_add(struct timeout *to, int ticks) waits `ticks / hz' seconds, which is ((period * hz) / 1000) / hz [s] = period / 1000 [s] = period [ms] in these cases.
With the zero check, this perfectly matches the millisecond version. This conversion by itself also lifts the implicit expection of `period' to be evenly divisible by ten; in case it was not, integer division would truncate it. To cross check this w.r.t. `period's order of magnitude and unit, see how /usr/src/sys/wscons/wskbd.c sets it up. In particular: 254:#define WSKBD_DEFAULT_BELL_PERIOD 100 /* 100ms */ Feedback? OK? Index: arch/sparc64/dev//beep.c =================================================================== RCS file: /cvs/src/sys/arch/sparc64/dev/beep.c,v retrieving revision 1.8 diff -u -p -r1.8 beep.c --- arch/sparc64/dev//beep.c 8 Sep 2017 05:36:52 -0000 1.8 +++ arch/sparc64/dev//beep.c 21 Jun 2019 19:30:08 -0000 @@ -218,11 +218,7 @@ void beep_bell(void *vsc, u_int pitch, u_int period, u_int volume, int poll) { struct beep_softc *sc = vsc; - int s, nticks; - - nticks = (period * hz) / 1000; - if (nticks <= 0) - nticks = 1; + int s; s = spltty(); if (sc->sc_bellactive) { @@ -239,7 +235,7 @@ beep_bell(void *vsc, u_int pitch, u_int sc->sc_belltimeout = 1; bus_space_write_1(sc->sc_iot, sc->sc_ioh, BEEP_CTRL, BEEP_CTRL_ON); - timeout_add(&sc->sc_to, nticks); + timeout_add_msec(&sc->sc_to, period); } splx(s); } Index: arch/sparc64/dev//beeper.c =================================================================== RCS file: /cvs/src/sys/arch/sparc64/dev/beeper.c,v retrieving revision 1.12 diff -u -p -r1.12 beeper.c --- arch/sparc64/dev//beeper.c 8 Sep 2017 05:36:52 -0000 1.12 +++ arch/sparc64/dev//beeper.c 21 Jun 2019 19:35:59 -0000 @@ -147,11 +147,7 @@ beeper_bell(vsc, pitch, period, volume, int poll; { struct beeper_softc *sc = vsc; - int s, nticks; - - nticks = (period * hz) / 1000; - if (nticks <= 0) - nticks = 1; + int s; s = spltty(); if (sc->sc_bellactive) { @@ -167,7 +163,7 @@ beeper_bell(vsc, pitch, period, volume, sc->sc_bellactive = 1; sc->sc_belltimeout = 1; bus_space_write_4(sc->sc_iot, sc->sc_ioh, BEEP_REG, 1); - timeout_add(&sc->sc_to, nticks); + timeout_add_msec(&sc->sc_to, period); } splx(s); }