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-cm-t35.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-cm-t35.c')
-rw-r--r-- | arch/arm/mach-omap2/board-cm-t35.c | 74 |
1 files changed, 22 insertions, 52 deletions
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c index e0e2d4838003..6063be82b563 100644 --- a/arch/arm/mach-omap2/board-cm-t35.c +++ b/arch/arm/mach-omap2/board-cm-t35.c | |||
@@ -182,10 +182,6 @@ static inline void cm_t35_init_nand(void) {} | |||
182 | #define CM_T35_LCD_BL_GPIO 58 | 182 | #define CM_T35_LCD_BL_GPIO 58 |
183 | #define CM_T35_DVI_EN_GPIO 54 | 183 | #define CM_T35_DVI_EN_GPIO 54 |
184 | 184 | ||
185 | static int lcd_bl_gpio; | ||
186 | static int lcd_en_gpio; | ||
187 | static int dvi_en_gpio; | ||
188 | |||
189 | static int lcd_enabled; | 185 | static int lcd_enabled; |
190 | static int dvi_enabled; | 186 | static int dvi_enabled; |
191 | 187 | ||
@@ -196,8 +192,8 @@ static int cm_t35_panel_enable_lcd(struct omap_dss_device *dssdev) | |||
196 | return -EINVAL; | 192 | return -EINVAL; |
197 | } | 193 | } |
198 | 194 | ||
199 | gpio_set_value(lcd_en_gpio, 1); | 195 | gpio_set_value(CM_T35_LCD_EN_GPIO, 1); |
200 | gpio_set_value(lcd_bl_gpio, 1); | 196 | gpio_set_value(CM_T35_LCD_BL_GPIO, 1); |
201 | 197 | ||
202 | lcd_enabled = 1; | 198 | lcd_enabled = 1; |
203 | 199 | ||
@@ -208,8 +204,8 @@ static void cm_t35_panel_disable_lcd(struct omap_dss_device *dssdev) | |||
208 | { | 204 | { |
209 | lcd_enabled = 0; | 205 | lcd_enabled = 0; |
210 | 206 | ||
211 | gpio_set_value(lcd_bl_gpio, 0); | 207 | gpio_set_value(CM_T35_LCD_BL_GPIO, 0); |
212 | gpio_set_value(lcd_en_gpio, 0); | 208 | gpio_set_value(CM_T35_LCD_EN_GPIO, 0); |
213 | } | 209 | } |
214 | 210 | ||
215 | static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev) | 211 | static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev) |
@@ -219,7 +215,7 @@ static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev) | |||
219 | return -EINVAL; | 215 | return -EINVAL; |
220 | } | 216 | } |
221 | 217 | ||
222 | gpio_set_value(dvi_en_gpio, 0); | 218 | gpio_set_value(CM_T35_DVI_EN_GPIO, 0); |
223 | dvi_enabled = 1; | 219 | dvi_enabled = 1; |
224 | 220 | ||
225 | return 0; | 221 | return 0; |
@@ -227,7 +223,7 @@ static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev) | |||
227 | 223 | ||
228 | static void cm_t35_panel_disable_dvi(struct omap_dss_device *dssdev) | 224 | static void cm_t35_panel_disable_dvi(struct omap_dss_device *dssdev) |
229 | { | 225 | { |
230 | gpio_set_value(dvi_en_gpio, 1); | 226 | gpio_set_value(CM_T35_DVI_EN_GPIO, 1); |
231 | dvi_enabled = 0; | 227 | dvi_enabled = 0; |
232 | } | 228 | } |
233 | 229 | ||
@@ -309,62 +305,38 @@ static struct spi_board_info cm_t35_lcd_spi_board_info[] __initdata = { | |||
309 | }, | 305 | }, |
310 | }; | 306 | }; |
311 | 307 | ||
308 | static struct gpio cm_t35_dss_gpios[] __initdata = { | ||
309 | { CM_T35_LCD_EN_GPIO, GPIOF_OUT_INIT_LOW, "lcd enable" }, | ||
310 | { CM_T35_LCD_BL_GPIO, GPIOF_OUT_INIT_LOW, "lcd bl enable" }, | ||
311 | { CM_T35_DVI_EN_GPIO, GPIOF_OUT_INIT_HIGH, "dvi enable" }, | ||
312 | }; | ||
313 | |||
312 | static void __init cm_t35_init_display(void) | 314 | static void __init cm_t35_init_display(void) |
313 | { | 315 | { |
314 | int err; | 316 | int err; |
315 | 317 | ||
316 | lcd_en_gpio = CM_T35_LCD_EN_GPIO; | ||
317 | lcd_bl_gpio = CM_T35_LCD_BL_GPIO; | ||
318 | dvi_en_gpio = CM_T35_DVI_EN_GPIO; | ||
319 | |||
320 | spi_register_board_info(cm_t35_lcd_spi_board_info, | 318 | spi_register_board_info(cm_t35_lcd_spi_board_info, |
321 | ARRAY_SIZE(cm_t35_lcd_spi_board_info)); | 319 | ARRAY_SIZE(cm_t35_lcd_spi_board_info)); |
322 | 320 | ||
323 | err = gpio_request(lcd_en_gpio, "LCD RST"); | 321 | err = gpio_request_array(cm_t35_dss_gpios, |
324 | if (err) { | 322 | ARRAY_SIZE(cm_t35_dss_gpios)); |
325 | pr_err("CM-T35: failed to get LCD reset GPIO\n"); | ||
326 | goto out; | ||
327 | } | ||
328 | |||
329 | err = gpio_request(lcd_bl_gpio, "LCD BL"); | ||
330 | if (err) { | 323 | if (err) { |
331 | pr_err("CM-T35: failed to get LCD backlight control GPIO\n"); | 324 | pr_err("CM-T35: failed to request DSS control GPIOs\n"); |
332 | goto err_lcd_bl; | 325 | return; |
333 | } | 326 | } |
334 | 327 | ||
335 | err = gpio_request(dvi_en_gpio, "DVI EN"); | 328 | gpio_export(CM_T35_LCD_EN_GPIO, 0); |
336 | if (err) { | 329 | gpio_export(CM_T35_LCD_BL_GPIO, 0); |
337 | pr_err("CM-T35: failed to get DVI reset GPIO\n"); | 330 | gpio_export(CM_T35_DVI_EN_GPIO, 0); |
338 | goto err_dvi_en; | ||
339 | } | ||
340 | |||
341 | gpio_export(lcd_en_gpio, 0); | ||
342 | gpio_export(lcd_bl_gpio, 0); | ||
343 | gpio_export(dvi_en_gpio, 0); | ||
344 | gpio_direction_output(lcd_en_gpio, 0); | ||
345 | gpio_direction_output(lcd_bl_gpio, 0); | ||
346 | gpio_direction_output(dvi_en_gpio, 1); | ||
347 | 331 | ||
348 | msleep(50); | 332 | msleep(50); |
349 | gpio_set_value(lcd_en_gpio, 1); | 333 | gpio_set_value(CM_T35_LCD_EN_GPIO, 1); |
350 | 334 | ||
351 | err = omap_display_init(&cm_t35_dss_data); | 335 | err = omap_display_init(&cm_t35_dss_data); |
352 | if (err) { | 336 | if (err) { |
353 | pr_err("CM-T35: failed to register DSS device\n"); | 337 | pr_err("CM-T35: failed to register DSS device\n"); |
354 | goto err_dev_reg; | 338 | gpio_free_array(cm_t35_dss_gpios, ARRAY_SIZE(cm_t35_dss_gpios)); |
355 | } | 339 | } |
356 | |||
357 | return; | ||
358 | |||
359 | err_dev_reg: | ||
360 | gpio_free(dvi_en_gpio); | ||
361 | err_dvi_en: | ||
362 | gpio_free(lcd_bl_gpio); | ||
363 | err_lcd_bl: | ||
364 | gpio_free(lcd_en_gpio); | ||
365 | out: | ||
366 | |||
367 | return; | ||
368 | } | 340 | } |
369 | 341 | ||
370 | static struct regulator_consumer_supply cm_t35_vmmc1_supply = { | 342 | static struct regulator_consumer_supply cm_t35_vmmc1_supply = { |
@@ -497,10 +469,8 @@ static int cm_t35_twl_gpio_setup(struct device *dev, unsigned gpio, | |||
497 | { | 469 | { |
498 | int wlan_rst = gpio + 2; | 470 | int wlan_rst = gpio + 2; |
499 | 471 | ||
500 | if ((gpio_request(wlan_rst, "WLAN RST") == 0) && | 472 | if (gpio_request_one(wlan_rst, GPIOF_OUT_INIT_HIGH, "WLAN RST") == 0) { |
501 | (gpio_direction_output(wlan_rst, 1) == 0)) { | ||
502 | gpio_export(wlan_rst, 0); | 473 | gpio_export(wlan_rst, 0); |
503 | |||
504 | udelay(10); | 474 | udelay(10); |
505 | gpio_set_value(wlan_rst, 0); | 475 | gpio_set_value(wlan_rst, 0); |
506 | udelay(10); | 476 | udelay(10); |