Patchwork [U-Boot,1/4,V3] S5P: GPIO: Add generic pin numbering API's

login
register
mail settings
Submitter Rajeshwari Birje
Date Feb. 7, 2013, noon
Message ID <1360238430-27715-2-git-send-email-rajeshwari.s@samsung.com>
Download mbox | patch
Permalink /patch/218897/
State Changes Requested
Delegated to: Minkyu Kang
Headers show

Comments

Rajeshwari Birje - Feb. 7, 2013, noon
This patch adds API's to set config, drive and pull factor in
gpio pin numbering feature.

Signed-off-by: Rajeshawari Shinde <rajeshwari.s@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
---
Changes in V2:
        - none.
Changes in V3:
        - none.
 drivers/gpio/s5p_gpio.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
Simon Glass - Feb. 8, 2013, 4:11 p.m.
Hi Rajeshwari,

On Thu, Feb 7, 2013 at 4:00 AM, Rajeshwari Shinde
<rajeshwari.s@samsung.com> wrote:
> This patch adds API's to set config, drive and pull factor in
> gpio pin numbering feature.
>
> Signed-off-by: Rajeshawari Shinde <rajeshwari.s@samsung.com>
> Acked-by: Simon Glass <sjg@chromium.org>
> ---
> Changes in V2:
>         - none.
> Changes in V3:
>         - none.
>  drivers/gpio/s5p_gpio.c |   18 ++++++++++++++++++
>  1 files changed, 18 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c
> index 656bf4a..a53bdca 100644
> --- a/drivers/gpio/s5p_gpio.c
> +++ b/drivers/gpio/s5p_gpio.c
> @@ -196,3 +196,21 @@ int gpio_set_value(unsigned gpio, int value)
>
>         return 0;
>  }
> +
> +void gpio_set_pull(int gpio, int mode)
> +{
> +       s5p_gpio_set_pull(s5p_gpio_get_bank(gpio),
> +                       s5p_gpio_get_pin(gpio), mode);
> +}
> +
> +void gpio_set_drv(int gpio, int mode)
> +{
> +       s5p_gpio_set_drv(s5p_gpio_get_bank(gpio),
> +                       s5p_gpio_get_pin(gpio), mode);
> +}
> +
> +void gpio_cfg_pin(int gpio, int cfg)
> +{
> +       s5p_gpio_cfg_pin(s5p_gpio_get_bank(gpio),
> +                       s5p_gpio_get_pin(gpio), cfg);
> +}

Do you intend for these to be generic functions? If so then I think
you add a new patch to define this API in include/asm-generic/gpio.h.
As mentioned in the other email you may just say that the parameters
are arch-specific, but it might be nice to standardise at least the
pullup/pulldown mode.

Regards,
Simon


> --
> 1.7.4.4
>

Patch

diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c
index 656bf4a..a53bdca 100644
--- a/drivers/gpio/s5p_gpio.c
+++ b/drivers/gpio/s5p_gpio.c
@@ -196,3 +196,21 @@  int gpio_set_value(unsigned gpio, int value)
 
 	return 0;
 }
+
+void gpio_set_pull(int gpio, int mode)
+{
+	s5p_gpio_set_pull(s5p_gpio_get_bank(gpio),
+			s5p_gpio_get_pin(gpio), mode);
+}
+
+void gpio_set_drv(int gpio, int mode)
+{
+	s5p_gpio_set_drv(s5p_gpio_get_bank(gpio),
+			s5p_gpio_get_pin(gpio), mode);
+}
+
+void gpio_cfg_pin(int gpio, int cfg)
+{
+	s5p_gpio_cfg_pin(s5p_gpio_get_bank(gpio),
+			s5p_gpio_get_pin(gpio), cfg);
+}