J jcbian #
Message details and related content
This patch adds a driver for PIXCIR's I2C connected touchscreens. Signed-off-by: Bee <redacted> --- drivers/input/touchscreen/Kconfig | 9 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/pixcir_i2c_ts.c | 293 +++++++++++++++++++++++++++++ 3 files changed, 303 insertions(+), 0 deletions(-) create mode 100644 drivers/input/touchscreen/pixcir_i2c_ts.c
diff --git a/drivers/input/touchscreen/Kconfigb/drivers/input/touchscreen/Kconfig index 61834ae..f11c1ab 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig@@ -693,4 +693,13 @@ config TOUCHSCREEN_TPS6507XTo compile this driver as a module, choose M here: the
module will be called tps6507x_ts.
+config TOUCHSCREEN_PIXCIR
+ tristate "PIXCIR touchscreen panel support"
+ depends on I2C
+ help
+ Say Y here if you have a PIXCIR based touchscreen.
+
+ To compile this driver as a module, choose M here: the
+ module will be called pixcir_i2c_ts.
+
endifdiff --git a/drivers/input/touchscreen/Makefileb/drivers/input/touchscreen/Makefile index 718bcc8..4513668 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile@@ -57,3 +57,4 @@ obj-$(CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE) +=mainstone-wm97xx.o obj-$(CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE) += zylonite-wm97xx.o obj-$(CONFIG_TOUCHSCREEN_W90X900) += w90p910_ts.o obj-$(CONFIG_TOUCHSCREEN_TPS6507X) += tps6507x-ts.o +obj-$(CONFIG_TOUCHSCREEN_PIXCIR) += pixcir_i2c_ts.o
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.cb/drivers/input/touchscreen/pixcir_i2c_ts.c new file mode 100644 index 0000000..e3fbeb0
--- /dev/null
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c@@ -0,0 +1,293 @@ +/* drivers/input/touchscreen/pixcir_i2c_ts.c + * + * Copyright (C) 2010-2011 Pixcir, Inc. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include <linux/module.h> +#include <linux/interrupt.h> +#include <linux/slab.h> +#include <linux/input.h> +#include <linux/i2c.h> +#include <linux/gpio.h> + +#define DRIVER_VERSION "v1.0" +#define DRIVER_AUTHOR
"Bee[off-list ref],Reed[off-list ref]"
+#define DRIVER_DESC "Pixcir I2C Touchscreen Driver"
+#define DRIVER_LICENSE "GPL"
+
+/* todo:check specs for resolution of touch screen */
+#define TOUCHSCREEN_MINX 0
+#define TOUCHSCREEN_MAXX 400
+#define TOUCHSCREEN_MINY 0
+#define TOUCHSCREEN_MAXY 600
+
+#define DEBUG 0
+
+static struct workqueue_struct *pixcir_wq;
+
+struct pixcir_i2c_ts_data {
+ struct i2c_client *client;
+ struct input_dev *input;
+ struct delayed_work work;
+ int irq;
+};
+
+static void pixcir_ts_poscheck(struct work_struct *work)
+{
+ struct pixcir_i2c_ts_data *tsdata = container_of(work,
+ struct pixcir_i2c_ts_data,
+ work.work);
+
+ unsigned char touching, oldtouching;
+ int posx1, posy1, posx2, posy2;
+ u_int8_t Rdbuf[10], Wrbuf[1];
+ int ret;
+ int z = 50;
+ int w = 15;
+
+ memset(Wrbuf, 0, sizeof(Wrbuf));
+ memset(Rdbuf, 0, sizeof(Rdbuf));
+
+ Wrbuf[0] = 0;
+ ret = i2c_master_send(tsdata->client, Wrbuf, 1);
+ if (ret != 1) {