diff options
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r-- | drivers/gpio/gpiolib.c | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 7b35e5093ef5..c5509359ba88 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -845,12 +845,6 @@ done: | |||
845 | return status; | 845 | return status; |
846 | } | 846 | } |
847 | 847 | ||
848 | int gpio_request(unsigned gpio, const char *label) | ||
849 | { | ||
850 | return gpiod_request(gpio_to_desc(gpio), label); | ||
851 | } | ||
852 | EXPORT_SYMBOL_GPL(gpio_request); | ||
853 | |||
854 | static bool __gpiod_free(struct gpio_desc *desc) | 848 | static bool __gpiod_free(struct gpio_desc *desc) |
855 | { | 849 | { |
856 | bool ret = false; | 850 | bool ret = false; |
@@ -891,93 +885,6 @@ void gpiod_free(struct gpio_desc *desc) | |||
891 | WARN_ON(extra_checks); | 885 | WARN_ON(extra_checks); |
892 | } | 886 | } |
893 | 887 | ||
894 | void gpio_free(unsigned gpio) | ||
895 | { | ||
896 | gpiod_free(gpio_to_desc(gpio)); | ||
897 | } | ||
898 | EXPORT_SYMBOL_GPL(gpio_free); | ||
899 | |||
900 | /** | ||
901 | * gpio_request_one - request a single GPIO with initial configuration | ||
902 | * @gpio: the GPIO number | ||
903 | * @flags: GPIO configuration as specified by GPIOF_* | ||
904 | * @label: a literal description string of this GPIO | ||
905 | */ | ||
906 | int gpio_request_one(unsigned gpio, unsigned long flags, const char *label) | ||
907 | { | ||
908 | struct gpio_desc *desc; | ||
909 | int err; | ||
910 | |||
911 | desc = gpio_to_desc(gpio); | ||
912 | |||
913 | err = gpiod_request(desc, label); | ||
914 | if (err) | ||
915 | return err; | ||
916 | |||
917 | if (flags & GPIOF_OPEN_DRAIN) | ||
918 | set_bit(FLAG_OPEN_DRAIN, &desc->flags); | ||
919 | |||
920 | if (flags & GPIOF_OPEN_SOURCE) | ||
921 | set_bit(FLAG_OPEN_SOURCE, &desc->flags); | ||
922 | |||
923 | if (flags & GPIOF_DIR_IN) | ||
924 | err = gpiod_direction_input(desc); | ||
925 | else | ||
926 | err = gpiod_direction_output_raw(desc, | ||
927 | (flags & GPIOF_INIT_HIGH) ? 1 : 0); | ||
928 | |||
929 | if (err) | ||
930 | goto free_gpio; | ||
931 | |||
932 | if (flags & GPIOF_EXPORT) { | ||
933 | err = gpiod_export(desc, flags & GPIOF_EXPORT_CHANGEABLE); | ||
934 | if (err) | ||
935 | goto free_gpio; | ||
936 | } | ||
937 | |||
938 | return 0; | ||
939 | |||
940 | free_gpio: | ||
941 | gpiod_free(desc); | ||
942 | return err; | ||
943 | } | ||
944 | EXPORT_SYMBOL_GPL(gpio_request_one); | ||
945 | |||
946 | /** | ||
947 | * gpio_request_array - request multiple GPIOs in a single call | ||
948 | * @array: array of the 'struct gpio' | ||
949 | * @num: how many GPIOs in the array | ||
950 | */ | ||
951 | int gpio_request_array(const struct gpio *array, size_t num) | ||
952 | { | ||
953 | int i, err; | ||
954 | |||
955 | for (i = 0; i < num; i++, array++) { | ||
956 | err = gpio_request_one(array->gpio, array->flags, array->label); | ||
957 | if (err) | ||
958 | goto err_free; | ||
959 | } | ||
960 | return 0; | ||
961 | |||
962 | err_free: | ||
963 | while (i--) | ||
964 | gpio_free((--array)->gpio); | ||
965 | return err; | ||
966 | } | ||
967 | EXPORT_SYMBOL_GPL(gpio_request_array); | ||
968 | |||
969 | /** | ||
970 | * gpio_free_array - release multiple GPIOs in a single call | ||
971 | * @array: array of the 'struct gpio' | ||
972 | * @num: how many GPIOs in the array | ||
973 | */ | ||
974 | void gpio_free_array(const struct gpio *array, size_t num) | ||
975 | { | ||
976 | while (num--) | ||
977 | gpio_free((array++)->gpio); | ||
978 | } | ||
979 | EXPORT_SYMBOL_GPL(gpio_free_array); | ||
980 | |||
981 | /** | 888 | /** |
982 | * gpiochip_is_requested - return string iff signal was requested | 889 | * gpiochip_is_requested - return string iff signal was requested |
983 | * @chip: controller managing the signal | 890 | * @chip: controller managing the signal |
@@ -1545,12 +1452,6 @@ int gpiod_lock_as_irq(struct gpio_desc *desc) | |||
1545 | } | 1452 | } |
1546 | EXPORT_SYMBOL_GPL(gpiod_lock_as_irq); | 1453 | EXPORT_SYMBOL_GPL(gpiod_lock_as_irq); |
1547 | 1454 | ||
1548 | int gpio_lock_as_irq(struct gpio_chip *chip, unsigned int offset) | ||
1549 | { | ||
1550 | return gpiod_lock_as_irq(gpiochip_get_desc(chip, offset)); | ||
1551 | } | ||
1552 | EXPORT_SYMBOL_GPL(gpio_lock_as_irq); | ||
1553 | |||
1554 | /** | 1455 | /** |
1555 | * gpiod_unlock_as_irq() - unlock a GPIO used as IRQ | 1456 | * gpiod_unlock_as_irq() - unlock a GPIO used as IRQ |
1556 | * @gpio: the GPIO line to unlock from IRQ usage | 1457 | * @gpio: the GPIO line to unlock from IRQ usage |
@@ -1567,12 +1468,6 @@ void gpiod_unlock_as_irq(struct gpio_desc *desc) | |||
1567 | } | 1468 | } |
1568 | EXPORT_SYMBOL_GPL(gpiod_unlock_as_irq); | 1469 | EXPORT_SYMBOL_GPL(gpiod_unlock_as_irq); |
1569 | 1470 | ||
1570 | void gpio_unlock_as_irq(struct gpio_chip *chip, unsigned int offset) | ||
1571 | { | ||
1572 | return gpiod_unlock_as_irq(gpiochip_get_desc(chip, offset)); | ||
1573 | } | ||
1574 | EXPORT_SYMBOL_GPL(gpio_unlock_as_irq); | ||
1575 | |||
1576 | /** | 1471 | /** |
1577 | * gpiod_get_raw_value_cansleep() - return a gpio's raw value | 1472 | * gpiod_get_raw_value_cansleep() - return a gpio's raw value |
1578 | * @desc: gpio whose value will be returned | 1473 | * @desc: gpio whose value will be returned |