X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Finput%2Ftouchscreen%2Fads7846.c;h=39573b91c8de4be826ff4b2a44a3c5f6f71c36c4;hb=548453fd107f789f5f1bc2dc13cc432ceb3b5efd;hp=f59aecf5ec1565fe4959308edc8cc034c3a0a9a3;hpb=60812a4a99b796d894d2522dc63cb0fafc3be25e;p=linux-2.6 diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index f59aecf5ec..39573b91c8 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -28,13 +28,6 @@ #include #include -#ifdef CONFIG_ARM -#include -#ifdef CONFIG_ARCH_OMAP -#include -#endif -#endif - /* * This code has been heavily tested on a Nokia 770, and lightly @@ -116,6 +109,7 @@ struct ads7846 { // FIXME remove "irq_disabled" unsigned irq_disabled:1; /* P: lock */ unsigned disabled:1; + unsigned is_suspended:1; int (*filter)(void *data, int data_idx, int *val); void *filter_data; @@ -203,7 +197,7 @@ static void ads7846_disable(struct ads7846 *ts); static int device_suspended(struct device *dev) { struct ads7846 *ts = dev_get_drvdata(dev); - return dev->power.power_state.event != PM_EVENT_ON || ts->disabled; + return ts->is_suspended || ts->disabled; } static int ads7846_read12_ser(struct device *dev, unsigned command) @@ -212,7 +206,7 @@ static int ads7846_read12_ser(struct device *dev, unsigned command) struct ads7846 *ts = dev_get_drvdata(dev); struct ser_req *req = kzalloc(sizeof *req, GFP_KERNEL); int status; - int sample; + int uninitialized_var(sample); int use_internal; if (!req) @@ -267,13 +261,12 @@ static int ads7846_read12_ser(struct device *dev, unsigned command) ts->irq_disabled = 0; enable_irq(spi->irq); - if (req->msg.status) - status = req->msg.status; - - /* on-wire is a must-ignore bit, a BE12 value, then padding */ - sample = be16_to_cpu(req->sample); - sample = sample >> 3; - sample &= 0x0fff; + if (status == 0) { + /* on-wire is a must-ignore bit, a BE12 value, then padding */ + sample = be16_to_cpu(req->sample); + sample = sample >> 3; + sample &= 0x0fff; + } kfree(req); return status ? status : sample; @@ -795,7 +788,7 @@ static int ads7846_suspend(struct spi_device *spi, pm_message_t message) spin_lock_irq(&ts->lock); - spi->dev.power.power_state = message; + ts->is_suspended = 1; ads7846_disable(ts); spin_unlock_irq(&ts->lock); @@ -810,7 +803,7 @@ static int ads7846_resume(struct spi_device *spi) spin_lock_irq(&ts->lock); - spi->dev.power.power_state = PMSG_ON; + ts->is_suspended = 0; ads7846_enable(ts); spin_unlock_irq(&ts->lock); @@ -872,7 +865,6 @@ static int __devinit ads7846_probe(struct spi_device *spi) } dev_set_drvdata(&spi->dev, ts); - spi->dev.power.power_state = PMSG_ON; ts->spi = spi; ts->input = input_dev; @@ -1175,31 +1167,6 @@ static struct spi_driver ads7846_driver = { static int __init ads7846_init(void) { - /* grr, board-specific init should stay out of drivers!! */ - -#ifdef CONFIG_ARCH_OMAP - if (machine_is_omap_osk()) { - /* GPIO4 = PENIRQ; GPIO6 = BUSY */ - omap_request_gpio(4); - omap_set_gpio_direction(4, 1); - omap_request_gpio(6); - omap_set_gpio_direction(6, 1); - } - // also TI 1510 Innovator, bitbanging through FPGA - // also Nokia 770 - // also Palm Tungsten T2 -#endif - - // PXA: - // also Dell Axim X50 - // also HP iPaq H191x/H192x/H415x/H435x - // also Intel Lubbock (additional to UCB1400; as temperature sensor) - // also Sharp Zaurus C7xx, C8xx (corgi/sheperd/husky) - - // Atmel at91sam9261-EK uses ads7843 - - // also various AMD Au1x00 devel boards - return spi_register_driver(&ads7846_driver); } module_init(ads7846_init); @@ -1207,14 +1174,6 @@ module_init(ads7846_init); static void __exit ads7846_exit(void) { spi_unregister_driver(&ads7846_driver); - -#ifdef CONFIG_ARCH_OMAP - if (machine_is_omap_osk()) { - omap_free_gpio(4); - omap_free_gpio(6); - } -#endif - } module_exit(ads7846_exit);