]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
use gpio_direction_output (OMAP tree only)
authorDavid Brownell <dbrownell@users.sourceforge.net>
Thu, 30 Oct 2008 07:33:53 +0000 (00:33 -0700)
committerTony Lindgren <tony@atomide.com>
Thu, 13 Nov 2008 21:29:50 +0000 (13:29 -0800)
More conversion to the standard GPIO interfaces:  stop using
omap_set_gpio_direction() entirely, and switch over to the
gpio_direction_output() call.

Note that because gpio_direction_output() includes the initial
value, this change isn't quite transparent.

 - For the call sites which defined an initial value either
   before or after setting the direction, that value was used.

   When that value was previously assigned afterwards, this
   could eliminate a brief output glitch ... and possibly
   change behavior.  In a few cases (LCDs) several values
   were assigned together ... those were re-arranged to match
   the explicit sequence provided.

 - Some call sites didn't define such a value; so I chose an
   initial "off/reset" value that seemed to default to "off".

In short, files touched by this patch might notice some small
changes in startup behavior (with trivial fixes).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Tony Lindgren <tony@atomide.com>
15 files changed:
arch/arm/mach-omap2/board-2430sdp.c
arch/arm/mach-omap2/board-n800-camera.c
arch/arm/mach-omap2/board-n800-mmc.c
arch/arm/mach-omap2/board-n800-usb.c
arch/arm/mach-omap2/board-n800.c
drivers/bluetooth/brf6150.c
drivers/bluetooth/hci_h4p/core.c
drivers/cbus/cbus.c
drivers/leds/leds-omap.c
drivers/spi/tsc2301-core.c
drivers/usb/host/ehci-omap.c
drivers/video/omap/lcd_2430sdp.c
drivers/video/omap/lcd_omap2evm.c
drivers/video/omap/lcd_omap3evm.c
drivers/video/omap/lcd_p2.c

index e0bf5857758aa6db72f78100181c1a2c6efeefe2..3f3a58b788b428f119aa57718493f88638473a6d 100644 (file)
@@ -420,8 +420,7 @@ static void __init omap_2430sdp_init(void)
        hsmmc_init(mmc);
 
        /* turn off secondary LCD backlight */
-       omap_set_gpio_direction(SECONDARY_LCD_GPIO, 0);
-       gpio_set_value(SECONDARY_LCD_GPIO, 0);
+       gpio_direction_output(SECONDARY_LCD_GPIO, 0);
 }
 
 static void __init omap_2430sdp_map_io(void)
index 2dd1138cb882bfcc83b72efc96e5a0b33946e760..1f3b1e9f2b60f8ea012c0e73c1cd8fab726943c1 100644 (file)
@@ -363,8 +363,7 @@ void __init n800_cam_init(void)
                return;
        }
 
-       gpio_set_value(N800_CAM_SENSOR_RESET_GPIO, 0);
-       omap_set_gpio_direction(N800_CAM_SENSOR_RESET_GPIO, 0);
+       gpio_direction_output(N800_CAM_SENSOR_RESET_GPIO, 0);
 
        sensor_okay = 1;
 }
index 471d3158fe31e2560734583b48829063626e43a0..d4df2b77bfe86000d962572ad2842a235b59d882 100644 (file)
@@ -346,19 +346,16 @@ void __init n800_mmc_init(void)
 
        if (omap_request_gpio(slot_switch_gpio) < 0)
                BUG();
-       gpio_set_value(slot_switch_gpio, 0);
-       omap_set_gpio_direction(slot_switch_gpio, 0);
+       gpio_direction_output(slot_switch_gpio, 0);
 
        if (machine_is_nokia_n810()) {
                if (omap_request_gpio(n810_slot2_pw_vddf) < 0)
                        BUG();
-               gpio_set_value(n810_slot2_pw_vddf, 0);
-               omap_set_gpio_direction(n810_slot2_pw_vddf, 0);
+               gpio_direction_output(n810_slot2_pw_vddf, 0);
 
                if (omap_request_gpio(n810_slot2_pw_vdd) < 0)
                        BUG();
-               gpio_set_value(n810_slot2_pw_vdd, 0);
-               omap_set_gpio_direction(n810_slot2_pw_vdd, 0);
+               gpio_direction_output(n810_slot2_pw_vdd, 0);
        }
 
        mmc_data[0] = &mmc1_data;
