]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/input/touchscreen/omap/omap_ts.c
h63xx: touchscreen support
[linux-2.6-omap-h63xx.git] / drivers / input / touchscreen / omap / omap_ts.c
index 5916245d11d96a00d0a29c66b61769696b11f44e..1063794deec0606d222b726a26b3b6a3257b5d09 100644 (file)
@@ -46,7 +46,7 @@
 #define OMAP_TS_NAME   "omap_ts"
 
 static struct ts_device *__initdata ts_devs[] = {
-#if defined(CONFIG_MACH_OMAP_H2) || defined(CONFIG_MACH_OMAP_H3)
+#if defined(CONFIG_MACH_OMAP_H2) || defined(CONFIG_MACH_OMAP_H3) || defined(CONFIG_MACH_OMAP_H6300)
        &hx_ts,
 #endif
 #ifdef CONFIG_MACH_OMAP_OSK
@@ -133,6 +133,12 @@ static int __init omap_ts_probe(struct platform_device *pdev)
        int status = -ENODEV;
 
        memset(&ts_omap, 0, sizeof(ts_omap));
+
+       ts_omap.inputdevice = input_allocate_device();
+       if (!ts_omap.inputdevice) {
+               return -ENOMEM;
+       }
+
        spin_lock_init(&ts_omap.lock);
 
        for (i = 0; i < ARRAY_SIZE(ts_devs); i++) {
@@ -145,8 +151,10 @@ static int __init omap_ts_probe(struct platform_device *pdev)
                }
        }
 
-       if (status != 0)
+       if (status != 0) {
+               input_free_device(ts_omap.inputdevice);
                return status;
+       }
 
        // Init acquisition timer function
        init_timer(&ts_omap.ts_timer);
@@ -154,20 +162,24 @@ static int __init omap_ts_probe(struct platform_device *pdev)
 
        /* request irq */
        if (ts_omap.irq != -1) {
-               if (request_irq(ts_omap.irq, omap_ts_handler, 0,
+               if (request_irq(ts_omap.irq, omap_ts_handler,
+                               SA_SAMPLE_RANDOM | ts_omap.irq_type,
                                OMAP_TS_NAME, &ts_omap)) {
                        printk(KERN_ERR
          "omap_ts.c: Could not allocate touchscreen IRQ!\n");
                        ts_omap.irq = -1;
+                       ts_omap.dev->remove();
+                       input_free_device(ts_omap.inputdevice);
                        return -EINVAL;
                }
                ts_omap.irq_enabled = 1;
        } else {
                printk(KERN_ERR "omap_ts.c: No touchscreen IRQ assigned!\n");
+               ts_omap.dev->remove();
+               input_free_device(ts_omap.inputdevice);
                return -EINVAL;
        }
 
-       ts_omap.inputdevice = input_allocate_device();
        ts_omap.inputdevice->name = OMAP_TS_NAME;
        ts_omap.inputdevice->dev = &pdev->dev;
        ts_omap.inputdevice->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
@@ -216,7 +228,7 @@ static struct platform_driver omap_ts_driver = {
        .remove         = omap_ts_remove,
        .suspend        = omap_ts_suspend,
        .resume         = omap_ts_resume,
-       .driver {
+       .driver {
                .name   = OMAP_TS_NAME,
        },
 };