Linux Kernel
3.7.1
|
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/spinlock.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/gpio.h>
#include <linux/of_gpio.h>
#include <linux/idr.h>
#include <linux/slab.h>
#include <trace/events/gpio.h>
Go to the source code of this file.
Data Structures | |
struct | gpio_desc |
Macros | |
#define | CREATE_TRACE_POINTS |
#define | extra_checks 0 |
#define | FLAG_REQUESTED 0 |
#define | FLAG_IS_OUT 1 |
#define | FLAG_RESERVED 2 |
#define | FLAG_EXPORT 3 /* protected by sysfs_lock */ |
#define | FLAG_SYSFS 4 /* exported via /sys/class/gpio/control */ |
#define | FLAG_TRIG_FALL 5 /* trigger on falling edge */ |
#define | FLAG_TRIG_RISE 6 /* trigger on rising edge */ |
#define | FLAG_ACTIVE_LOW 7 /* sysfs value has active low */ |
#define | FLAG_OPEN_DRAIN 8 /* Gpio is open drain type */ |
#define | FLAG_OPEN_SOURCE 9 /* Gpio is open source type */ |
#define | ID_SHIFT 16 /* add new flags before this one */ |
#define | GPIO_FLAGS_MASK ((1 << ID_SHIFT) - 1) |
#define | GPIO_TRIGGER_MASK (BIT(FLAG_TRIG_FALL) | BIT(FLAG_TRIG_RISE)) |
#define GPIO_TRIGGER_MASK (BIT(FLAG_TRIG_FALL) | BIT(FLAG_TRIG_RISE)) |
int __gpio_cansleep | ( | unsigned | gpio | ) |
__gpio_cansleep() - report whether gpio value access will sleep : gpio in question Context: any
This is used directly or indirectly to implement gpio_cansleep(). It returns nonzero if access reading or writing the GPIO value can sleep.
int __gpio_get_value | ( | unsigned | gpio | ) |
__gpio_get_value() - return a gpio's value : gpio whose value will be returned Context: any
This is used directly or indirectly to implement gpio_get_value(). It returns the zero or nonzero value provided by the associated gpio_chip.get() method; or zero if no such method is provided.
__gpio_set_value() - assign a gpio's value : gpio whose value will be assigned : value to assign Context: any
This is used directly or indirectly to implement gpio_set_value(). It invokes the associated gpio_chip.set() method.
int __gpio_to_irq | ( | unsigned | gpio | ) |
__gpio_to_irq() - return the IRQ corresponding to a GPIO : gpio whose IRQ will be returned (already requested) Context: any
This is used directly or indirectly to implement gpio_to_irq(). It returns the number of the IRQ signaled by this (input) GPIO, or a negative errno.
EXPORT_SYMBOL_GPL | ( | gpiochip_add | ) |
EXPORT_SYMBOL_GPL | ( | gpiochip_remove | ) |
EXPORT_SYMBOL_GPL | ( | gpiochip_find | ) |
EXPORT_SYMBOL_GPL | ( | gpio_request | ) |
EXPORT_SYMBOL_GPL | ( | gpio_free | ) |
EXPORT_SYMBOL_GPL | ( | gpio_request_one | ) |
EXPORT_SYMBOL_GPL | ( | gpio_request_array | ) |
EXPORT_SYMBOL_GPL | ( | gpio_free_array | ) |
EXPORT_SYMBOL_GPL | ( | gpiochip_is_requested | ) |
EXPORT_SYMBOL_GPL | ( | gpio_direction_input | ) |
EXPORT_SYMBOL_GPL | ( | gpio_direction_output | ) |
EXPORT_SYMBOL_GPL | ( | gpio_set_debounce | ) |
EXPORT_SYMBOL_GPL | ( | __gpio_get_value | ) |
EXPORT_SYMBOL_GPL | ( | __gpio_set_value | ) |
EXPORT_SYMBOL_GPL | ( | __gpio_cansleep | ) |
EXPORT_SYMBOL_GPL | ( | __gpio_to_irq | ) |
EXPORT_SYMBOL_GPL | ( | gpio_get_value_cansleep | ) |
EXPORT_SYMBOL_GPL | ( | gpio_set_value_cansleep | ) |
int gpio_set_debounce | ( | unsigned | gpio, |
unsigned | debounce | ||
) |
gpiochip_add() - register a gpio_chip : the chip to register, with chip->base initialized Context: potentially before irqs or kmalloc will work
Returns a negative errno if the chip can't be registered, such as because the chip->base is invalid or already associated with a different chip. Otherwise it returns zero as a success code.
When gpiochip_add() is called very early during boot, so that GPIOs can be freely used, the chip->dev device must be registered before the gpio framework's arch_initcall(). Otherwise sysfs initialization for GPIOs will fail rudely.
If chip->base is negative, this requests dynamic assignment of a range of valid GPIOs.
|
read |
gpiochip_find() - iterator for locating a specific gpio_chip : data to pass to match function : Callback function to check gpio_chip
Similar to bus_find_device. It returns a reference to a gpio_chip as determined by a user supplied callback. The callback should return 0 if the device doesn't match and non-zero if it does. If the callback is non-zero, this function will return to the caller and not iterate over any more gpio_chips.
gpiochip_is_requested - return string iff signal was requested : controller managing the signal : of signal within controller's 0..(ngpio - 1) range
Returns NULL if the GPIO is not currently requested, else a string. If debugfs support is enabled, the string returned is the label passed to gpio_request(); otherwise it is a meaningless constant.
This function is for use by GPIO controller drivers. The label can help with diagnostics, and knowing that the signal is used as a GPIO can help avoid accidentally multiplexing it to another controller.
gpiochip_remove() - unregister a gpio_chip : the chip to unregister
A gpio_chip with any GPIOs still requested may not be removed.
gpiochip_reserve() - reserve range of gpios to use with platform code only : starting gpio number : number of gpios to reserve Context: platform init, potentially before irqs or kmalloc will work
Returns a negative errno if any gpio within the range is already reserved or registered, else returns zero as a success code. Use this function to mark a range of gpios as unavailable for dynamic gpio number allocation, for example because its driver support is not yet loaded.