aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-4430sdp.c
diff options
context:
space:
mode:
authorIgor Grinberg <grinberg@compulab.co.il>2011-05-03 11:22:09 -0400
committerTony Lindgren <tony@atomide.com>2011-05-12 05:52:06 -0400
commitbc593f5d787d0a015539e21868302fb44a47c3e3 (patch)
tree75feac78712ae08e38b678c0dae62cb75765ddb0 /arch/arm/mach-omap2/board-4430sdp.c
parent9e18630b689d658d65bf59508bfec084f61ff5c6 (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-4430sdp.c')
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c98
1 files changed, 23 insertions, 75 deletions
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 707354222d4c..ae3153c5396d 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -252,58 +252,22 @@ static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
252 }, 252 },
253}; 253};
254 254
255static struct gpio sdp4430_eth_gpios[] __initdata = {
256 { ETH_KS8851_POWER_ON, GPIOF_OUT_INIT_HIGH, "eth_power" },
257 { ETH_KS8851_QUART, GPIOF_OUT_INIT_HIGH, "quart" },
258 { ETH_KS8851_IRQ, GPIOF_IN, "eth_irq" },
259};
260
255static int omap_ethernet_init(void) 261static int omap_ethernet_init(void)
256{ 262{
257 int status; 263 int status;
258 264
259 /* Request of GPIO lines */ 265 /* Request of GPIO lines */
266 status = gpio_request_array(sdp4430_eth_gpios,
267 ARRAY_SIZE(sdp4430_eth_gpios));
268 if (status)
269 pr_err("Cannot request ETH GPIOs\n");
260 270
261 status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
262 if (status) {
263 pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
264 return status;
265 }
266
267 status = gpio_request(ETH_KS8851_QUART, "quart");
268 if (status) {
269 pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
270 goto error1;
271 }
272
273 status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
274 if (status) {
275 pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
276 goto error2;
277 }
278
279 /* Configuration of requested GPIO lines */
280
281 status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
282 if (status) {
283 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
284 goto error3;
285 }
286
287 status = gpio_direction_output(ETH_KS8851_QUART, 1);
288 if (status) {
289 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
290 goto error3;
291 }
292
293 status = gpio_direction_input(ETH_KS8851_IRQ);
294 if (status) {
295 pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
296 goto error3;
297 }
298
299 return 0;
300
301error3:
302 gpio_free(ETH_KS8851_IRQ);
303error2:
304 gpio_free(ETH_KS8851_QUART);
305error1:
306 gpio_free(ETH_KS8851_POWER_ON);
307 return status; 271 return status;
308} 272}
309 273
@@ -602,21 +566,13 @@ static int __init omap4_i2c_init(void)
602 566
603static void __init omap_sfh7741prox_init(void) 567static void __init omap_sfh7741prox_init(void)
604{ 568{
605 int error; 569 int error;
606 570
607 error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741"); 571 error = gpio_request_one(OMAP4_SFH7741_ENABLE_GPIO,
608 if (error < 0) { 572 GPIOF_OUT_INIT_LOW, "sfh7741");
573 if (error < 0)
609 pr_err("%s:failed to request GPIO %d, error %d\n", 574 pr_err("%s:failed to request GPIO %d, error %d\n",
610 __func__, OMAP4_SFH7741_ENABLE_GPIO, error); 575 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
611 return;
612 }
613
614 error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0);
615 if (error < 0) {
616 pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n",
617 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
618 gpio_free(OMAP4_SFH7741_ENABLE_GPIO);
619 }
620} 576}
621 577
622static void sdp4430_hdmi_mux_init(void) 578static void sdp4430_hdmi_mux_init(void)
@@ -633,27 +589,19 @@ static void sdp4430_hdmi_mux_init(void)
633 OMAP_PIN_INPUT_PULLUP); 589 OMAP_PIN_INPUT_PULLUP);
634} 590}
635 591
592static struct gpio sdp4430_hdmi_gpios[] = {
593 { HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" },
594 { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" },
595};
596
636static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev) 597static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev)
637{ 598{
638 int status; 599 int status;
639 600
640 status = gpio_request_one(HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, 601 status = gpio_request_array(sdp4430_hdmi_gpios,
641 "hdmi_gpio_hpd"); 602 ARRAY_SIZE(sdp4430_hdmi_gpios));
642 if (status) { 603 if (status)
643 pr_err("Cannot request GPIO %d\n", HDMI_GPIO_HPD); 604 pr_err("%s: Cannot request HDMI GPIOs\n", __func__);
644 return status;
645 }
646 status = gpio_request_one(HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH,
647 "hdmi_gpio_ls_oe");
648 if (status) {
649 pr_err("Cannot request GPIO %d\n", HDMI_GPIO_LS_OE);
650 goto error1;
651 }
652
653 return 0;
654
655error1:
656 gpio_free(HDMI_GPIO_HPD);
657 605
658 return status; 606 return status;
659} 607}