1*fd71220bSRobert Mustacchi.\" 2*fd71220bSRobert Mustacchi.\" This file and its contents are supplied under the terms of the 3*fd71220bSRobert Mustacchi.\" Common Development and Distribution License ("CDDL"), version 1.0. 4*fd71220bSRobert Mustacchi.\" You may only use this file in accordance with the terms of version 5*fd71220bSRobert Mustacchi.\" 1.0 of the CDDL. 6*fd71220bSRobert Mustacchi.\" 7*fd71220bSRobert Mustacchi.\" A full copy of the text of the CDDL should have accompanied this 8*fd71220bSRobert Mustacchi.\" source. A copy of the CDDL is also available via the Internet at 9*fd71220bSRobert Mustacchi.\" http://www.illumos.org/license/CDDL. 10*fd71220bSRobert Mustacchi.\" 11*fd71220bSRobert Mustacchi.\" 12*fd71220bSRobert Mustacchi.\" Copyright 2022 Oxide Computer Company 13*fd71220bSRobert Mustacchi.\" 14*fd71220bSRobert Mustacchi.Dd September 17, 2022 15*fd71220bSRobert Mustacchi.Dt GPIOADM 8 16*fd71220bSRobert Mustacchi.Os 17*fd71220bSRobert Mustacchi.Sh NAME 18*fd71220bSRobert Mustacchi.Nm gpioadm 19*fd71220bSRobert Mustacchi.Nd gpio and dpio administration 20*fd71220bSRobert Mustacchi.Sh SYNOPSIS 21*fd71220bSRobert Mustacchi.Nm 22*fd71220bSRobert Mustacchi.Cm controller 23*fd71220bSRobert Mustacchi.Cm list 24*fd71220bSRobert Mustacchi.Op Fl H 25*fd71220bSRobert Mustacchi.Op Fl o Ar field Ns [,...] Op Fl p 26*fd71220bSRobert Mustacchi.Op Ar filter Ns ... 27*fd71220bSRobert Mustacchi.Nm 28*fd71220bSRobert Mustacchi.Cm gpio 29*fd71220bSRobert Mustacchi.Cm list 30*fd71220bSRobert Mustacchi.Op Fl H 31*fd71220bSRobert Mustacchi.Op Fl 1 32*fd71220bSRobert Mustacchi.Op Fl o Ar field Ns [,...] Op Fl p 33*fd71220bSRobert Mustacchi.Op Ar filter Ns ... 34*fd71220bSRobert Mustacchi.Nm 35*fd71220bSRobert Mustacchi.Cm gpio 36*fd71220bSRobert Mustacchi.Cm attr 37*fd71220bSRobert Mustacchi.Cm get 38*fd71220bSRobert Mustacchi.Op Fl H 39*fd71220bSRobert Mustacchi.Op Fl o Ar field Ns [,...] Op Fl p 40*fd71220bSRobert Mustacchi.Ar controller/gpio 41*fd71220bSRobert Mustacchi.Op Ar filter Ns ... 42*fd71220bSRobert Mustacchi.Nm 43*fd71220bSRobert Mustacchi.Cm gpio 44*fd71220bSRobert Mustacchi.Cm attr 45*fd71220bSRobert Mustacchi.Cm set 46*fd71220bSRobert Mustacchi.Ar controller/gpio 47*fd71220bSRobert Mustacchi.Ar attr=value 48*fd71220bSRobert Mustacchi.Op Ar attr=value Ns ... 49*fd71220bSRobert Mustacchi.Nm 50*fd71220bSRobert Mustacchi.Cm dpio 51*fd71220bSRobert Mustacchi.Cm list 52*fd71220bSRobert Mustacchi.Op Fl H 53*fd71220bSRobert Mustacchi.Op Fl o Ar field Ns [,...] Op Fl p 54*fd71220bSRobert Mustacchi.Op Ar filter Ns ... 55*fd71220bSRobert Mustacchi.Nm 56*fd71220bSRobert Mustacchi.Cm dpio 57*fd71220bSRobert Mustacchi.Cm define 58*fd71220bSRobert Mustacchi.Op Fl r 59*fd71220bSRobert Mustacchi.Op Fl w 60*fd71220bSRobert Mustacchi.Op Fl K 61*fd71220bSRobert Mustacchi.Ar controller/gpio 62*fd71220bSRobert Mustacchi.Ar name 63*fd71220bSRobert Mustacchi.Nm 64*fd71220bSRobert Mustacchi.Cm dpio 65*fd71220bSRobert Mustacchi.Cm undefine 66*fd71220bSRobert Mustacchi.Ar controller/gpio 67*fd71220bSRobert Mustacchi.Sh DESCRIPTION 68*fd71220bSRobert MustacchiThe 69*fd71220bSRobert Mustacchi.Nm 70*fd71220bSRobert Mustacchiutility is used to enumerate and manipulate the general purpose and 71*fd71220bSRobert Mustacchidedicated purpose I/Os 72*fd71220bSRobert Mustacchi.Pq GPIO and DPIO 73*fd71220bSRobert Mustacchiand their controllers that are present in the system. 74*fd71220bSRobert MustacchiFor more background on the GPIO and DPIO subsystem, please see 75*fd71220bSRobert Mustacchi.Xr gpio 7 . 76*fd71220bSRobert Mustacchi.Pp 77*fd71220bSRobert MustacchiThere are three top-level objects in 78*fd71220bSRobert Mustacchi.Nm : 79*fd71220bSRobert Mustacchi.Bl -tag -width Ds 80*fd71220bSRobert Mustacchi.It GPIOs 81*fd71220bSRobert MustacchiGeneral Purpose I/Os are software controllable pins that exist on 82*fd71220bSRobert Mustacchivarious hardware devices. 83*fd71220bSRobert MustacchiGPIOs are identified by a human-readable name and a controller-specific 84*fd71220bSRobert Mustacchinumeric ID 85*fd71220bSRobert Mustacchi.Po 86*fd71220bSRobert Mustacchiwhich has no relation to the hardware or datasheet's numbering of GPIOs, 87*fd71220bSRobert Mustacchithese are used by the kernel to identify GPIOs 88*fd71220bSRobert Mustacchi.Pc . 89*fd71220bSRobert MustacchiAll 90*fd71220bSRobert Mustacchi.Nm 91*fd71220bSRobert Mustacchioperations allow a GPIO to be named either by its human-readable name 92*fd71220bSRobert Mustacchior its controller-specific ID. 93*fd71220bSRobert Mustacchi.Nm 94*fd71220bSRobert Mustacchiwill always attempt to resolve a string as a GPIO's name first and will 95*fd71220bSRobert Mustacchionly attempt to parse it as a GPIO's ID if there is no GPIO with that 96*fd71220bSRobert Mustacchiname. 97*fd71220bSRobert Mustacchi.Pp 98*fd71220bSRobert MustacchiGPIOs themselves contain a series of attributes which vary based on the 99*fd71220bSRobert Mustacchicontroller. 100*fd71220bSRobert MustacchiAn attribute itself may be read-only or read-write and controls one 101*fd71220bSRobert Mustacchiaspect of the GPIO. 102*fd71220bSRobert MustacchiFor example, there are attributes for things such as the name of the 103*fd71220bSRobert Mustacchidevice, which pin it corresponds to on the package, what the current 104*fd71220bSRobert Mustacchiinput and output values are, whether there are pull-up or pull-down 105*fd71220bSRobert Mustacchiresistors enabled, and much more. 106*fd71220bSRobert Mustacchi.Pp 107*fd71220bSRobert MustacchiGPIOs support the discovery and manipulation of their attributes through 108*fd71220bSRobert Mustacchithe 109*fd71220bSRobert Mustacchi.Cm attr 110*fd71220bSRobert Mustacchi.Cm get 111*fd71220bSRobert Mustacchiand 112*fd71220bSRobert Mustacchi.Cm attr 113*fd71220bSRobert Mustacchi.Cm set 114*fd71220bSRobert Mustacchisubcommands. 115*fd71220bSRobert MustacchiManipulating attributes can 116*fd71220bSRobert Mustacchi.Sy potentially damage 117*fd71220bSRobert Mustacchiyour system. 118*fd71220bSRobert MustacchiDocumentation of specific attributes, may potentially be found in 119*fd71220bSRobert Mustacchiprovider-specific driver manual pages in section 4D. 120*fd71220bSRobert Mustacchi.It Controllers 121*fd71220bSRobert MustacchiThese are hardware devices that provide access to GPIOs. 122*fd71220bSRobert Mustacchi.Nm 123*fd71220bSRobert Mustacchiprovides the ability to list and get basic information about these 124*fd71220bSRobert Mustacchicontrollers. 125*fd71220bSRobert MustacchiControllers are not manipulated directly but are indirectly used when 126*fd71220bSRobert Mustacchigetting information about and manipulating GPIOs and DPIOs. 127*fd71220bSRobert Mustacchi.It DPIOs 128*fd71220bSRobert MustacchiDedicated Purpose I/Os are devices which wrap up and constrain a GPIO 129*fd71220bSRobert Mustacchiwhile allowing one to indicate that there are particular semantics. 130*fd71220bSRobert MustacchiUnlike a GPIO which has a full series of attributes, a DPIO provides 131*fd71220bSRobert Mustacchigeneric access to reading the current input value and setting the output 132*fd71220bSRobert Mustacchivalue, while freezing all other attributes of the underlying GPIO. 133*fd71220bSRobert MustacchiFor more background on DPIOs, how they work, and why the exist, please 134*fd71220bSRobert Mustacchisee 135*fd71220bSRobert Mustacchi.Xr dpio 7 . 136*fd71220bSRobert Mustacchi.Pp 137*fd71220bSRobert MustacchiSpecifically, 138*fd71220bSRobert Mustacchi.Nm 139*fd71220bSRobert Mustacchisupports the creation of DPIOs from a GPIO using the 140*fd71220bSRobert Mustacchi.Cm dpio 141*fd71220bSRobert Mustacchi.Cm define 142*fd71220bSRobert Mustacchisubcommand and release a GPIO from being a DPIO through the 143*fd71220bSRobert Mustacchi.Cm dpio 144*fd71220bSRobert Mustacchi.Cm undefine 145*fd71220bSRobert Mustacchisubcommand. 146*fd71220bSRobert Mustacchi.El 147*fd71220bSRobert Mustacchi.Pp 148*fd71220bSRobert MustacchiAll listing operations leverage the standard illumos output format 149*fd71220bSRobert Mustacchilibrary 150*fd71220bSRobert Mustacchi.Po 151*fd71220bSRobert Mustacchi.Xr ofmt 3OFMT 152*fd71220bSRobert Mustacchi.Pc 153*fd71220bSRobert Mustacchiallowing the selection of specific output fields, the omission of the 154*fd71220bSRobert Mustacchiheader 155*fd71220bSRobert Mustacchi.Pq Fl H , 156*fd71220bSRobert Mustacchiand a parsable mode intended for programmatic consumption 157*fd71220bSRobert Mustacchi.Pq Fl p . 158*fd71220bSRobert MustacchiWhen requesting parsable output, the colon 159*fd71220bSRobert Mustacchi.Po 160*fd71220bSRobert Mustacchi.Do 161*fd71220bSRobert Mustacchi: 162*fd71220bSRobert Mustacchi.Dc 163*fd71220bSRobert Mustacchi.Pc 164*fd71220bSRobert Mustacchicharacter is used as a delimiter between fields and any delimiters that 165*fd71220bSRobert Mustacchiwould appear in an output field will be escaped with a backslash 166*fd71220bSRobert Mustacchicharacter 167*fd71220bSRobert Mustacchi.Po 168*fd71220bSRobert Mustacchi.Do 169*fd71220bSRobert Mustacchi\e 170*fd71220bSRobert Mustacchi.Dc 171*fd71220bSRobert Mustacchi.Pc . 172*fd71220bSRobert Mustacchi.Pp 173*fd71220bSRobert MustacchiGetting information about GPIOs, DPIOs, and controllers currently 174*fd71220bSRobert Mustacchirequires that a process have the 175*fd71220bSRobert Mustacchi.Brq Dv PRIV_SYS_DEVICES 176*fd71220bSRobert Mustacchiprivilege. 177*fd71220bSRobert Mustacchi.Ss Persistence 178*fd71220bSRobert MustacchiCurrently there is no persistence across reboots of any changes that are 179*fd71220bSRobert Mustacchimade to GPIO attributes. 180*fd71220bSRobert MustacchiSimilarly, any DPIOs that are created and manipulated only last until 181*fd71220bSRobert Mustacchithe next reboot of the system. 182*fd71220bSRobert Mustacchi.Sh SUBCOMMANDS 183*fd71220bSRobert MustacchiThe following commands are supported by 184*fd71220bSRobert Mustacchi.Nm : 185*fd71220bSRobert Mustacchi.Bl -tag -width "" 186*fd71220bSRobert Mustacchi.It Xo 187*fd71220bSRobert Mustacchi.Nm 188*fd71220bSRobert Mustacchi.Cm controller 189*fd71220bSRobert Mustacchi.Cm list 190*fd71220bSRobert Mustacchi.Op Fl H 191*fd71220bSRobert Mustacchi.Op Fl o Ar field Ns [,...] Op Fl p 192*fd71220bSRobert Mustacchi.Op Ar filter Ns ... 193*fd71220bSRobert Mustacchi.Xc 194*fd71220bSRobert MustacchiList all of the GPIO controllers in the system and basic information 195*fd71220bSRobert Mustacchiabout them. 196*fd71220bSRobert Mustacchi.Pp 197*fd71220bSRobert MustacchiThe following fields are supported: 198*fd71220bSRobert Mustacchi.Bl -tag -width CONTROLLER 199*fd71220bSRobert Mustacchi.It Sy CONTROLLER 200*fd71220bSRobert MustacchiThis is the name of the GPIO controller in the system. 201*fd71220bSRobert Mustacchi.It Sy NGPIOS 202*fd71220bSRobert MustacchiThe number of GPIOs that the controller supports. 203*fd71220bSRobert MustacchiThis value will not change unless the controller driver changes somehow. 204*fd71220bSRobert Mustacchi.It Sy NDPIOS 205*fd71220bSRobert MustacchiThe number of DPIOs that the controller currently actively has. 206*fd71220bSRobert MustacchiThis value will change over time depending on the creation and removal 207*fd71220bSRobert Mustacchiof DPIOs. 208*fd71220bSRobert Mustacchi.It Sy PROVIDER 209*fd71220bSRobert MustacchiThe 210*fd71220bSRobert Mustacchi.Pa /devices 211*fd71220bSRobert Mustacchipath to the kernel provider for this GPIO controller. 212*fd71220bSRobert Mustacchi.It Sy PATH 213*fd71220bSRobert MustacchiThe 214*fd71220bSRobert Mustacchi.Pa /devices 215*fd71220bSRobert Mustacchipath to the GPIO controller minor node. 216*fd71220bSRobert Mustacchi.El 217*fd71220bSRobert Mustacchi.Pp 218*fd71220bSRobert MustacchiThe following options are supported: 219*fd71220bSRobert Mustacchi.Bl -tag -width Fl 220*fd71220bSRobert Mustacchi.It Fl H 221*fd71220bSRobert MustacchiOmit the column header when printing output. 222*fd71220bSRobert Mustacchi.It Fl o Ar field Ns [,...] 223*fd71220bSRobert MustacchiA comma-delineated list of fields to output, selected from the ones 224*fd71220bSRobert Mustacchiabove. 225*fd71220bSRobert Mustacchi.It Fl p 226*fd71220bSRobert MustacchiDisplays the output in a machine-parsable format. 227*fd71220bSRobert MustacchiWhen requesting parsable output, the 228*fd71220bSRobert Mustacchi.Fl o 229*fd71220bSRobert Mustacchioption is required to specifically control which fields are included. 230*fd71220bSRobert Mustacchi.El 231*fd71220bSRobert Mustacchi.Pp 232*fd71220bSRobert MustacchiThe following operands are supported: 233*fd71220bSRobert Mustacchi.Bl -tag -width Ar 234*fd71220bSRobert Mustacchi.It Ar filter 235*fd71220bSRobert MustacchiOne or more filters may be specified that are used to constrain the list 236*fd71220bSRobert Mustacchiof GPIO controllers that are printed. 237*fd71220bSRobert MustacchiEach 238*fd71220bSRobert Mustacchi.Ar filter 239*fd71220bSRobert Mustacchiis the name of a GPIO controller that matches the aforementioned 240*fd71220bSRobert Mustacchi.Sy CONTROLLER 241*fd71220bSRobert Mustacchifield. 242*fd71220bSRobert Mustacchi.Pp 243*fd71220bSRobert MustacchiIf any filter is specified and does not match, then that is treated as 244*fd71220bSRobert Mustacchian error. 245*fd71220bSRobert Mustacchi.Pp 246*fd71220bSRobert MustacchiBecause these are filters, they do not control the order that items are 247*fd71220bSRobert Mustacchiprinted out, only what is printed out. 248*fd71220bSRobert Mustacchi.El 249*fd71220bSRobert Mustacchi.It Xo 250*fd71220bSRobert Mustacchi.Nm 251*fd71220bSRobert Mustacchi.Cm gpio 252*fd71220bSRobert Mustacchi.Cm list 253*fd71220bSRobert Mustacchi.Op Fl H 254*fd71220bSRobert Mustacchi.Op Fl 1 255*fd71220bSRobert Mustacchi.Op Fl o Ar field Ns [,...] Op Fl p 256*fd71220bSRobert Mustacchi.Op Ar filter Ns ... 257*fd71220bSRobert Mustacchi.Xc 258*fd71220bSRobert MustacchiList all of the GPIOs in the system across all controllers. 259*fd71220bSRobert Mustacchi.Pp 260*fd71220bSRobert MustacchiThe following fields are supported: 261*fd71220bSRobert Mustacchi.Bl -tag -width CONTROLLER 262*fd71220bSRobert Mustacchi.It Sy CONTROLLER 263*fd71220bSRobert MustacchiThis is the name of the GPIO controller in the system. 264*fd71220bSRobert Mustacchi.It Sy GPIO 265*fd71220bSRobert MustacchiThis is the name of the GPIO provided by its controller. 266*fd71220bSRobert MustacchiGPIO names are not unique in the system and are scoped to their 267*fd71220bSRobert Mustacchicontroller. 268*fd71220bSRobert Mustacchi.It Sy ID 269*fd71220bSRobert MustacchiThe numeric ID of the GPIO. 270*fd71220bSRobert MustacchiThis is used as part of getting and setting attributes as well as when 271*fd71220bSRobert Mustacchidefining and undefining DPIOs. 272*fd71220bSRobert Mustacchi.El 273*fd71220bSRobert Mustacchi.Pp 274*fd71220bSRobert MustacchiThe following options are supported: 275*fd71220bSRobert Mustacchi.Bl -tag -width Fl 276*fd71220bSRobert Mustacchi.It Fl 1 277*fd71220bSRobert MustacchiExit non-zero if the list operation outputs more than one item. 278*fd71220bSRobert MustacchiThis is generally used in conjunction with a specific 279*fd71220bSRobert Mustacchi.Ar filter 280*fd71220bSRobert Mustacchithat would include both a controller and a GPIO name. 281*fd71220bSRobert Mustacchi.It Fl H 282*fd71220bSRobert MustacchiOmit the column header when printing output. 283*fd71220bSRobert Mustacchi.It Fl o Ar field Ns [,...] 284*fd71220bSRobert MustacchiA comma-delineated list of fields to output, selected from the ones 285*fd71220bSRobert Mustacchiabove. 286*fd71220bSRobert Mustacchi.It Fl p 287*fd71220bSRobert MustacchiDisplays the output in a machine-parsable format. 288*fd71220bSRobert MustacchiWhen requesting parsable output, the 289*fd71220bSRobert Mustacchi.Fl o 290*fd71220bSRobert Mustacchioption is required to specifically control which fields are included. 291*fd71220bSRobert Mustacchi.El 292*fd71220bSRobert MustacchiThe following operands are supported: 293*fd71220bSRobert Mustacchi.Bl -tag -width Ar 294*fd71220bSRobert Mustacchi.It Ar filter 295*fd71220bSRobert MustacchiOne or more filters that are used to constrain the list of GPIOs that 296*fd71220bSRobert Mustacchiare printed. 297*fd71220bSRobert MustacchiEach filter may combine a GPIO controller and a GPIO name. 298*fd71220bSRobert MustacchiThere are three general forms: 299*fd71220bSRobert Mustacchi.Bl -tag -width Ar 300*fd71220bSRobert Mustacchi.It Ar controller 301*fd71220bSRobert MustacchiThis filter matches all GPIOs that are present under the controller 302*fd71220bSRobert Mustacchinamed by 303*fd71220bSRobert Mustacchi.Ar controller . 304*fd71220bSRobert Mustacchi.It Ar */gpio 305*fd71220bSRobert MustacchiThis filter matches all controllers, but only prints GPIOs with the 306*fd71220bSRobert Mustacchispecified name 307*fd71220bSRobert Mustacchi.Ar gpio . 308*fd71220bSRobert Mustacchi.It Ar controller/gpio 309*fd71220bSRobert MustacchiThis is the intersection of the prior two filters. 310*fd71220bSRobert MustacchiThis filter will only print if both a GPIO's controller and its name 311*fd71220bSRobert Mustacchimatch the specified values. 312*fd71220bSRobert Mustacchi.El 313*fd71220bSRobert Mustacchi.Pp 314*fd71220bSRobert MustacchiLike with other filters, this does not control the order that matches 315*fd71220bSRobert Mustacchiare printed in and 316*fd71220bSRobert Mustacchi.Nm 317*fd71220bSRobert Mustacchiwill error if not all filters are used. 318*fd71220bSRobert MustacchiThe filters can be combined with the 319*fd71220bSRobert Mustacchi.Fl 1 320*fd71220bSRobert Mustacchioption to guarantee that only a single GPIO is matched. 321*fd71220bSRobert Mustacchi.El 322*fd71220bSRobert Mustacchi.It Xo 323*fd71220bSRobert Mustacchi.Nm 324*fd71220bSRobert Mustacchi.Cm gpio 325*fd71220bSRobert Mustacchi.Cm attr 326*fd71220bSRobert Mustacchi.Cm get 327*fd71220bSRobert Mustacchi.Op Fl H 328*fd71220bSRobert Mustacchi.Op Fl o Ar field Ns [,...] Op Fl p 329*fd71220bSRobert Mustacchi.Ar controller/gpio 330*fd71220bSRobert Mustacchi.Op Ar filter Ns ... 331*fd71220bSRobert Mustacchi.Xc 332*fd71220bSRobert MustacchiThe 333*fd71220bSRobert Mustacchi.Cm gpio 334*fd71220bSRobert Mustacchi.Cm attr 335*fd71220bSRobert Mustacchi.Cm get 336*fd71220bSRobert Mustacchisubcommand is used to display all of the attributes of a single GPIO 337*fd71220bSRobert Mustacchithat is specified by 338*fd71220bSRobert Mustacchi.Ar controller/gpio . 339*fd71220bSRobert MustacchiThe 340*fd71220bSRobert Mustacchi.Ar controller 341*fd71220bSRobert Mustacchipart of that is the name of the controller. 342*fd71220bSRobert MustacchiThe 343*fd71220bSRobert Mustacchi.Ar gpio 344*fd71220bSRobert Mustacchipart is either the name or ID of the GPIO. 345*fd71220bSRobert Mustacchi.Pp 346*fd71220bSRobert MustacchiFor each of a single GPIO's attributes, the name of the attribute, its 347*fd71220bSRobert Mustacchicurrent value, what permissions exist for its value, and then what 348*fd71220bSRobert Mustacchivalues are possible to st for it are displayed. 349*fd71220bSRobert MustacchiFilters can be used to limit which attributes are displayed. 350*fd71220bSRobert Mustacchi.Pp 351*fd71220bSRobert MustacchiThe following fields are supported: 352*fd71220bSRobert Mustacchi.Bl -tag -width POSSIBLE 353*fd71220bSRobert Mustacchi.It Sy ATTR 354*fd71220bSRobert MustacchiThis is the name of the attribute. 355*fd71220bSRobert MustacchiIt is split into a provider name and then a specific attribute name as 356*fd71220bSRobert Mustacchiall attributes are generally scoped to their provider. 357*fd71220bSRobert Mustacchi.It Sy PERM 358*fd71220bSRobert MustacchiThis indicates the current permissions for manipulating this attribute. 359*fd71220bSRobert MustacchiThis is treated as a two character field with 360*fd71220bSRobert Mustacchi.Sq r 361*fd71220bSRobert Mustacchistanding for reading the value and 362*fd71220bSRobert Mustacchi.Sq w 363*fd71220bSRobert Mustacchistanding for writing the value. 364*fd71220bSRobert Mustacchi.It Sy VALUE 365*fd71220bSRobert MustacchiThis is the current value of the attribute. 366*fd71220bSRobert MustacchiIt will generally be rendered as a human-readable string when 367*fd71220bSRobert Mustacchiappropriate so that way the value can be understood and does not require 368*fd71220bSRobert Mustacchiunderstanding the underlying provider's specific values. 369*fd71220bSRobert Mustacchi.It Sy POSSIBLE 370*fd71220bSRobert MustacchiA list of all possible values that are supported for this field. 371*fd71220bSRobert MustacchiThis allows one to know what they can possibly set for this attribute. 372*fd71220bSRobert MustacchiFor some read-only attributes this field may not have a value. 373*fd71220bSRobert Mustacchi.It Sy RAW 374*fd71220bSRobert MustacchiThis provides the underlying provider's value for this attribute. 375*fd71220bSRobert MustacchiFor string based attributes, this is the same as the 376*fd71220bSRobert Mustacchi.Sy VALUE 377*fd71220bSRobert Mustacchifield. 378*fd71220bSRobert MustacchiFor other attributes, such as those which are uint32 values under the 379*fd71220bSRobert Mustacchihood, these are the hexadecimal form of the integer. 380*fd71220bSRobert Mustacchi.El 381*fd71220bSRobert Mustacchi.Pp 382*fd71220bSRobert MustacchiThe following options are supported: 383*fd71220bSRobert Mustacchi.Bl -tag -width Fl 384*fd71220bSRobert Mustacchi.It Fl H 385*fd71220bSRobert MustacchiOmit the column header when printing output. 386*fd71220bSRobert Mustacchi.It Fl o Ar field Ns [,...] 387*fd71220bSRobert MustacchiA comma-delineated list of fields to output, selected from the ones 388*fd71220bSRobert Mustacchiabove. 389*fd71220bSRobert Mustacchi.It Fl p 390*fd71220bSRobert MustacchiDisplays the output in a machine-parsable format. 391*fd71220bSRobert MustacchiWhen requesting parsable output, the 392*fd71220bSRobert Mustacchi.Fl o 393*fd71220bSRobert Mustacchioption is required to specifically control which fields are included. 394*fd71220bSRobert Mustacchi.El 395*fd71220bSRobert MustacchiThe following operands are supported: 396*fd71220bSRobert Mustacchi.Bl -tag -width Ar 397*fd71220bSRobert Mustacchi.It Ar filter 398*fd71220bSRobert MustacchiOne or more filters may be specified that are used to constrain the list 399*fd71220bSRobert Mustacchiof GPIO attributes that are printed. 400*fd71220bSRobert MustacchiEach 401*fd71220bSRobert Mustacchi.Ar filter 402*fd71220bSRobert Mustacchiis the name of a GPIO attributes that matches the aforementioned 403*fd71220bSRobert Mustacchi.Sy ATTR 404*fd71220bSRobert Mustacchifield. 405*fd71220bSRobert Mustacchi.El 406*fd71220bSRobert Mustacchi.It Xo 407*fd71220bSRobert Mustacchi.Nm 408*fd71220bSRobert Mustacchi.Cm gpio 409*fd71220bSRobert Mustacchi.Cm attr 410*fd71220bSRobert Mustacchi.Cm set 411*fd71220bSRobert Mustacchi.Ar controller/gpio 412*fd71220bSRobert Mustacchi.Ar attr=value 413*fd71220bSRobert Mustacchi.Op Ar attr=value Ns ... 414*fd71220bSRobert Mustacchi.Xc 415*fd71220bSRobert MustacchiThe 416*fd71220bSRobert Mustacchi.Cm gpio 417*fd71220bSRobert Mustacchi.Cm attr 418*fd71220bSRobert Mustacchi.Cm set 419*fd71220bSRobert Mustacchisubcommand is used to set one or more attributes of the GPIO that is 420*fd71220bSRobert Mustacchinamed by 421*fd71220bSRobert Mustacchi.Ar controller/gpio . 422*fd71220bSRobert MustacchiThe 423*fd71220bSRobert Mustacchi.Ar controller 424*fd71220bSRobert Mustacchipart of that is the name of the controller. 425*fd71220bSRobert MustacchiThe 426*fd71220bSRobert Mustacchi.Ar gpio 427*fd71220bSRobert Mustacchipart is either the name or ID of the GPIO. 428*fd71220bSRobert Mustacchi.Pp 429*fd71220bSRobert MustacchiAll attributes that are specified are given to the hardware to apply at 430*fd71220bSRobert Mustacchionce which generally means that either all of them should be applied or 431*fd71220bSRobert Mustacchinone of them will be. 432*fd71220bSRobert MustacchiThis allows a change from one atomic state to another without worrying 433*fd71220bSRobert Mustacchiabout how to construct an attribute by attribute path from one state to 434*fd71220bSRobert Mustacchithe next, which may not be safe. 435*fd71220bSRobert Mustacchi.Pp 436*fd71220bSRobert MustacchiAttributes and values are separated with the equals character 437*fd71220bSRobert Mustacchi.Po 438*fd71220bSRobert Mustacchi.Do 439*fd71220bSRobert Mustacchi= 440*fd71220bSRobert Mustacchi.Dc 441*fd71220bSRobert Mustacchi.Pc . 442*fd71220bSRobert Mustacchi.Ar attr 443*fd71220bSRobert Mustacchishould be the full name of an attribute. 444*fd71220bSRobert Mustacchi.Ar value 445*fd71220bSRobert Mustacchiis the value to set. 446*fd71220bSRobert Mustacchi.Nm 447*fd71220bSRobert Mustacchiwill automatically convert the human-readable strings that describe 448*fd71220bSRobert Mustacchivalues into the appropriate underlying provider-specific form. 449*fd71220bSRobert MustacchiTo see which values are valid, look at the 450*fd71220bSRobert Mustacchi.Sy POSSIBLE 451*fd71220bSRobert Mustacchicolumn when getting the attributes. 452*fd71220bSRobert Mustacchi.It Xo 453*fd71220bSRobert Mustacchi.Nm 454*fd71220bSRobert Mustacchi.Cm dpio 455*fd71220bSRobert Mustacchi.Cm list 456*fd71220bSRobert Mustacchi.Op Fl H 457*fd71220bSRobert Mustacchi.Op Fl o Ar field Ns [,...] Op Fl p 458*fd71220bSRobert Mustacchi.Op Ar filter Ns ... 459*fd71220bSRobert Mustacchi.Xc 460*fd71220bSRobert MustacchiThe 461*fd71220bSRobert Mustacchi.Cm dpio 462*fd71220bSRobert Mustacchi.Cm list 463*fd71220bSRobert Mustacchisubcommand lists all the DPIOs that have been created from GPIOs in the 464*fd71220bSRobert Mustacchisystem. 465*fd71220bSRobert Mustacchi.Pp 466*fd71220bSRobert MustacchiThe following fields are supported: 467*fd71220bSRobert Mustacchi.Bl -tag -width CONTROLLER 468*fd71220bSRobert Mustacchi.It Sy DPIO 469*fd71220bSRobert MustacchiThis is the name of a DPIO. 470*fd71220bSRobert MustacchiDPIO names are unique in the system and a DPIO can be found in the 471*fd71220bSRobert Mustacchifilesystem at 472*fd71220bSRobert Mustacchi.Pa /dev/dpio/<name> . 473*fd71220bSRobert Mustacchi.It Sy CAPS 474*fd71220bSRobert MustacchiThis is a list of capabilities that a DPIO supports, which is a 475*fd71220bSRobert Mustacchicombination of what the underlying provider supports and what a user 476*fd71220bSRobert Mustacchirequested when creating the DPIO. 477*fd71220bSRobert MustacchiThe following are the current capabilities, though this list may expand 478*fd71220bSRobert Mustacchiin the future: 479*fd71220bSRobert Mustacchi.Bl -tag -width write 480*fd71220bSRobert Mustacchi.It read 481*fd71220bSRobert MustacchiIndicates that the DPIO supports the various 482*fd71220bSRobert Mustacchi.Xr read 2 483*fd71220bSRobert Mustacchifamily of functions. 484*fd71220bSRobert MustacchiReading a DPIO returns the current value the DPIO sees on its pin in the 485*fd71220bSRobert Mustacchiform of a 4 byte 486*fd71220bSRobert Mustacchi.Vt dpio_input_t . 487*fd71220bSRobert MustacchiSee 488*fd71220bSRobert Mustacchi.Xr dpio 7 489*fd71220bSRobert Mustacchifor more information. 490*fd71220bSRobert Mustacchi.It write 491*fd71220bSRobert MustacchiIndicates that the DPIO supports the various 492*fd71220bSRobert Mustacchi.Xr write 2 493*fd71220bSRobert Mustacchifamily of functions. 494*fd71220bSRobert MustacchiWriting a DPIO changes the value that it is outputting on its pin. 495*fd71220bSRobert MustacchiWrites must always be a 4 byte 496*fd71220bSRobert Mustacchi.Vt dpio_output_t 497*fd71220bSRobert Mustacchivalue. 498*fd71220bSRobert MustacchiSee 499*fd71220bSRobert Mustacchi.Xr dpio 7 500*fd71220bSRobert Mustacchifor more information. 501*fd71220bSRobert Mustacchi.It poll 502*fd71220bSRobert MustacchiThis indicates that the DPIO can be polled for changes to its input 503*fd71220bSRobert Mustacchivalue via the 504*fd71220bSRobert Mustacchi.Dv POLLIN 505*fd71220bSRobert Mustacchievent with functions such as 506*fd71220bSRobert Mustacchi.Xr poll 2 , 507*fd71220bSRobert Mustacchi.Xr port_create 3C , 508*fd71220bSRobert Mustacchiand others. 509*fd71220bSRobert MustacchiIn addition, the timestamp of when the last change was detected can be 510*fd71220bSRobert Mustacchiretrieved via a device-specific 511*fd71220bSRobert Mustacchi.Xr ioctl 2 . 512*fd71220bSRobert MustacchiThis capability will not show up if the read capability is not present. 513*fd71220bSRobert MustacchiSee 514*fd71220bSRobert Mustacchi.Xr dpio 7 515*fd71220bSRobert Mustacchifor more information. 516*fd71220bSRobert Mustacchi.El 517*fd71220bSRobert Mustacchi.It Sy FLAGS 518*fd71220bSRobert MustacchiThis is a series of different flags that describe different aspects of 519*fd71220bSRobert Mustacchithe DPIOs behavior. 520*fd71220bSRobert MustacchiThe flags are organized and printed a series of letters where a 521*fd71220bSRobert Mustacchi.Sq - 522*fd71220bSRobert Mustacchicharacter denotes that a flag is not set and a letter indicates that a 523*fd71220bSRobert Mustacchiflag is set. 524*fd71220bSRobert MustacchiThe currently defined flags are: 525*fd71220bSRobert Mustacchi.Bl -tag -width K 526*fd71220bSRobert Mustacchi.It K 527*fd71220bSRobert MustacchiIndicates that the DPIO may only be used by the kernel in a layered 528*fd71220bSRobert Mustacchifashion 529*fd71220bSRobert Mustacchi.Po 530*fd71220bSRobert Mustacchie.g. it must be opened by 531*fd71220bSRobert Mustacchi.Xr ldi_open_by_name 9F 532*fd71220bSRobert Mustacchior a similar LDI call 533*fd71220bSRobert Mustacchi.Pc . 534*fd71220bSRobert Mustacchi.Pp 535*fd71220bSRobert MustacchiUsers of this field should not assume that the number of flags is fixed. 536*fd71220bSRobert MustacchiWhen additional flag are added, they will be appended to the current 537*fd71220bSRobert Mustacchiset, ensuring that the order does not change. 538*fd71220bSRobert MustacchiThe appearance of additional characters in the string is what allows 539*fd71220bSRobert Mustacchicallers to know that a new flag is present and gives software and humans 540*fd71220bSRobert Mustacchithe ability to distinguish changes. 541*fd71220bSRobert Mustacchi.El 542*fd71220bSRobert Mustacchi.It Sy CONTROLLER 543*fd71220bSRobert MustacchiThis is the name of the GPIO controller that the DPIO is leveraging. 544*fd71220bSRobert MustacchiWhen combined with the 545*fd71220bSRobert Mustacchi.Sy GPIONUM 546*fd71220bSRobert Mustacchifield, this uniquely identifies the GPIO that powers the DPIO. 547*fd71220bSRobert MustacchiThis name is the same as would show up in the 548*fd71220bSRobert Mustacchi.Cm controller 549*fd71220bSRobert Mustacchi.Cm list 550*fd71220bSRobert Mustacchisubcommand. 551*fd71220bSRobert Mustacchi.It Sy GPIONUM 552*fd71220bSRobert MustacchiThis is the ID of the GPIO on the specified controller that the DPIO has 553*fd71220bSRobert Mustacchiwrapped up and constrained. 554*fd71220bSRobert Mustacchi.El 555*fd71220bSRobert Mustacchi.It Xo 556*fd71220bSRobert Mustacchi.Nm 557*fd71220bSRobert Mustacchi.Cm dpio 558*fd71220bSRobert Mustacchi.Cm define 559*fd71220bSRobert Mustacchi.Op Fl r 560*fd71220bSRobert Mustacchi.Op Fl w 561*fd71220bSRobert Mustacchi.Op Fl K 562*fd71220bSRobert Mustacchi.Ar controller/gpio 563*fd71220bSRobert Mustacchi.Ar name 564*fd71220bSRobert Mustacchi.Xc 565*fd71220bSRobert MustacchiThe 566*fd71220bSRobert Mustacchi.Cm dpio 567*fd71220bSRobert Mustacchi.Cm define 568*fd71220bSRobert Mustacchisubcommand creates a new DPIO named 569*fd71220bSRobert Mustacchi.Ar name 570*fd71220bSRobert Mustacchifrom the specified GPIO 571*fd71220bSRobert Mustacchi.Ar controller/gpio . 572*fd71220bSRobert MustacchiA DPIO's name may be up to 31 characters. 573*fd71220bSRobert MustacchiThe first character must be alphanumeric, after which, hyphens, 574*fd71220bSRobert Mustacchiunderscores, periods, and plus signs are also allowed 575*fd71220bSRobert Mustacchi.Po 576*fd71220bSRobert Mustacchi.Sq - , 577*fd71220bSRobert Mustacchi.Sq _ , 578*fd71220bSRobert Mustacchi.Sq \&. , 579*fd71220bSRobert Mustacchi.Sq + 580*fd71220bSRobert Mustacchi.Pc . 581*fd71220bSRobert MustacchiOnce created, a new character device will be present at 582*fd71220bSRobert Mustacchi.Pa /dev/dpio/<name> 583*fd71220bSRobert Mustacchiand the GPIOs attributes will be frozen other than those that are 584*fd71220bSRobert Mustacchiallowed for the DPIO to operate. 585*fd71220bSRobert MustacchiAfter that point, the 586*fd71220bSRobert Mustacchi.Cm gpio 587*fd71220bSRobert Mustacchi.Cm attr 588*fd71220bSRobert Mustacchi.Cm set 589*fd71220bSRobert Mustacchicommand will always fail until the DPIO is removed. 590*fd71220bSRobert Mustacchi.Pp 591*fd71220bSRobert MustacchiThe following options are supported, which modify the behavior of what the 592*fd71220bSRobert MustacchiDPIO is allowed to do: 593*fd71220bSRobert Mustacchi.Bl -tag -width Fl 594*fd71220bSRobert Mustacchi.It Fl K 595*fd71220bSRobert MustacchiThe DPIO will be constrained such that only the kernel can open it. 596*fd71220bSRobert MustacchiSee the description of the 597*fd71220bSRobert Mustacchi.Dq K 598*fd71220bSRobert Mustacchiflag above. 599*fd71220bSRobert Mustacchi.It Fl r 600*fd71220bSRobert MustacchiThis allows the DPIO to be read and return the current logical value 601*fd71220bSRobert Mustacchithat the pin sees. 602*fd71220bSRobert MustacchiSee the description of the read capability above for more information. 603*fd71220bSRobert Mustacchi.It Fl w 604*fd71220bSRobert MustacchiThis allows the DPIO's logical output value to be set or disabled. 605*fd71220bSRobert MustacchiSee the description of the write capability above for more information. 606*fd71220bSRobert Mustacchi.El 607*fd71220bSRobert Mustacchi.Pp 608*fd71220bSRobert MustacchiWhile it may seem weird, it is allowed to create a DPIO and not specify 609*fd71220bSRobert Mustacchieither of 610*fd71220bSRobert Mustacchi.Fl r 611*fd71220bSRobert Mustacchior 612*fd71220bSRobert Mustacchi.Fl w . 613*fd71220bSRobert MustacchiSuch a DPIO will simply remain in its fixed state. 614*fd71220bSRobert MustacchiFor example, if its attributes have it set up to drive a particular 615*fd71220bSRobert Mustacchioutput value 616*fd71220bSRobert Mustacchi.Pq or none at all for an open-drain based pin 617*fd71220bSRobert Mustacchithen that will remain constant throughout the life of the DPIO. 618*fd71220bSRobert Mustacchi.It Xo 619*fd71220bSRobert Mustacchi.Nm 620*fd71220bSRobert Mustacchi.Cm dpio 621*fd71220bSRobert Mustacchi.Cm undefine 622*fd71220bSRobert Mustacchi.Ar controller/gpio 623*fd71220bSRobert Mustacchi.Xc 624*fd71220bSRobert MustacchiThe 625*fd71220bSRobert Mustacchi.Cm dpio 626*fd71220bSRobert Mustacchi.Cm undefine 627*fd71220bSRobert Mustacchisubcommand releases the corresponding DPIO that was named by its GPIO 628*fd71220bSRobert Mustacchicontroller and specific GPIO. 629*fd71220bSRobert MustacchiIf the DPIO is currently in use, this will fail. 630*fd71220bSRobert MustacchiOnce successfully completed, the 631*fd71220bSRobert Mustacchi.Pa /dev 632*fd71220bSRobert Mustacchientry 633*fd71220bSRobert Mustacchi.Pa /dev/dpio/<name> 634*fd71220bSRobert Mustacchiwill be removed and the GPIOs attributes will be unfrozen, allowing them 635*fd71220bSRobert Mustacchito be manipulated again with the 636*fd71220bSRobert Mustacchi.Cm gpio 637*fd71220bSRobert Mustacchi.Cm attr 638*fd71220bSRobert Mustacchi.Cm set 639*fd71220bSRobert Mustacchisubcommand. 640*fd71220bSRobert Mustacchi.El 641*fd71220bSRobert Mustacchi.Sh EXIT STATUS 642*fd71220bSRobert MustacchiThe 643*fd71220bSRobert Mustacchi.Nm 644*fd71220bSRobert Mustacchiutility exits 0 on success. 645*fd71220bSRobert MustacchiIf an error occurs, it exits 1, and provides additional details about 646*fd71220bSRobert Mustacchithe underlying cause of the error. 647*fd71220bSRobert MustacchiIf there was an invalid or missing command line options, then 648*fd71220bSRobert Mustacchi.Nm 649*fd71220bSRobert Mustacchiexits 2. 650*fd71220bSRobert Mustacchi.Pp 651*fd71220bSRobert MustacchiWhen listing controllers, GPIOs, DPIOs, or attributes, if none are 652*fd71220bSRobert Mustacchilisted or if a filter is specified but is not matched, then these 653*fd71220bSRobert Mustacchiconditions are all treated as errors and 654*fd71220bSRobert Mustacchi.Nm 655*fd71220bSRobert Mustacchiexits 1. 656*fd71220bSRobert Mustacchi.Sh EXAMPLES 657*fd71220bSRobert Mustacchi.Sy Example 1 658*fd71220bSRobert MustacchiDiscovering Controllers 659*fd71220bSRobert Mustacchi.Pp 660*fd71220bSRobert MustacchiThis example shows how you discover what controllers exist. 661*fd71220bSRobert Mustacchi.Bd -literal -offset indent 662*fd71220bSRobert Mustacchi# gpioadm controller list 663*fd71220bSRobert MustacchiCONTROLLER NGPIOS NDPIOS PROVIDER 664*fd71220bSRobert Mustacchigpio_sim0 6 0 /pseudo/gpio_sim@0 665*fd71220bSRobert Mustacchigpio_sim1 6 0 /pseudo/gpio_sim@1 666*fd71220bSRobert Mustacchigpio_sim2 6 0 /pseudo/gpio_sim@2 667*fd71220bSRobert Mustacchi.Ed 668*fd71220bSRobert Mustacchi.Pp 669*fd71220bSRobert MustacchiThe controller information can be changed by changing the fields or 670*fd71220bSRobert Mustacchiadding a filter. 671*fd71220bSRobert MustacchiFor example: 672*fd71220bSRobert Mustacchi.Bd -literal -offset indent 673*fd71220bSRobert Mustacchi# gpioadm controller list -o controller,ngpios,path gpio_sim2 674*fd71220bSRobert MustacchiCONTROLLER NGPIOS PATH 675*fd71220bSRobert Mustacchigpio_sim2 6 /pseudo/kgpio@0:gpio_sim2 676*fd71220bSRobert Mustacchi.Ed 677*fd71220bSRobert Mustacchi.Pp 678*fd71220bSRobert Mustacchi.Sy Example 2 679*fd71220bSRobert MustacchiListing GPIOs avialable on the system. 680*fd71220bSRobert Mustacchi.Pp 681*fd71220bSRobert MustacchiThis example allows you to discover which GPIOs exist on the system and 682*fd71220bSRobert Mustacchiwhich controllers that they belong to. 683*fd71220bSRobert MustacchiFirst this shows listing all the GPIOs and then limiting the request to 684*fd71220bSRobert MustacchiGPIOs on a specific controller. 685*fd71220bSRobert Mustacchi.Bd -literal -offset indent 686*fd71220bSRobert Mustacchi# gpioadm gpio list 687*fd71220bSRobert MustacchiCONTROLLER GPIO ID 688*fd71220bSRobert Mustacchigpio_sim0 1v8 0 689*fd71220bSRobert Mustacchigpio_sim0 3v3 1 690*fd71220bSRobert Mustacchigpio_sim0 12V 2 691*fd71220bSRobert Mustacchigpio_sim0 54V 3 692*fd71220bSRobert Mustacchigpio_sim0 periodic-500ms 4 693*fd71220bSRobert Mustacchigpio_sim0 open-drain 5 694*fd71220bSRobert Mustacchigpio_sim1 1v8 0 695*fd71220bSRobert Mustacchigpio_sim1 3v3 1 696*fd71220bSRobert Mustacchigpio_sim1 12V 2 697*fd71220bSRobert Mustacchigpio_sim1 54V 3 698*fd71220bSRobert Mustacchigpio_sim1 periodic-500ms 4 699*fd71220bSRobert Mustacchigpio_sim1 open-drain 5 700*fd71220bSRobert Mustacchigpio_sim2 1v8 0 701*fd71220bSRobert Mustacchigpio_sim2 3v3 1 702*fd71220bSRobert Mustacchigpio_sim2 12V 2 703*fd71220bSRobert Mustacchigpio_sim2 54V 3 704*fd71220bSRobert Mustacchigpio_sim2 periodic-500ms 4 705*fd71220bSRobert Mustacchigpio_sim2 open-drain 5 706*fd71220bSRobert Mustacchi.Ed 707*fd71220bSRobert Mustacchi.Pp 708*fd71220bSRobert MustacchiNext, to limit them, additional arguments may be passed as filters. 709*fd71220bSRobert MustacchiThis will specify everything on the controller gpio_sim1 and a specific 710*fd71220bSRobert MustacchiGPIO on gpio_sim2. 711*fd71220bSRobert MustacchiA reminder that the filters are based on names. 712*fd71220bSRobert Mustacchi.Bd -literal -offset indent 713*fd71220bSRobert Mustacchi# gpioadm gpio list gpio_sim1 gpio_sim2/periodic-500ms 714*fd71220bSRobert MustacchiCONTROLLER GPIO ID 715*fd71220bSRobert Mustacchigpio_sim1 1v8 0 716*fd71220bSRobert Mustacchigpio_sim1 3v3 1 717*fd71220bSRobert Mustacchigpio_sim1 12V 2 718*fd71220bSRobert Mustacchigpio_sim1 54V 3 719*fd71220bSRobert Mustacchigpio_sim1 periodic-500ms 4 720*fd71220bSRobert Mustacchigpio_sim1 open-drain 5 721*fd71220bSRobert Mustacchigpio_sim2 periodic-500ms 4 722*fd71220bSRobert Mustacchi.Ed 723*fd71220bSRobert Mustacchi.Pp 724*fd71220bSRobert Mustacchi.Sy Example 3 725*fd71220bSRobert MustacchiLooking up a single GPIO by name and getting its attributes. 726*fd71220bSRobert Mustacchi.Pp 727*fd71220bSRobert MustacchiThese two commands could also be chained together through the use of a 728*fd71220bSRobert Mustacchisubshell. 729*fd71220bSRobert Mustacchi.Bd -literal -offset indent 730*fd71220bSRobert Mustacchi# gpioadm gpio list -1 -p -o id gpio_sim1/3v3 731*fd71220bSRobert Mustacchi1 732*fd71220bSRobert Mustacchi# gpioadm gpio attr get gpio_sim1/1 733*fd71220bSRobert MustacchiATTR PERM VALUE POSSIBLE 734*fd71220bSRobert Mustacchiname r- 3v3 -- 735*fd71220bSRobert Mustacchisim:output rw disabled disabled,low,high 736*fd71220bSRobert Mustacchisim:input r- low low,high 737*fd71220bSRobert Mustacchisim:pull rw down 738*fd71220bSRobert Mustacchidisabled,down,up,up|down 739*fd71220bSRobert Mustacchisim:voltage r- 3.3V 3.3V 740*fd71220bSRobert Mustacchisim:speed rw low low,medium,high, 741*fd71220bSRobert Mustacchi very-high 742*fd71220bSRobert Mustacchi.Ed 743*fd71220bSRobert Mustacchi.Pp 744*fd71220bSRobert Mustacchi.Sy Example 4 745*fd71220bSRobert MustacchiSetting GPIO attributes 746*fd71220bSRobert Mustacchi.Pp 747*fd71220bSRobert MustacchiMultiple GPIO attributes can be set at the same time. 748*fd71220bSRobert MustacchiThey all will take effect at the same time. 749*fd71220bSRobert MustacchiThis example shows setting and then getting those same properties: 750*fd71220bSRobert Mustacchi.Bd -literal -offset indent 751*fd71220bSRobert Mustacchi# gpioadm gpio attr set gpio_sim1/1 sim:pull=up sim:speed=high 752*fd71220bSRobert Mustacchi# gpioadm gpio attr get gpio_sim1/1 sim:pull sim:speed 753*fd71220bSRobert MustacchiATTR PERM VALUE POSSIBLE 754*fd71220bSRobert Mustacchisim:pull rw up 755*fd71220bSRobert Mustacchidisabled,down,up,up|down 756*fd71220bSRobert Mustacchisim:speed rw high low,medium,high, 757*fd71220bSRobert Mustacchi very-high 758*fd71220bSRobert Mustacchi.Ed 759*fd71220bSRobert Mustacchi.Pp 760*fd71220bSRobert Mustacchi.Sy Example 5 761*fd71220bSRobert MustacchiCreating a DPIO 762*fd71220bSRobert Mustacchi.Pp 763*fd71220bSRobert MustacchiThis example shows the creation of a DPIO from a GPIO. 764*fd71220bSRobert Mustacchi.Bd -literal -offset indent 765*fd71220bSRobert Mustacchi# gpioadm dpio define -r -w gpio_sim2/2 example5 766*fd71220bSRobert Mustacchi# $ ls /dev/dpio/example5 767*fd71220bSRobert Mustacchi/dev/dpio/example5 768*fd71220bSRobert Mustacchi# gpioadm dpio list 769*fd71220bSRobert MustacchiDPIO CAPS FLAGS CONTROLLER GPIONUM 770*fd71220bSRobert Mustacchiexample5 read,write - gpio_sim2 2 771*fd71220bSRobert Mustacchi.Ed 772*fd71220bSRobert Mustacchi.Pp 773*fd71220bSRobert Mustacchi.Sy Example 6 774*fd71220bSRobert MustacchiRemoving a DPIO 775*fd71220bSRobert Mustacchi.Pp 776*fd71220bSRobert MustacchiThis example removes the DPIO that we created in the prior example. 777*fd71220bSRobert MustacchiIf the system has other DPIOs than the output of the final command will 778*fd71220bSRobert Mustacchibe different. 779*fd71220bSRobert Mustacchi.Bd -literal -offset indent 780*fd71220bSRobert Mustacchi# gpioadm dpio undefine gpio_sim2/2 781*fd71220bSRobert Mustacchi# ls /dev/dpio/example5 782*fd71220bSRobert Mustacchi/dev/dpio/example5: No such file or directory 783*fd71220bSRobert Mustacchi# gpioadm dpio list 784*fd71220bSRobert Mustacchigpioadm: no DPIOs found 785*fd71220bSRobert Mustacchi.Ed 786*fd71220bSRobert Mustacchi.Sh INTERFACE STABILITY 787*fd71220bSRobert MustacchiThe command line interface of 788*fd71220bSRobert Mustacchi.Nm 789*fd71220bSRobert Mustacchiis 790*fd71220bSRobert Mustacchi.Sy Evolving . 791*fd71220bSRobert MustacchiThe output of 792*fd71220bSRobert Mustacchi.Nm 793*fd71220bSRobert Mustacchiis 794*fd71220bSRobert Mustacchi.Sy Not-An-Interface 795*fd71220bSRobert Mustacchiand may change at any time. 796*fd71220bSRobert Mustacchi.Sh SEE ALSO 797*fd71220bSRobert Mustacchi.Xr poll 2 , 798*fd71220bSRobert Mustacchi.Xr read 2 , 799*fd71220bSRobert Mustacchi.Xr write 2 , 800*fd71220bSRobert Mustacchi.Xr port_get 3 C 801*fd71220bSRobert Mustacchi.Xr ofmt 3OFMT , 802*fd71220bSRobert Mustacchi.Xr dpio 7 , 803*fd71220bSRobert Mustacchi.Xr gpio 7 , 804*fd71220bSRobert Mustacchi.Xr ldi_open_by_name 9F 805