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-omap3evm.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-omap3evm.c')
-rw-r--r-- | arch/arm/mach-omap2/board-omap3evm.c | 99 |
1 files changed, 28 insertions, 71 deletions
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 5066b0bbf63d..02e1ad29e1e8 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c | |||
@@ -149,6 +149,15 @@ static inline void __init omap3evm_init_smsc911x(void) { return; } | |||
149 | #define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210 | 149 | #define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210 |
150 | #define OMAP3EVM_DVI_PANEL_EN_GPIO 199 | 150 | #define OMAP3EVM_DVI_PANEL_EN_GPIO 199 |
151 | 151 | ||
152 | static struct gpio omap3_evm_dss_gpios[] __initdata = { | ||
153 | { OMAP3EVM_LCD_PANEL_RESB, GPIOF_OUT_INIT_HIGH, "lcd_panel_resb" }, | ||
154 | { OMAP3EVM_LCD_PANEL_INI, GPIOF_OUT_INIT_HIGH, "lcd_panel_ini" }, | ||
155 | { OMAP3EVM_LCD_PANEL_QVGA, GPIOF_OUT_INIT_LOW, "lcd_panel_qvga" }, | ||
156 | { OMAP3EVM_LCD_PANEL_LR, GPIOF_OUT_INIT_HIGH, "lcd_panel_lr" }, | ||
157 | { OMAP3EVM_LCD_PANEL_UD, GPIOF_OUT_INIT_HIGH, "lcd_panel_ud" }, | ||
158 | { OMAP3EVM_LCD_PANEL_ENVDD, GPIOF_OUT_INIT_LOW, "lcd_panel_envdd" }, | ||
159 | }; | ||
160 | |||
152 | static int lcd_enabled; | 161 | static int lcd_enabled; |
153 | static int dvi_enabled; | 162 | static int dvi_enabled; |
154 | 163 | ||
@@ -156,61 +165,10 @@ static void __init omap3_evm_display_init(void) | |||
156 | { | 165 | { |
157 | int r; | 166 | int r; |
158 | 167 | ||
159 | r = gpio_request(OMAP3EVM_LCD_PANEL_RESB, "lcd_panel_resb"); | 168 | r = gpio_request_array(omap3_evm_dss_gpios, |
160 | if (r) { | 169 | ARRAY_SIZE(omap3_evm_dss_gpios)); |
161 | printk(KERN_ERR "failed to get lcd_panel_resb\n"); | 170 | if (r) |
162 | return; | 171 | printk(KERN_ERR "failed to get lcd_panel_* gpios\n"); |
163 | } | ||
164 | gpio_direction_output(OMAP3EVM_LCD_PANEL_RESB, 1); | ||
165 | |||
166 | r = gpio_request(OMAP3EVM_LCD_PANEL_INI, "lcd_panel_ini"); | ||
167 | if (r) { | ||
168 | printk(KERN_ERR "failed to get lcd_panel_ini\n"); | ||
169 | goto err_1; | ||
170 | } | ||
171 | gpio_direction_output(OMAP3EVM_LCD_PANEL_INI, 1); | ||
172 | |||
173 | r = gpio_request(OMAP3EVM_LCD_PANEL_QVGA, "lcd_panel_qvga"); | ||
174 | if (r) { | ||
175 | printk(KERN_ERR "failed to get lcd_panel_qvga\n"); | ||
176 | goto err_2; | ||
177 | } | ||
178 | gpio_direction_output(OMAP3EVM_LCD_PANEL_QVGA, 0); | ||
179 | |||
180 | r = gpio_request(OMAP3EVM_LCD_PANEL_LR, "lcd_panel_lr"); | ||
181 | if (r) { | ||
182 | printk(KERN_ERR "failed to get lcd_panel_lr\n"); | ||
183 | goto err_3; | ||
184 | } | ||
185 | gpio_direction_output(OMAP3EVM_LCD_PANEL_LR, 1); | ||
186 | |||
187 | r = gpio_request(OMAP3EVM_LCD_PANEL_UD, "lcd_panel_ud"); | ||
188 | if (r) { | ||
189 | printk(KERN_ERR "failed to get lcd_panel_ud\n"); | ||
190 | goto err_4; | ||
191 | } | ||
192 | gpio_direction_output(OMAP3EVM_LCD_PANEL_UD, 1); | ||
193 | |||
194 | r = gpio_request(OMAP3EVM_LCD_PANEL_ENVDD, "lcd_panel_envdd"); | ||
195 | if (r) { | ||
196 | printk(KERN_ERR "failed to get lcd_panel_envdd\n"); | ||
197 | goto err_5; | ||
198 | } | ||
199 | gpio_direction_output(OMAP3EVM_LCD_PANEL_ENVDD, 0); | ||
200 | |||
201 | return; | ||
202 | |||
203 | err_5: | ||
204 | gpio_free(OMAP3EVM_LCD_PANEL_UD); | ||
205 | err_4: | ||
206 | gpio_free(OMAP3EVM_LCD_PANEL_LR); | ||
207 | err_3: | ||
208 | gpio_free(OMAP3EVM_LCD_PANEL_QVGA); | ||
209 | err_2: | ||
210 | gpio_free(OMAP3EVM_LCD_PANEL_INI); | ||
211 | err_1: | ||
212 | gpio_free(OMAP3EVM_LCD_PANEL_RESB); | ||
213 | |||
214 | } | 172 | } |
215 | 173 | ||
216 | static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev) | 174 | static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev) |
@@ -400,7 +358,7 @@ static struct platform_device leds_gpio = { | |||
400 | static int omap3evm_twl_gpio_setup(struct device *dev, | 358 | static int omap3evm_twl_gpio_setup(struct device *dev, |
401 | unsigned gpio, unsigned ngpio) | 359 | unsigned gpio, unsigned ngpio) |
402 | { | 360 | { |
403 | int r; | 361 | int r, lcd_bl_en; |
404 | 362 | ||
405 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ | 363 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ |
406 | omap_mux_init_gpio(63, OMAP_PIN_INPUT); | 364 | omap_mux_init_gpio(63, OMAP_PIN_INPUT); |
@@ -417,16 +375,14 @@ static int omap3evm_twl_gpio_setup(struct device *dev, | |||
417 | */ | 375 | */ |
418 | 376 | ||
419 | /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */ | 377 | /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */ |
420 | r = gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL"); | 378 | lcd_bl_en = get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2 ? |
421 | if (!r) | 379 | GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW; |
422 | r = gpio_direction_output(gpio + TWL4030_GPIO_MAX, | 380 | r = gpio_request_one(gpio + TWL4030_GPIO_MAX, lcd_bl_en, "EN_LCD_BKL"); |
423 | (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) ? 1 : 0); | ||
424 | if (r) | 381 | if (r) |
425 | printk(KERN_ERR "failed to get/set lcd_bkl gpio\n"); | 382 | printk(KERN_ERR "failed to get/set lcd_bkl gpio\n"); |
426 | 383 | ||
427 | /* gpio + 7 == DVI Enable */ | 384 | /* gpio + 7 == DVI Enable */ |
428 | gpio_request(gpio + 7, "EN_DVI"); | 385 | gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI"); |
429 | gpio_direction_output(gpio + 7, 0); | ||
430 | 386 | ||
431 | /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ | 387 | /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ |
432 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; | 388 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; |
@@ -717,6 +673,11 @@ static struct omap_musb_board_data musb_board_data = { | |||
717 | .power = 100, | 673 | .power = 100, |
718 | }; | 674 | }; |
719 | 675 | ||
676 | static struct gpio omap3_evm_ehci_gpios[] __initdata = { | ||
677 | { OMAP3_EVM_EHCI_VBUS, GPIOF_OUT_INIT_HIGH, "enable EHCI VBUS" }, | ||
678 | { OMAP3_EVM_EHCI_SELECT, GPIOF_OUT_INIT_LOW, "select EHCI port" }, | ||
679 | }; | ||
680 | |||
720 | static void __init omap3_evm_init(void) | 681 | static void __init omap3_evm_init(void) |
721 | { | 682 | { |
722 | omap3_evm_get_revision(); | 683 | omap3_evm_get_revision(); |
@@ -740,16 +701,12 @@ static void __init omap3_evm_init(void) | |||
740 | 701 | ||
741 | if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) { | 702 | if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) { |
742 | /* enable EHCI VBUS using GPIO22 */ | 703 | /* enable EHCI VBUS using GPIO22 */ |
743 | omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP); | 704 | omap_mux_init_gpio(OMAP3_EVM_EHCI_VBUS, OMAP_PIN_INPUT_PULLUP); |
744 | gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS"); | ||
745 | gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0); | ||
746 | gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1); | ||
747 | |||
748 | /* Select EHCI port on main board */ | 705 | /* Select EHCI port on main board */ |
749 | omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP); | 706 | omap_mux_init_gpio(OMAP3_EVM_EHCI_SELECT, |
750 | gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port"); | 707 | OMAP_PIN_INPUT_PULLUP); |
751 | gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0); | 708 | gpio_request_array(omap3_evm_ehci_gpios, |
752 | gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0); | 709 | ARRAY_SIZE(omap3_evm_ehci_gpios)); |
753 | 710 | ||
754 | /* setup EHCI phy reset config */ | 711 | /* setup EHCI phy reset config */ |
755 | omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP); | 712 | omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP); |