diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/gpio/consumer.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index bed128e8f4b1..6a37ef0dc59c 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h | |||
| @@ -23,6 +23,12 @@ struct gpio_desc *__must_check gpiod_get(struct device *dev, | |||
| 23 | struct gpio_desc *__must_check gpiod_get_index(struct device *dev, | 23 | struct gpio_desc *__must_check gpiod_get_index(struct device *dev, |
| 24 | const char *con_id, | 24 | const char *con_id, |
| 25 | unsigned int idx); | 25 | unsigned int idx); |
| 26 | struct gpio_desc *__must_check gpiod_get_optional(struct device *dev, | ||
| 27 | const char *con_id); | ||
| 28 | struct gpio_desc *__must_check gpiod_get_index_optional(struct device *dev, | ||
| 29 | const char *con_id, | ||
| 30 | unsigned int index); | ||
| 31 | |||
| 26 | void gpiod_put(struct gpio_desc *desc); | 32 | void gpiod_put(struct gpio_desc *desc); |
| 27 | 33 | ||
| 28 | struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, | 34 | struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, |
| @@ -30,6 +36,12 @@ struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, | |||
| 30 | struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, | 36 | struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, |
| 31 | const char *con_id, | 37 | const char *con_id, |
| 32 | unsigned int idx); | 38 | unsigned int idx); |
| 39 | struct gpio_desc *__must_check devm_gpiod_get_optional(struct device *dev, | ||
| 40 | const char *con_id); | ||
| 41 | struct gpio_desc *__must_check | ||
| 42 | devm_gpiod_get_index_optional(struct device *dev, const char *con_id, | ||
| 43 | unsigned int index); | ||
| 44 | |||
| 33 | void devm_gpiod_put(struct device *dev, struct gpio_desc *desc); | 45 | void devm_gpiod_put(struct device *dev, struct gpio_desc *desc); |
| 34 | 46 | ||
| 35 | int gpiod_get_direction(const struct gpio_desc *desc); | 47 | int gpiod_get_direction(const struct gpio_desc *desc); |
| @@ -73,6 +85,20 @@ static inline struct gpio_desc *__must_check gpiod_get_index(struct device *dev, | |||
| 73 | { | 85 | { |
| 74 | return ERR_PTR(-ENOSYS); | 86 | return ERR_PTR(-ENOSYS); |
| 75 | } | 87 | } |
| 88 | |||
| 89 | static inline struct gpio_desc *__must_check | ||
| 90 | gpiod_get_optional(struct device *dev, const char *con_id) | ||
| 91 | { | ||
| 92 | return ERR_PTR(-ENOSYS); | ||
| 93 | } | ||
| 94 | |||
| 95 | static inline struct gpio_desc *__must_check | ||
| 96 | gpiod_get_index_optional(struct device *dev, const char *con_id, | ||
| 97 | unsigned int index) | ||
| 98 | { | ||
| 99 | return ERR_PTR(-ENOSYS); | ||
| 100 | } | ||
| 101 | |||
| 76 | static inline void gpiod_put(struct gpio_desc *desc) | 102 | static inline void gpiod_put(struct gpio_desc *desc) |
| 77 | { | 103 | { |
| 78 | might_sleep(); | 104 | might_sleep(); |
| @@ -93,6 +119,20 @@ struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, | |||
| 93 | { | 119 | { |
| 94 | return ERR_PTR(-ENOSYS); | 120 | return ERR_PTR(-ENOSYS); |
| 95 | } | 121 | } |
| 122 | |||
| 123 | static inline struct gpio_desc *__must_check | ||
| 124 | devm_gpiod_get_optional(struct device *dev, const char *con_id) | ||
| 125 | { | ||
| 126 | return ERR_PTR(-ENOSYS); | ||
| 127 | } | ||
| 128 | |||
| 129 | static inline struct gpio_desc *__must_check | ||
| 130 | devm_gpiod_get_index_optional(struct device *dev, const char *con_id, | ||
| 131 | unsigned int index) | ||
| 132 | { | ||
| 133 | return ERR_PTR(-ENOSYS); | ||
| 134 | } | ||
| 135 | |||
| 96 | static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc) | 136 | static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc) |
| 97 | { | 137 | { |
| 98 | might_sleep(); | 138 | might_sleep(); |
