diff options
author | Igor Grinberg <grinberg@compulab.co.il> | 2011-05-03 11:22:09 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2011-05-12 05:52:06 -0400 |
commit | bc593f5d787d0a015539e21868302fb44a47c3e3 (patch) | |
tree | 75feac78712ae08e38b678c0dae62cb75765ddb0 /arch/arm/mach-omap2/board-overo.c | |
parent | 9e18630b689d658d65bf59508bfec084f61ff5c6 (diff) |
arm: omap2plus: GPIO cleanup
use gpio_request_<one|array>() instead of multiple gpiolib calls,
remove unneeded variables, etc.
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/board-overo.c')
-rw-r--r-- | arch/arm/mach-omap2/board-overo.c | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c index e152c13ded75..c03f92b14f9c 100644 --- a/arch/arm/mach-omap2/board-overo.c +++ b/arch/arm/mach-omap2/board-overo.c | |||
@@ -151,21 +151,20 @@ static int dvi_enabled; | |||
151 | #define OVERO_GPIO_LCD_EN 144 | 151 | #define OVERO_GPIO_LCD_EN 144 |
152 | #define OVERO_GPIO_LCD_BL 145 | 152 | #define OVERO_GPIO_LCD_BL 145 |
153 | 153 | ||
154 | static struct gpio overo_dss_gpios[] __initdata = { | ||
155 | { OVERO_GPIO_LCD_EN, GPIOF_OUT_INIT_HIGH, "OVERO_GPIO_LCD_EN" }, | ||
156 | { OVERO_GPIO_LCD_BL, GPIOF_OUT_INIT_HIGH, "OVERO_GPIO_LCD_BL" }, | ||
157 | }; | ||
158 | |||
154 | static void __init overo_display_init(void) | 159 | static void __init overo_display_init(void) |
155 | { | 160 | { |
156 | if ((gpio_request(OVERO_GPIO_LCD_EN, "OVERO_GPIO_LCD_EN") == 0) && | 161 | if (gpio_request_array(overo_dss_gpios, ARRAY_SIZE(overo_dss_gpios))) { |
157 | (gpio_direction_output(OVERO_GPIO_LCD_EN, 1) == 0)) | 162 | printk(KERN_ERR "could not obtain DSS control GPIOs\n"); |
158 | gpio_export(OVERO_GPIO_LCD_EN, 0); | 163 | return; |
159 | else | 164 | } |
160 | printk(KERN_ERR "could not obtain gpio for " | ||
161 | "OVERO_GPIO_LCD_EN\n"); | ||
162 | 165 | ||
163 | if ((gpio_request(OVERO_GPIO_LCD_BL, "OVERO_GPIO_LCD_BL") == 0) && | 166 | gpio_export(OVERO_GPIO_LCD_EN, 0); |
164 | (gpio_direction_output(OVERO_GPIO_LCD_BL, 1) == 0)) | 167 | gpio_export(OVERO_GPIO_LCD_BL, 0); |
165 | gpio_export(OVERO_GPIO_LCD_BL, 0); | ||
166 | else | ||
167 | printk(KERN_ERR "could not obtain gpio for " | ||
168 | "OVERO_GPIO_LCD_BL\n"); | ||
169 | } | 168 | } |
170 | 169 | ||
171 | static int overo_panel_enable_dvi(struct omap_dss_device *dssdev) | 170 | static int overo_panel_enable_dvi(struct omap_dss_device *dssdev) |
@@ -553,8 +552,15 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
553 | }; | 552 | }; |
554 | #endif | 553 | #endif |
555 | 554 | ||
555 | static struct gpio overo_bt_gpios[] __initdata = { | ||
556 | { OVERO_GPIO_BT_XGATE, GPIOF_OUT_INIT_LOW, "lcd enable" }, | ||
557 | { OVERO_GPIO_BT_NRESET, GPIOF_OUT_INIT_HIGH, "lcd bl enable" }, | ||
558 | }; | ||
559 | |||
556 | static void __init overo_init(void) | 560 | static void __init overo_init(void) |
557 | { | 561 | { |
562 | int ret; | ||
563 | |||
558 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 564 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
559 | overo_i2c_init(); | 565 | overo_i2c_init(); |
560 | omap_display_init(&overo_dss_data); | 566 | omap_display_init(&overo_dss_data); |
@@ -574,9 +580,9 @@ static void __init overo_init(void) | |||
574 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); | 580 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); |
575 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); | 581 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); |
576 | 582 | ||
577 | if ((gpio_request(OVERO_GPIO_W2W_NRESET, | 583 | ret = gpio_request_one(OVERO_GPIO_W2W_NRESET, GPIOF_OUT_INIT_HIGH, |
578 | "OVERO_GPIO_W2W_NRESET") == 0) && | 584 | "OVERO_GPIO_W2W_NRESET"); |
579 | (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) { | 585 | if (ret == 0) { |
580 | gpio_export(OVERO_GPIO_W2W_NRESET, 0); | 586 | gpio_export(OVERO_GPIO_W2W_NRESET, 0); |
581 | gpio_set_value(OVERO_GPIO_W2W_NRESET, 0); | 587 | gpio_set_value(OVERO_GPIO_W2W_NRESET, 0); |
582 | udelay(10); | 588 | udelay(10); |
@@ -586,25 +592,20 @@ static void __init overo_init(void) | |||
586 | "OVERO_GPIO_W2W_NRESET\n"); | 592 | "OVERO_GPIO_W2W_NRESET\n"); |
587 | } | 593 | } |
588 | 594 | ||
589 | if ((gpio_request(OVERO_GPIO_BT_XGATE, "OVERO_GPIO_BT_XGATE") == 0) && | 595 | ret = gpio_request_array(overo_bt_gpios, ARRAY_SIZE(overo_bt_gpios)); |
590 | (gpio_direction_output(OVERO_GPIO_BT_XGATE, 0) == 0)) | 596 | if (ret) { |
597 | pr_err("%s: could not obtain BT gpios\n", __func__); | ||
598 | } else { | ||
591 | gpio_export(OVERO_GPIO_BT_XGATE, 0); | 599 | gpio_export(OVERO_GPIO_BT_XGATE, 0); |
592 | else | ||
593 | printk(KERN_ERR "could not obtain gpio for OVERO_GPIO_BT_XGATE\n"); | ||
594 | |||
595 | if ((gpio_request(OVERO_GPIO_BT_NRESET, "OVERO_GPIO_BT_NRESET") == 0) && | ||
596 | (gpio_direction_output(OVERO_GPIO_BT_NRESET, 1) == 0)) { | ||
597 | gpio_export(OVERO_GPIO_BT_NRESET, 0); | 600 | gpio_export(OVERO_GPIO_BT_NRESET, 0); |
598 | gpio_set_value(OVERO_GPIO_BT_NRESET, 0); | 601 | gpio_set_value(OVERO_GPIO_BT_NRESET, 0); |
599 | mdelay(6); | 602 | mdelay(6); |
600 | gpio_set_value(OVERO_GPIO_BT_NRESET, 1); | 603 | gpio_set_value(OVERO_GPIO_BT_NRESET, 1); |
601 | } else { | ||
602 | printk(KERN_ERR "could not obtain gpio for " | ||
603 | "OVERO_GPIO_BT_NRESET\n"); | ||
604 | } | 604 | } |
605 | 605 | ||
606 | if ((gpio_request(OVERO_GPIO_USBH_CPEN, "OVERO_GPIO_USBH_CPEN") == 0) && | 606 | ret = gpio_request_one(OVERO_GPIO_USBH_CPEN, GPIOF_OUT_INIT_HIGH, |
607 | (gpio_direction_output(OVERO_GPIO_USBH_CPEN, 1) == 0)) | 607 | "OVERO_GPIO_USBH_CPEN"); |
608 | if (ret == 0) | ||
608 | gpio_export(OVERO_GPIO_USBH_CPEN, 0); | 609 | gpio_export(OVERO_GPIO_USBH_CPEN, 0); |
609 | else | 610 | else |
610 | printk(KERN_ERR "could not obtain gpio for " | 611 | printk(KERN_ERR "could not obtain gpio for " |