index 36bb6a8804168f355d9525b72df010e5b42add66..5ab453dba25335d58074a1775ed9331eee7ffbbb 100644 (file)
@@ -156,7 +156,7 @@ void __init n800_usb_init(void)
                       GPIO_TUSB_ENABLE);
                return;
        }
-       omap_set_gpio_direction(GPIO_TUSB_ENABLE, 0);
+       gpio_direction_output(GPIO_TUSB_ENABLE, 0);
 
        tusb_set_power(0);
 
index 74ffd4e2ed269620f8116a56da1b7e7dfaa2f7d7..280806c3ccf5858fd4a67662c0f644d1d3289409 100644 (file)
@@ -133,8 +133,7 @@ void __init nokia_n800_init_irq(void)
                return;
        }
 
-       omap_set_gpio_direction(N800_STI_GPIO, 0);
-       gpio_set_value(N800_STI_GPIO, 0);
+       gpio_direction_output(N800_STI_GPIO, 0);
 #endif
 }
 
@@ -258,8 +257,7 @@ static void __init blizzard_dev_init(void)
        r = omap_request_gpio(N800_BLIZZARD_POWERDOWN_GPIO);
        if (r < 0)
                return;
-       omap_set_gpio_direction(N800_BLIZZARD_POWERDOWN_GPIO, 0);
-       gpio_set_value(N800_BLIZZARD_POWERDOWN_GPIO, 1);
+       gpio_direction_output(N800_BLIZZARD_POWERDOWN_GPIO, 1);
 
        blizzard_get_clocks();
        omapfb_set_ctrl_platform_data(&n800_blizzard_data);
@@ -339,7 +337,7 @@ static int __init tea5761_dev_init(void)
                        return -ENODEV;
                }
 
-               omap_set_gpio_direction(enable_gpio, 0);
+               gpio_direction_output(enable_gpio, 0);
                udelay(50);
                gpio_set_value(enable_gpio, 1);
        }
index baddb8a6357aa93dac278d2bc4f019bd20665d26..adb947ac2919e7ae36c06613cf216e747803b21b 100644 (file)
@@ -943,8 +943,8 @@ static int __init brf6150_init(void)
                return err;
        }
 
-       omap_set_gpio_direction(info->btinfo->reset_gpio, 0);
-       omap_set_gpio_direction(info->btinfo->bt_wakeup_gpio, 0);
+       gpio_direction_output(info->btinfo->reset_gpio, 0);
+       gpio_direction_output(info->btinfo->bt_wakeup_gpio, 0);
        gpio_direction_input(info->btinfo->host_wakeup_gpio);
        set_irq_type(OMAP_GPIO_IRQ(info->btinfo->host_wakeup_gpio), IRQ_TYPE_NONE);
 
index 4c97c76c61294927d74a46cc6230c8b3315f2576..3bf7c211d37d577a5c403936624aa22d3b14a604 100644 (file)
@@ -852,8 +852,8 @@ static int hci_h4p_probe(struct platform_device *pdev)
                goto cleanup;
        }
 
-       omap_set_gpio_direction(info->reset_gpio, 0);
-       omap_set_gpio_direction(info->bt_wakeup_gpio, 0);
+       gpio_direction_output(info->reset_gpio, 0);
+       gpio_direction_output(info->bt_wakeup_gpio, 0);
        gpio_direction_input(info->host_wakeup_gpio);
 
        switch (bt_config->bt_uart) {
index f373799135b5f2f658da1dc77653b2b6a87fc654..1a184b0aad9efc580f7b7cc5c3eebdd93e513520 100644 (file)
@@ -99,9 +99,11 @@ static u8 cbus_receive_bit(struct cbus_host *host, u32 base)
        return ret;
 }
 
+#define cbus_output(base, gpio, val)   cbus_set_gpio_direction(base, gpio, 0)
+
 #else
 
-#define cbus_set_gpio_direction(base, gpio, is_input) omap_set_gpio_direction(gpio, is_input)
+#define cbus_output(base, gpio, val)   gpio_direction_output(gpio, val)
 #define cbus_set_gpio_dataout(base, gpio, enable) gpio_set_value(gpio, enable)
 #define cbus_get_gpio_datain(base, int, gpio) gpio_get_value(gpio)
 
@@ -156,7 +158,7 @@ static int cbus_transfer(struct cbus_host *host, int dev, int reg, int data)
        cbus_set_gpio_dataout(base, host->sel_gpio, 0);
 
        /* Set the DAT pin to output */
