diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2013-12-09 08:04:37 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-12-09 08:04:37 -0500 |
commit | bdc54ef45d7670aeb52ce73f8b7ad5f3e5563661 (patch) | |
tree | da6e170ce87891a0242de88d8d7c1ba34faf9bb7 /drivers/gpio | |
parent | 33e0aae11e4854c792e9871f94da6d28bf2e2bb8 (diff) | |
parent | 374b105797c3d4f29c685f3be535c35f5689b30e (diff) |
Merge tag 'v3.13-rc3' into devel
Linux 3.13-rc3
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-bcm-kona.c | 2 | ||||
-rw-r--r-- | drivers/gpio/gpio-mpc8xxx.c | 8 | ||||
-rw-r--r-- | drivers/gpio/gpio-msm-v2.c | 2 | ||||
-rw-r--r-- | drivers/gpio/gpio-mvebu.c | 2 | ||||
-rw-r--r-- | drivers/gpio/gpio-pl061.c | 10 | ||||
-rw-r--r-- | drivers/gpio/gpio-rcar.c | 2 | ||||
-rw-r--r-- | drivers/gpio/gpio-tb10x.c | 1 | ||||
-rw-r--r-- | drivers/gpio/gpio-twl4030.c | 13 | ||||
-rw-r--r-- | drivers/gpio/gpio-ucb1400.c | 1 | ||||
-rw-r--r-- | drivers/gpio/gpiolib.c | 78 |
10 files changed, 73 insertions, 46 deletions
diff --git a/drivers/gpio/gpio-bcm-kona.c b/drivers/gpio/gpio-bcm-kona.c index 3437414eaef2..233d088ac59f 100644 --- a/drivers/gpio/gpio-bcm-kona.c +++ b/drivers/gpio/gpio-bcm-kona.c | |||
@@ -158,7 +158,7 @@ static int bcm_kona_gpio_get(struct gpio_chip *chip, unsigned gpio) | |||
158 | spin_unlock_irqrestore(&kona_gpio->lock, flags); | 158 | spin_unlock_irqrestore(&kona_gpio->lock, flags); |
159 | 159 | ||
160 | /* return the specified bit status */ | 160 | /* return the specified bit status */ |
161 | return !!(val & bit); | 161 | return !!(val & BIT(bit)); |
162 | } | 162 | } |
163 | 163 | ||
164 | static int bcm_kona_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) | 164 | static int bcm_kona_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) |
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c index 914e859e3eda..d7d6d72eba33 100644 --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c | |||
@@ -70,10 +70,14 @@ static int mpc8572_gpio_get(struct gpio_chip *gc, unsigned int gpio) | |||
70 | u32 val; | 70 | u32 val; |
71 | struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc); | 71 | struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc); |
72 | struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm); | 72 | struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm); |
73 | u32 out_mask, out_shadow; | ||
73 | 74 | ||
74 | val = in_be32(mm->regs + GPIO_DAT) & ~in_be32(mm->regs + GPIO_DIR); | 75 | out_mask = in_be32(mm->regs + GPIO_DIR); |
75 | 76 | ||
76 | return (val | mpc8xxx_gc->data) & mpc8xxx_gpio2mask(gpio); | 77 | val = in_be32(mm->regs + GPIO_DAT) & ~out_mask; |
78 | out_shadow = mpc8xxx_gc->data & out_mask; | ||
79 | |||
80 | return (val | out_shadow) & mpc8xxx_gpio2mask(gpio); | ||
77 | } | 81 | } |
78 | 82 | ||
79 | static int mpc8xxx_gpio_get(struct gpio_chip *gc, unsigned int gpio) | 83 | static int mpc8xxx_gpio_get(struct gpio_chip *gc, unsigned int gpio) |
diff --git a/drivers/gpio/gpio-msm-v2.c b/drivers/gpio/gpio-msm-v2.c index f7a0cc4da950..7b37300973db 100644 --- a/drivers/gpio/gpio-msm-v2.c +++ b/drivers/gpio/gpio-msm-v2.c | |||
@@ -102,7 +102,7 @@ struct msm_gpio_dev { | |||
102 | DECLARE_BITMAP(wake_irqs, MAX_NR_GPIO); | 102 | DECLARE_BITMAP(wake_irqs, MAX_NR_GPIO); |
103 | DECLARE_BITMAP(dual_edge_irqs, MAX_NR_GPIO); | 103 | DECLARE_BITMAP(dual_edge_irqs, MAX_NR_GPIO); |
104 | struct irq_domain *domain; | 104 | struct irq_domain *domain; |
105 | unsigned int summary_irq; | 105 | int summary_irq; |
106 | void __iomem *msm_tlmm_base; | 106 | void __iomem *msm_tlmm_base; |
107 | }; | 107 | }; |
108 | 108 | ||
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c index a8908009803f..bc78a9da5502 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c | |||
@@ -79,7 +79,7 @@ struct mvebu_gpio_chip { | |||
79 | spinlock_t lock; | 79 | spinlock_t lock; |
80 | void __iomem *membase; | 80 | void __iomem *membase; |
81 | void __iomem *percpu_membase; | 81 | void __iomem *percpu_membase; |
82 | unsigned int irqbase; | 82 | int irqbase; |
83 | struct irq_domain *domain; | 83 | struct irq_domain *domain; |
84 | int soc_variant; | 84 | int soc_variant; |
85 | }; | 85 | }; |
diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c index f22f7f3e2e53..b4d42112d02d 100644 --- a/drivers/gpio/gpio-pl061.c +++ b/drivers/gpio/gpio-pl061.c | |||
@@ -286,11 +286,6 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) | |||
286 | if (!chip->base) | 286 | if (!chip->base) |
287 | return -ENOMEM; | 287 | return -ENOMEM; |
288 | 288 | ||
289 | chip->domain = irq_domain_add_simple(adev->dev.of_node, PL061_GPIO_NR, | ||
290 | irq_base, &pl061_domain_ops, chip); | ||
291 | if (!chip->domain) | ||
292 | return -ENODEV; | ||
293 | |||
294 | spin_lock_init(&chip->lock); | 289 | spin_lock_init(&chip->lock); |
295 | 290 | ||
296 | chip->gc.request = pl061_gpio_request; | 291 | chip->gc.request = pl061_gpio_request; |
@@ -320,6 +315,11 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) | |||
320 | irq_set_chained_handler(irq, pl061_irq_handler); | 315 | irq_set_chained_handler(irq, pl061_irq_handler); |
321 | irq_set_handler_data(irq, chip); | 316 | irq_set_handler_data(irq, chip); |
322 | 317 | ||
318 | chip->domain = irq_domain_add_simple(adev->dev.of_node, PL061_GPIO_NR, | ||
319 | irq_base, &pl061_domain_ops, chip); | ||
320 | if (!chip->domain) | ||
321 | return -ENODEV; | ||
322 | |||
323 | for (i = 0; i < PL061_GPIO_NR; i++) { | 323 | for (i = 0; i < PL061_GPIO_NR; i++) { |
324 | if (pdata) { | 324 | if (pdata) { |
325 | if (pdata->directions & (1 << i)) | 325 | if (pdata->directions & (1 << i)) |
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c index 28fa94a316ff..2fdd0191819d 100644 --- a/drivers/gpio/gpio-rcar.c +++ b/drivers/gpio/gpio-rcar.c | |||
@@ -421,7 +421,7 @@ static int gpio_rcar_probe(struct platform_device *pdev) | |||
421 | if (!p->irq_domain) { | 421 | if (!p->irq_domain) { |
422 | ret = -ENXIO; | 422 | ret = -ENXIO; |
423 | dev_err(&pdev->dev, "cannot initialize irq domain\n"); | 423 | dev_err(&pdev->dev, "cannot initialize irq domain\n"); |
424 | goto err1; | 424 | goto err0; |
425 | } | 425 | } |
426 | 426 | ||
427 | if (devm_request_irq(&pdev->dev, irq->start, | 427 | if (devm_request_irq(&pdev->dev, irq->start, |
diff --git a/drivers/gpio/gpio-tb10x.c b/drivers/gpio/gpio-tb10x.c index 66a54ea4f779..3162555ca1cb 100644 --- a/drivers/gpio/gpio-tb10x.c +++ b/drivers/gpio/gpio-tb10x.c | |||
@@ -132,6 +132,7 @@ static int tb10x_gpio_direction_out(struct gpio_chip *chip, | |||
132 | int mask = BIT(offset); | 132 | int mask = BIT(offset); |
133 | int val = TB10X_GPIO_DIR_OUT << offset; | 133 | int val = TB10X_GPIO_DIR_OUT << offset; |
134 | 134 | ||
135 | tb10x_gpio_set(chip, offset, value); | ||
135 | tb10x_set_bits(tb10x_gpio, OFFSET_TO_REG_DDR, mask, val); | 136 | tb10x_set_bits(tb10x_gpio, OFFSET_TO_REG_DDR, mask, val); |
136 | 137 | ||
137 | return 0; | 138 | return 0; |
diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c index cd06678a29f7..29f00a76bb92 100644 --- a/drivers/gpio/gpio-twl4030.c +++ b/drivers/gpio/gpio-twl4030.c | |||
@@ -354,17 +354,18 @@ static void twl_set(struct gpio_chip *chip, unsigned offset, int value) | |||
354 | static int twl_direction_out(struct gpio_chip *chip, unsigned offset, int value) | 354 | static int twl_direction_out(struct gpio_chip *chip, unsigned offset, int value) |
355 | { | 355 | { |
356 | struct gpio_twl4030_priv *priv = to_gpio_twl4030(chip); | 356 | struct gpio_twl4030_priv *priv = to_gpio_twl4030(chip); |
357 | int ret = -EINVAL; | ||
357 | 358 | ||
358 | mutex_lock(&priv->mutex); | 359 | mutex_lock(&priv->mutex); |
359 | if (offset < TWL4030_GPIO_MAX) | 360 | if (offset < TWL4030_GPIO_MAX) |
360 | twl4030_set_gpio_dataout(offset, value); | 361 | ret = twl4030_set_gpio_direction(offset, 0); |
361 | 362 | ||
362 | priv->direction |= BIT(offset); | 363 | priv->direction |= BIT(offset); |
363 | mutex_unlock(&priv->mutex); | 364 | mutex_unlock(&priv->mutex); |
364 | 365 | ||
365 | twl_set(chip, offset, value); | 366 | twl_set(chip, offset, value); |
366 | 367 | ||
367 | return 0; | 368 | return ret; |
368 | } | 369 | } |
369 | 370 | ||
370 | static int twl_to_irq(struct gpio_chip *chip, unsigned offset) | 371 | static int twl_to_irq(struct gpio_chip *chip, unsigned offset) |
@@ -435,7 +436,8 @@ static int gpio_twl4030_debounce(u32 debounce, u8 mmc_cd) | |||
435 | 436 | ||
436 | static int gpio_twl4030_remove(struct platform_device *pdev); | 437 | static int gpio_twl4030_remove(struct platform_device *pdev); |
437 | 438 | ||
438 | static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev) | 439 | static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev, |
440 | struct twl4030_gpio_platform_data *pdata) | ||
439 | { | 441 | { |
440 | struct twl4030_gpio_platform_data *omap_twl_info; | 442 | struct twl4030_gpio_platform_data *omap_twl_info; |
441 | 443 | ||
@@ -443,6 +445,9 @@ static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev) | |||
443 | if (!omap_twl_info) | 445 | if (!omap_twl_info) |
444 | return NULL; | 446 | return NULL; |
445 | 447 | ||
448 | if (pdata) | ||
449 | *omap_twl_info = *pdata; | ||
450 | |||
446 | omap_twl_info->use_leds = of_property_read_bool(dev->of_node, | 451 | omap_twl_info->use_leds = of_property_read_bool(dev->of_node, |
447 | "ti,use-leds"); | 452 | "ti,use-leds"); |
448 | 453 | ||
@@ -500,7 +505,7 @@ no_irqs: | |||
500 | mutex_init(&priv->mutex); | 505 | mutex_init(&priv->mutex); |
501 | 506 | ||
502 | if (node) | 507 | if (node) |
503 | pdata = of_gpio_twl4030(&pdev->dev); | 508 | pdata = of_gpio_twl4030(&pdev->dev, pdata); |
504 | 509 | ||
505 | if (pdata == NULL) { | 510 | if (pdata == NULL) { |
506 | dev_err(&pdev->dev, "Platform data is missing\n"); | 511 | dev_err(&pdev->dev, "Platform data is missing\n"); |
diff --git a/drivers/gpio/gpio-ucb1400.c b/drivers/gpio/gpio-ucb1400.c index c6a53971387b..2445fe771179 100644 --- a/drivers/gpio/gpio-ucb1400.c +++ b/drivers/gpio/gpio-ucb1400.c | |||
@@ -105,3 +105,4 @@ module_platform_driver(ucb1400_gpio_driver); | |||
105 | 105 | ||
106 | MODULE_DESCRIPTION("Philips UCB1400 GPIO driver"); | 106 | MODULE_DESCRIPTION("Philips UCB1400 GPIO driver"); |
107 | MODULE_LICENSE("GPL"); | 107 | MODULE_LICENSE("GPL"); |
108 | MODULE_ALIAS("platform:ucb1400_gpio"); | ||
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 94467ddb3711..44a232701179 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> |
@@ -1309,6 +1310,18 @@ struct gpio_chip *gpiochip_find(void *data, | |||
1309 | } | 1310 | } |
1310 | EXPORT_SYMBOL_GPL(gpiochip_find); | 1311 | EXPORT_SYMBOL_GPL(gpiochip_find); |
1311 | 1312 | ||
1313 | static int gpiochip_match_name(struct gpio_chip *chip, void *data) | ||
1314 | { | ||
1315 | const char *name = data; | ||
1316 | |||
1317 | return !strcmp(chip->label, name); | ||
1318 | } | ||
1319 | |||
1320 | static struct gpio_chip *find_chip_by_name(const char *name) | ||
1321 | { | ||
1322 | return gpiochip_find((void *)name, gpiochip_match_name); | ||
1323 | } | ||
1324 | |||
1312 | #ifdef CONFIG_PINCTRL | 1325 | #ifdef CONFIG_PINCTRL |
1313 | 1326 | ||
1314 | /** | 1327 | /** |
@@ -1342,8 +1355,10 @@ int gpiochip_add_pingroup_range(struct gpio_chip *chip, | |||
1342 | ret = pinctrl_get_group_pins(pctldev, pin_group, | 1355 | ret = pinctrl_get_group_pins(pctldev, pin_group, |
1343 | &pin_range->range.pins, | 1356 | &pin_range->range.pins, |
1344 | &pin_range->range.npins); | 1357 | &pin_range->range.npins); |
1345 | if (ret < 0) | 1358 | if (ret < 0) { |
1359 | kfree(pin_range); | ||
1346 | return ret; | 1360 | return ret; |
1361 | } | ||
1347 | 1362 | ||
1348 | pinctrl_add_gpio_range(pctldev, &pin_range->range); | 1363 | pinctrl_add_gpio_range(pctldev, &pin_range->range); |
1349 | 1364 | ||
@@ -2261,26 +2276,10 @@ void gpiod_add_table(struct gpiod_lookup *table, size_t size) | |||
2261 | mutex_unlock(&gpio_lookup_lock); | 2276 | mutex_unlock(&gpio_lookup_lock); |
2262 | } | 2277 | } |
2263 | 2278 | ||
2264 | /* | ||
2265 | * Caller must have a acquired gpio_lookup_lock | ||
2266 | */ | ||
2267 | static struct gpio_chip *find_chip_by_name(const char *name) | ||
2268 | { | ||
2269 | struct gpio_chip *chip = NULL; | ||
2270 | |||
2271 | list_for_each_entry(chip, &gpio_lookup_list, list) { | ||
2272 | if (chip->label == NULL) | ||
2273 | continue; | ||
2274 | if (!strcmp(chip->label, name)) | ||
2275 | break; | ||
2276 | } | ||
2277 | |||
2278 | return chip; | ||
2279 | } | ||
2280 | |||
2281 | #ifdef CONFIG_OF | 2279 | #ifdef CONFIG_OF |
2282 | static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, | 2280 | static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, |
2283 | unsigned int idx, unsigned long *flags) | 2281 | unsigned int idx, |
2282 | enum gpio_lookup_flags *flags) | ||
2284 | { | 2283 | { |
2285 | char prop_name[32]; /* 32 is max size of property name */ | 2284 | char prop_name[32]; /* 32 is max size of property name */ |
2286 | enum of_gpio_flags of_flags; | 2285 | enum of_gpio_flags of_flags; |
@@ -2298,20 +2297,22 @@ static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, | |||
2298 | return desc; | 2297 | return desc; |
2299 | 2298 | ||
2300 | if (of_flags & OF_GPIO_ACTIVE_LOW) | 2299 | if (of_flags & OF_GPIO_ACTIVE_LOW) |
2301 | *flags |= GPIOF_ACTIVE_LOW; | 2300 | *flags |= GPIO_ACTIVE_LOW; |
2302 | 2301 | ||
2303 | return desc; | 2302 | return desc; |
2304 | } | 2303 | } |
2305 | #else | 2304 | #else |
2306 | static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, | 2305 | static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, |
2307 | unsigned int idx, unsigned long *flags) | 2306 | unsigned int idx, |
2307 | enum gpio_lookup_flags *flags) | ||
2308 | { | 2308 | { |
2309 | return ERR_PTR(-ENODEV); | 2309 | return ERR_PTR(-ENODEV); |
2310 | } | 2310 | } |
2311 | #endif | 2311 | #endif |
2312 | 2312 | ||
2313 | static struct gpio_desc *acpi_find_gpio(struct device *dev, const char *con_id, | 2313 | static struct gpio_desc *acpi_find_gpio(struct device *dev, const char *con_id, |
2314 | unsigned int idx, unsigned long *flags) | 2314 | unsigned int idx, |
2315 | enum gpio_lookup_flags *flags) | ||
2315 | { | 2316 | { |
2316 | struct acpi_gpio_info info; | 2317 | struct acpi_gpio_info info; |
2317 | struct gpio_desc *desc; | 2318 | struct gpio_desc *desc; |
@@ -2321,13 +2322,14 @@ static struct gpio_desc *acpi_find_gpio(struct device *dev, const char *con_id, | |||
2321 | return desc; | 2322 | return desc; |
2322 | 2323 | ||
2323 | if (info.gpioint && info.active_low) | 2324 | if (info.gpioint && info.active_low) |
2324 | *flags |= GPIOF_ACTIVE_LOW; | 2325 | *flags |= GPIO_ACTIVE_LOW; |
2325 | 2326 | ||
2326 | return desc; | 2327 | return desc; |
2327 | } | 2328 | } |
2328 | 2329 | ||
2329 | static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id, | 2330 | static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id, |
2330 | unsigned int idx, unsigned long *flags) | 2331 | unsigned int idx, |
2332 | enum gpio_lookup_flags *flags) | ||
2331 | { | 2333 | { |
2332 | const char *dev_id = dev ? dev_name(dev) : NULL; | 2334 | const char *dev_id = dev ? dev_name(dev) : NULL; |
2333 | struct gpio_desc *desc = ERR_PTR(-ENODEV); | 2335 | struct gpio_desc *desc = ERR_PTR(-ENODEV); |
@@ -2367,7 +2369,7 @@ static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id, | |||
2367 | continue; | 2369 | continue; |
2368 | } | 2370 | } |
2369 | 2371 | ||
2370 | if (chip->ngpio >= p->chip_hwnum) { | 2372 | if (chip->ngpio <= p->chip_hwnum) { |
2371 | dev_warn(dev, "GPIO chip %s has %d GPIOs\n", | 2373 | dev_warn(dev, "GPIO chip %s has %d GPIOs\n", |
2372 | chip->label, chip->ngpio); | 2374 | chip->label, chip->ngpio); |
2373 | continue; | 2375 | continue; |
@@ -2417,9 +2419,9 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, | |||
2417 | const char *con_id, | 2419 | const char *con_id, |
2418 | unsigned int idx) | 2420 | unsigned int idx) |
2419 | { | 2421 | { |
2420 | struct gpio_desc *desc; | 2422 | struct gpio_desc *desc = NULL; |
2421 | int status; | 2423 | int status; |
2422 | unsigned long flags = 0; | 2424 | enum gpio_lookup_flags flags = 0; |
2423 | 2425 | ||
2424 | dev_dbg(dev, "GPIO lookup for consumer %s\n", con_id); | 2426 | dev_dbg(dev, "GPIO lookup for consumer %s\n", con_id); |
2425 | 2427 | ||
@@ -2430,13 +2432,23 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, | |||
2430 | } else if (IS_ENABLED(CONFIG_ACPI) && dev && ACPI_HANDLE(dev)) { | 2432 | } else if (IS_ENABLED(CONFIG_ACPI) && dev && ACPI_HANDLE(dev)) { |
2431 | dev_dbg(dev, "using ACPI for GPIO lookup\n"); | 2433 | dev_dbg(dev, "using ACPI for GPIO lookup\n"); |
2432 | desc = acpi_find_gpio(dev, con_id, idx, &flags); | 2434 | desc = acpi_find_gpio(dev, con_id, idx, &flags); |
2433 | } else { | 2435 | } |
2436 | |||
2437 | /* | ||
2438 | * Either we are not using DT or ACPI, or their lookup did not return | ||
2439 | * a result. In that case, use platform lookup as a fallback. | ||
2440 | */ | ||
2441 | if (!desc || IS_ERR(desc)) { | ||
2442 | struct gpio_desc *pdesc; | ||
2434 | dev_dbg(dev, "using lookup tables for GPIO lookup"); | 2443 | dev_dbg(dev, "using lookup tables for GPIO lookup"); |
2435 | desc = gpiod_find(dev, con_id, idx, &flags); | 2444 | pdesc = gpiod_find(dev, con_id, idx, &flags); |
2445 | /* If used as fallback, do not replace the previous error */ | ||
2446 | if (!IS_ERR(pdesc) || !desc) | ||
2447 | desc = pdesc; | ||
2436 | } | 2448 | } |
2437 | 2449 | ||
2438 | if (IS_ERR(desc)) { | 2450 | if (IS_ERR(desc)) { |
2439 | dev_warn(dev, "lookup for GPIO %s failed\n", con_id); | 2451 | dev_dbg(dev, "lookup for GPIO %s failed\n", con_id); |
2440 | return desc; | 2452 | return desc; |
2441 | } | 2453 | } |
2442 | 2454 | ||
@@ -2445,8 +2457,12 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, | |||
2445 | if (status < 0) | 2457 | if (status < 0) |
2446 | return ERR_PTR(status); | 2458 | return ERR_PTR(status); |
2447 | 2459 | ||
2448 | if (flags & GPIOF_ACTIVE_LOW) | 2460 | if (flags & GPIO_ACTIVE_LOW) |
2449 | set_bit(FLAG_ACTIVE_LOW, &desc->flags); | 2461 | set_bit(FLAG_ACTIVE_LOW, &desc->flags); |
2462 | if (flags & GPIO_OPEN_DRAIN) | ||
2463 | set_bit(FLAG_OPEN_DRAIN, &desc->flags); | ||
2464 | if (flags & GPIO_OPEN_SOURCE) | ||
2465 | set_bit(FLAG_OPEN_SOURCE, &desc->flags); | ||
2450 | 2466 | ||
2451 | return desc; | 2467 | return desc; |
2452 | } | 2468 | } |