diff options
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r-- | drivers/gpio/gpiolib.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index d8938b9b794a..490198365ce4 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/idr.h> | 14 | #include <linux/idr.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/acpi.h> | 16 | #include <linux/acpi.h> |
17 | #include <linux/gpio/driver.h> | ||
17 | 18 | ||
18 | #define CREATE_TRACE_POINTS | 19 | #define CREATE_TRACE_POINTS |
19 | #include <trace/events/gpio.h> | 20 | #include <trace/events/gpio.h> |
@@ -2274,7 +2275,8 @@ void gpiod_add_table(struct gpiod_lookup *table, size_t size) | |||
2274 | 2275 | ||
2275 | #ifdef CONFIG_OF | 2276 | #ifdef CONFIG_OF |
2276 | static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, | 2277 | static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, |
2277 | unsigned int idx, unsigned long *flags) | 2278 | unsigned int idx, |
2279 | enum gpio_lookup_flags *flags) | ||
2278 | { | 2280 | { |
2279 | char prop_name[32]; /* 32 is max size of property name */ | 2281 | char prop_name[32]; /* 32 is max size of property name */ |
2280 | enum of_gpio_flags of_flags; | 2282 | enum of_gpio_flags of_flags; |
@@ -2292,7 +2294,7 @@ static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, | |||
2292 | return desc; | 2294 | return desc; |
2293 | 2295 | ||
2294 | if (of_flags & OF_GPIO_ACTIVE_LOW) | 2296 | if (of_flags & OF_GPIO_ACTIVE_LOW) |
2295 | *flags |= GPIOF_ACTIVE_LOW; | 2297 | *flags |= GPIO_ACTIVE_LOW; |
2296 | 2298 | ||
2297 | return desc; | 2299 | return desc; |
2298 | } | 2300 | } |
@@ -2305,7 +2307,8 @@ static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, | |||
2305 | #endif | 2307 | #endif |
2306 | 2308 | ||
2307 | static struct gpio_desc *acpi_find_gpio(struct device *dev, const char *con_id, | 2309 | static struct gpio_desc *acpi_find_gpio(struct device *dev, const char *con_id, |
2308 | unsigned int idx, unsigned long *flags) | 2310 | unsigned int idx, |
2311 | enum gpio_lookup_flags *flags) | ||
2309 | { | 2312 | { |
2310 | struct acpi_gpio_info info; | 2313 | struct acpi_gpio_info info; |
2311 | struct gpio_desc *desc; | 2314 | struct gpio_desc *desc; |
@@ -2315,13 +2318,14 @@ static struct gpio_desc *acpi_find_gpio(struct device *dev, const char *con_id, | |||
2315 | return desc; | 2318 | return desc; |
2316 | 2319 | ||
2317 | if (info.gpioint && info.active_low) | 2320 | if (info.gpioint && info.active_low) |
2318 | *flags |= GPIOF_ACTIVE_LOW; | 2321 | *flags |= GPIO_ACTIVE_LOW; |
2319 | 2322 | ||
2320 | return desc; | 2323 | return desc; |
2321 | } | 2324 | } |
2322 | 2325 | ||
2323 | static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id, | 2326 | static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id, |
2324 | unsigned int idx, unsigned long *flags) | 2327 | unsigned int idx, |
2328 | enum gpio_lookup_flags *flags) | ||
2325 | { | 2329 | { |
2326 | const char *dev_id = dev ? dev_name(dev) : NULL; | 2330 | const char *dev_id = dev ? dev_name(dev) : NULL; |
2327 | struct gpio_desc *desc = ERR_PTR(-ENODEV); | 2331 | struct gpio_desc *desc = ERR_PTR(-ENODEV); |
@@ -2413,7 +2417,7 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, | |||
2413 | { | 2417 | { |
2414 | struct gpio_desc *desc; | 2418 | struct gpio_desc *desc; |
2415 | int status; | 2419 | int status; |
2416 | unsigned long flags = 0; | 2420 | enum gpio_lookup_flags flags = 0; |
2417 | 2421 | ||
2418 | dev_dbg(dev, "GPIO lookup for consumer %s\n", con_id); | 2422 | dev_dbg(dev, "GPIO lookup for consumer %s\n", con_id); |
2419 | 2423 | ||
@@ -2439,8 +2443,12 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, | |||
2439 | if (status < 0) | 2443 | if (status < 0) |
2440 | return ERR_PTR(status); | 2444 | return ERR_PTR(status); |
2441 | 2445 | ||
2442 | if (flags & GPIOF_ACTIVE_LOW) | 2446 | if (flags & GPIO_ACTIVE_LOW) |
2443 | set_bit(FLAG_ACTIVE_LOW, &desc->flags); | 2447 | set_bit(FLAG_ACTIVE_LOW, &desc->flags); |
2448 | if (flags & GPIO_OPEN_DRAIN) | ||
2449 | set_bit(FLAG_OPEN_DRAIN, &desc->flags); | ||
2450 | if (flags & GPIO_OPEN_SOURCE) | ||
2451 | set_bit(FLAG_OPEN_SOURCE, &desc->flags); | ||
2444 | 2452 | ||
2445 | return desc; | 2453 | return desc; |
2446 | } | 2454 | } |