* [PATCH] pxa/hx4700: use gpio arrays for global gpio initialization
@ 2011-04-20 19:55 Philipp Zabel
2011-04-21 15:02 ` Dmitry Artamonow
0 siblings, 1 reply; 7+ messages in thread
From: Philipp Zabel @ 2011-04-20 19:55 UTC (permalink / raw)
To: linux-arm-kernel
gpio_request_arrays() is a functional replacement for hx4700_gpio_request(),
which is now obsolete.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
---
arch/arm/mach-pxa/hx4700.c | 66 ++++++++++----------------------------------
1 files changed, 15 insertions(+), 51 deletions(-)
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index 9cdcca5..f8a3a6e 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -135,42 +135,6 @@ static unsigned long hx4700_pin_config[] __initdata = {
GPIO66_GPIO, /* nSDIO_IRQ */
};
-#define HX4700_GPIO_IN(num, _desc) \
- { .gpio = (num), .dir = 0, .desc = (_desc) }
-#define HX4700_GPIO_OUT(num, _init, _desc) \
- { .gpio = (num), .dir = 1, .init = (_init), .desc = (_desc) }
-struct gpio_ress {
- unsigned gpio : 8;
- unsigned dir : 1;
- unsigned init : 1;
- char *desc;
-};
-
-static int hx4700_gpio_request(struct gpio_ress *gpios, int size)
-{
- int i, rc = 0;
- int gpio;
- int dir;
-
- for (i = 0; (!rc) && (i < size); i++) {
- gpio = gpios[i].gpio;
- dir = gpios[i].dir;
- rc = gpio_request(gpio, gpios[i].desc);
- if (rc) {
- pr_err("Error requesting GPIO %d(%s) : %d\n",
- gpio, gpios[i].desc, rc);
- continue;
- }
- if (dir)
- gpio_direction_output(gpio, gpios[i].init);
- else
- gpio_direction_input(gpio);
- }
- while ((rc) && (--i >= 0))
- gpio_free(gpios[i].gpio);
- return rc;
-}
-
/*
* IRDA
*/
@@ -829,26 +793,26 @@ static struct platform_device *devices[] __initdata = {
&pcmcia,
};
-static struct gpio_ress global_gpios[] = {
- HX4700_GPIO_IN(GPIO12_HX4700_ASIC3_IRQ, "ASIC3_IRQ"),
- HX4700_GPIO_IN(GPIO13_HX4700_W3220_IRQ, "W3220_IRQ"),
- HX4700_GPIO_IN(GPIO14_HX4700_nWLAN_IRQ, "WLAN_IRQ"),
- HX4700_GPIO_OUT(GPIO59_HX4700_LCD_PC1, 1, "LCD_PC1"),
- HX4700_GPIO_OUT(GPIO62_HX4700_LCD_nRESET, 1, "LCD_RESET"),
- HX4700_GPIO_OUT(GPIO70_HX4700_LCD_SLIN1, 1, "LCD_SLIN1"),
- HX4700_GPIO_OUT(GPIO84_HX4700_LCD_SQN, 1, "LCD_SQN"),
- HX4700_GPIO_OUT(GPIO110_HX4700_LCD_LVDD_3V3_ON, 1, "LCD_LVDD"),
- HX4700_GPIO_OUT(GPIO111_HX4700_LCD_AVDD_3V3_ON, 1, "LCD_AVDD"),
- HX4700_GPIO_OUT(GPIO32_HX4700_RS232_ON, 1, "RS232_ON"),
- HX4700_GPIO_OUT(GPIO71_HX4700_ASIC3_nRESET, 1, "ASIC3_nRESET"),
- HX4700_GPIO_OUT(GPIO82_HX4700_EUART_RESET, 1, "EUART_RESET"),
- HX4700_GPIO_OUT(GPIO105_HX4700_nIR_ON, 1, "nIR_EN"),
+static struct gpio global_gpios[] = {
+ { GPIO12_HX4700_ASIC3_IRQ, GPIOF_IN, "ASIC3_IRQ" },
+ { GPIO13_HX4700_W3220_IRQ, GPIOF_IN, "W3220_IRQ" },
+ { GPIO14_HX4700_nWLAN_IRQ, GPIOF_IN, "WLAN_IRQ" },
+ { GPIO59_HX4700_LCD_PC1, GPIOF_OUT_INIT_HIGH, "LCD_PC1" },
+ { GPIO62_HX4700_LCD_nRESET, GPIOF_OUT_INIT_HIGH, "LCD_RESET" },
+ { GPIO70_HX4700_LCD_SLIN1, GPIOF_OUT_INIT_HIGH, "LCD_SLIN1" },
+ { GPIO84_HX4700_LCD_SQN, GPIOF_OUT_INIT_HIGH, "LCD_SQN" },
+ { GPIO110_HX4700_LCD_LVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_LVDD" },
+ { GPIO111_HX4700_LCD_AVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_AVDD" },
+ { GPIO32_HX4700_RS232_ON, GPIOF_OUT_INIT_HIGH, "RS232_ON" },
+ { GPIO71_HX4700_ASIC3_nRESET, GPIOF_OUT_INIT_HIGH, "ASIC3_nRESET" },
+ { GPIO82_HX4700_EUART_RESET, GPIOF_OUT_INIT_HIGH, "EUART_RESET" },
+ { GPIO105_HX4700_nIR_ON, GPIOF_OUT_INIT_HIGH, "nIR_EN" },
};
static void __init hx4700_init(void)
{
pxa2xx_mfp_config(ARRAY_AND_SIZE(hx4700_pin_config));
- hx4700_gpio_request(ARRAY_AND_SIZE(global_gpios));
+ gpio_request_array(ARRAY_AND_SIZE(global_gpios));
pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] pxa/hx4700: use gpio arrays for global gpio initialization
2011-04-20 19:55 [PATCH] pxa/hx4700: use gpio arrays for global gpio initialization Philipp Zabel
@ 2011-04-21 15:02 ` Dmitry Artamonow
2011-04-27 18:50 ` [PATCH v2] " Philipp Zabel
0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Artamonow @ 2011-04-21 15:02 UTC (permalink / raw)
To: linux-arm-kernel
On 21:55 Wed 20 Apr , Philipp Zabel wrote:
> gpio_request_arrays() is a functional replacement for hx4700_gpio_request(),
> which is now obsolete.
[snip]
> - hx4700_gpio_request(ARRAY_AND_SIZE(global_gpios));
> + gpio_request_array(ARRAY_AND_SIZE(global_gpios));
It would be nice to check return value here and print some message on error,
as unlike hx4700_gpio_request, gpio_request_array() is completely silent.
--
Best regards,
Dmitry "MAD" ArtAMonow
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] pxa/hx4700: use gpio arrays for global gpio initialization
2011-04-21 15:02 ` Dmitry Artamonow
@ 2011-04-27 18:50 ` Philipp Zabel
2011-04-28 9:05 ` Russell King - ARM Linux
0 siblings, 1 reply; 7+ messages in thread
From: Philipp Zabel @ 2011-04-27 18:50 UTC (permalink / raw)
To: linux-arm-kernel
gpio_request_array() is a functional replacement for hx4700_gpio_request(),
which is now obsolete.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
---
arch/arm/mach-pxa/hx4700.c | 70 ++++++++++++--------------------------------
1 files changed, 19 insertions(+), 51 deletions(-)
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index 9cdcca5..46b8045 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -135,42 +135,6 @@ static unsigned long hx4700_pin_config[] __initdata = {
GPIO66_GPIO, /* nSDIO_IRQ */
};
-#define HX4700_GPIO_IN(num, _desc) \
- { .gpio = (num), .dir = 0, .desc = (_desc) }
-#define HX4700_GPIO_OUT(num, _init, _desc) \
- { .gpio = (num), .dir = 1, .init = (_init), .desc = (_desc) }
-struct gpio_ress {
- unsigned gpio : 8;
- unsigned dir : 1;
- unsigned init : 1;
- char *desc;
-};
-
-static int hx4700_gpio_request(struct gpio_ress *gpios, int size)
-{
- int i, rc = 0;
- int gpio;
- int dir;
-
- for (i = 0; (!rc) && (i < size); i++) {
- gpio = gpios[i].gpio;
- dir = gpios[i].dir;
- rc = gpio_request(gpio, gpios[i].desc);
- if (rc) {
- pr_err("Error requesting GPIO %d(%s) : %d\n",
- gpio, gpios[i].desc, rc);
- continue;
- }
- if (dir)
- gpio_direction_output(gpio, gpios[i].init);
- else
- gpio_direction_input(gpio);
- }
- while ((rc) && (--i >= 0))
- gpio_free(gpios[i].gpio);
- return rc;
-}
-
/*
* IRDA
*/
@@ -829,26 +793,30 @@ static struct platform_device *devices[] __initdata = {
&pcmcia,
};
-static struct gpio_ress global_gpios[] = {
- HX4700_GPIO_IN(GPIO12_HX4700_ASIC3_IRQ, "ASIC3_IRQ"),
- HX4700_GPIO_IN(GPIO13_HX4700_W3220_IRQ, "W3220_IRQ"),
- HX4700_GPIO_IN(GPIO14_HX4700_nWLAN_IRQ, "WLAN_IRQ"),
- HX4700_GPIO_OUT(GPIO59_HX4700_LCD_PC1, 1, "LCD_PC1"),
- HX4700_GPIO_OUT(GPIO62_HX4700_LCD_nRESET, 1, "LCD_RESET"),
- HX4700_GPIO_OUT(GPIO70_HX4700_LCD_SLIN1, 1, "LCD_SLIN1"),
- HX4700_GPIO_OUT(GPIO84_HX4700_LCD_SQN, 1, "LCD_SQN"),
- HX4700_GPIO_OUT(GPIO110_HX4700_LCD_LVDD_3V3_ON, 1, "LCD_LVDD"),
- HX4700_GPIO_OUT(GPIO111_HX4700_LCD_AVDD_3V3_ON, 1, "LCD_AVDD"),
- HX4700_GPIO_OUT(GPIO32_HX4700_RS232_ON, 1, "RS232_ON"),
- HX4700_GPIO_OUT(GPIO71_HX4700_ASIC3_nRESET, 1, "ASIC3_nRESET"),
- HX4700_GPIO_OUT(GPIO82_HX4700_EUART_RESET, 1, "EUART_RESET"),
- HX4700_GPIO_OUT(GPIO105_HX4700_nIR_ON, 1, "nIR_EN"),
+static struct gpio global_gpios[] = {
+ { GPIO12_HX4700_ASIC3_IRQ, GPIOF_IN, "ASIC3_IRQ" },
+ { GPIO13_HX4700_W3220_IRQ, GPIOF_IN, "W3220_IRQ" },
+ { GPIO14_HX4700_nWLAN_IRQ, GPIOF_IN, "WLAN_IRQ" },
+ { GPIO59_HX4700_LCD_PC1, GPIOF_OUT_INIT_HIGH, "LCD_PC1" },
+ { GPIO62_HX4700_LCD_nRESET, GPIOF_OUT_INIT_HIGH, "LCD_RESET" },
+ { GPIO70_HX4700_LCD_SLIN1, GPIOF_OUT_INIT_HIGH, "LCD_SLIN1" },
+ { GPIO84_HX4700_LCD_SQN, GPIOF_OUT_INIT_HIGH, "LCD_SQN" },
+ { GPIO110_HX4700_LCD_LVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_LVDD" },
+ { GPIO111_HX4700_LCD_AVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_AVDD" },
+ { GPIO32_HX4700_RS232_ON, GPIOF_OUT_INIT_HIGH, "RS232_ON" },
+ { GPIO71_HX4700_ASIC3_nRESET, GPIOF_OUT_INIT_HIGH, "ASIC3_nRESET" },
+ { GPIO82_HX4700_EUART_RESET, GPIOF_OUT_INIT_HIGH, "EUART_RESET" },
+ { GPIO105_HX4700_nIR_ON, GPIOF_OUT_INIT_HIGH, "nIR_EN" },
};
static void __init hx4700_init(void)
{
+ int ret;
+
pxa2xx_mfp_config(ARRAY_AND_SIZE(hx4700_pin_config));
- hx4700_gpio_request(ARRAY_AND_SIZE(global_gpios));
+ ret = gpio_request_array(ARRAY_AND_SIZE(global_gpios));
+ if (ret)
+ pr_err ("hx4700: Failed to request GPIOs.\n");
pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2] pxa/hx4700: use gpio arrays for global gpio initialization
2011-04-27 18:50 ` [PATCH v2] " Philipp Zabel
@ 2011-04-28 9:05 ` Russell King - ARM Linux
2011-04-28 20:16 ` Philipp Zabel
2011-04-28 20:17 ` [PATCH v3] " Philipp Zabel
0 siblings, 2 replies; 7+ messages in thread
From: Russell King - ARM Linux @ 2011-04-28 9:05 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Apr 27, 2011 at 08:50:19PM +0200, Philipp Zabel wrote:
> - hx4700_gpio_request(ARRAY_AND_SIZE(global_gpios));
> + ret = gpio_request_array(ARRAY_AND_SIZE(global_gpios));
> + if (ret)
> + pr_err ("hx4700: Failed to request GPIOs.\n");
No space between pr_err and (.
Does the return code convey useful information as to _why_ it failed? If
yes, you really should print its value. Knowing whether it's -EBUSY
(eg, already in use) instead of -EINVAL (eg, invalid GPIO number) really
helps to debug problems.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] pxa/hx4700: use gpio arrays for global gpio initialization
2011-04-28 9:05 ` Russell King - ARM Linux
@ 2011-04-28 20:16 ` Philipp Zabel
2011-04-28 20:17 ` [PATCH v3] " Philipp Zabel
1 sibling, 0 replies; 7+ messages in thread
From: Philipp Zabel @ 2011-04-28 20:16 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Apr 28, 2011 at 11:05 AM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Wed, Apr 27, 2011 at 08:50:19PM +0200, Philipp Zabel wrote:
>> - ? ? hx4700_gpio_request(ARRAY_AND_SIZE(global_gpios));
>> + ? ? ret = gpio_request_array(ARRAY_AND_SIZE(global_gpios));
>> + ? ? if (ret)
>> + ? ? ? ? ? ? pr_err ("hx4700: Failed to request GPIOs.\n");
>
> No space between pr_err and (.
checkpatch issue. Sorry about that.
> Does the return code convey useful information as to _why_ it failed? ?If
> yes, you really should print its value. ?Knowing whether it's -EBUSY
> (eg, already in use) instead of -EINVAL (eg, invalid GPIO number) really
> helps to debug problems.
Yes, it does. It is certainly better to include the error code.
Recompiling with DEBUG_GPIO enabled might still be necessary to get
information about which GPIO failed, and whether -EINVAL was returned
by gpio_request() or gpio_direction_input/output().
regards
Philipp
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3] pxa/hx4700: use gpio arrays for global gpio initialization
2011-04-28 9:05 ` Russell King - ARM Linux
2011-04-28 20:16 ` Philipp Zabel
@ 2011-04-28 20:17 ` Philipp Zabel
2011-07-05 7:53 ` Eric Miao
1 sibling, 1 reply; 7+ messages in thread
From: Philipp Zabel @ 2011-04-28 20:17 UTC (permalink / raw)
To: linux-arm-kernel
gpio_request_array() is a functional replacement for hx4700_gpio_request(),
which is now obsolete.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
---
arch/arm/mach-pxa/hx4700.c | 70 ++++++++++++--------------------------------
1 files changed, 19 insertions(+), 51 deletions(-)
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index 9cdcca5..3254a60 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -135,42 +135,6 @@ static unsigned long hx4700_pin_config[] __initdata = {
GPIO66_GPIO, /* nSDIO_IRQ */
};
-#define HX4700_GPIO_IN(num, _desc) \
- { .gpio = (num), .dir = 0, .desc = (_desc) }
-#define HX4700_GPIO_OUT(num, _init, _desc) \
- { .gpio = (num), .dir = 1, .init = (_init), .desc = (_desc) }
-struct gpio_ress {
- unsigned gpio : 8;
- unsigned dir : 1;
- unsigned init : 1;
- char *desc;
-};
-
-static int hx4700_gpio_request(struct gpio_ress *gpios, int size)
-{
- int i, rc = 0;
- int gpio;
- int dir;
-
- for (i = 0; (!rc) && (i < size); i++) {
- gpio = gpios[i].gpio;
- dir = gpios[i].dir;
- rc = gpio_request(gpio, gpios[i].desc);
- if (rc) {
- pr_err("Error requesting GPIO %d(%s) : %d\n",
- gpio, gpios[i].desc, rc);
- continue;
- }
- if (dir)
- gpio_direction_output(gpio, gpios[i].init);
- else
- gpio_direction_input(gpio);
- }
- while ((rc) && (--i >= 0))
- gpio_free(gpios[i].gpio);
- return rc;
-}
-
/*
* IRDA
*/
@@ -829,26 +793,30 @@ static struct platform_device *devices[] __initdata = {
&pcmcia,
};
-static struct gpio_ress global_gpios[] = {
- HX4700_GPIO_IN(GPIO12_HX4700_ASIC3_IRQ, "ASIC3_IRQ"),
- HX4700_GPIO_IN(GPIO13_HX4700_W3220_IRQ, "W3220_IRQ"),
- HX4700_GPIO_IN(GPIO14_HX4700_nWLAN_IRQ, "WLAN_IRQ"),
- HX4700_GPIO_OUT(GPIO59_HX4700_LCD_PC1, 1, "LCD_PC1"),
- HX4700_GPIO_OUT(GPIO62_HX4700_LCD_nRESET, 1, "LCD_RESET"),
- HX4700_GPIO_OUT(GPIO70_HX4700_LCD_SLIN1, 1, "LCD_SLIN1"),
- HX4700_GPIO_OUT(GPIO84_HX4700_LCD_SQN, 1, "LCD_SQN"),
- HX4700_GPIO_OUT(GPIO110_HX4700_LCD_LVDD_3V3_ON, 1, "LCD_LVDD"),
- HX4700_GPIO_OUT(GPIO111_HX4700_LCD_AVDD_3V3_ON, 1, "LCD_AVDD"),
- HX4700_GPIO_OUT(GPIO32_HX4700_RS232_ON, 1, "RS232_ON"),
- HX4700_GPIO_OUT(GPIO71_HX4700_ASIC3_nRESET, 1, "ASIC3_nRESET"),
- HX4700_GPIO_OUT(GPIO82_HX4700_EUART_RESET, 1, "EUART_RESET"),
- HX4700_GPIO_OUT(GPIO105_HX4700_nIR_ON, 1, "nIR_EN"),
+static struct gpio global_gpios[] = {
+ { GPIO12_HX4700_ASIC3_IRQ, GPIOF_IN, "ASIC3_IRQ" },
+ { GPIO13_HX4700_W3220_IRQ, GPIOF_IN, "W3220_IRQ" },
+ { GPIO14_HX4700_nWLAN_IRQ, GPIOF_IN, "WLAN_IRQ" },
+ { GPIO59_HX4700_LCD_PC1, GPIOF_OUT_INIT_HIGH, "LCD_PC1" },
+ { GPIO62_HX4700_LCD_nRESET, GPIOF_OUT_INIT_HIGH, "LCD_RESET" },
+ { GPIO70_HX4700_LCD_SLIN1, GPIOF_OUT_INIT_HIGH, "LCD_SLIN1" },
+ { GPIO84_HX4700_LCD_SQN, GPIOF_OUT_INIT_HIGH, "LCD_SQN" },
+ { GPIO110_HX4700_LCD_LVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_LVDD" },
+ { GPIO111_HX4700_LCD_AVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_AVDD" },
+ { GPIO32_HX4700_RS232_ON, GPIOF_OUT_INIT_HIGH, "RS232_ON" },
+ { GPIO71_HX4700_ASIC3_nRESET, GPIOF_OUT_INIT_HIGH, "ASIC3_nRESET" },
+ { GPIO82_HX4700_EUART_RESET, GPIOF_OUT_INIT_HIGH, "EUART_RESET" },
+ { GPIO105_HX4700_nIR_ON, GPIOF_OUT_INIT_HIGH, "nIR_EN" },
};
static void __init hx4700_init(void)
{
+ int ret;
+
pxa2xx_mfp_config(ARRAY_AND_SIZE(hx4700_pin_config));
- hx4700_gpio_request(ARRAY_AND_SIZE(global_gpios));
+ ret = gpio_request_array(ARRAY_AND_SIZE(global_gpios));
+ if (ret)
+ pr_err("hx4700: Failed to request GPIOs: %d\n", ret);
pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3] pxa/hx4700: use gpio arrays for global gpio initialization
2011-04-28 20:17 ` [PATCH v3] " Philipp Zabel
@ 2011-07-05 7:53 ` Eric Miao
0 siblings, 0 replies; 7+ messages in thread
From: Eric Miao @ 2011-07-05 7:53 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Apr 29, 2011 at 4:17 AM, Philipp Zabel <philipp.zabel@gmail.com> wrote:
> gpio_request_array() is a functional replacement for hx4700_gpio_request(),
> which is now obsolete.
>
> Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Applied.
> ---
> ?arch/arm/mach-pxa/hx4700.c | ? 70 ++++++++++++--------------------------------
> ?1 files changed, 19 insertions(+), 51 deletions(-)
>
> diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
> index 9cdcca5..3254a60 100644
> --- a/arch/arm/mach-pxa/hx4700.c
> +++ b/arch/arm/mach-pxa/hx4700.c
> @@ -135,42 +135,6 @@ static unsigned long hx4700_pin_config[] __initdata = {
> ? ? ? ?GPIO66_GPIO, ? ?/* nSDIO_IRQ */
> ?};
>
> -#define HX4700_GPIO_IN(num, _desc) \
> - ? ? ? { .gpio = (num), .dir = 0, .desc = (_desc) }
> -#define HX4700_GPIO_OUT(num, _init, _desc) \
> - ? ? ? { .gpio = (num), .dir = 1, .init = (_init), .desc = (_desc) }
> -struct gpio_ress {
> - ? ? ? unsigned gpio : 8;
> - ? ? ? unsigned dir : 1;
> - ? ? ? unsigned init : 1;
> - ? ? ? char *desc;
> -};
> -
> -static int hx4700_gpio_request(struct gpio_ress *gpios, int size)
> -{
> - ? ? ? int i, rc = 0;
> - ? ? ? int gpio;
> - ? ? ? int dir;
> -
> - ? ? ? for (i = 0; (!rc) && (i < size); i++) {
> - ? ? ? ? ? ? ? gpio = gpios[i].gpio;
> - ? ? ? ? ? ? ? dir = gpios[i].dir;
> - ? ? ? ? ? ? ? rc = gpio_request(gpio, gpios[i].desc);
> - ? ? ? ? ? ? ? if (rc) {
> - ? ? ? ? ? ? ? ? ? ? ? pr_err("Error requesting GPIO %d(%s) : %d\n",
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?gpio, gpios[i].desc, rc);
> - ? ? ? ? ? ? ? ? ? ? ? continue;
> - ? ? ? ? ? ? ? }
> - ? ? ? ? ? ? ? if (dir)
> - ? ? ? ? ? ? ? ? ? ? ? gpio_direction_output(gpio, gpios[i].init);
> - ? ? ? ? ? ? ? else
> - ? ? ? ? ? ? ? ? ? ? ? gpio_direction_input(gpio);
> - ? ? ? }
> - ? ? ? while ((rc) && (--i >= 0))
> - ? ? ? ? ? ? ? gpio_free(gpios[i].gpio);
> - ? ? ? return rc;
> -}
> -
> ?/*
> ?* IRDA
> ?*/
> @@ -829,26 +793,30 @@ static struct platform_device *devices[] __initdata = {
> ? ? ? ?&pcmcia,
> ?};
>
> -static struct gpio_ress global_gpios[] = {
> - ? ? ? HX4700_GPIO_IN(GPIO12_HX4700_ASIC3_IRQ, "ASIC3_IRQ"),
> - ? ? ? HX4700_GPIO_IN(GPIO13_HX4700_W3220_IRQ, "W3220_IRQ"),
> - ? ? ? HX4700_GPIO_IN(GPIO14_HX4700_nWLAN_IRQ, "WLAN_IRQ"),
> - ? ? ? HX4700_GPIO_OUT(GPIO59_HX4700_LCD_PC1, ? ? ? ? ?1, "LCD_PC1"),
> - ? ? ? HX4700_GPIO_OUT(GPIO62_HX4700_LCD_nRESET, ? ? ? 1, "LCD_RESET"),
> - ? ? ? HX4700_GPIO_OUT(GPIO70_HX4700_LCD_SLIN1, ? ? ? ?1, "LCD_SLIN1"),
> - ? ? ? HX4700_GPIO_OUT(GPIO84_HX4700_LCD_SQN, ? ? ? ? ?1, "LCD_SQN"),
> - ? ? ? HX4700_GPIO_OUT(GPIO110_HX4700_LCD_LVDD_3V3_ON, 1, "LCD_LVDD"),
> - ? ? ? HX4700_GPIO_OUT(GPIO111_HX4700_LCD_AVDD_3V3_ON, 1, "LCD_AVDD"),
> - ? ? ? HX4700_GPIO_OUT(GPIO32_HX4700_RS232_ON, ? ? ? ? 1, "RS232_ON"),
> - ? ? ? HX4700_GPIO_OUT(GPIO71_HX4700_ASIC3_nRESET, ? ? 1, "ASIC3_nRESET"),
> - ? ? ? HX4700_GPIO_OUT(GPIO82_HX4700_EUART_RESET, ? ? ?1, "EUART_RESET"),
> - ? ? ? HX4700_GPIO_OUT(GPIO105_HX4700_nIR_ON, ? ? ? ? ?1, "nIR_EN"),
> +static struct gpio global_gpios[] = {
> + ? ? ? { GPIO12_HX4700_ASIC3_IRQ, GPIOF_IN, "ASIC3_IRQ" },
> + ? ? ? { GPIO13_HX4700_W3220_IRQ, GPIOF_IN, "W3220_IRQ" },
> + ? ? ? { GPIO14_HX4700_nWLAN_IRQ, GPIOF_IN, "WLAN_IRQ" },
> + ? ? ? { GPIO59_HX4700_LCD_PC1, ? ? ? ? ?GPIOF_OUT_INIT_HIGH, "LCD_PC1" },
> + ? ? ? { GPIO62_HX4700_LCD_nRESET, ? ? ? GPIOF_OUT_INIT_HIGH, "LCD_RESET" },
> + ? ? ? { GPIO70_HX4700_LCD_SLIN1, ? ? ? ?GPIOF_OUT_INIT_HIGH, "LCD_SLIN1" },
> + ? ? ? { GPIO84_HX4700_LCD_SQN, ? ? ? ? ?GPIOF_OUT_INIT_HIGH, "LCD_SQN" },
> + ? ? ? { GPIO110_HX4700_LCD_LVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_LVDD" },
> + ? ? ? { GPIO111_HX4700_LCD_AVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_AVDD" },
> + ? ? ? { GPIO32_HX4700_RS232_ON, ? ? ? ? GPIOF_OUT_INIT_HIGH, "RS232_ON" },
> + ? ? ? { GPIO71_HX4700_ASIC3_nRESET, ? ? GPIOF_OUT_INIT_HIGH, "ASIC3_nRESET" },
> + ? ? ? { GPIO82_HX4700_EUART_RESET, ? ? ?GPIOF_OUT_INIT_HIGH, "EUART_RESET" },
> + ? ? ? { GPIO105_HX4700_nIR_ON, ? ? ? ? ?GPIOF_OUT_INIT_HIGH, "nIR_EN" },
> ?};
>
> ?static void __init hx4700_init(void)
> ?{
> + ? ? ? int ret;
> +
> ? ? ? ?pxa2xx_mfp_config(ARRAY_AND_SIZE(hx4700_pin_config));
> - ? ? ? hx4700_gpio_request(ARRAY_AND_SIZE(global_gpios));
> + ? ? ? ret = gpio_request_array(ARRAY_AND_SIZE(global_gpios));
> + ? ? ? if (ret)
> + ? ? ? ? ? ? ? pr_err("hx4700: Failed to request GPIOs: %d\n", ret);
>
> ? ? ? ?pxa_set_ffuart_info(NULL);
> ? ? ? ?pxa_set_btuart_info(NULL);
> --
> 1.7.4.4
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-07-05 7:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-20 19:55 [PATCH] pxa/hx4700: use gpio arrays for global gpio initialization Philipp Zabel
2011-04-21 15:02 ` Dmitry Artamonow
2011-04-27 18:50 ` [PATCH v2] " Philipp Zabel
2011-04-28 9:05 ` Russell King - ARM Linux
2011-04-28 20:16 ` Philipp Zabel
2011-04-28 20:17 ` [PATCH v3] " Philipp Zabel
2011-07-05 7:53 ` Eric Miao
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.