]> git.karo-electronics.de Git - karo-tx-uboot.git/commitdiff
dm: gpio: Add dm_gpio_request() to manually request a GPIO
authorSimon Glass <sjg@chromium.org>
Tue, 23 Jun 2015 21:38:41 +0000 (15:38 -0600)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 9 Sep 2015 11:36:29 +0000 (13:36 +0200)
This function can be used for testing to manually request a GPIO for use,
without resorting to the legacy GPIO API.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/gpio/gpio-uclass.c
include/asm-generic/gpio.h

index c6fd5802f57891568121b51c11acfb717be6a389..4efda311a49e81c8470a23d88f62a09b07f0f5bc 100644 (file)
@@ -127,7 +127,7 @@ static int gpio_find_and_xlate(struct gpio_desc *desc,
        return ops->xlate ? ops->xlate(desc->dev, desc, args) : 0;
 }
 
-static int dm_gpio_request(struct gpio_desc *desc, const char *label)
+int dm_gpio_request(struct gpio_desc *desc, const char *label)
 {
        struct udevice *dev = desc->dev;
        struct gpio_dev_priv *uc_priv;
index cce99ccdc431527404f9a2ba989de3805a0bf1e0..eb801ac3783525e4836ea600ba2b51d65c0fda10 100644 (file)
@@ -445,6 +445,18 @@ int gpio_request_list_by_name(struct udevice *dev, const char *list_name,
                              struct gpio_desc *desc_list, int max_count,
                              int flags);
 
+/**
+ * dm_gpio_request() - manually request a GPIO
+ *
+ * Note: This function should only be used for testing / debugging. Instead.
+ * use gpio_request_by_name() to pull GPIOs from the device tree.
+ *
+ * @desc:      GPIO description of GPIO to request (see dm_gpio_lookup_name())
+ * @label:     Label to attach to the GPIO while claimed
+ * @return 0 if OK, -ve on error
+ */
+int dm_gpio_request(struct gpio_desc *desc, const char *label);
+
 /**
  * gpio_get_list_count() - Returns the number of GPIOs in a list
  *