gpioled: add a new hint for initial state

hint.gpioled.%d.state determines the initial state of the LED when the
driver takes control over it:
  0 - the LED is off
  1 - the LED is on
 -1 - the LED is kept as it was

While here, add a module version declaration.

MFC after:	2 weks
This commit is contained in:
avg 2019-05-23 11:15:22 +00:00
parent f97f5fe3be
commit 2c9d92dc61

View File

@ -115,6 +115,8 @@ gpioled_attach(device_t dev)
name = NULL;
resource_int_value(device_get_name(dev),
device_get_unit(dev), "invert", &sc->sc_invert);
resource_int_value(device_get_name(dev),
device_get_unit(dev), "state", &state);
sc->sc_leddev = led_create_state(gpioled_control, sc, name ? name :
device_get_nameunit(dev), state);
@ -155,3 +157,4 @@ static driver_t gpioled_driver = {
DRIVER_MODULE(gpioled, gpiobus, gpioled_driver, gpioled_devclass, 0, 0);
MODULE_DEPEND(gpioled, gpiobus, 1, 1, 1);
MODULE_VERSION(gpioled, 1);