18ce07fe7SLuiz Otavio O Souza.\" Copyright (c) 2013, Luiz Otavio O Souza <loos@FreeBSD.org> 28ce07fe7SLuiz Otavio O Souza.\" All rights reserved. 38ce07fe7SLuiz Otavio O Souza.\" 48ce07fe7SLuiz Otavio O Souza.\" Redistribution and use in source and binary forms, with or without 58ce07fe7SLuiz Otavio O Souza.\" modification, are permitted provided that the following conditions 68ce07fe7SLuiz Otavio O Souza.\" are met: 78ce07fe7SLuiz Otavio O Souza.\" 1. Redistributions of source code must retain the above copyright 88ce07fe7SLuiz Otavio O Souza.\" notice, this list of conditions and the following disclaimer. 98ce07fe7SLuiz Otavio O Souza.\" 2. Redistributions in binary form must reproduce the above copyright 108ce07fe7SLuiz Otavio O Souza.\" notice, this list of conditions and the following disclaimer in the 118ce07fe7SLuiz Otavio O Souza.\" documentation and/or other materials provided with the distribution. 128ce07fe7SLuiz Otavio O Souza.\" 138ce07fe7SLuiz Otavio O Souza.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 148ce07fe7SLuiz Otavio O Souza.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 158ce07fe7SLuiz Otavio O Souza.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 168ce07fe7SLuiz Otavio O Souza.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 178ce07fe7SLuiz Otavio O Souza.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 188ce07fe7SLuiz Otavio O Souza.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 198ce07fe7SLuiz Otavio O Souza.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 208ce07fe7SLuiz Otavio O Souza.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 218ce07fe7SLuiz Otavio O Souza.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 228ce07fe7SLuiz Otavio O Souza.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 238ce07fe7SLuiz Otavio O Souza.\" SUCH DAMAGE. 248ce07fe7SLuiz Otavio O Souza.\" 258ce07fe7SLuiz Otavio O Souza.\" $FreeBSD$ 268ce07fe7SLuiz Otavio O Souza.\" 279a2a079aSLuiz Otavio O Souza.Dd February 13, 2014 288ce07fe7SLuiz Otavio O Souza.Dt GPIOLED 4 298ce07fe7SLuiz Otavio O Souza.Os 308ce07fe7SLuiz Otavio O Souza.Sh NAME 318ce07fe7SLuiz Otavio O Souza.Nm gpioled 32*6a6ce390SChristian Brueffer.Nd GPIO LED generic device driver 338ce07fe7SLuiz Otavio O Souza.Sh SYNOPSIS 34*6a6ce390SChristian BruefferTo compile this driver into the kernel, 35*6a6ce390SChristian Bruefferplace the following lines in your 36*6a6ce390SChristian Bruefferkernel configuration file: 37*6a6ce390SChristian Brueffer.Bd -ragged -offset indent 388ce07fe7SLuiz Otavio O Souza.Cd "device gpio" 398ce07fe7SLuiz Otavio O Souza.Cd "device gpioled" 40*6a6ce390SChristian Brueffer.Ed 418ce07fe7SLuiz Otavio O Souza.Sh DESCRIPTION 428ce07fe7SLuiz Otavio O SouzaThe 43*6a6ce390SChristian Brueffer.Nm 44*6a6ce390SChristian Bruefferdriver provides glue to attach a 458ce07fe7SLuiz Otavio O Souza.Xr led 4 468ce07fe7SLuiz Otavio O Souzacompatible device to a GPIO pin. 47*6a6ce390SChristian BruefferEach LED in the system has a 488ce07fe7SLuiz Otavio O Souza.Pa name 49*6a6ce390SChristian Bruefferwhich is used to export a device as 508ce07fe7SLuiz Otavio O Souza.Pa /dev/led/<name> . 518ce07fe7SLuiz Otavio O SouzaThe GPIO pin can then be controlled by writing to this device as described 52*6a6ce390SChristian Bruefferin 538ce07fe7SLuiz Otavio O Souza.Xr led 4 . 548ce07fe7SLuiz Otavio O Souza.Pp 55*6a6ce390SChristian BruefferOn a 56*6a6ce390SChristian Brueffer.Xr device.hints 5 57*6a6ce390SChristian Bruefferbased system, like 58*6a6ce390SChristian Brueffer.Li MIPS , 59*6a6ce390SChristian Bruefferthese values are configurable for 608ce07fe7SLuiz Otavio O Souza.Nm : 618ce07fe7SLuiz Otavio O Souza.Bl -tag -width ".Va hint.gpioiic.%d.atXXX" 628ce07fe7SLuiz Otavio O Souza.It Va hint.gpioled.%d.at 638ce07fe7SLuiz Otavio O SouzaThe gpiobus you are attaching to. 648ce07fe7SLuiz Otavio O SouzaNormally assigned to gpiobus0. 658ce07fe7SLuiz Otavio O Souza.It Va hint.gpioled.%d.name 668ce07fe7SLuiz Otavio O SouzaArbitrary name of device in 678ce07fe7SLuiz Otavio O Souza.Pa /dev/led/ 688ce07fe7SLuiz Otavio O Souzato create for 698ce07fe7SLuiz Otavio O Souza.Xr led 4 . 708ce07fe7SLuiz Otavio O Souza.It Va hint.gpioled.%d.pins 718ce07fe7SLuiz Otavio O SouzaWhich pin on the GPIO interface to map to this instance. 728ce07fe7SLuiz Otavio O SouzaPlease note that this mask should only ever have one bit set 73*6a6ce390SChristian Brueffer(any other bits - i.e., pins - will be ignored). 748ce07fe7SLuiz Otavio O Souza.El 759a2a079aSLuiz Otavio O Souza.Pp 769a2a079aSLuiz Otavio O SouzaOn a 779a2a079aSLuiz Otavio O Souza.Xr FDT 4 789a2a079aSLuiz Otavio O Souzabased system, like 79*6a6ce390SChristian Brueffer.Li ARM , 80*6a6ce390SChristian Bruefferthe DTS part for a 819a2a079aSLuiz Otavio O Souza.Nm gpioled 829a2a079aSLuiz Otavio O Souzadevice usually looks like: 839a2a079aSLuiz Otavio O Souza.Bd -literal 849a2a079aSLuiz Otavio O Souzagpio: gpio { 859a2a079aSLuiz Otavio O Souza 869a2a079aSLuiz Otavio O Souza gpio-controller; 879a2a079aSLuiz Otavio O Souza ... 889a2a079aSLuiz Otavio O Souza 899a2a079aSLuiz Otavio O Souza led0 { 909a2a079aSLuiz Otavio O Souza compatible = "gpioled"; 919a2a079aSLuiz Otavio O Souza gpios = <&gpio 16 2 0>; /* GPIO pin 16. */ 929a2a079aSLuiz Otavio O Souza name = "ok"; 939a2a079aSLuiz Otavio O Souza }; 949a2a079aSLuiz Otavio O Souza 959a2a079aSLuiz Otavio O Souza led1 { 969a2a079aSLuiz Otavio O Souza compatible = "gpioled"; 979a2a079aSLuiz Otavio O Souza gpios = <&gpio 17 2 0>; /* GPIO pin 17. */ 989a2a079aSLuiz Otavio O Souza name = "user-led1"; 999a2a079aSLuiz Otavio O Souza }; 1009a2a079aSLuiz Otavio O Souza}; 1019a2a079aSLuiz Otavio O Souza.Ed 1029a2a079aSLuiz Otavio O Souza.Pp 103*6a6ce390SChristian BruefferOptionally, you can choose to combine all the LEDs under a single 1049a2a079aSLuiz Otavio O Souza.Dq gpio-leds 1059a2a079aSLuiz Otavio O Souzacompatible node: 1069a2a079aSLuiz Otavio O Souza.Bd -literal 1079a2a079aSLuiz Otavio O Souzasimplebus0 { 1089a2a079aSLuiz Otavio O Souza 1099a2a079aSLuiz Otavio O Souza ... 1109a2a079aSLuiz Otavio O Souza 1119a2a079aSLuiz Otavio O Souza leds { 1129a2a079aSLuiz Otavio O Souza compatible = "gpio-leds"; 1139a2a079aSLuiz Otavio O Souza 1149a2a079aSLuiz Otavio O Souza led0 { 1159a2a079aSLuiz Otavio O Souza gpios = <&gpio 16 2 0>; 1169a2a079aSLuiz Otavio O Souza name = "ok" 1179a2a079aSLuiz Otavio O Souza }; 1189a2a079aSLuiz Otavio O Souza 1199a2a079aSLuiz Otavio O Souza led1 { 1209a2a079aSLuiz Otavio O Souza gpios = <&gpio 17 2 0>; 1219a2a079aSLuiz Otavio O Souza name = "user-led1" 1229a2a079aSLuiz Otavio O Souza }; 1239a2a079aSLuiz Otavio O Souza }; 1249a2a079aSLuiz Otavio O Souza}; 1259a2a079aSLuiz Otavio O Souza.Ed 1269a2a079aSLuiz Otavio O Souza.Pp 127*6a6ce390SChristian BruefferBoth methods are equally supported and it is possible to have the LEDs 1289a2a079aSLuiz Otavio O Souzadefined with any sort of mix between the methods. 1299a2a079aSLuiz Otavio O SouzaThe only restriction is that a GPIO pin cannot be mapped by two different 1309a2a079aSLuiz Otavio O Souza(gpio)leds. 1319a2a079aSLuiz Otavio O Souza.Pp 1329a2a079aSLuiz Otavio O SouzaFor more details about the 1339a2a079aSLuiz Otavio O Souza.Va gpios 1349a2a079aSLuiz Otavio O Souzaproperty, please consult 1359a2a079aSLuiz Otavio O Souza.Pa /usr/src/sys/boot/fdt/dts/bindings-gpio.txt . 1369a2a079aSLuiz Otavio O Souza.Pp 1379a2a079aSLuiz Otavio O SouzaThe property 1389a2a079aSLuiz Otavio O Souza.Va name 139*6a6ce390SChristian Bruefferis the arbitrary name of the device in 1409a2a079aSLuiz Otavio O Souza.Pa /dev/led/ 1419a2a079aSLuiz Otavio O Souzato create for 1429a2a079aSLuiz Otavio O Souza.Xr led 4 . 1438ce07fe7SLuiz Otavio O Souza.Sh SEE ALSO 1449a2a079aSLuiz Otavio O Souza.Xr fdt 4 , 1458ce07fe7SLuiz Otavio O Souza.Xr gpio 4 , 146*6a6ce390SChristian Brueffer.Xr gpioiic 4 , 147*6a6ce390SChristian Brueffer.Xr led 4 1488ce07fe7SLuiz Otavio O Souza.Sh HISTORY 1498ce07fe7SLuiz Otavio O SouzaThe 1508ce07fe7SLuiz Otavio O Souza.Nm 1518ce07fe7SLuiz Otavio O Souzamanual page first appeared in 1528ce07fe7SLuiz Otavio O Souza.Fx 11.0 . 1538ce07fe7SLuiz Otavio O Souza.Sh AUTHORS 1548ce07fe7SLuiz Otavio O SouzaThis 1558ce07fe7SLuiz Otavio O Souzamanual page was written by 1568ce07fe7SLuiz Otavio O Souza.An Luiz Otavio O Souza . 157