-       cbus_set_gpio_direction(base, host->dat_gpio, 0);
+       cbus_output(base, host->dat_gpio, 1);
 
        /* Send the device address */
        for (i = 3; i > 0; i--)
@@ -260,12 +262,9 @@ int __init cbus_bus_init(void)
        if ((ret = omap_request_gpio(chost->sel_gpio)) < 0)
                goto exit3;
 
-       gpio_set_value(chost->clk_gpio, 0);
-       gpio_set_value(chost->sel_gpio, 1);
-
-       omap_set_gpio_direction(chost->clk_gpio, 0);
+       gpio_direction_output(chost->clk_gpio, 0);
        gpio_direction_input(chost->dat_gpio);
-       omap_set_gpio_direction(chost->sel_gpio, 0);
+       gpio_direction_output(chost->sel_gpio, 1);
 
        gpio_set_value(chost->clk_gpio, 1);
        gpio_set_value(chost->clk_gpio, 0);
index bf5cce8f8d1b4f8d1e805073330a81c87d936e9c..05776cd4fbb5d0486b89e468251f57164c0364f3 100644 (file)
@@ -36,7 +36,7 @@ static void omap_configure_led_gpio(int gpio)
                printk(KERN_ERR "Failed to request GPIO%d for LEDs\n", gpio);
                return;
        }
-       omap_set_gpio_direction(gpio, 0);       /* OUT */
+       gpio_direction_output(gpio, 0);
 }
 
 static int omap_led_probe(struct platform_device *dev)
index f6351c66f179e0c48caf60e80221583c4df18144..715e400ebf7898cd0ea0df13fc0ea71bb7935340 100644 (file)
@@ -161,8 +161,7 @@ static int __devinit tsc2301_probe(struct spi_device *spi)
                r = omap_request_gpio(tsc->reset_gpio);
                if (r < 0)
                        goto err1;
-               gpio_set_value(tsc->reset_gpio, 1);
-               omap_set_gpio_direction(tsc->reset_gpio, 0);
+               gpio_direction_output(tsc->reset_gpio, 1);
                mdelay(1);
                gpio_set_value(tsc->reset_gpio, 0);
 #endif
index adbff661b33c5c41914075bc233c572263dfabe7..4dffba6fc60b00854a6cfd0c53cee5acd77adf3c 100644 (file)
@@ -226,11 +226,9 @@ static int omap_start_ehc(struct platform_device *dev, struct usb_hcd *hcd)
 #ifdef EXTERNAL_PHY_RESET
        /* Refer: ISSUE1 */
        omap_request_gpio(EXT_PHY_RESET_GPIO_PORT1);
-       omap_set_gpio_direction(EXT_PHY_RESET_GPIO_PORT1, 0);
+       gpio_direction_output(EXT_PHY_RESET_GPIO_PORT1, 0);
        omap_request_gpio(EXT_PHY_RESET_GPIO_PORT2);
-       omap_set_gpio_direction(EXT_PHY_RESET_GPIO_PORT2, 0);
-       gpio_set_value(EXT_PHY_RESET_GPIO_PORT1, 0);
-       gpio_set_value(EXT_PHY_RESET_GPIO_PORT2, 0);
+       gpio_direction_output(EXT_PHY_RESET_GPIO_PORT2, 0);
        /* Hold the PHY in RESET for enough time till DIR is high */
        udelay(EXT_PHY_RESET_DELAY);
 #endif
index 12c9ed27600f6e1d060674378d294a6fe1278bcd..99cd2dba9c8cda1518423c8af55f77b00111cdf8 100644 (file)
@@ -67,8 +67,8 @@ static int sdp2430_panel_init(struct lcd_panel *panel,
 
        omap_request_gpio(enable_gpio);                 /* LCD panel */
        omap_request_gpio(backlight_gpio);              /* LCD backlight */
-       omap_set_gpio_direction(enable_gpio, 0);        /* output */
-       omap_set_gpio_direction(backlight_gpio, 0);     /* output */
+       gpio_direction_output(enable_gpio, 0);
+       gpio_direction_output(backlight_gpio, 0);
 
        return 0;
 }
