From 2c9d92dc6112593f8f1f8b61ffe52a0ac5a5fb74 Mon Sep 17 00:00:00 2001 From: avg Date: Thu, 23 May 2019 11:15:22 +0000 Subject: [PATCH] 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 --- sys/dev/gpio/gpioled.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/gpio/gpioled.c b/sys/dev/gpio/gpioled.c index a4e6140cf4cb..a3d686478469 100644 --- a/sys/dev/gpio/gpioled.c +++ b/sys/dev/gpio/gpioled.c @@ -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);