Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Jun 2019 20:12:01 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r349208 - in stable/11: share/man/man4 sys/dev/gpio
Message-ID:  <201906192012.x5JKC1kN040505@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Wed Jun 19 20:12:00 2019
New Revision: 349208
URL: https://svnweb.freebsd.org/changeset/base/349208

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/11/share/man/man4/gpioled.4
  stable/11/sys/dev/gpio/gpioled.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/gpioled.4
==============================================================================
--- stable/11/share/man/man4/gpioled.4	Wed Jun 19 20:09:04 2019	(r349207)
+++ stable/11/share/man/man4/gpioled.4	Wed Jun 19 20:12:00 2019	(r349208)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 14, 2014
+.Dd May 23, 2019
 .Dt GPIOLED 4
 .Os
 .Sh NAME
@@ -71,6 +71,10 @@ to create for
 Which pin on the GPIO interface to map to this instance.
 Please note that this mask should only ever have one bit set
 (any other bits - i.e., pins - will be ignored).
+.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/11/sys/dev/gpio/gpioled.c
==============================================================================
--- stable/11/sys/dev/gpio/gpioled.c	Wed Jun 19 20:09:04 2019	(r349207)
+++ stable/11/sys/dev/gpio/gpioled.c	Wed Jun 19 20:12:00 2019	(r349208)
@@ -108,6 +108,8 @@ gpioled_attach(device_t dev)
 	if (resource_string_value(device_get_name(dev), 
 	    device_get_unit(dev), "name", &name))
 		name = NULL;
+	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);
@@ -148,3 +150,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906192012.x5JKC1kN040505>