24 Oct, 2011

1 commit

  • Currently struct gpio is only defined when using gpiolib which makes the
    stub gpio_request_array() much less useful in drivers than is ideal as
    they can't work with struct gpio. Since there are no other definitions
    in kernel instead make the define always available no matter if gpiolib
    is selectable or selected, ensuring that drivers can always use the
    type.

    Signed-off-by: Mark Brown
    Signed-off-by: Grant Likely

    Mark Brown
     

16 Jun, 2011

1 commit

  • Make GPIOF_ defined values available even when GPIOLIB nor GENERIC_GPIO
    is enabled by moving them to .

    Fixes these build errors in linux-next:
    sound/soc/codecs/ak4641.c:524: error: 'GPIOF_OUT_INIT_LOW' undeclared (first use in this function)
    sound/soc/codecs/wm8915.c:2921: error: 'GPIOF_OUT_INIT_LOW' undeclared (first use in this function)

    Signed-off-by: Randy Dunlap
    Signed-off-by: Grant Likely

    Randy Dunlap
     

28 May, 2011

1 commit


27 May, 2011

1 commit

  • Make the code a bit more readable.

    Instead of casting an int to an unsigned then comparing to
    MAX_NR_GPIOS, add a >= 0 test and let the compiler optimizer
    do the conversion to unsigned.

    The generated code should be the same.

    Signed-off-by: Joe Perches
    Acked-by: Linus Walleij
    Signed-off-by: Grant Likely

    Joe Perches
     

15 Jan, 2011

1 commit


14 Jan, 2011

3 commits

  • This reverts commit 0fdae42d361bbb431ca0ab0efed5126a94821177, which
    wasn't really supposed to go in, and causes lots of annoying warnings.

    Quoth Andrew:
    "Complete brainfart - I meant to drop that patch ages ago."

    Quoth Greg:
    "Ick, yeah, that patch isn't ok to go in as-is, all of the callers
    need to be fixed up first, which is what I thought we had agreed on..."

    Reported-by: Stephen Rothwell
    Acked-by: Andrew Morton
    Acked-by: Greg KH
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     
  • Signed-off-by: Wolfram Sang
    Cc: David Brownell
    Cc: Greg KH
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Wolfram Sang
     
  • Because GPIOs can have crucial functions especially in embedded systems,
    we are better safe than sorry regarding their configuration. For
    gpio_request, the documentation is simply enforced: "The return
    value of gpio_request() must be checked." For gpio_direction_* and
    gpio_request_*, we now act accordingly.

    Signed-off-by: Wolfram Sang
    Cc: David Brownell
    Cc: Greg KH
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Wolfram Sang
     

01 Sep, 2010

1 commit

  • With CONFIG_GPIOLIB=n, the 'struct gpio_chip' is not declared,
    so the following pops up on PowerPC:

    cc1: warnings being treated as errors
    In file included from arch/powerpc/platforms/52xx/mpc52xx_common.c:19:
    include/linux/of_gpio.h:74: warning: 'struct gpio_chip' declared
    inside parameter list
    include/linux/of_gpio.h:74: warning: its scope is only this definition
    or declaration, which is probably not what
    you want
    include/linux/of_gpio.h:75: warning: 'struct gpio_chip' declared
    inside parameter list
    make[2]: *** [arch/powerpc/platforms/52xx/mpc52xx_common.o] Error 1

    This patch fixes the issue by providing the proper forward declaration.

    Signed-off-by: Anton Vorontsov
    Signed-off-by: Grant Likely

    Anton Vorontsov
     

28 May, 2010

1 commit

  • A few architectures, like OMAP, allow you to set a debouncing time for the
    gpio before generating the IRQ. Teach gpiolib about that.

    Mark said:
    : This would be generally useful for embedded systems, especially where
    : the interrupt concerned is a wake source. It allows drivers to avoid
    : spurious interrupts from noisy sources so if the hardware supports it
    : the driver can avoid having to explicitly wait for the signal to become
    : stable and software has to cope with fewer events. We've lived without
    : it for quite some time, though.

    David said:
    : I looked at adding debounce support to the generic GPIO calls (and thus
    : gpiolib) some time back, but decided against it. I forget why at this
    : time (check list archives) but it wasn't because of lack of utility in
    : certain contexts.
    :
    : One thing to watch out for is just how variable the hardware capabilities
    : are. Atmel GPIOs have something like a fixed number of 32K clock cycles
    : for debounce, twl4030 had something odd, OMAPs were more like the Atmel
    : chips but with a different clock. In some cases debouncing had to be
    : ganged, not per-GPIO. And so forth.

    Signed-off-by: Felipe Balbi
    Cc: Tony Lindgren
    Cc: David Brownell
    Reviewed-by: Mark Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Felipe Balbi
     

