Loading drivers/input/touchscreen/corgi_ts.c +45 −44 Original line number Diff line number Diff line Loading @@ -41,8 +41,7 @@ struct ts_event { }; struct corgi_ts { char phys[32]; struct input_dev input; struct input_dev *input; struct timer_list timer; struct ts_event tc; int pendown; Loading Loading @@ -182,14 +181,12 @@ static void new_data(struct corgi_ts *corgi_ts, struct pt_regs *regs) if (!corgi_ts->tc.pressure && corgi_ts->pendown == 0) return; if (regs) input_regs(&corgi_ts->input, regs); input_report_abs(&corgi_ts->input, ABS_X, corgi_ts->tc.x); input_report_abs(&corgi_ts->input, ABS_Y, corgi_ts->tc.y); input_report_abs(&corgi_ts->input, ABS_PRESSURE, corgi_ts->tc.pressure); input_report_key(&corgi_ts->input, BTN_TOUCH, (corgi_ts->pendown != 0)); input_sync(&corgi_ts->input); input_regs(corgi_ts->input, regs); input_report_abs(corgi_ts->input, ABS_X, corgi_ts->tc.x); input_report_abs(corgi_ts->input, ABS_Y, corgi_ts->tc.y); input_report_abs(corgi_ts->input, ABS_PRESSURE, corgi_ts->tc.pressure); input_report_key(corgi_ts->input, BTN_TOUCH, (corgi_ts->pendown != 0)); input_sync(corgi_ts->input); } static void ts_interrupt_main(struct corgi_ts *corgi_ts, int isTimer, struct pt_regs *regs) Loading Loading @@ -273,39 +270,44 @@ static int __init corgits_probe(struct device *dev) { struct corgi_ts *corgi_ts; struct platform_device *pdev = to_platform_device(dev); struct input_dev *input_dev; int err = -ENOMEM; if (!(corgi_ts = kmalloc(sizeof(struct corgi_ts), GFP_KERNEL))) return -ENOMEM; corgi_ts = kzalloc(sizeof(struct corgi_ts), GFP_KERNEL); input_dev = input_allocate_device(); if (!corgi_ts || !input_dev) goto fail; dev_set_drvdata(dev, corgi_ts); memset(corgi_ts, 0, sizeof(struct corgi_ts)); corgi_ts->machinfo = dev->platform_data; corgi_ts->irq_gpio = platform_get_irq(pdev, 0); if (corgi_ts->irq_gpio < 0) { kfree(corgi_ts); return -ENODEV; err = -ENODEV; goto fail; } init_input_dev(&corgi_ts->input); corgi_ts->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); corgi_ts->input.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); input_set_abs_params(&corgi_ts->input, ABS_X, X_AXIS_MIN, X_AXIS_MAX, 0, 0); input_set_abs_params(&corgi_ts->input, ABS_Y, Y_AXIS_MIN, Y_AXIS_MAX, 0, 0); input_set_abs_params(&corgi_ts->input, ABS_PRESSURE, PRESSURE_MIN, PRESSURE_MAX, 0, 0); corgi_ts->input = input_dev; strcpy(corgi_ts->phys, "corgits/input0"); init_timer(&corgi_ts->timer); corgi_ts->timer.data = (unsigned long) corgi_ts; corgi_ts->timer.function = corgi_ts_timer; corgi_ts->input.private = corgi_ts; corgi_ts->input.name = "Corgi Touchscreen"; corgi_ts->input.dev = dev; corgi_ts->input.phys = corgi_ts->phys; corgi_ts->input.id.bustype = BUS_HOST; corgi_ts->input.id.vendor = 0x0001; corgi_ts->input.id.product = 0x0002; corgi_ts->input.id.version = 0x0100; input_dev->name = "Corgi Touchscreen"; input_dev->phys = "corgits/input0"; input_dev->id.bustype = BUS_HOST; input_dev->id.vendor = 0x0001; input_dev->id.product = 0x0002; input_dev->id.version = 0x0100; input_dev->cdev.dev = dev; input_dev->private = corgi_ts; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); input_set_abs_params(input_dev, ABS_X, X_AXIS_MIN, X_AXIS_MAX, 0, 0); input_set_abs_params(input_dev, ABS_Y, Y_AXIS_MIN, Y_AXIS_MAX, 0, 0); input_set_abs_params(input_dev, ABS_PRESSURE, PRESSURE_MIN, PRESSURE_MAX, 0, 0); pxa_gpio_mode(IRQ_TO_GPIO(corgi_ts->irq_gpio) | GPIO_IN); Loading @@ -319,25 +321,24 @@ static int __init corgits_probe(struct device *dev) corgi_ssp_ads7846_putget((5u << ADSCTRL_ADR_SH) | ADSCTRL_STS); mdelay(5); init_timer(&corgi_ts->timer); corgi_ts->timer.data = (unsigned long) corgi_ts; corgi_ts->timer.function = corgi_ts_timer; input_register_device(&corgi_ts->input); corgi_ts->power_mode = PWR_MODE_ACTIVE; if (request_irq(corgi_ts->irq_gpio, ts_interrupt, SA_INTERRUPT, "ts", corgi_ts)) { input_unregister_device(&corgi_ts->input); kfree(corgi_ts); return -EBUSY; err = -EBUSY; goto fail; } input_register_device(corgi_ts->input); corgi_ts->power_mode = PWR_MODE_ACTIVE; /* Enable Falling Edge */ set_irq_type(corgi_ts->irq_gpio, IRQT_FALLING); printk(KERN_INFO "input: Corgi Touchscreen Registered\n"); return 0; fail: input_free_device(input_dev); kfree(corgi_ts); return err; } static int corgits_remove(struct device *dev) Loading @@ -347,7 +348,7 @@ static int corgits_remove(struct device *dev) free_irq(corgi_ts->irq_gpio, NULL); del_timer_sync(&corgi_ts->timer); corgi_ts->machinfo->put_hsync(); input_unregister_device(&corgi_ts->input); input_unregister_device(corgi_ts->input); kfree(corgi_ts); return 0; } Loading drivers/input/touchscreen/elo.c +44 −45 Original line number Diff line number Diff line Loading @@ -36,14 +36,12 @@ MODULE_LICENSE("GPL"); #define ELO_MAX_LENGTH 10 static char *elo_name = "Elo Serial TouchScreen"; /* * Per-touchscreen data. */ struct elo { struct input_dev dev; struct input_dev *dev; struct serio *serio; int id; int idx; Loading @@ -54,7 +52,7 @@ struct elo { static void elo_process_data_10(struct elo* elo, unsigned char data, struct pt_regs *regs) { struct input_dev *dev = &elo->dev; struct input_dev *dev = elo->dev; elo->csum += elo->data[elo->idx] = data; Loading @@ -80,7 +78,7 @@ static void elo_process_data_10(struct elo* elo, unsigned char data, struct pt_r input_report_abs(dev, ABS_X, (elo->data[4] << 8) | elo->data[3]); input_report_abs(dev, ABS_Y, (elo->data[6] << 8) | elo->data[5]); input_report_abs(dev, ABS_PRESSURE, (elo->data[8] << 8) | elo->data[7]); input_report_key(dev, BTN_TOUCH, elo->data[2] & 3); input_report_key(dev, BTN_TOUCH, elo->data[8] || elo->data[7]); input_sync(dev); } elo->idx = 0; Loading @@ -91,7 +89,7 @@ static void elo_process_data_10(struct elo* elo, unsigned char data, struct pt_r static void elo_process_data_6(struct elo* elo, unsigned char data, struct pt_regs *regs) { struct input_dev *dev = &elo->dev; struct input_dev *dev = elo->dev; elo->data[elo->idx] = data; Loading Loading @@ -129,7 +127,7 @@ static void elo_process_data_6(struct elo* elo, unsigned char data, struct pt_re case 5: if ((data & 0xf0) == 0) { input_report_abs(dev, ABS_PRESSURE, elo->data[5]); input_report_key(dev, BTN_TOUCH, elo->data[5]); input_report_key(dev, BTN_TOUCH, !!elo->data[5]); } input_sync(dev); elo->idx = 0; Loading @@ -139,7 +137,7 @@ static void elo_process_data_6(struct elo* elo, unsigned char data, struct pt_re static void elo_process_data_3(struct elo* elo, unsigned char data, struct pt_regs *regs) { struct input_dev *dev = &elo->dev; struct input_dev *dev = elo->dev; elo->data[elo->idx] = data; Loading Loading @@ -191,7 +189,7 @@ static void elo_disconnect(struct serio *serio) { struct elo* elo = serio_get_drvdata(serio); input_unregister_device(&elo->dev); input_unregister_device(elo->dev); serio_close(serio); serio_set_drvdata(serio, NULL); kfree(elo); Loading @@ -206,67 +204,68 @@ static void elo_disconnect(struct serio *serio) static int elo_connect(struct serio *serio, struct serio_driver *drv) { struct elo *elo; struct input_dev *input_dev; int err; if (!(elo = kmalloc(sizeof(struct elo), GFP_KERNEL))) return -ENOMEM; elo = kzalloc(sizeof(struct elo), GFP_KERNEL); input_dev = input_allocate_device(); if (!elo || !input_dev) { err = -ENOMEM; goto fail; } memset(elo, 0, sizeof(struct elo)); elo->serio = serio; elo->id = serio->id.id; elo->dev = input_dev; snprintf(elo->phys, sizeof(elo->phys), "%s/input0", serio->phys); init_input_dev(&elo->dev); elo->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); elo->dev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); input_dev->private = elo; input_dev->name = "Elo Serial TouchScreen"; input_dev->phys = elo->phys; input_dev->id.bustype = BUS_RS232; input_dev->id.vendor = SERIO_ELO; input_dev->id.product = elo->id; input_dev->id.version = 0x0100; input_dev->cdev.dev = &serio->dev; elo->id = serio->id.id; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); switch (elo->id) { case 0: /* 10-byte protocol */ input_set_abs_params(&elo->dev, ABS_X, 96, 4000, 0, 0); input_set_abs_params(&elo->dev, ABS_Y, 96, 4000, 0, 0); input_set_abs_params(&elo->dev, ABS_PRESSURE, 0, 255, 0, 0); input_set_abs_params(input_dev, ABS_X, 96, 4000, 0, 0); input_set_abs_params(input_dev, ABS_Y, 96, 4000, 0, 0); input_set_abs_params(input_dev, ABS_PRESSURE, 0, 255, 0, 0); break; case 1: /* 6-byte protocol */ input_set_abs_params(&elo->dev, ABS_PRESSURE, 0, 15, 0, 0); input_set_abs_params(input_dev, ABS_PRESSURE, 0, 15, 0, 0); case 2: /* 4-byte protocol */ input_set_abs_params(&elo->dev, ABS_X, 96, 4000, 0, 0); input_set_abs_params(&elo->dev, ABS_Y, 96, 4000, 0, 0); input_set_abs_params(input_dev, ABS_X, 96, 4000, 0, 0); input_set_abs_params(input_dev, ABS_Y, 96, 4000, 0, 0); break; case 3: /* 3-byte protocol */ input_set_abs_params(&elo->dev, ABS_X, 0, 255, 0, 0); input_set_abs_params(&elo->dev, ABS_Y, 0, 255, 0, 0); input_set_abs_params(input_dev, ABS_X, 0, 255, 0, 0); input_set_abs_params(input_dev, ABS_Y, 0, 255, 0, 0); break; } elo->serio = serio; sprintf(elo->phys, "%s/input0", serio->phys); elo->dev.private = elo; elo->dev.name = elo_name; elo->dev.phys = elo->phys; elo->dev.id.bustype = BUS_RS232; elo->dev.id.vendor = SERIO_ELO; elo->dev.id.product = elo->id; elo->dev.id.version = 0x0100; serio_set_drvdata(serio, elo); err = serio_open(serio, drv); if (err) { serio_set_drvdata(serio, NULL); kfree(elo); return err; } input_register_device(&elo->dev); printk(KERN_INFO "input: %s on %s\n", elo_name, serio->phys); if (err) goto fail; input_register_device(elo->dev); return 0; fail: serio_set_drvdata(serio, NULL); input_free_device(input_dev); kfree(elo); return err; } /* Loading drivers/input/touchscreen/gunze.c +33 −33 Original line number Diff line number Diff line Loading @@ -48,14 +48,12 @@ MODULE_LICENSE("GPL"); #define GUNZE_MAX_LENGTH 10 static char *gunze_name = "Gunze AHL-51S TouchScreen"; /* * Per-touchscreen data. */ struct gunze { struct input_dev dev; struct input_dev *dev; struct serio *serio; int idx; unsigned char data[GUNZE_MAX_LENGTH]; Loading @@ -64,7 +62,7 @@ struct gunze { static void gunze_process_packet(struct gunze* gunze, struct pt_regs *regs) { struct input_dev *dev = &gunze->dev; struct input_dev *dev = gunze->dev; if (gunze->idx != GUNZE_MAX_LENGTH || gunze->data[5] != ',' || (gunze->data[0] != 'T' && gunze->data[0] != 'R')) { Loading Loading @@ -102,9 +100,11 @@ static void gunze_disconnect(struct serio *serio) { struct gunze *gunze = serio_get_drvdata(serio); input_unregister_device(&gunze->dev); input_get_device(gunze->dev); input_unregister_device(gunze->dev); serio_close(serio); serio_set_drvdata(serio, NULL); input_put_device(gunze->dev); kfree(gunze); } Loading @@ -117,45 +117,45 @@ static void gunze_disconnect(struct serio *serio) static int gunze_connect(struct serio *serio, struct serio_driver *drv) { struct gunze *gunze; struct input_dev *input_dev; int err; if (!(gunze = kmalloc(sizeof(struct gunze), GFP_KERNEL))) return -ENOMEM; memset(gunze, 0, sizeof(struct gunze)); init_input_dev(&gunze->dev); gunze->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); gunze->dev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); input_set_abs_params(&gunze->dev, ABS_X, 24, 1000, 0, 0); input_set_abs_params(&gunze->dev, ABS_Y, 24, 1000, 0, 0); gunze = kzalloc(sizeof(struct gunze), GFP_KERNEL); input_dev = input_allocate_device(); if (!gunze || !input_dev) { err = -ENOMEM; goto fail; } gunze->serio = serio; gunze->dev = input_dev; sprintf(gunze->phys, "%s/input0", serio->phys); gunze->dev.private = gunze; gunze->dev.name = gunze_name; gunze->dev.phys = gunze->phys; gunze->dev.id.bustype = BUS_RS232; gunze->dev.id.vendor = SERIO_GUNZE; gunze->dev.id.product = 0x0051; gunze->dev.id.version = 0x0100; input_dev->private = gunze; input_dev->name = "Gunze AHL-51S TouchScreen"; input_dev->phys = gunze->phys; input_dev->id.bustype = BUS_RS232; input_dev->id.vendor = SERIO_GUNZE; input_dev->id.product = 0x0051; input_dev->id.version = 0x0100; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); input_set_abs_params(input_dev, ABS_X, 24, 1000, 0, 0); input_set_abs_params(input_dev, ABS_Y, 24, 1000, 0, 0); serio_set_drvdata(serio, gunze); err = serio_open(serio, drv); if (err) { serio_set_drvdata(serio, NULL); kfree(gunze); return err; } input_register_device(&gunze->dev); printk(KERN_INFO "input: %s on %s\n", gunze_name, serio->phys); if (err) goto fail; input_register_device(gunze->dev); return 0; fail: serio_set_drvdata(serio, NULL); input_free_device(input_dev); kfree(gunze); return err; } /* Loading drivers/input/touchscreen/h3600_ts_input.c +59 −90 Original line number Diff line number Diff line Loading @@ -39,7 +39,6 @@ #include <linux/serio.h> #include <linux/init.h> #include <linux/delay.h> #include <linux/pm.h> /* SA1100 serial defines */ #include <asm/arch/hardware.h> Loading Loading @@ -93,16 +92,12 @@ MODULE_LICENSE("GPL"); #define H3600_SCANCODE_LEFT 8 /* 8 -> left */ #define H3600_SCANCODE_DOWN 9 /* 9 -> down */ static char *h3600_name = "H3600 TouchScreen"; /* * Per-touchscreen data. */ struct h3600_dev { struct input_dev dev; struct pm_dev *pm_dev; struct input_dev *dev; struct serio *serio; struct pm_dev *pm_dev; unsigned char event; /* event ID from packet */ unsigned char chksum; unsigned char len; Loading Loading @@ -163,33 +158,6 @@ unsigned int h3600_flite_power(struct input_dev *dev, enum flite_pwr pwr) return 0; } static int suspended = 0; static int h3600ts_pm_callback(struct pm_dev *pm_dev, pm_request_t req, void *data) { struct input_dev *dev = (struct input_dev *) data; switch (req) { case PM_SUSPEND: /* enter D1-D3 */ suspended = 1; h3600_flite_power(dev, FLITE_PWR_OFF); break; case PM_BLANK: if (!suspended) h3600_flite_power(dev, FLITE_PWR_OFF); break; case PM_RESUME: /* enter D0 */ /* same as unblank */ case PM_UNBLANK: if (suspended) { //initSerial(); suspended = 0; } h3600_flite_power(dev, FLITE_PWR_ON); break; } return 0; } #endif /* Loading @@ -199,7 +167,7 @@ static int h3600ts_pm_callback(struct pm_dev *pm_dev, pm_request_t req, */ static void h3600ts_process_packet(struct h3600_dev *ts, struct pt_regs *regs) { struct input_dev *dev = &ts->dev; struct input_dev *dev = ts->dev; static int touched = 0; int key, down = 0; Loading Loading @@ -295,6 +263,7 @@ static void h3600ts_process_packet(struct h3600_dev *ts, struct pt_regs *regs) static int h3600ts_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) { #if 0 struct h3600_dev *ts = dev->private; switch (type) { Loading @@ -304,6 +273,8 @@ static int h3600ts_event(struct input_dev *dev, unsigned int type, } } return -1; #endif return 0; } /* Loading Loading @@ -380,14 +351,48 @@ static irqreturn_t h3600ts_interrupt(struct serio *serio, unsigned char data, static int h3600ts_connect(struct serio *serio, struct serio_driver *drv) { struct h3600_dev *ts; struct input_dev *input_dev; int err; if (!(ts = kmalloc(sizeof(struct h3600_dev), GFP_KERNEL))) return -ENOMEM; ts = kzalloc(sizeof(struct h3600_dev), GFP_KERNEL); input_dev = input_allocate_device(); if (!ts || !input_dev) { err = -ENOMEM; goto fail1; } memset(ts, 0, sizeof(struct h3600_dev)); ts->serio = serio; ts->dev = input_dev; sprintf(ts->phys, "%s/input0", serio->phys); init_input_dev(&ts->dev); input_dev->name = "H3600 TouchScreen"; input_dev->phys = ts->phys; input_dev->id.bustype = BUS_RS232; input_dev->id.vendor = SERIO_H3600; input_dev->id.product = 0x0666; /* FIXME !!! We can ask the hardware */ input_dev->id.version = 0x0100; input_dev->cdev.dev = &serio->dev; input_dev->private = ts; input_dev->event = h3600ts_event; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_LED) | BIT(EV_PWR); input_dev->ledbit[0] = BIT(LED_SLEEP); input_set_abs_params(input_dev, ABS_X, 60, 985, 0, 0); input_set_abs_params(input_dev, ABS_Y, 35, 1024, 0, 0); set_bit(KEY_RECORD, input_dev->keybit); set_bit(KEY_Q, input_dev->keybit); set_bit(KEY_PROG1, input_dev->keybit); set_bit(KEY_PROG2, input_dev->keybit); set_bit(KEY_PROG3, input_dev->keybit); set_bit(KEY_UP, input_dev->keybit); set_bit(KEY_RIGHT, input_dev->keybit); set_bit(KEY_LEFT, input_dev->keybit); set_bit(KEY_DOWN, input_dev->keybit); set_bit(KEY_ENTER, input_dev->keybit); set_bit(KEY_SUSPEND, input_dev->keybit); set_bit(BTN_TOUCH, input_dev->keybit); /* Device specific stuff */ set_GPIO_IRQ_edge(GPIO_BITSY_ACTION_BUTTON, GPIO_BOTH_EDGES); Loading @@ -397,73 +402,35 @@ static int h3600ts_connect(struct serio *serio, struct serio_driver *drv) SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, "h3600_action", &ts->dev)) { printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n"); kfree(ts); return -EBUSY; err = -EBUSY; goto fail2; } if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler, SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, "h3600_suspend", &ts->dev)) { free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, &ts->dev); printk(KERN_ERR "h3600ts.c: Could not allocate Power Button IRQ!\n"); kfree(ts); return -EBUSY; err = -EBUSY; goto fail3; } /* Now we have things going we setup our input device */ ts->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_LED) | BIT(EV_PWR); ts->dev.ledbit[0] = BIT(LED_SLEEP); input_set_abs_params(&ts->dev, ABS_X, 60, 985, 0, 0); input_set_abs_params(&ts->dev, ABS_Y, 35, 1024, 0, 0); set_bit(KEY_RECORD, ts->dev.keybit); set_bit(KEY_Q, ts->dev.keybit); set_bit(KEY_PROG1, ts->dev.keybit); set_bit(KEY_PROG2, ts->dev.keybit); set_bit(KEY_PROG3, ts->dev.keybit); set_bit(KEY_UP, ts->dev.keybit); set_bit(KEY_RIGHT, ts->dev.keybit); set_bit(KEY_LEFT, ts->dev.keybit); set_bit(KEY_DOWN, ts->dev.keybit); set_bit(KEY_ENTER, ts->dev.keybit); ts->dev.keybit[LONG(BTN_TOUCH)] |= BIT(BTN_TOUCH); ts->dev.keybit[LONG(KEY_SUSPEND)] |= BIT(KEY_SUSPEND); ts->serio = serio; sprintf(ts->phys, "%s/input0", serio->phys); ts->dev.event = h3600ts_event; ts->dev.private = ts; ts->dev.name = h3600_name; ts->dev.phys = ts->phys; ts->dev.id.bustype = BUS_RS232; ts->dev.id.vendor = SERIO_H3600; ts->dev.id.product = 0x0666; /* FIXME !!! We can ask the hardware */ ts->dev.id.version = 0x0100; serio_set_drvdata(serio, ts); err = serio_open(serio, drv); if (err) { free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts); free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts); serio_set_drvdata(serio, NULL); kfree(ts); if (err) return err; } //h3600_flite_control(1, 25); /* default brightness */ #ifdef CONFIG_PM ts->pm_dev = pm_register(PM_ILLUMINATION_DEV, PM_SYS_LIGHT, h3600ts_pm_callback); printk("registered pm callback\n"); #endif input_register_device(&ts->dev); printk(KERN_INFO "input: %s on %s\n", h3600_name, serio->phys); input_register_device(ts->dev); return 0; fail3: free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts->dev); fail2: free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts->dev); fail1: serio_set_drvdata(serio, NULL); input_free_device(input_dev); kfree(ts); return err; } /* Loading @@ -476,9 +443,11 @@ static void h3600ts_disconnect(struct serio *serio) free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, &ts->dev); free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, &ts->dev); input_unregister_device(&ts->dev); input_get_device(ts->dev); input_unregister_device(ts->dev); serio_close(serio); serio_set_drvdata(serio, NULL); input_put_device(ts->dev); kfree(ts); } Loading drivers/input/touchscreen/hp680_ts_input.c +25 −25 Original line number Diff line number Diff line Loading @@ -21,10 +21,8 @@ static void do_softint(void *data); static struct input_dev hp680_ts_dev; static struct input_dev *hp680_ts_dev; static DECLARE_WORK(work, do_softint, 0); static char *hp680_ts_name = "HP Jornada touchscreen"; static char *hp680_ts_phys = "input0"; static void do_softint(void *data) { Loading Loading @@ -58,14 +56,14 @@ static void do_softint(void *data) } if (touched) { input_report_key(&hp680_ts_dev, BTN_TOUCH, 1); input_report_abs(&hp680_ts_dev, ABS_X, absx); input_report_abs(&hp680_ts_dev, ABS_Y, absy); input_report_key(hp680_ts_dev, BTN_TOUCH, 1); input_report_abs(hp680_ts_dev, ABS_X, absx); input_report_abs(hp680_ts_dev, ABS_Y, absy); } else { input_report_key(&hp680_ts_dev, BTN_TOUCH, 0); input_report_key(hp680_ts_dev, BTN_TOUCH, 0); } input_sync(&hp680_ts_dev); input_sync(hp680_ts_dev); enable_irq(HP680_TS_IRQ); } Loading @@ -92,27 +90,29 @@ static int __init hp680_ts_init(void) scpcr |= SCPCR_TS_ENABLE; ctrl_outw(scpcr, SCPCR); memset(&hp680_ts_dev, 0, sizeof(hp680_ts_dev)); init_input_dev(&hp680_ts_dev); hp680_ts_dev = input_allocate_device(); if (!hp680_ts_dev) return -ENOMEM; hp680_ts_dev.evbit[0] = BIT(EV_ABS) | BIT(EV_KEY); hp680_ts_dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y); hp680_ts_dev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); hp680_ts_dev->evbit[0] = BIT(EV_ABS) | BIT(EV_KEY); hp680_ts_dev->absbit[0] = BIT(ABS_X) | BIT(ABS_Y); hp680_ts_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); hp680_ts_dev.absmin[ABS_X] = HP680_TS_ABS_X_MIN; hp680_ts_dev.absmin[ABS_Y] = HP680_TS_ABS_Y_MIN; hp680_ts_dev.absmax[ABS_X] = HP680_TS_ABS_X_MAX; hp680_ts_dev.absmax[ABS_Y] = HP680_TS_ABS_Y_MAX; hp680_ts_dev->absmin[ABS_X] = HP680_TS_ABS_X_MIN; hp680_ts_dev->absmin[ABS_Y] = HP680_TS_ABS_Y_MIN; hp680_ts_dev->absmax[ABS_X] = HP680_TS_ABS_X_MAX; hp680_ts_dev->absmax[ABS_Y] = HP680_TS_ABS_Y_MAX; hp680_ts_dev.name = hp680_ts_name; hp680_ts_dev.phys = hp680_ts_phys; input_register_device(&hp680_ts_dev); hp680_ts_dev->name = "HP Jornada touchscreen"; hp680_ts_dev->phys = "hp680_ts/input0"; if (request_irq (HP680_TS_IRQ, hp680_ts_interrupt, SA_INTERRUPT, MODNAME, 0) < 0) { input_register_device(hp680_ts_dev); if (request_irq(HP680_TS_IRQ, hp680_ts_interrupt, SA_INTERRUPT, MODNAME, 0) < 0) { printk(KERN_ERR "hp680_touchscreen.c: Can't allocate irq %d\n", HP680_TS_IRQ); input_unregister_device(&hp680_ts_dev); input_unregister_device(hp680_ts_dev); return -EBUSY; } Loading @@ -124,7 +124,7 @@ static void __exit hp680_ts_exit(void) free_irq(HP680_TS_IRQ, 0); cancel_delayed_work(&work); flush_scheduled_work(); input_unregister_device(&hp680_ts_dev); input_unregister_device(hp680_ts_dev); } module_init(hp680_ts_init); Loading Loading
drivers/input/touchscreen/corgi_ts.c +45 −44 Original line number Diff line number Diff line Loading @@ -41,8 +41,7 @@ struct ts_event { }; struct corgi_ts { char phys[32]; struct input_dev input; struct input_dev *input; struct timer_list timer; struct ts_event tc; int pendown; Loading Loading @@ -182,14 +181,12 @@ static void new_data(struct corgi_ts *corgi_ts, struct pt_regs *regs) if (!corgi_ts->tc.pressure && corgi_ts->pendown == 0) return; if (regs) input_regs(&corgi_ts->input, regs); input_report_abs(&corgi_ts->input, ABS_X, corgi_ts->tc.x); input_report_abs(&corgi_ts->input, ABS_Y, corgi_ts->tc.y); input_report_abs(&corgi_ts->input, ABS_PRESSURE, corgi_ts->tc.pressure); input_report_key(&corgi_ts->input, BTN_TOUCH, (corgi_ts->pendown != 0)); input_sync(&corgi_ts->input); input_regs(corgi_ts->input, regs); input_report_abs(corgi_ts->input, ABS_X, corgi_ts->tc.x); input_report_abs(corgi_ts->input, ABS_Y, corgi_ts->tc.y); input_report_abs(corgi_ts->input, ABS_PRESSURE, corgi_ts->tc.pressure); input_report_key(corgi_ts->input, BTN_TOUCH, (corgi_ts->pendown != 0)); input_sync(corgi_ts->input); } static void ts_interrupt_main(struct corgi_ts *corgi_ts, int isTimer, struct pt_regs *regs) Loading Loading @@ -273,39 +270,44 @@ static int __init corgits_probe(struct device *dev) { struct corgi_ts *corgi_ts; struct platform_device *pdev = to_platform_device(dev); struct input_dev *input_dev; int err = -ENOMEM; if (!(corgi_ts = kmalloc(sizeof(struct corgi_ts), GFP_KERNEL))) return -ENOMEM; corgi_ts = kzalloc(sizeof(struct corgi_ts), GFP_KERNEL); input_dev = input_allocate_device(); if (!corgi_ts || !input_dev) goto fail; dev_set_drvdata(dev, corgi_ts); memset(corgi_ts, 0, sizeof(struct corgi_ts)); corgi_ts->machinfo = dev->platform_data; corgi_ts->irq_gpio = platform_get_irq(pdev, 0); if (corgi_ts->irq_gpio < 0) { kfree(corgi_ts); return -ENODEV; err = -ENODEV; goto fail; } init_input_dev(&corgi_ts->input); corgi_ts->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); corgi_ts->input.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); input_set_abs_params(&corgi_ts->input, ABS_X, X_AXIS_MIN, X_AXIS_MAX, 0, 0); input_set_abs_params(&corgi_ts->input, ABS_Y, Y_AXIS_MIN, Y_AXIS_MAX, 0, 0); input_set_abs_params(&corgi_ts->input, ABS_PRESSURE, PRESSURE_MIN, PRESSURE_MAX, 0, 0); corgi_ts->input = input_dev; strcpy(corgi_ts->phys, "corgits/input0"); init_timer(&corgi_ts->timer); corgi_ts->timer.data = (unsigned long) corgi_ts; corgi_ts->timer.function = corgi_ts_timer; corgi_ts->input.private = corgi_ts; corgi_ts->input.name = "Corgi Touchscreen"; corgi_ts->input.dev = dev; corgi_ts->input.phys = corgi_ts->phys; corgi_ts->input.id.bustype = BUS_HOST; corgi_ts->input.id.vendor = 0x0001; corgi_ts->input.id.product = 0x0002; corgi_ts->input.id.version = 0x0100; input_dev->name = "Corgi Touchscreen"; input_dev->phys = "corgits/input0"; input_dev->id.bustype = BUS_HOST; input_dev->id.vendor = 0x0001; input_dev->id.product = 0x0002; input_dev->id.version = 0x0100; input_dev->cdev.dev = dev; input_dev->private = corgi_ts; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); input_set_abs_params(input_dev, ABS_X, X_AXIS_MIN, X_AXIS_MAX, 0, 0); input_set_abs_params(input_dev, ABS_Y, Y_AXIS_MIN, Y_AXIS_MAX, 0, 0); input_set_abs_params(input_dev, ABS_PRESSURE, PRESSURE_MIN, PRESSURE_MAX, 0, 0); pxa_gpio_mode(IRQ_TO_GPIO(corgi_ts->irq_gpio) | GPIO_IN); Loading @@ -319,25 +321,24 @@ static int __init corgits_probe(struct device *dev) corgi_ssp_ads7846_putget((5u << ADSCTRL_ADR_SH) | ADSCTRL_STS); mdelay(5); init_timer(&corgi_ts->timer); corgi_ts->timer.data = (unsigned long) corgi_ts; corgi_ts->timer.function = corgi_ts_timer; input_register_device(&corgi_ts->input); corgi_ts->power_mode = PWR_MODE_ACTIVE; if (request_irq(corgi_ts->irq_gpio, ts_interrupt, SA_INTERRUPT, "ts", corgi_ts)) { input_unregister_device(&corgi_ts->input); kfree(corgi_ts); return -EBUSY; err = -EBUSY; goto fail; } input_register_device(corgi_ts->input); corgi_ts->power_mode = PWR_MODE_ACTIVE; /* Enable Falling Edge */ set_irq_type(corgi_ts->irq_gpio, IRQT_FALLING); printk(KERN_INFO "input: Corgi Touchscreen Registered\n"); return 0; fail: input_free_device(input_dev); kfree(corgi_ts); return err; } static int corgits_remove(struct device *dev) Loading @@ -347,7 +348,7 @@ static int corgits_remove(struct device *dev) free_irq(corgi_ts->irq_gpio, NULL); del_timer_sync(&corgi_ts->timer); corgi_ts->machinfo->put_hsync(); input_unregister_device(&corgi_ts->input); input_unregister_device(corgi_ts->input); kfree(corgi_ts); return 0; } Loading
drivers/input/touchscreen/elo.c +44 −45 Original line number Diff line number Diff line Loading @@ -36,14 +36,12 @@ MODULE_LICENSE("GPL"); #define ELO_MAX_LENGTH 10 static char *elo_name = "Elo Serial TouchScreen"; /* * Per-touchscreen data. */ struct elo { struct input_dev dev; struct input_dev *dev; struct serio *serio; int id; int idx; Loading @@ -54,7 +52,7 @@ struct elo { static void elo_process_data_10(struct elo* elo, unsigned char data, struct pt_regs *regs) { struct input_dev *dev = &elo->dev; struct input_dev *dev = elo->dev; elo->csum += elo->data[elo->idx] = data; Loading @@ -80,7 +78,7 @@ static void elo_process_data_10(struct elo* elo, unsigned char data, struct pt_r input_report_abs(dev, ABS_X, (elo->data[4] << 8) | elo->data[3]); input_report_abs(dev, ABS_Y, (elo->data[6] << 8) | elo->data[5]); input_report_abs(dev, ABS_PRESSURE, (elo->data[8] << 8) | elo->data[7]); input_report_key(dev, BTN_TOUCH, elo->data[2] & 3); input_report_key(dev, BTN_TOUCH, elo->data[8] || elo->data[7]); input_sync(dev); } elo->idx = 0; Loading @@ -91,7 +89,7 @@ static void elo_process_data_10(struct elo* elo, unsigned char data, struct pt_r static void elo_process_data_6(struct elo* elo, unsigned char data, struct pt_regs *regs) { struct input_dev *dev = &elo->dev; struct input_dev *dev = elo->dev; elo->data[elo->idx] = data; Loading Loading @@ -129,7 +127,7 @@ static void elo_process_data_6(struct elo* elo, unsigned char data, struct pt_re case 5: if ((data & 0xf0) == 0) { input_report_abs(dev, ABS_PRESSURE, elo->data[5]); input_report_key(dev, BTN_TOUCH, elo->data[5]); input_report_key(dev, BTN_TOUCH, !!elo->data[5]); } input_sync(dev); elo->idx = 0; Loading @@ -139,7 +137,7 @@ static void elo_process_data_6(struct elo* elo, unsigned char data, struct pt_re static void elo_process_data_3(struct elo* elo, unsigned char data, struct pt_regs *regs) { struct input_dev *dev = &elo->dev; struct input_dev *dev = elo->dev; elo->data[elo->idx] = data; Loading Loading @@ -191,7 +189,7 @@ static void elo_disconnect(struct serio *serio) { struct elo* elo = serio_get_drvdata(serio); input_unregister_device(&elo->dev); input_unregister_device(elo->dev); serio_close(serio); serio_set_drvdata(serio, NULL); kfree(elo); Loading @@ -206,67 +204,68 @@ static void elo_disconnect(struct serio *serio) static int elo_connect(struct serio *serio, struct serio_driver *drv) { struct elo *elo; struct input_dev *input_dev; int err; if (!(elo = kmalloc(sizeof(struct elo), GFP_KERNEL))) return -ENOMEM; elo = kzalloc(sizeof(struct elo), GFP_KERNEL); input_dev = input_allocate_device(); if (!elo || !input_dev) { err = -ENOMEM; goto fail; } memset(elo, 0, sizeof(struct elo)); elo->serio = serio; elo->id = serio->id.id; elo->dev = input_dev; snprintf(elo->phys, sizeof(elo->phys), "%s/input0", serio->phys); init_input_dev(&elo->dev); elo->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); elo->dev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); input_dev->private = elo; input_dev->name = "Elo Serial TouchScreen"; input_dev->phys = elo->phys; input_dev->id.bustype = BUS_RS232; input_dev->id.vendor = SERIO_ELO; input_dev->id.product = elo->id; input_dev->id.version = 0x0100; input_dev->cdev.dev = &serio->dev; elo->id = serio->id.id; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); switch (elo->id) { case 0: /* 10-byte protocol */ input_set_abs_params(&elo->dev, ABS_X, 96, 4000, 0, 0); input_set_abs_params(&elo->dev, ABS_Y, 96, 4000, 0, 0); input_set_abs_params(&elo->dev, ABS_PRESSURE, 0, 255, 0, 0); input_set_abs_params(input_dev, ABS_X, 96, 4000, 0, 0); input_set_abs_params(input_dev, ABS_Y, 96, 4000, 0, 0); input_set_abs_params(input_dev, ABS_PRESSURE, 0, 255, 0, 0); break; case 1: /* 6-byte protocol */ input_set_abs_params(&elo->dev, ABS_PRESSURE, 0, 15, 0, 0); input_set_abs_params(input_dev, ABS_PRESSURE, 0, 15, 0, 0); case 2: /* 4-byte protocol */ input_set_abs_params(&elo->dev, ABS_X, 96, 4000, 0, 0); input_set_abs_params(&elo->dev, ABS_Y, 96, 4000, 0, 0); input_set_abs_params(input_dev, ABS_X, 96, 4000, 0, 0); input_set_abs_params(input_dev, ABS_Y, 96, 4000, 0, 0); break; case 3: /* 3-byte protocol */ input_set_abs_params(&elo->dev, ABS_X, 0, 255, 0, 0); input_set_abs_params(&elo->dev, ABS_Y, 0, 255, 0, 0); input_set_abs_params(input_dev, ABS_X, 0, 255, 0, 0); input_set_abs_params(input_dev, ABS_Y, 0, 255, 0, 0); break; } elo->serio = serio; sprintf(elo->phys, "%s/input0", serio->phys); elo->dev.private = elo; elo->dev.name = elo_name; elo->dev.phys = elo->phys; elo->dev.id.bustype = BUS_RS232; elo->dev.id.vendor = SERIO_ELO; elo->dev.id.product = elo->id; elo->dev.id.version = 0x0100; serio_set_drvdata(serio, elo); err = serio_open(serio, drv); if (err) { serio_set_drvdata(serio, NULL); kfree(elo); return err; } input_register_device(&elo->dev); printk(KERN_INFO "input: %s on %s\n", elo_name, serio->phys); if (err) goto fail; input_register_device(elo->dev); return 0; fail: serio_set_drvdata(serio, NULL); input_free_device(input_dev); kfree(elo); return err; } /* Loading
drivers/input/touchscreen/gunze.c +33 −33 Original line number Diff line number Diff line Loading @@ -48,14 +48,12 @@ MODULE_LICENSE("GPL"); #define GUNZE_MAX_LENGTH 10 static char *gunze_name = "Gunze AHL-51S TouchScreen"; /* * Per-touchscreen data. */ struct gunze { struct input_dev dev; struct input_dev *dev; struct serio *serio; int idx; unsigned char data[GUNZE_MAX_LENGTH]; Loading @@ -64,7 +62,7 @@ struct gunze { static void gunze_process_packet(struct gunze* gunze, struct pt_regs *regs) { struct input_dev *dev = &gunze->dev; struct input_dev *dev = gunze->dev; if (gunze->idx != GUNZE_MAX_LENGTH || gunze->data[5] != ',' || (gunze->data[0] != 'T' && gunze->data[0] != 'R')) { Loading Loading @@ -102,9 +100,11 @@ static void gunze_disconnect(struct serio *serio) { struct gunze *gunze = serio_get_drvdata(serio); input_unregister_device(&gunze->dev); input_get_device(gunze->dev); input_unregister_device(gunze->dev); serio_close(serio); serio_set_drvdata(serio, NULL); input_put_device(gunze->dev); kfree(gunze); } Loading @@ -117,45 +117,45 @@ static void gunze_disconnect(struct serio *serio) static int gunze_connect(struct serio *serio, struct serio_driver *drv) { struct gunze *gunze; struct input_dev *input_dev; int err; if (!(gunze = kmalloc(sizeof(struct gunze), GFP_KERNEL))) return -ENOMEM; memset(gunze, 0, sizeof(struct gunze)); init_input_dev(&gunze->dev); gunze->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); gunze->dev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); input_set_abs_params(&gunze->dev, ABS_X, 24, 1000, 0, 0); input_set_abs_params(&gunze->dev, ABS_Y, 24, 1000, 0, 0); gunze = kzalloc(sizeof(struct gunze), GFP_KERNEL); input_dev = input_allocate_device(); if (!gunze || !input_dev) { err = -ENOMEM; goto fail; } gunze->serio = serio; gunze->dev = input_dev; sprintf(gunze->phys, "%s/input0", serio->phys); gunze->dev.private = gunze; gunze->dev.name = gunze_name; gunze->dev.phys = gunze->phys; gunze->dev.id.bustype = BUS_RS232; gunze->dev.id.vendor = SERIO_GUNZE; gunze->dev.id.product = 0x0051; gunze->dev.id.version = 0x0100; input_dev->private = gunze; input_dev->name = "Gunze AHL-51S TouchScreen"; input_dev->phys = gunze->phys; input_dev->id.bustype = BUS_RS232; input_dev->id.vendor = SERIO_GUNZE; input_dev->id.product = 0x0051; input_dev->id.version = 0x0100; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); input_set_abs_params(input_dev, ABS_X, 24, 1000, 0, 0); input_set_abs_params(input_dev, ABS_Y, 24, 1000, 0, 0); serio_set_drvdata(serio, gunze); err = serio_open(serio, drv); if (err) { serio_set_drvdata(serio, NULL); kfree(gunze); return err; } input_register_device(&gunze->dev); printk(KERN_INFO "input: %s on %s\n", gunze_name, serio->phys); if (err) goto fail; input_register_device(gunze->dev); return 0; fail: serio_set_drvdata(serio, NULL); input_free_device(input_dev); kfree(gunze); return err; } /* Loading
drivers/input/touchscreen/h3600_ts_input.c +59 −90 Original line number Diff line number Diff line Loading @@ -39,7 +39,6 @@ #include <linux/serio.h> #include <linux/init.h> #include <linux/delay.h> #include <linux/pm.h> /* SA1100 serial defines */ #include <asm/arch/hardware.h> Loading Loading @@ -93,16 +92,12 @@ MODULE_LICENSE("GPL"); #define H3600_SCANCODE_LEFT 8 /* 8 -> left */ #define H3600_SCANCODE_DOWN 9 /* 9 -> down */ static char *h3600_name = "H3600 TouchScreen"; /* * Per-touchscreen data. */ struct h3600_dev { struct input_dev dev; struct pm_dev *pm_dev; struct input_dev *dev; struct serio *serio; struct pm_dev *pm_dev; unsigned char event; /* event ID from packet */ unsigned char chksum; unsigned char len; Loading Loading @@ -163,33 +158,6 @@ unsigned int h3600_flite_power(struct input_dev *dev, enum flite_pwr pwr) return 0; } static int suspended = 0; static int h3600ts_pm_callback(struct pm_dev *pm_dev, pm_request_t req, void *data) { struct input_dev *dev = (struct input_dev *) data; switch (req) { case PM_SUSPEND: /* enter D1-D3 */ suspended = 1; h3600_flite_power(dev, FLITE_PWR_OFF); break; case PM_BLANK: if (!suspended) h3600_flite_power(dev, FLITE_PWR_OFF); break; case PM_RESUME: /* enter D0 */ /* same as unblank */ case PM_UNBLANK: if (suspended) { //initSerial(); suspended = 0; } h3600_flite_power(dev, FLITE_PWR_ON); break; } return 0; } #endif /* Loading @@ -199,7 +167,7 @@ static int h3600ts_pm_callback(struct pm_dev *pm_dev, pm_request_t req, */ static void h3600ts_process_packet(struct h3600_dev *ts, struct pt_regs *regs) { struct input_dev *dev = &ts->dev; struct input_dev *dev = ts->dev; static int touched = 0; int key, down = 0; Loading Loading @@ -295,6 +263,7 @@ static void h3600ts_process_packet(struct h3600_dev *ts, struct pt_regs *regs) static int h3600ts_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) { #if 0 struct h3600_dev *ts = dev->private; switch (type) { Loading @@ -304,6 +273,8 @@ static int h3600ts_event(struct input_dev *dev, unsigned int type, } } return -1; #endif return 0; } /* Loading Loading @@ -380,14 +351,48 @@ static irqreturn_t h3600ts_interrupt(struct serio *serio, unsigned char data, static int h3600ts_connect(struct serio *serio, struct serio_driver *drv) { struct h3600_dev *ts; struct input_dev *input_dev; int err; if (!(ts = kmalloc(sizeof(struct h3600_dev), GFP_KERNEL))) return -ENOMEM; ts = kzalloc(sizeof(struct h3600_dev), GFP_KERNEL); input_dev = input_allocate_device(); if (!ts || !input_dev) { err = -ENOMEM; goto fail1; } memset(ts, 0, sizeof(struct h3600_dev)); ts->serio = serio; ts->dev = input_dev; sprintf(ts->phys, "%s/input0", serio->phys); init_input_dev(&ts->dev); input_dev->name = "H3600 TouchScreen"; input_dev->phys = ts->phys; input_dev->id.bustype = BUS_RS232; input_dev->id.vendor = SERIO_H3600; input_dev->id.product = 0x0666; /* FIXME !!! We can ask the hardware */ input_dev->id.version = 0x0100; input_dev->cdev.dev = &serio->dev; input_dev->private = ts; input_dev->event = h3600ts_event; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_LED) | BIT(EV_PWR); input_dev->ledbit[0] = BIT(LED_SLEEP); input_set_abs_params(input_dev, ABS_X, 60, 985, 0, 0); input_set_abs_params(input_dev, ABS_Y, 35, 1024, 0, 0); set_bit(KEY_RECORD, input_dev->keybit); set_bit(KEY_Q, input_dev->keybit); set_bit(KEY_PROG1, input_dev->keybit); set_bit(KEY_PROG2, input_dev->keybit); set_bit(KEY_PROG3, input_dev->keybit); set_bit(KEY_UP, input_dev->keybit); set_bit(KEY_RIGHT, input_dev->keybit); set_bit(KEY_LEFT, input_dev->keybit); set_bit(KEY_DOWN, input_dev->keybit); set_bit(KEY_ENTER, input_dev->keybit); set_bit(KEY_SUSPEND, input_dev->keybit); set_bit(BTN_TOUCH, input_dev->keybit); /* Device specific stuff */ set_GPIO_IRQ_edge(GPIO_BITSY_ACTION_BUTTON, GPIO_BOTH_EDGES); Loading @@ -397,73 +402,35 @@ static int h3600ts_connect(struct serio *serio, struct serio_driver *drv) SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, "h3600_action", &ts->dev)) { printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n"); kfree(ts); return -EBUSY; err = -EBUSY; goto fail2; } if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler, SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, "h3600_suspend", &ts->dev)) { free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, &ts->dev); printk(KERN_ERR "h3600ts.c: Could not allocate Power Button IRQ!\n"); kfree(ts); return -EBUSY; err = -EBUSY; goto fail3; } /* Now we have things going we setup our input device */ ts->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_LED) | BIT(EV_PWR); ts->dev.ledbit[0] = BIT(LED_SLEEP); input_set_abs_params(&ts->dev, ABS_X, 60, 985, 0, 0); input_set_abs_params(&ts->dev, ABS_Y, 35, 1024, 0, 0); set_bit(KEY_RECORD, ts->dev.keybit); set_bit(KEY_Q, ts->dev.keybit); set_bit(KEY_PROG1, ts->dev.keybit); set_bit(KEY_PROG2, ts->dev.keybit); set_bit(KEY_PROG3, ts->dev.keybit); set_bit(KEY_UP, ts->dev.keybit); set_bit(KEY_RIGHT, ts->dev.keybit); set_bit(KEY_LEFT, ts->dev.keybit); set_bit(KEY_DOWN, ts->dev.keybit); set_bit(KEY_ENTER, ts->dev.keybit); ts->dev.keybit[LONG(BTN_TOUCH)] |= BIT(BTN_TOUCH); ts->dev.keybit[LONG(KEY_SUSPEND)] |= BIT(KEY_SUSPEND); ts->serio = serio; sprintf(ts->phys, "%s/input0", serio->phys); ts->dev.event = h3600ts_event; ts->dev.private = ts; ts->dev.name = h3600_name; ts->dev.phys = ts->phys; ts->dev.id.bustype = BUS_RS232; ts->dev.id.vendor = SERIO_H3600; ts->dev.id.product = 0x0666; /* FIXME !!! We can ask the hardware */ ts->dev.id.version = 0x0100; serio_set_drvdata(serio, ts); err = serio_open(serio, drv); if (err) { free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts); free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts); serio_set_drvdata(serio, NULL); kfree(ts); if (err) return err; } //h3600_flite_control(1, 25); /* default brightness */ #ifdef CONFIG_PM ts->pm_dev = pm_register(PM_ILLUMINATION_DEV, PM_SYS_LIGHT, h3600ts_pm_callback); printk("registered pm callback\n"); #endif input_register_device(&ts->dev); printk(KERN_INFO "input: %s on %s\n", h3600_name, serio->phys); input_register_device(ts->dev); return 0; fail3: free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts->dev); fail2: free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts->dev); fail1: serio_set_drvdata(serio, NULL); input_free_device(input_dev); kfree(ts); return err; } /* Loading @@ -476,9 +443,11 @@ static void h3600ts_disconnect(struct serio *serio) free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, &ts->dev); free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, &ts->dev); input_unregister_device(&ts->dev); input_get_device(ts->dev); input_unregister_device(ts->dev); serio_close(serio); serio_set_drvdata(serio, NULL); input_put_device(ts->dev); kfree(ts); } Loading
drivers/input/touchscreen/hp680_ts_input.c +25 −25 Original line number Diff line number Diff line Loading @@ -21,10 +21,8 @@ static void do_softint(void *data); static struct input_dev hp680_ts_dev; static struct input_dev *hp680_ts_dev; static DECLARE_WORK(work, do_softint, 0); static char *hp680_ts_name = "HP Jornada touchscreen"; static char *hp680_ts_phys = "input0"; static void do_softint(void *data) { Loading Loading @@ -58,14 +56,14 @@ static void do_softint(void *data) } if (touched) { input_report_key(&hp680_ts_dev, BTN_TOUCH, 1); input_report_abs(&hp680_ts_dev, ABS_X, absx); input_report_abs(&hp680_ts_dev, ABS_Y, absy); input_report_key(hp680_ts_dev, BTN_TOUCH, 1); input_report_abs(hp680_ts_dev, ABS_X, absx); input_report_abs(hp680_ts_dev, ABS_Y, absy); } else { input_report_key(&hp680_ts_dev, BTN_TOUCH, 0); input_report_key(hp680_ts_dev, BTN_TOUCH, 0); } input_sync(&hp680_ts_dev); input_sync(hp680_ts_dev); enable_irq(HP680_TS_IRQ); } Loading @@ -92,27 +90,29 @@ static int __init hp680_ts_init(void) scpcr |= SCPCR_TS_ENABLE; ctrl_outw(scpcr, SCPCR); memset(&hp680_ts_dev, 0, sizeof(hp680_ts_dev)); init_input_dev(&hp680_ts_dev); hp680_ts_dev = input_allocate_device(); if (!hp680_ts_dev) return -ENOMEM; hp680_ts_dev.evbit[0] = BIT(EV_ABS) | BIT(EV_KEY); hp680_ts_dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y); hp680_ts_dev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); hp680_ts_dev->evbit[0] = BIT(EV_ABS) | BIT(EV_KEY); hp680_ts_dev->absbit[0] = BIT(ABS_X) | BIT(ABS_Y); hp680_ts_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); hp680_ts_dev.absmin[ABS_X] = HP680_TS_ABS_X_MIN; hp680_ts_dev.absmin[ABS_Y] = HP680_TS_ABS_Y_MIN; hp680_ts_dev.absmax[ABS_X] = HP680_TS_ABS_X_MAX; hp680_ts_dev.absmax[ABS_Y] = HP680_TS_ABS_Y_MAX; hp680_ts_dev->absmin[ABS_X] = HP680_TS_ABS_X_MIN; hp680_ts_dev->absmin[ABS_Y] = HP680_TS_ABS_Y_MIN; hp680_ts_dev->absmax[ABS_X] = HP680_TS_ABS_X_MAX; hp680_ts_dev->absmax[ABS_Y] = HP680_TS_ABS_Y_MAX; hp680_ts_dev.name = hp680_ts_name; hp680_ts_dev.phys = hp680_ts_phys; input_register_device(&hp680_ts_dev); hp680_ts_dev->name = "HP Jornada touchscreen"; hp680_ts_dev->phys = "hp680_ts/input0"; if (request_irq (HP680_TS_IRQ, hp680_ts_interrupt, SA_INTERRUPT, MODNAME, 0) < 0) { input_register_device(hp680_ts_dev); if (request_irq(HP680_TS_IRQ, hp680_ts_interrupt, SA_INTERRUPT, MODNAME, 0) < 0) { printk(KERN_ERR "hp680_touchscreen.c: Can't allocate irq %d\n", HP680_TS_IRQ); input_unregister_device(&hp680_ts_dev); input_unregister_device(hp680_ts_dev); return -EBUSY; } Loading @@ -124,7 +124,7 @@ static void __exit hp680_ts_exit(void) free_irq(HP680_TS_IRQ, 0); cancel_delayed_work(&work); flush_scheduled_work(); input_unregister_device(&hp680_ts_dev); input_unregister_device(hp680_ts_dev); } module_init(hp680_ts_init); Loading