gpioled.4 (5748b897da441d1f10e1fe0c39155ea33d6d383a) gpioled.4 (6a6ce390c71e6d9db3677bfed4e82e29ee0da9c6)
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.

--- 15 unchanged lines hidden (view full) ---

24.\"
25.\" $FreeBSD$
26.\"
27.Dd February 13, 2014
28.Dt GPIOLED 4
29.Os
30.Sh NAME
31.Nm gpioled
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.

--- 15 unchanged lines hidden (view full) ---

24.\"
25.\" $FreeBSD$
26.\"
27.Dd February 13, 2014
28.Dt GPIOLED 4
29.Os
30.Sh NAME
31.Nm gpioled
32.Nd GPIO led generic device driver
32.Nd GPIO LED generic device driver
33.Sh SYNOPSIS
33.Sh SYNOPSIS
34To compile this driver into the kernel,
35place the following lines in your
36kernel configuration file:
37.Bd -ragged -offset indent
34.Cd "device gpio"
35.Cd "device gpioled"
38.Cd "device gpio"
39.Cd "device gpioled"
36.Pp
37This driver attaches a
38.Xr led 4
39device to a GPIO pin.
40.Ed
40.Sh DESCRIPTION
41The
41.Sh DESCRIPTION
42The
42.Em gpioled
43driver provides a glue to attach a
43.Nm
44driver provides glue to attach a
44.Xr led 4
45compatible device to a GPIO pin.
45.Xr led 4
46compatible device to a GPIO pin.
46Each led on the system has a
47Each LED in the system has a
47.Pa name
48.Pa name
48which is used to export a device in
49which is used to export a device as
49.Pa /dev/led/<name> .
50The GPIO pin can then be controlled by writing to this device as described
50.Pa /dev/led/<name> .
51The GPIO pin can then be controlled by writing to this device as described
51on
52in
52.Xr led 4 .
53.Pp
53.Xr led 4 .
54.Pp
54On a hint based system, like
55.Li MIPS , these values are configureable for
55On a
56.Xr device.hints 5
57based system, like
58.Li MIPS ,
59these values are configurable for
56.Nm :
57.Bl -tag -width ".Va hint.gpioiic.%d.atXXX"
58.It Va hint.gpioled.%d.at
59The gpiobus you are attaching to.
60Normally assigned to gpiobus0.
61.It Va hint.gpioled.%d.name
62Arbitrary name of device in
63.Pa /dev/led/
64to create for
65.Xr led 4 .
66.It Va hint.gpioled.%d.pins
67Which pin on the GPIO interface to map to this instance.
68Please note that this mask should only ever have one bit set
60.Nm :
61.Bl -tag -width ".Va hint.gpioiic.%d.atXXX"
62.It Va hint.gpioled.%d.at
63The gpiobus you are attaching to.
64Normally assigned to gpiobus0.
65.It Va hint.gpioled.%d.name
66Arbitrary name of device in
67.Pa /dev/led/
68to create for
69.Xr led 4 .
70.It Va hint.gpioled.%d.pins
71Which pin on the GPIO interface to map to this instance.
72Please note that this mask should only ever have one bit set
69(any others bits - i.e., pins - will be ignored).
73(any other bits - i.e., pins - will be ignored).
70.El
71.Pp
72On a
73.Xr FDT 4
74based system, like
74.El
75.Pp
76On a
77.Xr FDT 4
78based system, like
75.Li ARM , the dts part for a
79.Li ARM ,
80the DTS part for a
76.Nm gpioled
77device usually looks like:
78.Bd -literal
79gpio: gpio {
80
81 gpio-controller;
82 ...
83

--- 6 unchanged lines hidden (view full) ---

90 led1 {
91 compatible = "gpioled";
92 gpios = <&gpio 17 2 0>; /* GPIO pin 17. */
93 name = "user-led1";
94 };
95};
96.Ed
97.Pp
81.Nm gpioled
82device usually looks like:
83.Bd -literal
84gpio: gpio {
85
86 gpio-controller;
87 ...
88

--- 6 unchanged lines hidden (view full) ---

95 led1 {
96 compatible = "gpioled";
97 gpios = <&gpio 17 2 0>; /* GPIO pin 17. */
98 name = "user-led1";
99 };
100};
101.Ed
102.Pp
98And optionally, you can choose combine all the leds under a single
103Optionally, you can choose to combine all the LEDs under a single
99.Dq gpio-leds
100compatible node:
101.Bd -literal
102simplebus0 {
103
104 ...
105
106 leds {

--- 7 unchanged lines hidden (view full) ---

114 led1 {
115 gpios = <&gpio 17 2 0>;
116 name = "user-led1"
117 };
118 };
119};
120.Ed
121.Pp
104.Dq gpio-leds
105compatible node:
106.Bd -literal
107simplebus0 {
108
109 ...
110
111 leds {

--- 7 unchanged lines hidden (view full) ---

119 led1 {
120 gpios = <&gpio 17 2 0>;
121 name = "user-led1"
122 };
123 };
124};
125.Ed
126.Pp
122Both methods are equally supported and it is possible to have the leds
127Both methods are equally supported and it is possible to have the LEDs
123defined with any sort of mix between the methods.
124The only restriction is that a GPIO pin cannot be mapped by two different
125(gpio)leds.
126.Pp
127For more details about the
128.Va gpios
129property, please consult
130.Pa /usr/src/sys/boot/fdt/dts/bindings-gpio.txt .
131.Pp
132The property
133.Va name
128defined with any sort of mix between the methods.
129The only restriction is that a GPIO pin cannot be mapped by two different
130(gpio)leds.
131.Pp
132For more details about the
133.Va gpios
134property, please consult
135.Pa /usr/src/sys/boot/fdt/dts/bindings-gpio.txt .
136.Pp
137The property
138.Va name
134is the arbitrary name of device in
139is the arbitrary name of the device in
135.Pa /dev/led/
136to create for
137.Xr led 4 .
138.Sh SEE ALSO
139.Xr fdt 4 ,
140.Xr gpio 4 ,
140.Pa /dev/led/
141to create for
142.Xr led 4 .
143.Sh SEE ALSO
144.Xr fdt 4 ,
145.Xr gpio 4 ,
141.Xr led 4 ,
142.Xr gpioiic 4
146.Xr gpioiic 4 ,
147.Xr led 4
143.Sh HISTORY
144The
145.Nm
146manual page first appeared in
147.Fx 11.0 .
148.Sh AUTHORS
149This
150manual page was written by
151.An Luiz Otavio O Souza .
148.Sh HISTORY
149The
150.Nm
151manual page first appeared in
152.Fx 11.0 .
153.Sh AUTHORS
154This
155manual page was written by
156.An Luiz Otavio O Souza .