xref: /freebsd/usr.sbin/gpioctl/gpioctl.8 (revision 69b96cd3008d003f21c874f80746bc1e40840e31)
1968ec6a6SOleksandr Tymoshenko.\" Copyright (c) 1980, 1991, 1993
2968ec6a6SOleksandr Tymoshenko.\"	The Regents of the University of California.  All rights reserved.
3968ec6a6SOleksandr Tymoshenko.\"
4968ec6a6SOleksandr Tymoshenko.\" Redistribution and use in source and binary forms, with or without
5968ec6a6SOleksandr Tymoshenko.\" modification, are permitted provided that the following conditions
6968ec6a6SOleksandr Tymoshenko.\" are met:
7968ec6a6SOleksandr Tymoshenko.\" 1. Redistributions of source code must retain the above copyright
8968ec6a6SOleksandr Tymoshenko.\"    notice, this list of conditions and the following disclaimer.
9968ec6a6SOleksandr Tymoshenko.\" 2. Redistributions in binary form must reproduce the above copyright
10968ec6a6SOleksandr Tymoshenko.\"    notice, this list of conditions and the following disclaimer in the
11968ec6a6SOleksandr Tymoshenko.\"    documentation and/or other materials provided with the distribution.
12fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
13968ec6a6SOleksandr Tymoshenko.\"    may be used to endorse or promote products derived from this software
14968ec6a6SOleksandr Tymoshenko.\"    without specific prior written permission.
15968ec6a6SOleksandr Tymoshenko.\"
16968ec6a6SOleksandr Tymoshenko.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17968ec6a6SOleksandr Tymoshenko.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18968ec6a6SOleksandr Tymoshenko.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19968ec6a6SOleksandr Tymoshenko.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20968ec6a6SOleksandr Tymoshenko.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21968ec6a6SOleksandr Tymoshenko.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22968ec6a6SOleksandr Tymoshenko.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23968ec6a6SOleksandr Tymoshenko.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24968ec6a6SOleksandr Tymoshenko.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25968ec6a6SOleksandr Tymoshenko.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26968ec6a6SOleksandr Tymoshenko.\" SUCH DAMAGE.
27968ec6a6SOleksandr Tymoshenko.\"
28968ec6a6SOleksandr Tymoshenko.\" $FreeBSD$
29968ec6a6SOleksandr Tymoshenko.\"
30*69b96cd3SRomain Tartière.Dd June 6, 2018
31*69b96cd3SRomain Tartière.Dt GPIOCTL 8
32968ec6a6SOleksandr Tymoshenko.Os
33968ec6a6SOleksandr Tymoshenko.Sh NAME
34968ec6a6SOleksandr Tymoshenko.Nm gpioctl
35968ec6a6SOleksandr Tymoshenko.Nd GPIO control utility
36968ec6a6SOleksandr Tymoshenko.Sh SYNOPSIS
37968ec6a6SOleksandr Tymoshenko.Nm
3822e3858cSSean Bruno.Op Fl f Ar ctldev
39d752f0f6SLuiz Otavio O Souza.Cm -l
40968ec6a6SOleksandr Tymoshenko.Op Fl v
41968ec6a6SOleksandr Tymoshenko.Nm
4222e3858cSSean Bruno.Op Fl f Ar ctldev
433b2bb133SOleksandr Tymoshenko.Op Fl pN
44d752f0f6SLuiz Otavio O Souza.Cm -t
45968ec6a6SOleksandr Tymoshenko.Ar pin
46968ec6a6SOleksandr Tymoshenko.Nm
4722e3858cSSean Bruno.Op Fl f Ar ctldev
483b2bb133SOleksandr Tymoshenko.Op Fl pN
49d752f0f6SLuiz Otavio O Souza.Cm -c
50968ec6a6SOleksandr Tymoshenko.Ar pin
51968ec6a6SOleksandr Tymoshenko.Ar flag
52968ec6a6SOleksandr Tymoshenko.Op flag ...
53968ec6a6SOleksandr Tymoshenko.Nm
54d752f0f6SLuiz Otavio O Souza.Op Fl f Ar ctldev
553b2bb133SOleksandr Tymoshenko.Op Fl pN
56d752f0f6SLuiz Otavio O Souza.Cm -n
57d752f0f6SLuiz Otavio O Souza.Ar pin
58d752f0f6SLuiz Otavio O Souza.Ar pin-name
59d752f0f6SLuiz Otavio O Souza.Nm
6022e3858cSSean Bruno.Op Cm -f Ar ctldev
613b2bb133SOleksandr Tymoshenko.Op Fl pN
62968ec6a6SOleksandr Tymoshenko.Ar pin
63968ec6a6SOleksandr Tymoshenko.Ar [0|1]
64968ec6a6SOleksandr Tymoshenko.Sh DESCRIPTION
65968ec6a6SOleksandr TymoshenkoThe
66968ec6a6SOleksandr Tymoshenko.Nm
67968ec6a6SOleksandr Tymoshenkoutility could be used to manage GPIO pins from userland and list available pins.
68968ec6a6SOleksandr Tymoshenko.Pp
693b2bb133SOleksandr TymoshenkoThe
703b2bb133SOleksandr Tymoshenko.Pa pin
713b2bb133SOleksandr Tymoshenkoargument can either be a
723b2bb133SOleksandr Tymoshenko.Pa pin-number
733b2bb133SOleksandr Tymoshenkoor a
743b2bb133SOleksandr Tymoshenko.Pa pin-name .
753b2bb133SOleksandr TymoshenkoIf it is a number and a pin has this number as its name and you did not use
763b2bb133SOleksandr Tymoshenko.Fl N
773b2bb133SOleksandr Tymoshenkoor
783b2bb133SOleksandr Tymoshenko.Fl p
793b2bb133SOleksandr Tymoshenko, then
803b2bb133SOleksandr Tymoshenko.Nm
813b2bb133SOleksandr Tymoshenkoexits.
823b2bb133SOleksandr Tymoshenko.Pp
83968ec6a6SOleksandr TymoshenkoThe options are as follows:
84968ec6a6SOleksandr Tymoshenko.Bl -tag -width ".Fl f Ar ctldev"
85968ec6a6SOleksandr Tymoshenko.It Fl c Ar pin Ar flag Op flag ...
86de85f85aSLuiz Otavio O SouzaConfigure pin by setting provided flags.
87de85f85aSLuiz Otavio O SouzaThe following flags are currently defined:
88968ec6a6SOleksandr Tymoshenko.Bl -tag -offset indent -width ".Cm PULSE"
89968ec6a6SOleksandr Tymoshenko.It Cm IN
90968ec6a6SOleksandr TymoshenkoInput pin
91968ec6a6SOleksandr Tymoshenko.It Cm OUT
92968ec6a6SOleksandr TymoshenkoOutput pin
93968ec6a6SOleksandr Tymoshenko.It Cm OD
94968ec6a6SOleksandr TymoshenkoOpen drain pin
95968ec6a6SOleksandr Tymoshenko.It Cm PP
96968ec6a6SOleksandr TymoshenkoPush pull pin
97968ec6a6SOleksandr Tymoshenko.It Cm TS
98968ec6a6SOleksandr TymoshenkoTristate pin
99968ec6a6SOleksandr Tymoshenko.It Cm PU
100968ec6a6SOleksandr TymoshenkoPull-up pin
101968ec6a6SOleksandr Tymoshenko.It Cm PD
102968ec6a6SOleksandr TymoshenkoPull-down pin
103968ec6a6SOleksandr Tymoshenko.It Cm II
104968ec6a6SOleksandr TymoshenkoInverted input pin
105968ec6a6SOleksandr Tymoshenko.It Cm IO
106968ec6a6SOleksandr TymoshenkoInverted output pin
107968ec6a6SOleksandr Tymoshenko.El
108968ec6a6SOleksandr Tymoshenko.It Fl f Ar ctldev
109968ec6a6SOleksandr TymoshenkoGPIO controller device to use
11022e3858cSSean BrunoIf not specified, defaults to
11122e3858cSSean Bruno.Pa /dev/gpioc0
112968ec6a6SOleksandr Tymoshenko.It Fl l
113968ec6a6SOleksandr Tymoshenkolist available pins
114d752f0f6SLuiz Otavio O Souza.It Fl n Ar pin Ar pin-name
115d752f0f6SLuiz Otavio O Souzaset the name used to describe the pin
116968ec6a6SOleksandr Tymoshenko.It Fl t Ar pin
1173b2bb133SOleksandr Tymoshenkotoggle value of provided pin
118968ec6a6SOleksandr Tymoshenko.It Fl v
119968ec6a6SOleksandr Tymoshenkobe verbose: for each listed pin print current configuration
1203b2bb133SOleksandr Tymoshenko.It Fl p
1213b2bb133SOleksandr TymoshenkoForce
1223b2bb133SOleksandr Tymoshenko.Pa pin
1233b2bb133SOleksandr Tymoshenkoto be interpreted as a pin number
1243b2bb133SOleksandr Tymoshenko.It Fl N
1253b2bb133SOleksandr TymoshenkoForce
1263b2bb133SOleksandr Tymoshenko.Pa pin
1273b2bb133SOleksandr Tymoshenkoto be interpreted as a pin name
128968ec6a6SOleksandr Tymoshenko.El
129968ec6a6SOleksandr Tymoshenko.Sh EXAMPLES
130968ec6a6SOleksandr Tymoshenko.Bl -bullet
131968ec6a6SOleksandr Tymoshenko.It
132e74fe876SBenedict ReuschlingList pins available on GPIO controller defined by device /dev/gpioc0
133968ec6a6SOleksandr Tymoshenko.Pp
134e74fe876SBenedict Reuschlinggpioctl -f /dev/gpioc0 -l
135968ec6a6SOleksandr Tymoshenko.It
136968ec6a6SOleksandr TymoshenkoSet the value of pin 12 to 1
137968ec6a6SOleksandr Tymoshenko.Pp
138e74fe876SBenedict Reuschlinggpioctl -f /dev/gpioc0 12 1
139968ec6a6SOleksandr Tymoshenko.It
140968ec6a6SOleksandr TymoshenkoConfigure pin 12 to be input pin
141968ec6a6SOleksandr Tymoshenko.Pp
142e74fe876SBenedict Reuschlinggpioctl -f /dev/gpioc0 -c 12 IN
1433b2bb133SOleksandr Tymoshenko.It
1443b2bb133SOleksandr TymoshenkoSet the name of pin 12 to test
1453b2bb133SOleksandr Tymoshenko.Pp
1463b2bb133SOleksandr Tymoshenkogpioctl -f /dev/gpioc0 -n 12 test
1473b2bb133SOleksandr Tymoshenko.It
1483b2bb133SOleksandr TymoshenkoToggle the value the pin named test
1493b2bb133SOleksandr Tymoshenko.Pp
1503b2bb133SOleksandr Tymoshenkogpioctl -f /dev/gpioc0 -t test
1513b2bb133SOleksandr Tymoshenko.It
1523b2bb133SOleksandr TymoshenkoToggle the value of pin number 12 even if another pin has the name 12
1533b2bb133SOleksandr Tymoshenko.Pp
1543b2bb133SOleksandr Tymoshenkogpioctl -f /dev/gpioc0 -pt 12
155968ec6a6SOleksandr Tymoshenko.El
156dbcb0e96SSean Bruno.Sh SEE ALSO
157914f6e62SJoel Dahl.Xr gpio 4 ,
158914f6e62SJoel Dahl.Xr gpioiic 4 ,
1598ce07fe7SLuiz Otavio O Souza.Xr gpioled 4
160968ec6a6SOleksandr Tymoshenko.Sh HISTORY
161968ec6a6SOleksandr TymoshenkoThe
162968ec6a6SOleksandr Tymoshenko.Nm
163968ec6a6SOleksandr Tymoshenkoutility appeared in
164968ec6a6SOleksandr Tymoshenko.Fx 9.0 .
165968ec6a6SOleksandr Tymoshenko.Sh AUTHORS
166968ec6a6SOleksandr Tymoshenko.An -nosplit
167968ec6a6SOleksandr TymoshenkoThe
168968ec6a6SOleksandr Tymoshenko.Nm
169968ec6a6SOleksandr Tymoshenkoutility and this manual page were written by
17001c2b8acSBaptiste Daroussin.An Oleksandr Tymoshenko Aq Mt gonzo@freebsd.org .
171