OMAP3: Devkit8000: Change lcd power pin

This patch fixes a wrongly used lcd enable pin.

The Devkit8000 uses twl4030_ledA configured as output gpio only for
the lcd enable line. twl4030_gpio.1 is used through the generic
gpio functions while ledA is used via low level twl4030 calls.

This patch removes the low level calls and use the generic gpio functions
for initialization and use of ledA. This patch also fixes a bug where the
lcd would not power down when blanking.

Further this patch fixes an indentation issue. The comment line uses
eight whitespace and is replaced with a hard tab.

gpio_request + gpio_direction_output are replaced with gpio_request_one.
The return value of gpio_request_one is used to set the value of the
gpio to -EINVAL when unsuccessful, so that gpio_is_valid can detect the
unsuccessful request. But already successful requested gpios are not freed.

Reported-by: Daniel Morsing <daniel.morsing@gmail.com>
Signed-off-by: Thomas Weber <weber@corscience.de>
Signed-off-by: Tony Lindgren <tony@atomide.com>

authored by Thomas Weber and committed by Tony Lindgren daf7aabc 190910cb

+16 -11
+16 -11
arch/arm/mach-omap2/board-devkit8000.c
··· 115 116 static int devkit8000_panel_enable_lcd(struct omap_dss_device *dssdev) 117 { 118 - twl_i2c_write_u8(TWL4030_MODULE_GPIO, 0x80, REG_GPIODATADIR1); 119 - twl_i2c_write_u8(TWL4030_MODULE_LED, 0x0, 0x0); 120 - 121 if (gpio_is_valid(dssdev->reset_gpio)) 122 gpio_set_value_cansleep(dssdev->reset_gpio, 1); 123 return 0; ··· 244 static int devkit8000_twl_gpio_setup(struct device *dev, 245 unsigned gpio, unsigned ngpio) 246 { 247 omap_mux_init_gpio(29, OMAP_PIN_INPUT); 248 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 249 mmc[0].gpio_cd = gpio + 0; ··· 254 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ 255 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 256 257 - /* gpio + 1 is "LCD_PWREN" (out, active high) */ 258 - devkit8000_lcd_device.reset_gpio = gpio + 1; 259 - gpio_request(devkit8000_lcd_device.reset_gpio, "LCD_PWREN"); 260 - /* Disable until needed */ 261 - gpio_direction_output(devkit8000_lcd_device.reset_gpio, 0); 262 263 /* gpio + 7 is "DVI_PD" (out, active low) */ 264 devkit8000_dvi_device.reset_gpio = gpio + 7; 265 - gpio_request(devkit8000_dvi_device.reset_gpio, "DVI PowerDown"); 266 - /* Disable until needed */ 267 - gpio_direction_output(devkit8000_dvi_device.reset_gpio, 0); 268 269 return 0; 270 }
··· 115 116 static int devkit8000_panel_enable_lcd(struct omap_dss_device *dssdev) 117 { 118 if (gpio_is_valid(dssdev->reset_gpio)) 119 gpio_set_value_cansleep(dssdev->reset_gpio, 1); 120 return 0; ··· 247 static int devkit8000_twl_gpio_setup(struct device *dev, 248 unsigned gpio, unsigned ngpio) 249 { 250 + int ret; 251 + 252 omap_mux_init_gpio(29, OMAP_PIN_INPUT); 253 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 254 mmc[0].gpio_cd = gpio + 0; ··· 255 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ 256 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 257 258 + /* TWL4030_GPIO_MAX + 0 is "LCD_PWREN" (out, active high) */ 259 + devkit8000_lcd_device.reset_gpio = gpio + TWL4030_GPIO_MAX + 0; 260 + ret = gpio_request_one(devkit8000_lcd_device.reset_gpio, 261 + GPIOF_DIR_OUT | GPIOF_INIT_LOW, "LCD_PWREN"); 262 + if (ret < 0) { 263 + devkit8000_lcd_device.reset_gpio = -EINVAL; 264 + printk(KERN_ERR "Failed to request GPIO for LCD_PWRN\n"); 265 + } 266 267 /* gpio + 7 is "DVI_PD" (out, active low) */ 268 devkit8000_dvi_device.reset_gpio = gpio + 7; 269 + ret = gpio_request_one(devkit8000_dvi_device.reset_gpio, 270 + GPIOF_DIR_OUT | GPIOF_INIT_LOW, "DVI PowerDown"); 271 + if (ret < 0) { 272 + devkit8000_dvi_device.reset_gpio = -EINVAL; 273 + printk(KERN_ERR "Failed to request GPIO for DVI PowerDown\n"); 274 + } 275 276 return 0; 277 }