aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-am3517evm.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-am3517evm.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-am3517evm.c')
-rw-r--r--arch/arm/mach-omap2/board-am3517evm.c54
1 files changed, 16 insertions, 38 deletions
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index ce7d5e6e4150..6c4706038808 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -174,19 +174,14 @@ static void __init am3517_evm_rtc_init(void)
174 int r; 174 int r;
175 175
176 omap_mux_init_gpio(GPIO_RTCS35390A_IRQ, OMAP_PIN_INPUT_PULLUP); 176 omap_mux_init_gpio(GPIO_RTCS35390A_IRQ, OMAP_PIN_INPUT_PULLUP);
177 r = gpio_request(GPIO_RTCS35390A_IRQ, "rtcs35390a-irq"); 177
178 r = gpio_request_one(GPIO_RTCS35390A_IRQ, GPIOF_IN, "rtcs35390a-irq");
178 if (r < 0) { 179 if (r < 0) {
179 printk(KERN_WARNING "failed to request GPIO#%d\n", 180 printk(KERN_WARNING "failed to request GPIO#%d\n",
180 GPIO_RTCS35390A_IRQ); 181 GPIO_RTCS35390A_IRQ);
181 return; 182 return;
182 } 183 }
183 r = gpio_direction_input(GPIO_RTCS35390A_IRQ); 184
184 if (r < 0) {
185 printk(KERN_WARNING "GPIO#%d cannot be configured as input\n",
186 GPIO_RTCS35390A_IRQ);
187 gpio_free(GPIO_RTCS35390A_IRQ);
188 return;
189 }
190 am3517evm_i2c1_boardinfo[0].irq = gpio_to_irq(GPIO_RTCS35390A_IRQ); 185 am3517evm_i2c1_boardinfo[0].irq = gpio_to_irq(GPIO_RTCS35390A_IRQ);
191} 186}
192 187
@@ -242,6 +237,15 @@ static int dvi_enabled;
242 237
243#if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \ 238#if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \
244 defined(CONFIG_PANEL_SHARP_LQ043T1DG01_MODULE) 239 defined(CONFIG_PANEL_SHARP_LQ043T1DG01_MODULE)
240static struct gpio am3517_evm_dss_gpios[] __initdata = {
241 /* GPIO 182 = LCD Backlight Power */
242 { LCD_PANEL_BKLIGHT_PWR, GPIOF_OUT_INIT_HIGH, "lcd_backlight_pwr" },
243 /* GPIO 181 = LCD Panel PWM */
244 { LCD_PANEL_PWM, GPIOF_OUT_INIT_HIGH, "lcd bl enable" },
245 /* GPIO 176 = LCD Panel Power enable pin */
246 { LCD_PANEL_PWR, GPIOF_OUT_INIT_HIGH, "dvi enable" },
247};
248
245static void __init am3517_evm_display_init(void) 249static void __init am3517_evm_display_init(void)
246{ 250{
247 int r; 251 int r;
@@ -249,41 +253,15 @@ static void __init am3517_evm_display_init(void)
249 omap_mux_init_gpio(LCD_PANEL_PWR, OMAP_PIN_INPUT_PULLUP); 253 omap_mux_init_gpio(LCD_PANEL_PWR, OMAP_PIN_INPUT_PULLUP);
250 omap_mux_init_gpio(LCD_PANEL_BKLIGHT_PWR, OMAP_PIN_INPUT_PULLDOWN); 254 omap_mux_init_gpio(LCD_PANEL_BKLIGHT_PWR, OMAP_PIN_INPUT_PULLDOWN);
251 omap_mux_init_gpio(LCD_PANEL_PWM, OMAP_PIN_INPUT_PULLDOWN); 255 omap_mux_init_gpio(LCD_PANEL_PWM, OMAP_PIN_INPUT_PULLDOWN);
252 /* 256
253 * Enable GPIO 182 = LCD Backlight Power 257 r = gpio_request_array(am3517_evm_dss_gpios,
254 */ 258 ARRAY_SIZE(am3517_evm_dss_gpios));
255 r = gpio_request(LCD_PANEL_BKLIGHT_PWR, "lcd_backlight_pwr");
256 if (r) { 259 if (r) {
257 printk(KERN_ERR "failed to get lcd_backlight_pwr\n"); 260 printk(KERN_ERR "failed to get DSS panel control GPIOs\n");
258 return; 261 return;
259 } 262 }
260 gpio_direction_output(LCD_PANEL_BKLIGHT_PWR, 1);
261 /*
262 * Enable GPIO 181 = LCD Panel PWM
263 */
264 r = gpio_request(LCD_PANEL_PWM, "lcd_pwm");
265 if (r) {
266 printk(KERN_ERR "failed to get lcd_pwm\n");
267 goto err_1;
268 }
269 gpio_direction_output(LCD_PANEL_PWM, 1);
270 /*
271 * Enable GPIO 176 = LCD Panel Power enable pin
272 */
273 r = gpio_request(LCD_PANEL_PWR, "lcd_panel_pwr");
274 if (r) {
275 printk(KERN_ERR "failed to get lcd_panel_pwr\n");
276 goto err_2;
277 }
278 gpio_direction_output(LCD_PANEL_PWR, 1);
279 263
280 printk(KERN_INFO "Display initialized successfully\n"); 264 printk(KERN_INFO "Display initialized successfully\n");
281 return;
282
283err_2:
284 gpio_free(LCD_PANEL_PWM);
285err_1:
286 gpio_free(LCD_PANEL_BKLIGHT_PWR);
287} 265}
288#else 266#else
289static void __init am3517_evm_display_init(void) {} 267static void __init am3517_evm_display_init(void) {}