// SPDX-License-Identifier: GPL-2.0-only /* * Sahara TouchIT-213 serial touchscreen driver * * Copyright (c) 2007-2008 Claudio Nieder <[email protected]> * * Based on Touchright driver (drivers/input/touchscreen/touchright.c) * Copyright (c) 2006 Rick Koch <[email protected]> * Copyright (c) 2004 Vojtech Pavlik * and Dan Streetman <[email protected]> */ #include <linux/errno.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/input.h> #include <linux/serio.h> #define DRIVER_DESC … MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…); MODULE_LICENSE(…) …; /* * Definitions & global arrays. */ /* * Data is received through COM1 at 9600bit/s,8bit,no parity in packets * of 5 byte each. * * +--------+ +--------+ +--------+ +--------+ +--------+ * |1000000p| |0xxxxxxx| |0xxxxxxx| |0yyyyyyy| |0yyyyyyy| * +--------+ +--------+ +--------+ +--------+ +--------+ * MSB LSB MSB LSB * * The value of p is 1 as long as the screen is touched and 0 when * reporting the location where touching stopped, e.g. where the pen was * lifted from the screen. * * When holding the screen in landscape mode as the BIOS text output is * presented, x is the horizontal axis with values growing from left to * right and y is the vertical axis with values growing from top to * bottom. * * When holding the screen in portrait mode with the Sahara logo in its * correct position, x ist the vertical axis with values growing from * top to bottom and y is the horizontal axis with values growing from * right to left. */ #define T213_FORMAT_TOUCH_BIT … #define T213_FORMAT_STATUS_BYTE … #define T213_FORMAT_STATUS_MASK … /* * On my Sahara Touch-IT 213 I have observed x values from 0 to 0x7f0 * and y values from 0x1d to 0x7e9, so the actual measurement is * probably done with an 11 bit precision. */ #define T213_MIN_XC … #define T213_MAX_XC … #define T213_MIN_YC … #define T213_MAX_YC … /* * Per-touchscreen data. */ struct touchit213 { … }; static irqreturn_t touchit213_interrupt(struct serio *serio, unsigned char data, unsigned int flags) { … } /* * touchit213_disconnect() is the opposite of touchit213_connect() */ static void touchit213_disconnect(struct serio *serio) { … } /* * touchit213_connect() is the routine that is called when someone adds a * new serio device that supports the Touchright protocol and registers it as * an input device. */ static int touchit213_connect(struct serio *serio, struct serio_driver *drv) { … } /* * The serio driver structure. */ static const struct serio_device_id touchit213_serio_ids[] = …; MODULE_DEVICE_TABLE(serio, touchit213_serio_ids); static struct serio_driver touchit213_drv = …; module_serio_driver(…) …;