From bbf2478026c0addfff000f31cc1b5639cbff52cb Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 6 Mar 2016 19:27:50 -0700 Subject: gpio: Add a function to obtain a GPIO vector value We can use GPIOs as binary digits for reading 'strapping' values. Each GPIO is assigned a single bit and can be set high or low on the circuit board. We already have a legacy function for reading these values. Add one that supports driver model. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- include/asm-generic/gpio.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/asm-generic') diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 0af599f86d..059f33906e 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -359,6 +359,18 @@ int gpio_lookup_name(const char *name, struct udevice **devp, */ int gpio_get_values_as_int(const int *gpio_list); +/** + * dm_gpio_get_values_as_int() - Turn the values of a list of GPIOs into an int + * + * This puts the value of the first GPIO into bit 0, the second into bit 1, + * etc. then returns the resulting integer. + * + * @desc_list: List of GPIOs to collect + * @count: Number of GPIOs + * @return resulting integer value, or -ve on error + */ +int dm_gpio_get_values_as_int(struct gpio_desc *desc_list, int count); + /** * gpio_claim_vector() - claim a number of GPIOs for input * -- cgit v1.2.3