1GPIO Interfaces
   3This provides an overview of GPIO access conventions on Linux.
   5These calls use the gpio_* naming prefix.  No other calls should use that
   6prefix, or the related __gpio_* prefix.
   9What is a GPIO?
  11A "General Purpose Input/Output" (GPIO) is a flexible software-controlled
  12digital signal.  They are provided from many kinds of chip, and are familiar
  13to Linux developers working with embedded and custom hardware.  Each GPIO
  14represents a bit connected to a particular pin, or "ball" on Ball Grid Array
  15(BGA) packages.  Board schematics show which external hardware connects to
  16which GPIOs.  Drivers can be written generically, so that board setup code
  17passes such pin configuration data to drivers.
  19System-on-Chip (SOC) processors heavily rely on GPIOs.  In some cases, every
  20non-dedicated pin can be configured as a GPIO; and most chips have at least
  21several dozen of them.  Programmable logic devices (like FPGAs) can easily
  22provide GPIOs; multifunction chips like power managers, and audio codecs
  23often have a few such pins to help with pin scarcity on SOCs; and there are
  24also "GPIO Expander" chips that connect using the I2C or SPI serial busses.
  25Most PC southbridges have a few dozen GPIO-capable pins (with only the BIOS
  26firmware knowing how they're used).
  28The exact capabilities of GPIOs vary between systems.  Common options:
  30  - Output values are writable (high=1, low=0).  Some chips also have
  31    options about how that value is driven, so that for example only one
  32    value might be driven ... supporting "wire-OR" and similar schemes
  33    for the other value (notably, "open drain" signaling).
  35  - Input values are likewise readable (1, 0).  Some chips support readback
  36    of pins configured as "output", which is very useful in such "wire-OR"
  37    cases (to support bidirectional signaling).  GPIO controllers may have
  38    input de-glitch/debounce logic, sometimes with software controls.
  40  - Inputs can often be used as IRQ signals, often edge triggered but
  41    sometimes level triggered.  Such IRQs may be configurable as system
  42    wakeup events, to wake the system from a low power state.
  44  - Usually a GPIO will be configurable as either input or output, as needed
  45    by different product boards; single direction ones exist too.
  47  - Most GPIOs can be accessed while holding spinlocks, but those accessed
  48    through a serial bus normally can't.  Some systems support both types.
  50On a given board each GPIO is used for one specific purpose like monitoring
  51MMC/SD card insertion/removal, detecting card writeprotect status, driving
  52a LED, configuring a transceiver, bitbanging a serial bus, poking a hardware
  53watchdog, sensing a switch, and so on.
  56GPIO conventions
  58Note that this is called a "convention" because you don't need to do it this
  59way, and it's no crime if you don't.  There **are** cases where portability
  60is not the main issue; GPIOs are often used for the kind of board-specific
  61glue logic that may even change between board revisions, and can't ever be
  62used on a board that's wired differently.  Only least-common-denominator
  63functionality can be very portable.  Other features are platform-specific,
  64and that can be critical for glue logic.
  66Plus, this doesn't require any implementation framework, just an interface.
  67One platform might implement it as simple inline functions accessing chip
  68registers; another might implement it by delegating through abstractions
  69used for several very different kinds of GPIO controller.  (There is some
  70optional code supporting such an implementation strategy, described later
  71in this document, but drivers acting as clients to the GPIO interface must
  72not care how it's implemented.)
  74That said, if the convention is supported on their platform, drivers should
  75use it when possible.  Platforms must declare GENERIC_GPIO support in their
  76Kconfig (boolean true), and provide an <asm/gpio.h> file.  Drivers that can't
  77work without standard GPIO calls should have Kconfig entries which depend
  78on GENERIC_GPIO.  The GPIO calls are available, either as "real code" or as
  79optimized-away stubs, when drivers use the include file:
  81        #include <linux/gpio.h>
  83If you stick to this convention then it'll be easier for other developers to
  84see what your code is doing, and help maintain it.
  86Note that these operations include I/O barriers on platforms which need to
  87use them; drivers don't need to add them explicitly.
  90Identifying GPIOs
  92GPIOs are identified by unsigned integers in the range 0..MAX_INT.  That
  93reserves "negative" numbers for other purposes like marking signals as
  94"not available on this board", or indicating faults.  Code that doesn't
  95touch the underlying hardware treats these integers as opaque cookies.
  97Platforms define how they use those integers, and usually #define symbols
  98for the GPIO lines so that board-specific setup code directly corresponds
  99to the relevant schematics.  In contrast, drivers should only use GPIO
 100numbers passed to them from that setup code, using platform_data to hold
 101board-specific pin configuration data (along with other board specific
 102data they need).  That avoids portability problems.
 104So for example one platform uses numbers 32-159 for GPIOs; while another
 105uses numbers 0..63 with one set of GPIO controllers, 64-79 with another
 106type of GPIO controller, and on one particular board 80-95 with an FPGA.
 107The numbers need not be contiguous; either of those platforms could also
 108use numbers 2000-2063 to identify GPIOs in a bank of I2C GPIO expanders.
 110If you want to initialize a structure with an invalid GPIO number, use
 111some negative number (perhaps "-EINVAL"); that will never be valid.  To
 112test if such number from such a structure could reference a GPIO, you
 113may use this predicate:
 115        int gpio_is_valid(int number);
 117A number that's not valid will be rejected by calls which may request
 118or free GPIOs (see below).  Other numbers may also be rejected; for
 119example, a number might be valid but temporarily unused on a given board.
 121Whether a platform supports multiple GPIO controllers is a platform-specific
 122implementation issue, as are whether that support can leave "holes" in the space
 123of GPIO numbers, and whether new controllers can be added at runtime.  Such issues
 124can affect things including whether adjacent GPIO numbers are both valid.
 126Using GPIOs
 128The first thing a system should do with a GPIO is allocate it, using
 129the gpio_request()href=, L118nts t.
 131One of the next things to do with a GPIO, often in board setup code when
 132setting up a platform_device using the GPIO, is mark its direction:
 134        /* set as input or output, returning 0 or negative errno */
 135        int gpio_direction_input(unsigned gpio);
 136        int gpio_direction_output(unsigned gpio, int value);
 138The return value is zero for success, else a negative errno.  It should
 139be checked, since the get/set calls don't have error returns and since
 140misconfiguration is possible.  You should normally issue these calls from
 141a task context.  However, for spinlock-safe GPIOs it's OK to use them
 142before tasking is enabled, as part of early board setup.
 144For output GPIOs, the value provided becomes the initial output value.
 145This helps avoid signal glitching during system startup.
 147For compatibility with legacy interfaces to GPIOs, setting the direction
 148of a GPIO implicitly requests that GPIO (see below) if it has not been
 149requested already.  That compatibility is being removed from the optional
 150gpiolib framework.
 152Setting the direction can fail if the GPIO number is invalid, or when
 153that particular GPIO cahave errbe used ion/g.txtode.  It's generally a bad
 154idea to rely on boot firmware to have set the direction correctly, since
 155it probably wasn't validated to do more than boot Linux.  (Similarly,
 156that board setup code probably needs to multiplexn/g.txpin as a GPIO,
 157and configure pullups/pulldowns appropriately.)
 160Spinlock-Safe GPIO access
 162Most GPIO controllers can be accessed with memory read/write instructions.
 163Those don't need to sleep, and can safely be done from inside hard
 164(nonthreaded) IRQ handlers and similar contexts.
 166Use the following calls to access such GPIOs,
 167for which gpio_cansleep() will always return false (see below):
 169        /* GPIO INPUT:  return zero or nonzero */
 170        int gpio_get_value(unsigned gpio);
 172        /* GPIO OUTPUT */
 173        void gpio_set_value(unsigned gpio, int value);
 175The values are boolean, zero for low, nonzero for high.  When reading the
 176value of an output pin, the value returned should be what's seen on the
 177pin ... that won't always match the specified output value, because of
 178issues including open-drain signaling and output nts ncies.
 180The get/set calls have no error returns because "invalid GPIO" should have
 181been reported earlier from gpio_direction_*().  However, note that not all
 182platforms can read the value of output pins; those  href="Documen6"
	  Tesion/ithout standarbecause y 18n/gpio.line" nam181Also,ne" name="guration i/a>So foa>platforms can r63"> 163< can be accessed while holding spinlocks, 1ther deve1lopers to
 148o id="line" 17passes such pin configuration ="L174"> ntain it.
 152  input d="L7t>that partic"> 140>  60 #L1see below).  Other numbers may alsodutput nts>  88
Use the following calls to aame="L89"1>  89
   and wheo.txt#L79ration d="Lmss="ame="L52">166Use the following calls to aauot; shouing GPIOs
ef="L">   (Oer te a feim>   155166Use the following calls to aaote that ---------
passes such pin configuration 0..MAX_I1NT.  That
 161--------ame="L96"1>  96
 161--------a them ex1e symbols
ass="line" na/a>Those don'164" class=" the value provided becomes the ini2uips have to hold
 122boar6" id="L126" class="line" name="L126"> 2ability p2oblems.
 L175"> 17sted aL58" cl (36ss="linsda If you want to="L126" class="line" name="L126"> 2aCs; and t103
 xt#L1p61The fi="L162"129" id="L12 gpio_cansleep() will always return 2Os; while2another
 170        int gpio_get_val2-95 with 2n FPGA.
 da ass="line"ne" namine" no>Whethms defdgpio_cansleep() will always return 2O  Common anders.
 1," class classs="line" name="L172"> 172       2 GPIO num2er, use
 170        int gpio_get_val2ver be va2id.  To
 172       2 Cs; and tdicate:
 173        void gpio_set_value(unsigned2e="L114">2114
>ss="linsda 164"> 1umber that&="line"#L104" id="Lxt#L116" id="L116" class="line" na2eforms co2request
 can boto #L77" id"L74"7" class="Docuhmefame="L6">   6prefix, or the relate2 some casees, every
ation 17passes such pin configuratio2OCs; and tthere are
>same=linmas can be written generically, so tha2with only  the BIOS
 16umber that&="line""L139" clythat&ine" namene" name="L152can be written generically, so tha2w="L116">2re used).
Platfomas "7sted56" ican be written generically, so tha2wforms co2>  27
  99ass="e/#L2rlineL100"> so" id="L58 of thyut d="s="lt157and configure pullups/pulldow2.  Common  options:
and configure pullups/pulldow2e="L130">2130
and configure pullups/pulldow2eFPGAs) cade when
and configure pullups/pulldow2e and audioo codecs
and configure pullups/pulldow2ePI serialrrno */
and configure pullups/pulldow2eith only  gpio);
and configure pullups/pulldow2e="L116">2value);
and configure pullups/pulldow2e  Common  should
and configure pullups/pulldow2returns a2d since
 161-------2ial outpu2 value.
 145L140" id="L140line"",mewo6"ine" namems defd 17passes such pin configuratio2g system 2tartup.
 e="L134"> 134        /* s 17passes such pin configuratio2g="L137">2rection
  41 172       2from the 2ptional
 172       2frly boar2or when
 170        int gpio_get_val2s general2y a bad
166Use the following calls to 2nux.  (Si2ilarly,
platfol="L12" L138" id="L138ttxt#L116" id="L116" class="line" na2.txpin as2a GPIO,
 140misconfiguration is possible.  You should normally issu2s appropr2ately.)
 141a task contexid="L12L132"d="L126" class="line" name="L126"> 2e="L158">2158
 142before tasking is enabled, as part of 2e="L159">2159
 dlinebette04diagnosass=;a>    thrsupport bidirectional signaling).  GPIO co2ite instr2ctions.
 dame="> 131e rela2 name=ae" namemple,n.  Programmable logic devices (like  from ins2de hard
">  99xclus    't">plation can fail if the GPIO number i2sith only tthe BIOS
a task 141">texida>re>">  9928"  classid="L117" c boact    " class=is,"id="L122"> ation can fail if the GPIO number i2s appropr2below):
 118  - d="L31w name="L" name=ct    s (see below).  Other numbers may als2e(unsigne2 gpio);
  22ther,="line"s17 " namineL/a>examt imisecto="line,e155"see below).  Other numbers may als2e="L151">2171
in 36"ctrl0    t,""L122">b class="line"o.txt#L73" id="L73" class="line" n2gimilar c2174
  99L117""L129"l86" classi"> 1cer from gpio_direction_*().  However,2 When rea2ing the
  99L117" c.L1189"l86" classi"> 1cer from gpio_direction_*().  However,2 hey'ree used).
    tla>Thwther 6"ctrl5id="L12_  Ho(lfrom gpio_direction_*().  However,2  appropr2ause of
ne" namext#Lt#Ls naroup9"> 149"line" wnam>  582 ncies.
 156< 14 see below).  Other numbers may als2e="L179">2179
 grammof xt#L56"> 156< 14class="lineass=is  will ="L1rineepin, the value returned should be what2note that2not all
in name="L157" xt#La>to theccurne" n08">  id="d>  99L117"  the value returned should be what2nte instr2esion/ithout standarbeca2se y 28n/gpi." class="line" n5Lt#L." class="line" na5L86" class=s="lineccurnafte04,n.  Programmable logic devices (like ther deve2lopers to
Thwther="line-L118"mig classi"L42">  Programmable logic devices (like timilar c2ntain it.
 a>One p47"> 147  xt#L1al very1" id=ss="lindlass="u="L53" L152can be written generically, so tha2ame="L85"2>  85
nd>  9n/aela2169- id="HW bme="ore tasking is enabled, as part of 2orms whic2h need to
Thw verycallsl o166" ative&qut/a>or inee name=5" id="L45irs can be accessed with memory read/w2dutput nt2>  88
    inpuread ther/a>GPIeass=" na"linedetaie" namcan be accessed with memory read/w2auot; sho2ing GPIOs
i 60<"l"L135id="L129"l"> 149" class  60in 36"ctrl0    ta task mnam152" ">  78 class="166" id="L107" classa transceiver, bitbanging a serial bus,2 0..MAX_I2NT.  That
see what your code is doing, and2ame="L96"2>  96
of iclasO.  ine" namems defdgpio_cansleep() will always return 3uld only 3se GPIO
 e" na/a>For oL140" id="L14077"> 177boarargL137""linext#L137" id="L137" class="line" na3e3 board 3pT.  That
 172       3Os; while3another
T9ine" name="L13"ine" name01"> flags3"t d="s="lr *label        void gpio_set_value(unsigned34-79 with3another
   ngl"Lcer from gpio_direction_*().  However,3tforms co3ld also
 172       3O9orms co3lresponds
   ngl"Lcer from gpio_direction_*().  However,3ver be va3id.  To
 172       3rence a G3IO, you
nms defds="l=7"> 1yL166" id="L166"me="ertiesgpio_cansleep() will always return 3alid(int 3umber);
Foa/a>For olthiss="lLOWo.txt#L29" id="L29" class="line" n3 GPIO num3 at least
Foa/a>For olthiss="lHIGHo.txt#L29" id="L29" class="line" n3 er be va3nn easily
see what your code is doing, and3h4 board 3there are
Thw ="lL52">sbility with legacy interfaces to GPIOs, set3w="L116">3re used).
/a"roup9="linxt#L137" id="L137" class="line" na3w9orms co3 options:
For olthissLOWo.txt#L29" id="L29" class="line" n3e and aud3oo codecs
For olthissHIGHo.txt#L29" id="L29" class="line" n3e="L133">3133
that bL1alxt#L174" id="L174" class="line" na3eith only3 gpio);
tIt1alxt#L174" id="L174" class="line" na3e="L116">3value);

 154idea"L110pL31w ame=""#L1askfds="l=etss="line" 1108""L176" 3 1s ntHIGH.12" L36" 132   coms="lin0108""L176" 3xt#L174" id="L174" class="line" na3returns a3d since
that bL1alxt#L174" id="L174" class="line" na3;s OK to 3se them
  9n/="l0108""L176" 3tIt1alxt#L174" id="L174" class="line" na3arly boar3 setup.
 154idea"L110pL31w ame=""#L1askfds="l=etss="line" 0108""L176" 3 1s ntLOW.12" L36" 132   coms="lin1108""L176" 3xt#L174" id="L174" class="line" na3eith only3tartup.
 122me="erties>xt#L174" id="L174" class="line" na3eforms co3rection
ilsl o024"a>field=234gpio_cansleep() will always return 3piolib fr3mework.
  rflags       void gpio_set_value(unsigned3sPI seria3, since
3a GPIO,
  LED>  58 172       3-="L151">3-------
  58 172       3-rly boar3ctions.
  58 172       3- general3de hard
  58 172       3-PI seria3ntexts.
 3sith only3tthe BIOS
T931,d="L1F_IN,9"line"Ra=etsButton"line"        void gpio_set_value(unsigned3e="L158">3168

3 ncies.
>sappe=""L1IRQlxt#L168" id="L168" class="line" na3e="L179">3179
 161-------3quot; sho3ld have
/afect164"a>can a"L12" de1n/kesusxt#L174" id="L174" class="line" na3note that3not all
ndxt# nol=Docu>er ts (124can a a="line" name="L172"> 172       3ame="L85"3>  85
 170        int gpio_get_val3orms whic3h need to
can a 7"> 147"a>can a (="L145e" name=is) a="line" name="L172"> 172       3a="L158">3>  88
 9ine" nameirq70"> 170        int gpio_get_val3ame="L89"3>  89
 138The ret6" cla name="mnam152"ass="line" na/a>TablyF104" id="Lo="L126" class="line" name="L126"> 3 0..MAX_I3NT.  That
can / id="did55" clasoriginlatfolimeass="line" to_irq9)7from gpio_direction_*().  However,3eme="L85"3 cookies.
 131b="Ltorame" n"l164" rn id39n i/a>xt#L182"xt#L159" id="L159" class="line" na4u2d only 4s--------
 dayL166"er mi01" id="L1xa>For iz="L140cthNeported e164"triggn xt#L159" id="L159" class="line" na4u3d only 4sT.  That
xt#L174" id="L174" class="line" na4Os; while4another

For izycallupda>il">  99aon cansceiver, bitbanging a serial bus,4e879 with4a symbols
  --triggn  ine"Neported es8 122/ayname="L140="L145e" nam4see what your code is doing, and4e="L109">4109
 161-------4e4 board 4dicate:
Th" cl ss="llls havee" name=,39;s noe relin, the value returned should be what4e="L114">4114
CMOSnlass=iLtors       void gpio_set_value(unsigned4alid(int 4umber);
 18name="a>Th v clas      void gpio_set_value(unsigned4a779 with4116
praasslas">,17sted a, the value returned should be what4e879 with4request
Th id="L58 0Thw cl-ORTh/a>see what your code is doing, and4e979 with4ed; for
see what your code is doing, and4 GPIO num4 at least
 122 122 4SPI seria4l busses.
il=""li nam  pae whlatfor="L126" class="line" name="L126"> 4Slid(int 4 the BIOS
4re used).
  9s" id=ative&xt#L137" id="L137" class="line" na4w979 with4 options:
xt#L174" id="L174" class="line" na4href=, L148nts t.
xt#L174" id="L174" class="line" na4hence a G4oo codecs
Thd>   colls hav id=ative&"a>Th ame=129" " class="l="L17L81" idid=namwxt#L133" id="L133" class="line" na4ePI seria4rrno */
tm3"e" narirela="line"  tAsn 7, the value returned should be what4e="L116">4value);
  m"linstretched:0" 0slavorted ea" cs">  Programmable logic devices (like4eforms co4137
  t/a> = slays" id=ri#0" il  - 0f SCK,e a few &I2C 22ste04,djust93a>qxt#L171" id="L171" class="line" na4e9orms co4 should
    txt#L171" id="L171" class="line" na4;ence a G4 setup.
p &36"ctrlxt#L174" id="L174" class="line" na4elid(int 4tartup.
One pqxt#L171" id="L171" class="line" na4e="L146">4146
4y a bad
and configure pullups/pulldow4sPI seria4, since
 1s nt  cases0    tlcross- to r/a>ilme="L152can be written generically, so tha4s="L146">4a GPIO,
T byme=giste0 149"line"/a>GPslls havof xt#s, mber tnamenamegnor lyxt#L137" id="L137" class="line" na4-Safe GPI4 access
  s.12" de1namemsscribame" xt#L137" id="L137" class="line" na4-="L151">4-------
 1s nter oc="L140iss="tlatfomaddayL166"36"ctrl0    t,xt#L133" id="L133" class="line" na4-PI seria4ntexts.
ddayL"L13 ">  99<>tIt1supporppueo.txt#L82" id="L82" class="line" n4sith only4tthe BIOS
 SoC 132ddayLdi" id="L4"L13 ">  99<>o.txt#L82" id="L82" class="line" n4s="L146">4 GPIOs,
6logclas namleL4"L13 ">  99<"L1nss="l1" iirt5ir /a>GPs1toxt#L137" id="L137" class="line" na4s9orms co4168
    txt#L137" id="L137" class="line" na4eSafe GPI4 gpio);
o.txt#L82" id="L82" class="line" n4e="L151">4171
qt5ir /a>GP=li na36"ctrlxt#L174" id="L174" class="line" na4e general4value);
:=li naor #L77" idDT>o.txt#L82" id="L82" class="line" n4ePI seria4174
 122o.txt#L82" id="L82" class="line" n4e="L146">4ee used).
 122<, ihtm< cer o="lit im_add_36"_/a>GP9"lai namame="L157"xt#L137" id="L137" class="line" na4 9orms co4 ncies.
e=giste03a /a>GP=of "L13 t bL1ne namext#ctrl0">  99. F 604179
i#L1s" i hr/a>see what your code is doing, and4note that4not all
 156< 14e""L="lcan be written generically, so tha4t="L146">4h need to
Thtfol im01" id="L1 a f169122<">    62tm3"="o.txt#L85" id="L85" class="line" n4d them ex4plicitly.
 156< 14;1 aaname=sclasslass=justmewo6iady. " L104't",n.  Programmable logic devices (like4a="L158">4>  88
    thr id="run Linux naday.57and configure pullups/pulldow4aote that4---------
 156< 14cal c140" id="L140 a f clas come="166 157" cshe xt#L120" id="L120" class="line" na4marking s4ignals as
i =1igu8 122e" name="/a>see what your code is doing, and4ame="L96"4>  96
  9nstreng na(2 mA vs 20 mA)ss="lvolt/a>2(1.8V vs 3.3V)1al >  Programmable logic devices (like4e="L158">4rresponds
e)slas nam" a7,-to- 7, the value returned should be what5uld only 5se GPIO
    t01" id="L1me="lListhr id="areearli77"> 177see what your code is doing, and5u4d only 5sgnals as
 122 nam"L12L108"ga>G> dame=id="L117" cusur lyxt#L137" id="L137" class="line" na5Os; while5another

ddine166">   C clarel90" i1igured me="lListhrnegaxt#L174" id="L174" class="line" na5e979 with5aresponds
   xt#L174" id="L174" class="line" na5e="L109">5109
ideatt#"L12L10L1arlicur"L62">nstL1Iass;#L104" id="L,e"scan be accessed with memory read/w5ver be va5id.  To
see what your code is doing, and5v3d only 5IO, you
and configure pullups/pulldow5alid(int 5umber);
xt#L182"s="L1"> 122 gramm" name="L7L12"#L1frocuL150 id=" classlls ha"L13libTh/a>see what your code is doing, and5 some cas5es, every
said,a na sbugf="L58 vail=bl" a />  /kervel/ sbug/"L13 fil"xt#L146" id="L146" class="line" na5 er be va5nn easily
ni==/a>see what your code is doing, and5 4 board 5there are
 161-------5wforms co5>  27
ddine 0Thontrol="L13 t imTh"line" name="L161"> 161-------5w979 with5 options:
 isd "L12 bility with legacy interfaces to GPIOs, set5eer be va5de when

and configure pullups/pulldow5ePI seria5rrno */
a, mber tsupplimeass="l"s="li.xt#L182"_da>agpio_cansleep() will always return 5hforms co5137
can /pfl1ts firstL132">  a fhhw mm 93a>6ex12ses>xt#L174" id="L174" class="line" na5e9orms co5 should
 122ne" name=il">  99a3   xt#L174" id="L174" class="line" na5e="L143">5143
 131" "L13 t imm132xaname="id=10LtL1ce01" id="L1ontrold="Lne nast57"xt#L137" id="L137" class="line" na5elid(int 5tartup.
 e1 name="Ls,gured ine ddr" n 14e"p2">  137",xt#L133" id="L133" class="line" na5e="L146">5146
 est57" xt#L174" id="L174" class="line" na5eforms co5rection
2"=atfoignoreeative&qumber tlasss="line" nueo.txt#L82" id="L82" class="line" n5from the 5ptional
ddine166">   2" y1ss=='="lit im_is_id="L12>dl),#mber tss="L1sxt#L137" id="L137" class="line" na5piolib fr5mework.
patL132"la ame=""was id="L12>d xt#L174" id="L174" class="line" na5e="L151">5151
5y a bad
 122 161-------5sith only5ilarly,
Thoe (ctlls haveiname"line" name="L161"> 161-------5s="L146">5a GPIO,
 161-------5sforms co5ately.)
GP=>patL1ts <asm--h&ghavinclud9s"<asm-generic--h&ghavs="lms defsxt#L137" id="L137" class="line" na5p9orms co5158
fa>One pq:"129" " class="l),#129" s class="l),#s="l"L13 tan""lin9)7from gpio_direction_*().  However,5e="L159">5159
 1a>can /pfl"L12L108">ctPla4'e whlatxt#L182", #L77" i"line" name="L161"> 161-------5-ence a G5ctions.
   >er t   (It1e="L140coune" oth amilt- b/SoC e="L" nn"o.txt#L85" id="L85" class="line" n5- general5de hard
see what your code is doing, and5-PI seria5ntexts.
5 GPIOs,

xt#L174" id="L174" class="line" na5eSafe GPI5 gpio);
 122 -lib" a few &" clacL1nse" na clas4meayL166"i>xt#L174" id="L174" class="line" na5e general5value);

One pq1ss==" clasly1'frocuL150xt#L174" id="L174" class="line" na5eith only5ing the
ertche"  arougdaaset"L13 t imgpio_cansleep() will always return 5e="L146">5ee used).
One pq1#L77xt#L171" id="L171" class="line" na5nte instr5esion/ithout standarbeca5se y 58pio.tlogcl ; dymiz nam"ce" n "L1"" id="L1SOC-baseme166">   F104" id="Loa name=xt#L171" id="L171" class="line" na5n general5lopers to
 e1so02e"  cLtL1ttTh12Th,"" ct booor >For com1ts ass="oc"L14xt#L171" id="L171" class="line" na5nPI seria5ntain it.
10Lttrole pq, ne 99ao"lin coe valuegured ieo.txt#L82" id="L82" class="line" n5tWhen rea5>  85
ilm"lwhetfrocuL150xt#L174" id="L174" class="line" na5t="L146">5h need to
10Lttrole pq   F104bitba>GPd I/O,6uredxt#L137" id="L137" class="line" na5d them ex5plicitly.
5>  88
   2" nam"L12L1ah"L140b61a>can ed/labele="text#L159" id="L159" class="line" na5aote that5---------
   2" yxt#L159" id="L159" class="line" na5ate instr5NT.  That
i =# n"lxt#L182" xa>For iz="L140o.tmss=""> mtnlways"b6xt#L137" id="L137" class="line" na5aimilar c5esn't
Fasne() 104"erlierav idy1ss==o> 131txt#Lmas1IRQl.xt#L137" id="L137" class="line" na5aWhen rea5 cookies.
 161-------6uld only 6se GPIO
 161-------6u1d only 6sng GPIOs
 dFPGAsn r CPLDo --gm5="so> 131er mi01" id="L1" clahandlesxt#L159" id="L159" class="line" na6u2d only 6s--------
  99<"" idLwpatL132"xt#L159" id="L159" class="line" na6u3d only 6sT.  That
'L162"129"t im_add9)7L1Their a>can a o> 131ttLrtmrclassafte0xt#L159" id="L159" class="line" na6u4d only 6sgnals as
ilontrold="4" llntify name=il/a>GPo.txt#L85" id="L85" class="line" n6O7; while6a  96
 mt"L1seed /a> eex"andn  t imo.txt#L85" id="L85" class="line" n6O8; while6a symbols
a7L1Thee whetf im ">  99L117" cprobP9"ls" i hroc"L14 paam1whlao.txt#L85" id="L85" class="line" n6O9; while6aresponds
qt5robP9"ls" i hroah"L140e rel na" classafte04 catL132"xt#L159" id="L159" class="line" na6v3d only 6IO, you
e" nae=giste0edduntiaxt#L174" id="L174" class="line" na6e4 board 6dicate:

  mtext#L159" id="L159" class="line" na6alid(int 6umber);
  mwad the=giste03 s="li>xt#L159" id="L159" class="line" na6a7; while6116
 mt/a>irawluext#L159" id="L159" class="line" na6a8; while6request
The1"line" no9s0frocuL150 mafol oo#39"Lcan be written generically, so tha6h4 board 6there are
 147s7L12"#L1al di" id="L47sted a, the value returned should be what6SPI seria6l busses.
s7> 122<"xt#L159" id="L159" class="line" na6wforms co6>  27
    t, i<"="L c"L14xt#L171" id="L171" class="line" na6href=, L168nts t.
un"> teol"a hr=ume="text#L171" id="L171" class="line" na6hGPIO num6130
 teol"boo>6loadn /seg171"L108"fa>
d memory7L1S    tlupgradnn"> cedd="4xt#L171" id="L171" class="line" na6her be va6de when
atn"> teollas,#firstL1"l22< nam" L152,xt#L133" id="L133" class="line" na6hence a G6oo codecs
G com1ts "L176" on ca,me="nlupda> name=ilc1d"obt#L142re- clas coxt#L133" id="L133" class="line" na6h4 board 6133
 teoli=""L1Inear2"=a=ume,L132"/#23 wad thne 99ab39"ouched,xt#L133" id="L133" class="line" na6hPI seria6rrno */
see what your code is doing, and6hlid(int 6 gpio);

  99<"c"L140b6ssl o02s="wheta    tlre=atfoa" cs/a>see what your code is doing, and6 these ca6ls from
ThLED>0 a fButtonsTh"line" name="L161"> 161-------6 ence a G6 setup.
Thl cs-/a>-The a flls ha"L13_keysTh," rne ita>Tly7L1Usf"16 na"line" name="L161"> 161-------6 4 board 6143
i9L162"kervel"line" name="L161"> 161-------6 PI seria6 value.
see what your code is doing, and6 lid(int 6tartup.
 161-------6from the 6ptional
is nsatt#61"r>ni==/>  /nal
<-gpio_cansleep() will always return 6piolib fr6mework.
6y a bad
Thm1bLtL1ces)7o.txt#L85" id="L85" class="line" n6s="L146">6a GPIO,
of i"L140o.tstL1Iass&fil"svinclud name=ilThds="lills haveymhrek7o.txt#L85" id="L85" class="line" n6s9orms co6158
 nam1ts a>can /i/a>i#L1fil"7o.txt#L85" id="L85" class="line" n6sith only6tthe BIOS
6 GPIOs,
Thecho 19 &ghavex12rtlls havline"crea>ilaflls ha"L1319lls havn"d"xt#L146" id="L146" class="line" na6sforms co6below):
tmid="L12>ddby kervel9c"d"7o.txt#L85" id="L85" class="line" n6s9orms co6168
 aeff" idtt#ex12rt nameami<"="L7o.txt#L85" id="L85" class="line" n6eSafe GPI6 gpio);
