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-3430sdp.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-3430sdp.c')
-rw-r--r-- | arch/arm/mach-omap2/board-3430sdp.c | 47 |
1 files changed, 15 insertions, 32 deletions
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 951e5857ad31..99218a5299ca 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c | |||
@@ -126,8 +126,11 @@ static struct twl4030_keypad_data sdp3430_kp_data = { | |||
126 | #define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8 | 126 | #define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8 |
127 | #define SDP3430_LCD_PANEL_ENABLE_GPIO 5 | 127 | #define SDP3430_LCD_PANEL_ENABLE_GPIO 5 |
128 | 128 | ||
129 | static unsigned backlight_gpio; | 129 | static struct gpio sdp3430_dss_gpios[] __initdata = { |
130 | static unsigned enable_gpio; | 130 | {SDP3430_LCD_PANEL_ENABLE_GPIO, GPIOF_OUT_INIT_LOW, "LCD reset" }, |
131 | {SDP3430_LCD_PANEL_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "LCD Backlight"}, | ||
132 | }; | ||
133 | |||
131 | static int lcd_enabled; | 134 | static int lcd_enabled; |
132 | static int dvi_enabled; | 135 | static int dvi_enabled; |
133 | 136 | ||
@@ -135,29 +138,11 @@ static void __init sdp3430_display_init(void) | |||
135 | { | 138 | { |
136 | int r; | 139 | int r; |
137 | 140 | ||
138 | enable_gpio = SDP3430_LCD_PANEL_ENABLE_GPIO; | 141 | r = gpio_request_array(sdp3430_dss_gpios, |
139 | backlight_gpio = SDP3430_LCD_PANEL_BACKLIGHT_GPIO; | 142 | ARRAY_SIZE(sdp3430_dss_gpios)); |
140 | 143 | if (r) | |
141 | r = gpio_request(enable_gpio, "LCD reset"); | 144 | printk(KERN_ERR "failed to get LCD control GPIOs\n"); |
142 | if (r) { | ||
143 | printk(KERN_ERR "failed to get LCD reset GPIO\n"); | ||
144 | goto err0; | ||
145 | } | ||
146 | |||
147 | r = gpio_request(backlight_gpio, "LCD Backlight"); | ||
148 | if (r) { | ||
149 | printk(KERN_ERR "failed to get LCD backlight GPIO\n"); | ||
150 | goto err1; | ||
151 | } | ||
152 | |||
153 | gpio_direction_output(enable_gpio, 0); | ||
154 | gpio_direction_output(backlight_gpio, 0); | ||
155 | 145 | ||
156 | return; | ||
157 | err1: | ||
158 | gpio_free(enable_gpio); | ||
159 | err0: | ||
160 | return; | ||
161 | } | 146 | } |
162 | 147 | ||
163 | static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev) | 148 | static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev) |
@@ -167,8 +152,8 @@ static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev) | |||
167 | return -EINVAL; | 152 | return -EINVAL; |
168 | } | 153 | } |
169 | 154 | ||
170 | gpio_direction_output(enable_gpio, 1); | 155 | gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 1); |
171 | gpio_direction_output(backlight_gpio, 1); | 156 | gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 1); |
172 | 157 | ||
173 | lcd_enabled = 1; | 158 | lcd_enabled = 1; |
174 | 159 | ||
@@ -179,8 +164,8 @@ static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev) | |||
179 | { | 164 | { |
180 | lcd_enabled = 0; | 165 | lcd_enabled = 0; |
181 | 166 | ||
182 | gpio_direction_output(enable_gpio, 0); | 167 | gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 0); |
183 | gpio_direction_output(backlight_gpio, 0); | 168 | gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 0); |
184 | } | 169 | } |
185 | 170 | ||
186 | static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev) | 171 | static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev) |
@@ -308,12 +293,10 @@ static int sdp3430_twl_gpio_setup(struct device *dev, | |||
308 | omap2_hsmmc_init(mmc); | 293 | omap2_hsmmc_init(mmc); |
309 | 294 | ||
310 | /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */ | 295 | /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */ |
311 | gpio_request(gpio + 7, "sub_lcd_en_bkl"); | 296 | gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "sub_lcd_en_bkl"); |
312 | gpio_direction_output(gpio + 7, 0); | ||
313 | 297 | ||
314 | /* gpio + 15 is "sub_lcd_nRST" (output) */ | 298 | /* gpio + 15 is "sub_lcd_nRST" (output) */ |
315 | gpio_request(gpio + 15, "sub_lcd_nRST"); | 299 | gpio_request_one(gpio + 15, GPIOF_OUT_INIT_LOW, "sub_lcd_nRST"); |
316 | gpio_direction_output(gpio + 15, 0); | ||
317 | 300 | ||
318 | return 0; | 301 | return 0; |
319 | } | 302 | } |