Skip to contentSkip to conversation

mouse: add qci touchpad driver

PATCH Superseded Neil Leeder 3 participants 4 messages Aug 6, 2010 – Aug 12, 2010

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mouse: add qci touchpad driver

This driver is for the QCI trackpad used on Quanta smartbooks

Review URL: http://codereview.chromium.org/724001

[[email protected]: cleanup i2c calls, address review comments etc]
---
 drivers/input/mouse/Kconfig        |   12 ++
 drivers/input/mouse/Makefile       |    1 +
 drivers/input/mouse/qci_touchpad.c |  313 ++++++++++++++++++++++++++++++++++++
 include/linux/input/qci_touchpad.h |   25 +++
 4 files changed, 351 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/mouse/qci_touchpad.c
 create mode 100644 include/linux/input/qci_touchpad.h
drivers/input/mouse/Kconfig +12 -0
index 3feeb3a..320db55 100644
@@ -303,6 +303,18 @@ config MOUSE_MAPLE
 	  To compile this driver as a module choose M here: the module will be
 	  called maplemouse.
 
+config MOUSE_QCITP
+	tristate "Quanta Computer Inc. Touchpad"
+	depends on I2C
+	help
+	  This driver supports the touchpad on Quanta smartbook devices.
+
+	  Say Y here if you have a Quanta-based smartboot or notepad
+	  device and want to use the Quanta touchpad driver.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called qci_touchpad.
+
 config MOUSE_SYNAPTICS_I2C
 	tristate "Synaptics I2C Touchpad support"
 	depends on I2C
drivers/input/mouse/Makefile +1 -0
index 570c84a..6eda35d 100644
@@ -15,6 +15,7 @@ obj-$(CONFIG_MOUSE_MAPLE)		+= maplemouse.o
 obj-$(CONFIG_MOUSE_PC110PAD)		+= pc110pad.o
 obj-$(CONFIG_MOUSE_PS2)			+= psmouse.o
 obj-$(CONFIG_MOUSE_PXA930_TRKBALL)	+= pxa930_trkball.o
+obj-$(CONFIG_MOUSE_QCITP)		+= qci_touchpad.o
 obj-$(CONFIG_MOUSE_RISCPC)		+= rpcmouse.o
 obj-$(CONFIG_MOUSE_SERIAL)		+= sermouse.o
 obj-$(CONFIG_MOUSE_SYNAPTICS_I2C)	+= synaptics_i2c.o
drivers/input/mouse/qci_touchpad.c new file +313 -0

313 lines not on this page · raw message

include/linux/input/qci_touchpad.h new file +25 -0
new file mode 100644
index 0000000..8e266e4
@@ -0,0 +1,25 @@
+/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * 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 program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef __QCI_TOUCHPAD_H
+#define __QCI_TOUCHPAD_H
+
+struct qci_touchpad_platform_data {
+	unsigned long irq_trigger_type;
+};
+
+#endif
Signature · 4 lines
1.7.1
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#1 lore raw

Hi Neil,

Quoted 3 lines · Neil Leeder

This driver is for the QCI trackpad used on Quanta smartbooks

Review URL: http://codereview.chromium.org/724001

Do we need such URLs?

drivers/input/mouse/qci_touchpad.c line 22

Quoted 5 lines
drivers/input/mouse/qci_touchpad.c new file +5 -0
+
+/*
+ * Driver communicates over i2c to nuvoTon WPCE775x Embedded Controller,
+ * which has touchpad attached through PS/2 interface.
+ */

Why this driver is not developed through MFD architecture then? nuvoTon chip looks like multi-function chip, isn't it?

Quoted 20 lines
drivers/input/mouse/qci_touchpad.c new file +20 -0
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/i2c.h>
+#include <linux/interrupt.h>
+#include <linux/input.h>
+#include <linux/gpio.h>
+#include <linux/delay.h>
+#include <linux/input/qci_touchpad.h>
+
+#define TOUCHPAD_ID_NAME          "qci-i2cpad"
+#define TOUCHPAD_NAME             "QCI Touchpad"
+#define TOUCHPAD_DEVICE           "/qci_touchpad/input0"
+#define TOUCHPAD_CMD_ENABLE       0xF4
+#define TOUCHPAD_READ_DATA_LEN    3
+
+struct i2ctpad_drv_data {
+	struct i2c_client *ti2c_client;

drivers/input/mouse/qci_touchpad.c line 109

Quoted 10 lines
drivers/input/mouse/qci_touchpad.c new file +10 -0
+	struct input_dev *qcitp_dev;
+	unsigned int qcitp_gpio;
+	unsigned int qcitp_irq;
+	char ecdata[8];
+	bool opened;
+};
+
+
+static const struct i2c_device_id qcitp_idtable[] = {
+	{ TOUCHPAD_ID_NAME, 0 },

This should be chip name instead of driver or ID name I think.

drivers/input/mouse/qci_touchpad.c line 240

Quoted 8 lines
drivers/input/mouse/qci_touchpad.c new file +8 -0
+
+	err = gpio_request(context->qcitp_gpio, "qci-pad");
+	if (err) {
+		pr_err("[QCI TouchPad] gpio request failed\n");
+		goto gpio_request_fail;
+	}
+
+	context->qcitp_irq = gpio_to_irq(context->qcitp_gpio);

Please set the direction of the gpio as input, gpio_direction_input, even though gpios are coming as input by default.

drivers/input/mouse/qci_touchpad.c line 277

Quoted 9 lines
drivers/input/mouse/qci_touchpad.c new file +9 -0
+
+static int __devexit qcitp_remove(struct i2c_client *client)
+{
+	struct i2ctpad_drv_data *context = i2c_get_clientdata(client);
+
+	free_irq(context->qcitp_irq, context);
+	gpio_free(context->qcitp_gpio);
+	input_unregister_device(context->qcitp_dev);
+	i2c_set_clientdata(client, NULL);

Not required in latest kernels.

---Trilok Soni

Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#2 lore raw
Quoted 8 lines · Trilok Soni

drivers/input/mouse/qci_touchpad.c line 22

Quoted 5 lines
drivers/input/mouse/qci_touchpad.c new file +5 -0
+
+/*
+ * Driver communicates over i2c to nuvoTon WPCE775x Embedded Controller,
+ * which has touchpad attached through PS/2 interface.
+ */

Why this driver is not developed through MFD architecture then? nuvoTon chip looks like multi-function chip, isn't it?

It is, in the sense that it does multiple things. But, for this particular device, it makes the keyboard available as an i2c device. I don't see any particular reason to tie that to other functionality that the chip provides.

David

#3 lore raw

Hi David,

Quoted 11 lines · David Brown
Quoted 8 lines · Trilok Soni

drivers/input/mouse/qci_touchpad.c line 22

Quoted 5 lines
drivers/input/mouse/qci_touchpad.c new file +5 -0
+
+/*
+ * Driver communicates over i2c to nuvoTon WPCE775x Embedded Controller,
+ * which has touchpad attached through PS/2 interface.
+ */

Why this driver is not developed through MFD architecture then? nuvoTon chip looks like multi-function chip, isn't it?

Quoted 4 lines

It is, in the sense that it does multiple things. But, for this particular device, it makes the keyboard available as an i2c device. I don't see any particular reason to tie that to other functionality that the chip provides.

Ok, agreed. Neil, please submit a new patch with addressing other comments. Thanks.

---Trilok Soni

Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.