diff options
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpiolib.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index c27e52b56d66..137a8ca67822 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -12,6 +12,8 @@ | |||
12 | #include <linux/idr.h> | 12 | #include <linux/idr.h> |
13 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
14 | 14 | ||
15 | #define CREATE_TRACE_POINTS | ||
16 | #include <trace/events/gpio.h> | ||
15 | 17 | ||
16 | /* Optional implementation infrastructure for GPIO interfaces. | 18 | /* Optional implementation infrastructure for GPIO interfaces. |
17 | * | 19 | * |
@@ -1405,6 +1407,8 @@ int gpio_direction_input(unsigned gpio) | |||
1405 | status = chip->direction_input(chip, gpio); | 1407 | status = chip->direction_input(chip, gpio); |
1406 | if (status == 0) | 1408 | if (status == 0) |
1407 | clear_bit(FLAG_IS_OUT, &desc->flags); | 1409 | clear_bit(FLAG_IS_OUT, &desc->flags); |
1410 | |||
1411 | trace_gpio_direction(chip->base + gpio, 1, status); | ||
1408 | lose: | 1412 | lose: |
1409 | return status; | 1413 | return status; |
1410 | fail: | 1414 | fail: |
@@ -1458,6 +1462,8 @@ int gpio_direction_output(unsigned gpio, int value) | |||
1458 | status = chip->direction_output(chip, gpio, value); | 1462 | status = chip->direction_output(chip, gpio, value); |
1459 | if (status == 0) | 1463 | if (status == 0) |
1460 | set_bit(FLAG_IS_OUT, &desc->flags); | 1464 | set_bit(FLAG_IS_OUT, &desc->flags); |
1465 | trace_gpio_value(chip->base + gpio, 0, value); | ||
1466 | trace_gpio_direction(chip->base + gpio, 0, status); | ||
1461 | lose: | 1467 | lose: |
1462 | return status; | 1468 | return status; |
1463 | fail: | 1469 | fail: |
@@ -1547,10 +1553,13 @@ EXPORT_SYMBOL_GPL(gpio_set_debounce); | |||
1547 | int __gpio_get_value(unsigned gpio) | 1553 | int __gpio_get_value(unsigned gpio) |
1548 | { | 1554 | { |
1549 | struct gpio_chip *chip; | 1555 | struct gpio_chip *chip; |
1556 | int value; | ||
1550 | 1557 | ||
1551 | chip = gpio_to_chip(gpio); | 1558 | chip = gpio_to_chip(gpio); |
1552 | WARN_ON(chip->can_sleep); | 1559 | WARN_ON(chip->can_sleep); |
1553 | return chip->get ? chip->get(chip, gpio - chip->base) : 0; | 1560 | value = chip->get ? chip->get(chip, gpio - chip->base) : 0; |
1561 | trace_gpio_value(gpio, 1, value); | ||
1562 | return value; | ||
1554 | } | 1563 | } |
1555 | EXPORT_SYMBOL_GPL(__gpio_get_value); | 1564 | EXPORT_SYMBOL_GPL(__gpio_get_value); |
1556 | 1565 | ||
@@ -1569,6 +1578,7 @@ void __gpio_set_value(unsigned gpio, int value) | |||
1569 | 1578 | ||
1570 | chip = gpio_to_chip(gpio); | 1579 | chip = gpio_to_chip(gpio); |
1571 | WARN_ON(chip->can_sleep); | 1580 | WARN_ON(chip->can_sleep); |
1581 | trace_gpio_value(gpio, 0, value); | ||
1572 | chip->set(chip, gpio - chip->base, value); | 1582 | chip->set(chip, gpio - chip->base, value); |
1573 | } | 1583 | } |
1574 | EXPORT_SYMBOL_GPL(__gpio_set_value); | 1584 | EXPORT_SYMBOL_GPL(__gpio_set_value); |
@@ -1619,10 +1629,13 @@ EXPORT_SYMBOL_GPL(__gpio_to_irq); | |||
1619 | int gpio_get_value_cansleep(unsigned gpio) | 1629 | int gpio_get_value_cansleep(unsigned gpio) |
1620 | { | 1630 | { |
1621 | struct gpio_chip *chip; | 1631 | struct gpio_chip *chip; |
1632 | int value; | ||
1622 | 1633 | ||
1623 | might_sleep_if(extra_checks); | 1634 | might_sleep_if(extra_checks); |
1624 | chip = gpio_to_chip(gpio); | 1635 | chip = gpio_to_chip(gpio); |
1625 | return chip->get ? chip->get(chip, gpio - chip->base) : 0; | 1636 | value = chip->get ? chip->get(chip, gpio - chip->base) : 0; |
1637 | trace_gpio_value(gpio, 1, value); | ||
1638 | return value; | ||
1626 | } | 1639 | } |
1627 | EXPORT_SYMBOL_GPL(gpio_get_value_cansleep); | 1640 | EXPORT_SYMBOL_GPL(gpio_get_value_cansleep); |
1628 | 1641 | ||
@@ -1632,6 +1645,7 @@ void gpio_set_value_cansleep(unsigned gpio, int value) | |||
1632 | 1645 | ||
1633 | might_sleep_if(extra_checks); | 1646 | might_sleep_if(extra_checks); |
1634 | chip = gpio_to_chip(gpio); | 1647 | chip = gpio_to_chip(gpio); |
1648 | trace_gpio_value(gpio, 0, value); | ||
1635 | chip->set(chip, gpio - chip->base, value); | 1649 | chip->set(chip, gpio - chip->base, value); |
1636 | } | 1650 | } |
1637 | EXPORT_SYMBOL_GPL(gpio_set_value_cansleep); | 1651 | EXPORT_SYMBOL_GPL(gpio_set_value_cansleep); |