diff options
author | Mathias Nyman <mathias.nyman@linux.intel.com> | 2012-10-24 10:25:27 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-10-26 03:18:55 -0400 |
commit | 80b0a6029272247f19146bf8f88e5d4bba94cba5 (patch) | |
tree | 40cb6244bd1efb5e8e351952cf15e36d06801491 /include/asm-generic | |
parent | d6a2fa0424aefe97289aa561444ec3ae09bdbba0 (diff) |
gpiolib: add gpio get direction callback support
Add .get_direction callback to gpio_chip. This allows gpiolib
to check the current direction of a gpio.
Used to show the correct gpio direction in sysfs and debug entries.
If callback is not set then gpiolib will work as previously;
e.g. guessing everything is input until a direction is set.
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'include/asm-generic')
-rw-r--r-- | include/asm-generic/gpio.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index a9432fc6b8ba..eb70ca295971 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h | |||
@@ -56,6 +56,8 @@ struct device_node; | |||
56 | * enabling module power and clock; may sleep | 56 | * enabling module power and clock; may sleep |
57 | * @free: optional hook for chip-specific deactivation, such as | 57 | * @free: optional hook for chip-specific deactivation, such as |
58 | * disabling module power and clock; may sleep | 58 | * disabling module power and clock; may sleep |
59 | * @get_direction: returns direction for signal "offset", 0=out, 1=in, | ||
60 | * (same as GPIOF_DIR_XXX), or negative error | ||
59 | * @direction_input: configures signal "offset" as input, or returns error | 61 | * @direction_input: configures signal "offset" as input, or returns error |
60 | * @get: returns value for signal "offset"; for output signals this | 62 | * @get: returns value for signal "offset"; for output signals this |
61 | * returns either the value actually sensed, or zero | 63 | * returns either the value actually sensed, or zero |
@@ -100,7 +102,8 @@ struct gpio_chip { | |||
100 | unsigned offset); | 102 | unsigned offset); |
101 | void (*free)(struct gpio_chip *chip, | 103 | void (*free)(struct gpio_chip *chip, |
102 | unsigned offset); | 104 | unsigned offset); |
103 | 105 | int (*get_direction)(struct gpio_chip *chip, | |
106 | unsigned offset); | ||
104 | int (*direction_input)(struct gpio_chip *chip, | 107 | int (*direction_input)(struct gpio_chip *chip, |
105 | unsigned offset); | 108 | unsigned offset); |
106 | int (*get)(struct gpio_chip *chip, | 109 | int (*get)(struct gpio_chip *chip, |