16 Dec, 2009

1 commit

  • Drivers may use gpiolib sysfs as part of their public user space
    interface. The GPIO number and polarity might change from board to
    board. The gpio_export_link() call can be used to hide the GPIO number
    from user space. Add support for also hiding the GPIO line polarity
    changes from user space.

    Signed-off-by: Jani Nikula
    Cc: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jani Nikula
     

23 Sep, 2009

1 commit

  • Commit 926b663ce8215ba448960e1ff6e58b67a2c3b99b (gpiolib: allow GPIOs to
    be named) already provides naming on the chip level. This patch provides
    more flexibility by allowing multiple names where ever in sysfs on a per
    GPIO basis.

    Adapted from David Brownell's comments on a similar concept:
    http://lkml.org/lkml/2009/4/20/203.

    [randy.dunlap@oracle.com: fix build for CONFIG_GENERIC_GPIO=n]
    Signed-off-by: Jani Nikula
    Acked-by: David Brownell
    Cc: Daniel Silverstone
    Signed-off-by: Randy Dunlap
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jani Nikula
     

17 Oct, 2008

1 commit

  • According to the documentation gpio_free should only be called from task
    context only. To make this more explicit add a might sleep to all
    implementations.

    This is the generic part which changes gpiolib and the fallback
    implementation only.

    Signed-off-by: Uwe Kleine-König
    Cc: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Uwe Kleine-König
     

26 Jul, 2008

1 commit

  • This adds a simple sysfs interface for GPIOs.

    /sys/class/gpio
    /export ... asks the kernel to export a GPIO to userspace
    /unexport ... to return a GPIO to the kernel
    /gpioN ... for each exported GPIO #N
    /value ... always readable, writes fail for input GPIOs
    /direction ... r/w as: in, out (default low); write high, low
    /gpiochipN ... for each gpiochip; #N is its first GPIO
    /base ... (r/o) same as N
    /label ... (r/o) descriptive, not necessarily unique
    /ngpio ... (r/o) number of GPIOs; numbered N .. N+(ngpio - 1)

    GPIOs claimed by kernel code may be exported by its owner using a new
    gpio_export() call, which should be most useful for driver debugging.
    Such exports may optionally be done without a "direction" attribute.

    Userspace may ask to take over a GPIO by writing to a sysfs control file,
    helping to cope with incomplete board support or other "one-off"
    requirements that don't merit full kernel support:

    echo 23 > /sys/class/gpio/export
    ... will gpio_request(23, "sysfs") and gpio_export(23);
    use /sys/class/gpio/gpio-23/direction to (re)configure it,
    when that GPIO can be used as both input and output.
    echo 23 > /sys/class/gpio/unexport
    ... will gpio_free(23), when it was exported as above

    The extra D-space footprint is a few hundred bytes, except for the sysfs
    resources associated with each exported GPIO. The additional I-space
    footprint is about two thirds of the current size of gpiolib (!). Since
    no /dev node creation is involved, no "udev" support is needed.

    Related changes:

    * This adds a device pointer to "struct gpio_chip". When GPIO
    providers initialize that, sysfs gpio class devices become children of
    that device instead of being "virtual" devices.

    * The (few) gpio_chip providers which have such a device node have
    been updated.

    * Some gpio_chip drivers also needed to update their module "owner"
    field ... for which missing kerneldoc was added.

    * Some gpio_chips don't support input GPIOs. Those GPIOs are now
    flagged appropriately when the chip is registered.

    Based on previous patches, and discussion both on and off LKML.

    A Documentation/ABI/testing/sysfs-gpio update is ready to submit once this
    merges to mainline.

    [akpm@linux-foundation.org: a few maintenance build fixes]
    Signed-off-by: David Brownell
    Cc: Guennadi Liakhovetski
    Cc: Greg KH
    Cc: Kay Sievers
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Brownell
     

25 May, 2008

1 commit

  • This fixes various gpio-related build errors (mostly potential)
    reported in part by Russell King and Uwe Kleine-König.

    Signed-off-by: David Brownell
    Cc: Uwe Kleine-König
    Cc: Russell King
    Cc: Arnaud Patard
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Brownell
     

05 Mar, 2008

1 commit

  • Add a defining fail/warn stubs for GPIO calls on platforms that
    don't support the GPIO programming interface. That includes the arch-specific
    implementation glue otherwise.

    This facilitates a new model for GPIO usage: drivers that can use GPIOs if
    they're available, but don't require them. One example of such a driver is
    NAND driver for various FreeScale chips. On platforms update with GPIO
    support, they can be used instead of a worst-case delay to verify that the
    BUSY signal is off.

    (Also includes a couple minor unrelated doc updates.)

    Signed-off-by: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Brownell