svn commit: r348735 - in stable/12: share/man/man4 sys/dev/gpio

Andriy Gapon avg at FreeBSD.org
Thu Jun 6 11:42:28 UTC 2019


Author: avg
Date: Thu Jun  6 11:42:26 2019
New Revision: 348735
URL: https://svnweb.freebsd.org/changeset/base/348735

Log:
  MFC r348153-r348155: 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.

Modified:
  stable/12/share/man/man4/gpioled.4
  stable/12/sys/dev/gpio/gpioled.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/gpioled.4
==============================================================================
--- stable/12/share/man/man4/gpioled.4	Thu Jun  6 11:38:53 2019	(r348734)
+++ stable/12/share/man/man4/gpioled.4	Thu Jun  6 11:42:26 2019	(r348735)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 30, 2016
+.Dd May 23, 2019
 .Dt GPIOLED 4
 .Os
 .Sh NAME
@@ -73,6 +73,10 @@ Please note that this mask should only ever have one b
 (any other bits - i.e., pins - will be ignored).
 .It Va hint.gpioled.%d.invert
 If set to 1, the pin will be set to 0 to light the LED, and 1 to clear it.
+.It Va hint.gpioled.%d.state
+The initial state of the LED when the driver takes control over it.
+If set to 1 or 0, the LED will be on or off correspondingly.
+If set to -1, the LED will be kept in its original state.
 .El
 .Pp
 On a

Modified: stable/12/sys/dev/gpio/gpioled.c
==============================================================================
--- stable/12/sys/dev/gpio/gpioled.c	Thu Jun  6 11:38:53 2019	(r348734)
+++ stable/12/sys/dev/gpio/gpioled.c	Thu Jun  6 11:42:26 2019	(r348735)
@@ -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);


More information about the svn-src-all mailing list