index f3b012ca8662b5d55433a284f1d664a0cf88ee12..424fbae953c586043cb1f16fd6d3f0f6abc93bc5 100644 (file)
@@ -57,18 +57,12 @@ static int omap2evm_panel_init(struct lcd_panel *panel,
        omap_request_gpio(LCD_PANEL_QVGA);
        omap_request_gpio(LCD_PANEL_RESB);
 
-       omap_set_gpio_direction(LCD_PANEL_ENABLE_GPIO, 0);
-       omap_set_gpio_direction(LCD_PANEL_LR, 0);
-       omap_set_gpio_direction(LCD_PANEL_UD, 0);
-       omap_set_gpio_direction(LCD_PANEL_INI, 0);
-       omap_set_gpio_direction(LCD_PANEL_QVGA, 0);
-       omap_set_gpio_direction(LCD_PANEL_RESB, 0);
-
-       gpio_set_value(LCD_PANEL_RESB, 1);
-       gpio_set_value(LCD_PANEL_INI, 1);
-       gpio_set_value(LCD_PANEL_QVGA, 0);
-       gpio_set_value(LCD_PANEL_LR, 1);
-       gpio_set_value(LCD_PANEL_UD, 1);
+       gpio_direction_output(LCD_PANEL_ENABLE_GPIO, 1);
+       gpio_direction_output(LCD_PANEL_RESB, 1);
+       gpio_direction_output(LCD_PANEL_INI, 1);
+       gpio_direction_output(LCD_PANEL_QVGA, 0);
+       gpio_direction_output(LCD_PANEL_LR, 1);
+       gpio_direction_output(LCD_PANEL_UD, 1);
 
        twl4030_i2c_write_u8(TWL4030_MODULE_LED, 0x11, TWL_LED_LEDEN);
        twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, 0x01, TWL_PWMA_PWMAON);
index 7f10da0f0da223069a9ded2736858f2ac40a0d31..90aa015499e8e8d8eb6299a7c11a991fd37aa326 100644 (file)
@@ -60,23 +60,17 @@ static int omap3evm_panel_init(struct lcd_panel *panel,
        omap_request_gpio(LCD_PANEL_RESB);
        omap_request_gpio(LCD_PANEL_QVGA);
 
-       omap_set_gpio_direction(LCD_PANEL_LR, 0);
-       omap_set_gpio_direction(LCD_PANEL_UD, 0);
-       omap_set_gpio_direction(LCD_PANEL_INI, 0);
-       omap_set_gpio_direction(LCD_PANEL_RESB, 0);
-       omap_set_gpio_direction(LCD_PANEL_QVGA, 0);
+       gpio_direction_output(LCD_PANEL_RESB, 1);
+       gpio_direction_output(LCD_PANEL_INI, 1);
+       gpio_direction_output(LCD_PANEL_QVGA, 0);
+       gpio_direction_output(LCD_PANEL_LR, 1);
+       gpio_direction_output(LCD_PANEL_UD, 1);
 
        twl4030_i2c_write_u8(TWL4030_MODULE_LED, 0x11, TWL_LED_LEDEN);
        twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, 0x01, TWL_PWMA_PWMAON);
        twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, 0x02, TWL_PWMA_PWMAOFF);
        bklight_level = 100;
 
-       gpio_set_value(LCD_PANEL_RESB, 1);
-       gpio_set_value(LCD_PANEL_INI, 1);
-       gpio_set_value(LCD_PANEL_QVGA, 0);
-       gpio_set_value(LCD_PANEL_LR, 1);
-       gpio_set_value(LCD_PANEL_UD, 1);
-
        return 0;
 }
 
index afd5e28468f461dbd2e21477b98deb44b377c05d..dd40fd7e6bac46dc4795a458538ab0359257e358 100644 (file)
@@ -165,8 +165,7 @@ static int p2_panel_enable(struct lcd_panel *panel)
        unsigned long value;
 
                /* thwack the reset line */
-       omap_set_gpio_direction(19, 0);
-       gpio_set_value(19, 0);
+       gpio_direction_output(19, 0);
        mdelay(2);
        gpio_set_value(19, 1);
 
@@ -257,8 +256,7 @@ static int p2_panel_enable(struct lcd_panel *panel)
        omap_uwire_data_transfer(LCD_UWIRE_CS, LCD_DISON, 9, 0,NULL,1);
 
        /* enable backlight */
-       omap_set_gpio_direction(134, 0);
-       gpio_set_value(134, 1);
+       gpio_direction_output(134, 1);
 
        return 0;
 }