aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2008-02-26 03:01:23 -0500
committerTony Lindgren <tony@atomide.com>2008-04-14 12:57:06 -0400
commitac37a0b0ba7e8a6afce8db3f6c3367a3cfedad26 (patch)
tree18277a64c2662334c1ada7c721dc9daa2f6f4fbf
parent52e3134423c3af4431fedb34f77e31cfff91e0c3 (diff)
ARM: OMAP: 5912 OSK GPIO updates
Start cleaning up GPIO handling for OMAP5912 OSK board: - Initialize GPIOs using the cross-platform calls, not the old OMAP-private ones. - Move touchscreen setup out of ads7846 code into board-specfic setup code, where it belongs. This doesn't depend on the patches to update OMAP to use the gpiolib implementation framework. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/mach-omap1/board-osk.c30
-rw-r--r--drivers/input/touchscreen/ads7846.c40
2 files changed, 17 insertions, 53 deletions
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 5279e35a8aec..dd9ece8f409f 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -198,7 +198,7 @@ static struct i2c_board_info __initdata osk_i2c_board_info[] = {
198 198
199static void __init osk_init_smc91x(void) 199static void __init osk_init_smc91x(void)
200{ 200{
201 if ((omap_request_gpio(0)) < 0) { 201 if ((gpio_request(0, "smc_irq")) < 0) {
202 printk("Error requesting gpio 0 for smc91x irq\n"); 202 printk("Error requesting gpio 0 for smc91x irq\n");
203 return; 203 return;
204 } 204 }
@@ -210,7 +210,7 @@ static void __init osk_init_smc91x(void)
210static void __init osk_init_cf(void) 210static void __init osk_init_cf(void)
211{ 211{
212 omap_cfg_reg(M7_1610_GPIO62); 212 omap_cfg_reg(M7_1610_GPIO62);
213 if ((omap_request_gpio(62)) < 0) { 213 if ((gpio_request(62, "cf_irq")) < 0) {
214 printk("Error requesting gpio 62 for CF irq\n"); 214 printk("Error requesting gpio 62 for CF irq\n");
215 return; 215 return;
216 } 216 }
@@ -334,7 +334,7 @@ static struct platform_device *mistral_devices[] __initdata = {
334 334
335static int mistral_get_pendown_state(void) 335static int mistral_get_pendown_state(void)
336{ 336{
337 return !omap_get_gpio_datain(4); 337 return !gpio_get_value(4);
338} 338}
339 339
340static const struct ads7846_platform_data mistral_ts_info = { 340static const struct ads7846_platform_data mistral_ts_info = {
@@ -396,25 +396,31 @@ static void __init osk_mistral_init(void)
396 omap_cfg_reg(W14_1610_CCP_DATAP); 396 omap_cfg_reg(W14_1610_CCP_DATAP);
397 397
398 /* CAM_PWDN */ 398 /* CAM_PWDN */
399 if (omap_request_gpio(11) == 0) { 399 if (gpio_request(11, "cam_pwdn") == 0) {
400 omap_cfg_reg(N20_1610_GPIO11); 400 omap_cfg_reg(N20_1610_GPIO11);
401 omap_set_gpio_direction(11, 0 /* out */); 401 gpio_direction_output(11, 0);
402 omap_set_gpio_dataout(11, 0 /* off */);
403 } else 402 } else
404 pr_debug("OSK+Mistral: CAM_PWDN is awol\n"); 403 pr_debug("OSK+Mistral: CAM_PWDN is awol\n");
405 404
406 405
407 /* omap_cfg_reg(P19_1610_GPIO6); */ /* BUSY */ 406 /* omap_cfg_reg(P19_1610_GPIO6); */ /* BUSY */
407 gpio_request(6, "ts_busy");
408 gpio_direction_input(6);
409
408 omap_cfg_reg(P20_1610_GPIO4); /* PENIRQ */ 410 omap_cfg_reg(P20_1610_GPIO4); /* PENIRQ */
411 gpio_request(4, "ts_int");
412 gpio_direction_input(4);
409 set_irq_type(OMAP_GPIO_IRQ(4), IRQT_FALLING); 413 set_irq_type(OMAP_GPIO_IRQ(4), IRQT_FALLING);
414
410 spi_register_board_info(mistral_boardinfo, 415 spi_register_board_info(mistral_boardinfo,
411 ARRAY_SIZE(mistral_boardinfo)); 416 ARRAY_SIZE(mistral_boardinfo));
412 417
413 /* the sideways button (SW1) is for use as a "wakeup" button */ 418 /* the sideways button (SW1) is for use as a "wakeup" button */
414 omap_cfg_reg(N15_1610_MPUIO2); 419 omap_cfg_reg(N15_1610_MPUIO2);
415 if (omap_request_gpio(OMAP_MPUIO(2)) == 0) { 420 if (gpio_request(OMAP_MPUIO(2), "wakeup") == 0) {
416 int ret = 0; 421 int ret = 0;
417 omap_set_gpio_direction(OMAP_MPUIO(2), 1); 422
423 gpio_direction_input(OMAP_MPUIO(2));
418 set_irq_type(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), IRQT_RISING); 424 set_irq_type(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), IRQT_RISING);
419#ifdef CONFIG_PM 425#ifdef CONFIG_PM
420 /* share the IRQ in case someone wants to use the 426 /* share the IRQ in case someone wants to use the
@@ -425,7 +431,7 @@ static void __init osk_mistral_init(void)
425 IRQF_SHARED, "mistral_wakeup", 431 IRQF_SHARED, "mistral_wakeup",
426 &osk_mistral_wake_interrupt); 432 &osk_mistral_wake_interrupt);
427 if (ret != 0) { 433 if (ret != 0) {
428 omap_free_gpio(OMAP_MPUIO(2)); 434 gpio_free(OMAP_MPUIO(2));
429 printk(KERN_ERR "OSK+Mistral: no wakeup irq, %d?\n", 435 printk(KERN_ERR "OSK+Mistral: no wakeup irq, %d?\n",
430 ret); 436 ret);
431 } else 437 } else
@@ -438,10 +444,8 @@ static void __init osk_mistral_init(void)
438 * board, like the touchscreen, EEPROM, and wakeup (!) switch. 444 * board, like the touchscreen, EEPROM, and wakeup (!) switch.
439 */ 445 */
440 omap_cfg_reg(PWL); 446 omap_cfg_reg(PWL);
441 if (omap_request_gpio(2) == 0) { 447 if (gpio_request(2, "lcd_pwr") == 0)
442 omap_set_gpio_direction(2, 0 /* out */); 448 gpio_direction_output(2, 1);
443 omap_set_gpio_dataout(2, 1 /* on */);
444 }
445 449
446 platform_add_devices(mistral_devices, ARRAY_SIZE(mistral_devices)); 450 platform_add_devices(mistral_devices, ARRAY_SIZE(mistral_devices));
447} 451}
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 57a1c28bf122..39573b91c8de 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -28,13 +28,6 @@
28#include <linux/spi/ads7846.h> 28#include <linux/spi/ads7846.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30 30
31#ifdef CONFIG_ARM
32#include <asm/mach-types.h>
33#ifdef CONFIG_ARCH_OMAP
34#include <asm/arch/gpio.h>
35#endif
36#endif
37
38 31
39/* 32/*
40 * This code has been heavily tested on a Nokia 770, and lightly 33 * This code has been heavily tested on a Nokia 770, and lightly
@@ -1174,31 +1167,6 @@ static struct spi_driver ads7846_driver = {
1174 1167
1175static int __init ads7846_init(void) 1168static int __init ads7846_init(void)
1176{ 1169{
1177 /* grr, board-specific init should stay out of drivers!! */
1178
1179#ifdef CONFIG_ARCH_OMAP
1180 if (machine_is_omap_osk()) {
1181 /* GPIO4 = PENIRQ; GPIO6 = BUSY */
1182 omap_request_gpio(4);
1183 omap_set_gpio_direction(4, 1);
1184 omap_request_gpio(6);
1185 omap_set_gpio_direction(6, 1);
1186 }
1187 // also TI 1510 Innovator, bitbanging through FPGA
1188 // also Nokia 770
1189 // also Palm Tungsten T2
1190#endif
1191
1192 // PXA:
1193 // also Dell Axim X50
1194 // also HP iPaq H191x/H192x/H415x/H435x
1195 // also Intel Lubbock (additional to UCB1400; as temperature sensor)
1196 // also Sharp Zaurus C7xx, C8xx (corgi/sheperd/husky)
1197
1198 // Atmel at91sam9261-EK uses ads7843
1199
1200 // also various AMD Au1x00 devel boards
1201
1202 return spi_register_driver(&ads7846_driver); 1170 return spi_register_driver(&ads7846_driver);
1203} 1171}
1204module_init(ads7846_init); 1172module_init(ads7846_init);
@@ -1206,14 +1174,6 @@ module_init(ads7846_init);
1206static void __exit ads7846_exit(void) 1174static void __exit ads7846_exit(void)
1207{ 1175{
1208 spi_unregister_driver(&ads7846_driver); 1176 spi_unregister_driver(&ads7846_driver);
1209
1210#ifdef CONFIG_ARCH_OMAP
1211 if (machine_is_omap_osk()) {
1212 omap_free_gpio(4);
1213 omap_free_gpio(6);
1214 }
1215#endif
1216
1217} 1177}
1218module_exit(ads7846_exit); 1178module_exit(ads7846_exit);
1219 1179