summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpiolib.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r--drivers/gpio/gpiolib.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 3ee99d070608..f497003f119c 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -956,9 +956,11 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
956 } 956 }
957 957
958 if (eflags & GPIOEVENT_REQUEST_RISING_EDGE) 958 if (eflags & GPIOEVENT_REQUEST_RISING_EDGE)
959 irqflags |= IRQF_TRIGGER_RISING; 959 irqflags |= test_bit(FLAG_ACTIVE_LOW, &desc->flags) ?
960 IRQF_TRIGGER_FALLING : IRQF_TRIGGER_RISING;
960 if (eflags & GPIOEVENT_REQUEST_FALLING_EDGE) 961 if (eflags & GPIOEVENT_REQUEST_FALLING_EDGE)
961 irqflags |= IRQF_TRIGGER_FALLING; 962 irqflags |= test_bit(FLAG_ACTIVE_LOW, &desc->flags) ?
963 IRQF_TRIGGER_RISING : IRQF_TRIGGER_FALLING;
962 irqflags |= IRQF_ONESHOT; 964 irqflags |= IRQF_ONESHOT;
963 965
964 INIT_KFIFO(le->events); 966 INIT_KFIFO(le->events);
@@ -1392,12 +1394,17 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data,
1392 for (i = 0; i < chip->ngpio; i++) { 1394 for (i = 0; i < chip->ngpio; i++) {
1393 struct gpio_desc *desc = &gdev->descs[i]; 1395 struct gpio_desc *desc = &gdev->descs[i];
1394 1396
1395 if (chip->get_direction && gpiochip_line_is_valid(chip, i)) 1397 if (chip->get_direction && gpiochip_line_is_valid(chip, i)) {
1396 desc->flags = !chip->get_direction(chip, i) ? 1398 if (!chip->get_direction(chip, i))
1397 (1 << FLAG_IS_OUT) : 0; 1399 set_bit(FLAG_IS_OUT, &desc->flags);
1398 else 1400 else
1399 desc->flags = !chip->direction_input ? 1401 clear_bit(FLAG_IS_OUT, &desc->flags);
1400 (1 << FLAG_IS_OUT) : 0; 1402 } else {
1403 if (!chip->direction_input)
1404 set_bit(FLAG_IS_OUT, &desc->flags);
1405 else
1406 clear_bit(FLAG_IS_OUT, &desc->flags);
1407 }
1401 } 1408 }
1402 1409
1403 acpi_gpiochip_add(chip); 1410 acpi_gpiochip_add(chip);