lkml.org 
[lkml]   [2012]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [REPOST RFC PATCH 2/3] of_gpio: Add new helpers for easily requesting lots of GPIOs
On Tue, Dec 13, 2011 at 01:23:33PM -0500, Kyle Moffett wrote:
> Mirroring the new gpio_request_array() interface, we add several a few
> helper functions for operating on entire arrays of GPIOs.
>
> Also, to make it easier to write various combinations of "of_get_gpio()"
> followed by "gpio_request()", add several other new inline wrappers.
>
> Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
> ---
> drivers/of/gpio.c | 96 +++++++++++++++++++++++++++++
> include/linux/of_gpio.h | 154 +++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 250 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/of/gpio.c b/drivers/of/gpio.c
> index f349aaf..4c04f2f 100644
> --- a/drivers/of/gpio.c
> +++ b/drivers/of/gpio.c
> @@ -83,6 +83,47 @@ err0:
> EXPORT_SYMBOL(of_get_named_gpio_flags);
>
> /**
> + * of_get_gpio_array_flags() - Get array of gpios to use with GPIO API
> + * @np: device node to get GPIOs from
> + * @of_gpios: array of "struct of_gpio" to select which GPIOs to look up
> + * @of_flags: array of "enum of_gpio_flags" to be filled in (may be NULL)
> + * @gpios: array of "struct gpio" to be filled in
> + * @num: the number of GPIOs to look up
> + *
> + * Takes a constant array of "struct of_gpio" and looks up each item in the
> + * indicated device-node. The results are stored into the @gpios array,
> + * along with the optional GPIO "label" and "flags" values from the "of_gpio"
> + * structure.
> + *
> + * If an array of @of_flags is provided then any flags from the translate
> + * function will be stored into the corresponding element there.
> + */

That seems overly complex to me. How many gpios are you expecting to
request? If it is less than a handful, then I think letting the
driver call of_get_request() multiple times would still be simpler.

g.



\
 
 \ /
  Last update: 2012-01-04 20:09    [W:2.320 / U:0.748 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site