Exemple #1
0
static int tsc2102_ts_remove(struct platform_device *pdev)
{
	tsc2102_touch_cb(0);
	tsc2102_coords_cb(0);
	input_unregister_device(dev);
	input_free_device(dev);
	return 0;
}
Exemple #2
0
static int tsc2102_ts_probe(struct platform_device *pdev)
{
	int status;

	dev = input_allocate_device();
	if (!dev)
		return -ENOMEM;

	status = tsc2102_touch_cb(tsc2102_touch);
	if (status) {
		input_free_device(dev);
		return status;
	}

	status = tsc2102_coords_cb(tsc2102_coords);
	if (status) {
		tsc2102_touch_cb(0);
		input_free_device(dev);
		return status;
	}

	dev->name = "TSC2102 Touchscreen";
	dev->dev = &pdev->dev;
	dev->cdev.dev = &pdev->dev;
	dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
	dev->keybit[LONG(BTN_TOUCH)] |= BIT(BTN_TOUCH);
	dev->absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE);
	dev->phys = "tsc2102/input0";
	dev->id.bustype = BUS_HOST;
	dev->id.vendor = 0x0001;
	dev->id.product = 0x2102;
	dev->id.version = 0x0001;

	status = input_register_device(dev);
	if (status) {
		tsc2102_coords_cb(0);
		tsc2102_touch_cb(0);
		input_free_device(dev);
		return status;
	}

	printk(KERN_INFO "TSC2102 touchscreen driver initialized\n");
	return 0;
}