Thecho 19 &ghavunex12rtlls havline"e=movP"aflls ha"L1319lls haxt#L171" id="L171" class="line" na6eence a G6TPUT */
Thex12rtlls havfil"7o.txt#L85" id="L85" class="line" n6e general6value);

and configure pullups/pulldow6eith only6ing the
unattributesgpio_cansleep() will always return 6e="L146">6ee used).
te""L1Wri> naminells haoutlls haadefae" " "Lxt#L159" id="L159" class="line" na6e="L151">6not all
ThlowThe a flls haa>ThThesuppbme#ri>te" "Lxt#L159" id="L159" class="line" na6e general6lopers to
patLxa>For =="L137o.txt#L85" id="L85" class="line" n6nPI seria6ntain it.
 161-------6t="L146">6h need to
G come=il"4ideatt#L1166",3o0xt#L174" id="L174" class="line" na6d them ex6plicitly.
6>  88
e=c57" id="L" ine166" partic"4ide7o.txt#L85" id="L85" class="line" n6ame="L89"6>  89
Th)7L1I31" id166"o.txt#L80" id="L80" class="line" n6a="L151">6---------
ddine < eL176",L" ineass="osuppbme#ri>te"axt#L171" id="L171" class="line" na6ate instr6NT.  That
iddinea>Th7o.txt#L85" id="L85" class="line" n6a general6ignals as
ddine1 namrupt-genera> nam1 namruptxt#L174" id="L174" class="line" na6aWhen rea6 cookies.
em1 namrupts (seed a, the value returned should be what6ame="L96"6>  96
104106exceptfds. Afte0xt#L159" id="L159" class="line" na7u1d only 7sng GPIOs
e=ae 02e"="L137o.txt#L85" id="L85" class="line" n7u4d only 7sgnals as
Th,""line"/is naTh,""line"fall naTh,"o0xt#L174" id="L174" class="line" na7O6; while7acookies.
and configure pullups/pulldow7O7; while7a  96
ddineieo.txt#L82" id="L82" class="line" n7e="L109">7109
 nam1 76" s n7o.txt#L85" id="L85" class="line" n7 GPIO num7er, use
, the value returned should be what7v3d only 7IO, you
 na.  E ist nam"nd0d="Ln
The a flls hafall naTh edg3L1negatfoll"L0
<-//a>-t im42/ (L104 a, the value returned should be what7 some cas7es, every
ddayL16xl c imo.txt#L85" id="L85" class="line" n7Slid(int 7 the BIOS
diagnostics (">etnlways"uni="L57and configure pullups/pulldow7wforms co7>  27
 9316xl ma>GPs (No"L1N + n/a>- - 157and configure pullups/pulldow7href=, L178nts t.

 e;L132"s=with legacy interfaces to GPIOs, set7hence a G7oo codecs

niL1c14ja>One p ne nasche"="Lc>)"teide erm hrxt#L133" id="L133" class="line" na7hlid(int 7 gpio);
can /i/a'f/a>me" numbstive&7o.txt#L85" id="L85" class="line" n7e="L116">7value);

 161-------7 these ca7ls from
ddus nam"L13_" ="L12()gpio_cansleep() will always return 7 ence a G7 setup.

ide_say_cha>Ge)axt#L171" id="L171" class="line" na7 lid(int 7tartup.
and configure pullups/pulldow7eence a G7or when
7y a bad
  fs */xt#L171" id="L171" class="line" na7pPI seria7, since
  fs s claita>T_low(unstive"l"L13oainl=ass=")axt#L171" id="L171" class="line" na7sith only7ilarly,
7a GPIO,
  fs 1 name="L ayL"L13 sx12rt()7L1The b>  99m s="c"cases0wh came="hext#L133" id="L133" class="line" na7s9orms co7158
ideamafol a>Ge7L12"#L1helps b>  99<"prev71"=i<"="L c"d"xt#L133" id="L133" class="line" na7e="L159">7159
s(by mak namu87de hard
   f/a>d="L159" naminexaname="imer mi=su 122 xt#L174" id="L174" class="line" na7-PI seria7ntexts.
166 the value returned should be what7s="L146">7 GPIOs,
  fs m"lwhet 147d>  fs a"d"7L1D>  99<"cieo.txt#L82" id="L82" class="line" n7sforms co7below):
  fs #L77xt#L171" id="L171" class="line" na7s9orms co7168
  fs s claita>T_low()"teih d"  147dhrefdsolarityxt#L130" id="L130" class="line" na7e="L151">7171
er t   2"#L1e renaff" is="hext#L133" id="L133" class="line" na7eence a G7TPUT */
Ge1 s="br=done" oth at#L142s="l,fte0xt#L159" id="L159" class="line" na7e general7value);
 161-------7ePI seria7174
For co7o.txt#L85" id="L85" class="line" n7eith only7ing the

The ori52"e& LXRmu8ft="linayL166".txt#L85"http://n id39L10a> net/proj" is/lx0">LXRm  mmunityio.t,L" ineex1e0 m71"r ==99lx0@hreux.noio.t.
lx0.hreux.noais nrenho12>ddby .txt#L85"">Re=pega Lrepro ASio.t,Lprov d"e=e="Lreux" cLe" nnam"nd0oper class1txt#"li>0"L="le1995.