1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
<table class="head">
<tr>
<td class="head-ltitle">GPIOLED(4)</td>
<td class="head-vol">Device Drivers Manual</td>
<td class="head-rtitle">GPIOLED(4)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">gpioled</code> — <span class="Nd">GPIO LED
generic device driver</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp">To compile this driver into the kernel, place the following lines
in your kernel configuration file:</p>
<div class="Bd Pp Bd-indent"><code class="Cd">device gpio</code>
<br/>
<code class="Cd">device gpioled</code></div>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The <code class="Nm">gpioled</code> driver provides glue to attach
a <a class="Xr">led(4)</a> compatible device to a GPIO pin. Each LED in the
system has a <span class="Pa">name</span> which is used to export a device
as <span class="Pa">/dev/led/<name></span>. The GPIO pin can then be
controlled by writing to this device as described in
<a class="Xr">led(4)</a>.</p>
<p class="Pp">On a <a class="Xr">device.hints(5)</a> based system, like
<code class="Li">MIPS</code>, these values are configurable for
<code class="Nm">gpioled</code>:</p>
<dl class="Bl-tag">
<dt id="hint.gpioled._d.at"><var class="Va">hint.gpioled.%d.at</var></dt>
<dd>The gpiobus you are attaching to. Normally assigned to gpiobus0.</dd>
<dt id="hint.gpioled._d.name"><var class="Va">hint.gpioled.%d.name</var></dt>
<dd>Arbitrary name of device in <span class="Pa">/dev/led/</span> to create
for <a class="Xr">led(4)</a>.</dd>
<dt id="hint.gpioled._d.pins"><var class="Va">hint.gpioled.%d.pins</var></dt>
<dd>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).</dd>
<dt id="hint.gpioled._d.invert"><var class="Va">hint.gpioled.%d.invert</var></dt>
<dd>Use pin inversion. If set to 1, the pin will be set to 0 to light the LED,
and 1 to clear it.</dd>
<dt id="hint.gpioled._d.invmode"><var class="Va">hint.gpioled.%d.invmode</var></dt>
<dd>Whether or not to use hardware support when pin inversion is requested.
Must be one of:
<dl class="Bl-tag">
<dt id="auto"><var class="Va">auto</var></dt>
<dd>Use hardware pin inversion if available, else fallback to software pin
inversion. This is the default.</dd>
<dt id="hw"><var class="Va">hw</var></dt>
<dd>Use hardware pin inversion.</dd>
<dt id="sw"><var class="Va">sw</var></dt>
<dd>Use software pin inversion.</dd>
</dl>
</dd>
<dt id="hint.gpioled._d.state"><var class="Va">hint.gpioled.%d.state</var></dt>
<dd>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.</dd>
</dl>
<p class="Pp">On a <a class="Xr">FDT(4)</a> based system, like
<code class="Li">ARM</code>, the DTS part for a
<code class="Nm">gpioled</code> device usually looks like:</p>
<div class="Bd Pp Li">
<pre>gpio: gpio {
gpio-controller;
...
led0 {
compatible = "gpioled";
gpios = <&gpio 16 2 0>; /* GPIO pin 16. */
name = "ok";
};
led1 {
compatible = "gpioled";
gpios = <&gpio 17 2 0>; /* GPIO pin 17. */
name = "user-led1";
};
};</pre>
</div>
<p class="Pp">Optionally, you can choose to combine all the LEDs under a single
“gpio-leds” compatible node:</p>
<div class="Bd Pp Li">
<pre>simplebus0 {
...
leds {
compatible = "gpio-leds";
led0 {
gpios = <&gpio 16 2 0>;
name = "ok"
};
led1 {
gpios = <&gpio 17 2 0>;
name = "user-led1"
};
};
};</pre>
</div>
<p class="Pp">Both methods are equally supported and it is possible to have the
LEDs defined with any sort of mix between the methods. The only restriction
is that a GPIO pin cannot be mapped by two different (gpio)leds.</p>
<p class="Pp">For more details about the <var class="Va">gpios</var> property,
please consult
<span class="Pa">/usr/src/sys/dts/bindings-gpio.txt</span>.</p>
<p class="Pp">The property <var class="Va">name</var> is the arbitrary name of
the device in <span class="Pa">/dev/led/</span> to create for
<a class="Xr">led(4)</a>.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><a class="Xr">fdt(4)</a>, <a class="Xr">gpio(4)</a>,
<a class="Xr">gpioiic(4)</a>, <a class="Xr">led(4)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp">The <code class="Nm">gpioled</code> manual page first appeared in
<span class="Ux">FreeBSD 10.1</span>.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
<p class="Pp">This manual page was written by <span class="An">Luiz Otavio O
Souza</span>.</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">May 23, 2019</td>
<td class="foot-os">FreeBSD 15.0</td>
</tr>
</table>
|