]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man4/gpioled.4
Remove deprecated GEOM classes
[FreeBSD/FreeBSD.git] / share / man / man4 / gpioled.4
1 .\" Copyright (c) 2013, Luiz Otavio O Souza <loos@FreeBSD.org>
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\"
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 .\" SUCH DAMAGE.
24 .\"
25 .\" $FreeBSD$
26 .\"
27 .Dd May 23, 2019
28 .Dt GPIOLED 4
29 .Os
30 .Sh NAME
31 .Nm gpioled
32 .Nd GPIO LED generic device driver
33 .Sh SYNOPSIS
34 To compile this driver into the kernel,
35 place the following lines in your
36 kernel configuration file:
37 .Bd -ragged -offset indent
38 .Cd "device gpio"
39 .Cd "device gpioled"
40 .Ed
41 .Sh DESCRIPTION
42 The
43 .Nm
44 driver provides glue to attach a
45 .Xr led 4
46 compatible device to a GPIO pin.
47 Each LED in the system has a
48 .Pa name
49 which is used to export a device as
50 .Pa /dev/led/<name> .
51 The GPIO pin can then be controlled by writing to this device as described
52 in
53 .Xr led 4 .
54 .Pp
55 On a
56 .Xr device.hints 5
57 based system, like
58 .Li MIPS ,
59 these values are configurable for
60 .Nm :
61 .Bl -tag -width ".Va hint.gpioiic.%d.atXXX"
62 .It Va hint.gpioled.%d.at
63 The gpiobus you are attaching to.
64 Normally assigned to gpiobus0.
65 .It Va hint.gpioled.%d.name
66 Arbitrary name of device in
67 .Pa /dev/led/
68 to create for
69 .Xr led 4 .
70 .It Va hint.gpioled.%d.pins
71 Which pin on the GPIO interface to map to this instance.
72 Please note that this mask should only ever have one bit set
73 (any other bits - i.e., pins - will be ignored).
74 .It Va hint.gpioled.%d.invert
75 If set to 1, the pin will be set to 0 to light the LED, and 1 to clear it.
76 .It Va hint.gpioled.%d.state
77 The initial state of the LED when the driver takes control over it.
78 If set to 1 or 0, the LED will be on or off correspondingly.
79 If set to -1, the LED will be kept in its original state.
80 .El
81 .Pp
82 On a
83 .Xr FDT 4
84 based system, like
85 .Li ARM ,
86 the DTS part for a
87 .Nm gpioled
88 device usually looks like:
89 .Bd -literal
90 gpio: gpio {
91
92         gpio-controller;
93         ...
94
95         led0 {
96                 compatible = "gpioled";
97                 gpios = <&gpio 16 2 0>;         /* GPIO pin 16. */
98                 name = "ok";
99         };
100
101         led1 {
102                 compatible = "gpioled";
103                 gpios = <&gpio 17 2 0>;         /* GPIO pin 17. */
104                 name = "user-led1";
105         };
106 };
107 .Ed
108 .Pp
109 Optionally, you can choose to combine all the LEDs under a single
110 .Dq gpio-leds
111 compatible node:
112 .Bd -literal
113 simplebus0 {
114
115         ...
116
117         leds {
118                 compatible = "gpio-leds";
119
120                 led0 {
121                         gpios = <&gpio 16 2 0>;
122                         name = "ok"
123                 };
124
125                 led1 {
126                         gpios = <&gpio 17 2 0>;
127                         name = "user-led1"
128                 };
129         };
130 };
131 .Ed
132 .Pp
133 Both methods are equally supported and it is possible to have the LEDs
134 defined with any sort of mix between the methods.
135 The only restriction is that a GPIO pin cannot be mapped by two different
136 (gpio)leds.
137 .Pp
138 For more details about the
139 .Va gpios
140 property, please consult
141 .Pa /usr/src/sys/dts/bindings-gpio.txt .
142 .Pp
143 The property
144 .Va name
145 is the arbitrary name of the device in
146 .Pa /dev/led/
147 to create for
148 .Xr led 4 .
149 .Sh SEE ALSO
150 .Xr fdt 4 ,
151 .Xr gpio 4 ,
152 .Xr gpioiic 4 ,
153 .Xr led 4
154 .Sh HISTORY
155 The
156 .Nm
157 manual page first appeared in
158 .Fx 10.1 .
159 .Sh AUTHORS
160 This
161 manual page was written by
162 .An Luiz Otavio O Souza .