* [PATCH v7 0/5] Input: pixcir_i2c_ts: Add Type-B Multi-touch and DT support
@ 2014-06-17 9:31 Roger Quadros
2014-06-17 9:31 ` [PATCH v7 1/5] Input: pixcir_i2c_ts: Use Type-B Multi-Touch protocol Roger Quadros
` (6 more replies)
0 siblings, 7 replies; 12+ messages in thread
From: Roger Quadros @ 2014-06-17 9:31 UTC (permalink / raw)
To: dmitry.torokhov, tony
Cc: rydberg, balbi, dmurphy, mugunthanvnm, nsekhar, linux-input,
linux-kernel, linux-omap, Roger Quadros
Hi Dmitry,
These are the pending patches that didn't go through in the 3.16 merge window.
Please queue them for -next. Thanks.
The series does the following
- convert to Type-B multi touch protocol
- support upto 5 fingers with hardware supplied tracking IDs
- device tree support
Tony,
The last 2 patches fix the touch screen size property in the device tree since
we now use the unified touch screen properties.
cheers,
-roger
Changelog:
v7:
- Rebased on 3.16-rc1.
v6:
- Use unified touchscreen bindings.
- Update pointer math i.e. bufptr += 4 instead of &bufptr[4];
v5:
- Changed ts->exiting flag to ts->running in patch 2.
- Don't call pixcir_stop() from .suspend() if wakeup is required.
v4:
- Imporved pixcir_stop() as per Dmitry's suggestion.
- Removed unnecessary input_unregister_device() from .remove().
v3:
- Rebased to 3.15-rc3
- Fixed suspend while touchscreen in use
- Fixed module removal while touchscreen in use
v2:
- Addressed review comments and re-arranged patch order
v1:
- http://article.gmane.org/gmane.linux.kernel/1616417
--
Roger Quadros (5):
Input: pixcir_i2c_ts: Use Type-B Multi-Touch protocol
Input: pixcir_i2c_ts: support upto 5 fingers and hardware provided
tracking IDs
Input: pixcir_i2c_ts: Add device tree support
ARM: dts: am43x-epos-evm: Update binding for touchscreen size
ARM: dts: am437x-gp-evm: Update binding for touchscreen size
.../bindings/input/touchscreen/pixcir_i2c_ts.txt | 26 +++
.../devicetree/bindings/vendor-prefixes.txt | 1 +
arch/arm/boot/dts/am437x-gp-evm.dts | 4 +-
arch/arm/boot/dts/am43x-epos-evm.dts | 4 +-
drivers/input/touchscreen/pixcir_i2c_ts.c | 251 ++++++++++++++++++---
include/linux/input/pixcir_ts.h | 12 +
6 files changed, 259 insertions(+), 39 deletions(-)
create mode 100644 Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
--
1.8.3.2
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v7 1/5] Input: pixcir_i2c_ts: Use Type-B Multi-Touch protocol
2014-06-17 9:31 [PATCH v7 0/5] Input: pixcir_i2c_ts: Add Type-B Multi-touch and DT support Roger Quadros
@ 2014-06-17 9:31 ` Roger Quadros
2014-06-17 9:31 ` [PATCH v7 2/5] Input: pixcir_i2c_ts: support upto 5 fingers and hardware provided tracking IDs Roger Quadros
` (5 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Roger Quadros @ 2014-06-17 9:31 UTC (permalink / raw)
To: dmitry.torokhov, tony
Cc: rydberg, balbi, dmurphy, mugunthanvnm, nsekhar, linux-input,
linux-kernel, linux-omap, Roger Quadros
Switch to using the Type-B Multi-Touch protocol.
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
drivers/input/touchscreen/pixcir_i2c_ts.c | 125 ++++++++++++++++++++++--------
1 file changed, 94 insertions(+), 31 deletions(-)
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 19c6c0f..0b01681 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -23,9 +23,12 @@
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/input.h>
+#include <linux/input/mt.h>
#include <linux/input/pixcir_ts.h>
#include <linux/gpio.h>
+#define PIXCIR_MAX_SLOTS 2
+
struct pixcir_i2c_ts_data {
struct i2c_client *client;
struct input_dev *input;
@@ -33,12 +36,25 @@ struct pixcir_i2c_ts_data {
bool running;
};
-static void pixcir_ts_poscheck(struct pixcir_i2c_ts_data *data)
+struct pixcir_touch {
+ int x;
+ int y;
+};
+
+struct pixcir_report_data {
+ int num_touches;
+ struct pixcir_touch touches[PIXCIR_MAX_SLOTS];
+};
+
+static void pixcir_ts_parse(struct pixcir_i2c_ts_data *tsdata,
+ struct pixcir_report_data *report)
{
- struct pixcir_i2c_ts_data *tsdata = data;
u8 rdbuf[10], wrbuf[1] = { 0 };
+ u8 *bufptr;
u8 touch;
- int ret;
+ int ret, i;
+
+ memset(report, 0, sizeof(struct pixcir_report_data));
ret = i2c_master_send(tsdata->client, wrbuf, sizeof(wrbuf));
if (ret != sizeof(wrbuf)) {
@@ -56,45 +72,85 @@ static void pixcir_ts_poscheck(struct pixcir_i2c_ts_data *data)
return;
}
- touch = rdbuf[0];
- if (touch) {
- u16 posx1 = (rdbuf[3] << 8) | rdbuf[2];
- u16 posy1 = (rdbuf[5] << 8) | rdbuf[4];
- u16 posx2 = (rdbuf[7] << 8) | rdbuf[6];
- u16 posy2 = (rdbuf[9] << 8) | rdbuf[8];
-
- input_report_key(tsdata->input, BTN_TOUCH, 1);
- input_report_abs(tsdata->input, ABS_X, posx1);
- input_report_abs(tsdata->input, ABS_Y, posy1);
-
- input_report_abs(tsdata->input, ABS_MT_POSITION_X, posx1);
- input_report_abs(tsdata->input, ABS_MT_POSITION_Y, posy1);
- input_mt_sync(tsdata->input);
-
- if (touch == 2) {
- input_report_abs(tsdata->input,
- ABS_MT_POSITION_X, posx2);
- input_report_abs(tsdata->input,
- ABS_MT_POSITION_Y, posy2);
- input_mt_sync(tsdata->input);
- }
- } else {
- input_report_key(tsdata->input, BTN_TOUCH, 0);
+ touch = rdbuf[0] & 0x7;
+ if (touch > PIXCIR_MAX_SLOTS)
+ touch = PIXCIR_MAX_SLOTS;
+
+ report->num_touches = touch;
+ bufptr = &rdbuf[2];
+
+ for (i = 0; i < touch; i++) {
+ report->touches[i].x = (bufptr[1] << 8) | bufptr[0];
+ report->touches[i].y = (bufptr[3] << 8) | bufptr[2];
+
+ bufptr = bufptr + 4;
}
+}
+
+static void pixcir_ts_report(struct pixcir_i2c_ts_data *ts,
+ struct pixcir_report_data *report)
+{
+ struct input_mt_pos pos[PIXCIR_MAX_SLOTS];
+ int slots[PIXCIR_MAX_SLOTS];
+ struct pixcir_touch *touch;
+ int n, i, slot;
+ struct device *dev = &ts->client->dev;
+
+ n = report->num_touches;
+ if (n > PIXCIR_MAX_SLOTS)
+ n = PIXCIR_MAX_SLOTS;
- input_sync(tsdata->input);
+ for (i = 0; i < n; i++) {
+ touch = &report->touches[i];
+ pos[i].x = touch->x;
+ pos[i].y = touch->y;
+ }
+
+ input_mt_assign_slots(ts->input, slots, pos, n);
+
+ for (i = 0; i < n; i++) {
+ touch = &report->touches[i];
+ slot = slots[i];
+
+ input_mt_slot(ts->input, slot);
+ input_mt_report_slot_state(ts->input,
+ MT_TOOL_FINGER, true);
+
+ input_event(ts->input, EV_ABS, ABS_MT_POSITION_X, touch->x);
+ input_event(ts->input, EV_ABS, ABS_MT_POSITION_Y, touch->y);
+
+ dev_dbg(dev, "%d: slot %d, x %d, y %d\n",
+ i, slot, touch->x, touch->y);
+ }
+
+ input_mt_sync_frame(ts->input);
+ input_sync(ts->input);
}
static irqreturn_t pixcir_ts_isr(int irq, void *dev_id)
{
struct pixcir_i2c_ts_data *tsdata = dev_id;
const struct pixcir_ts_platform_data *pdata = tsdata->chip;
+ struct pixcir_report_data report;
while (tsdata->running) {
- pixcir_ts_poscheck(tsdata);
-
- if (gpio_get_value(pdata->gpio_attb))
+ /* parse packet */
+ pixcir_ts_parse(tsdata, &report);
+
+ /* report it */
+ pixcir_ts_report(tsdata, &report);
+
+ if (gpio_get_value(pdata->gpio_attb)) {
+ if (report.num_touches) {
+ /*
+ * Last report with no finger up?
+ * Do it now then.
+ */
+ input_mt_sync_frame(tsdata->input);
+ input_sync(tsdata->input);
+ }
break;
+ }
msleep(20);
}
@@ -371,6 +427,13 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
input_set_abs_params(input, ABS_MT_POSITION_X, 0, pdata->x_max, 0, 0);
input_set_abs_params(input, ABS_MT_POSITION_Y, 0, pdata->y_max, 0, 0);
+ error = input_mt_init_slots(input, PIXCIR_MAX_SLOTS,
+ INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
+ if (error) {
+ dev_err(dev, "Error initializing Multi-Touch slots\n");
+ return error;
+ }
+
input_set_drvdata(input, tsdata);
error = devm_gpio_request_one(dev, pdata->gpio_attb,
--
1.8.3.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v7 2/5] Input: pixcir_i2c_ts: support upto 5 fingers and hardware provided tracking IDs
2014-06-17 9:31 [PATCH v7 0/5] Input: pixcir_i2c_ts: Add Type-B Multi-touch and DT support Roger Quadros
2014-06-17 9:31 ` [PATCH v7 1/5] Input: pixcir_i2c_ts: Use Type-B Multi-Touch protocol Roger Quadros
@ 2014-06-17 9:31 ` Roger Quadros
2014-06-17 9:31 ` [PATCH v7 3/5] Input: pixcir_i2c_ts: Add device tree support Roger Quadros
` (4 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Roger Quadros @ 2014-06-17 9:31 UTC (permalink / raw)
To: dmitry.torokhov, tony
Cc: rydberg, balbi, dmurphy, mugunthanvnm, nsekhar, linux-input,
linux-kernel, linux-omap, Roger Quadros
Some variants of the Pixcir touch controller support upto 5
simultaneous fingers and hardware tracking IDs. Prepare the driver
for that.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
drivers/input/touchscreen/pixcir_i2c_ts.c | 74 ++++++++++++++++++++++++-------
include/linux/input/pixcir_ts.h | 12 +++++
2 files changed, 69 insertions(+), 17 deletions(-)
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 0b01681..083af4f 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -27,18 +27,20 @@
#include <linux/input/pixcir_ts.h>
#include <linux/gpio.h>
-#define PIXCIR_MAX_SLOTS 2
+#define PIXCIR_MAX_SLOTS 5 /* Max fingers supported by driver */
struct pixcir_i2c_ts_data {
struct i2c_client *client;
struct input_dev *input;
- const struct pixcir_ts_platform_data *chip;
+ const struct pixcir_ts_platform_data *pdata;
bool running;
+ int max_fingers; /* Max fingers supported in this instance */
};
struct pixcir_touch {
int x;
int y;
+ int id;
};
struct pixcir_report_data {
@@ -49,13 +51,21 @@ struct pixcir_report_data {
static void pixcir_ts_parse(struct pixcir_i2c_ts_data *tsdata,
struct pixcir_report_data *report)
{
- u8 rdbuf[10], wrbuf[1] = { 0 };
+ u8 rdbuf[2 + PIXCIR_MAX_SLOTS * 5];
+ u8 wrbuf[1] = { 0 };
u8 *bufptr;
u8 touch;
int ret, i;
+ int readsize;
+ const struct pixcir_i2c_chip_data *chip = &tsdata->pdata->chip;
memset(report, 0, sizeof(struct pixcir_report_data));
+ i = chip->has_hw_ids ? 1 : 0;
+ readsize = 2 + tsdata->max_fingers * (4 + i);
+ if (readsize > sizeof(rdbuf))
+ readsize = sizeof(rdbuf);
+
ret = i2c_master_send(tsdata->client, wrbuf, sizeof(wrbuf));
if (ret != sizeof(wrbuf)) {
dev_err(&tsdata->client->dev,
@@ -64,7 +74,7 @@ static void pixcir_ts_parse(struct pixcir_i2c_ts_data *tsdata,
return;
}
- ret = i2c_master_recv(tsdata->client, rdbuf, sizeof(rdbuf));
+ ret = i2c_master_recv(tsdata->client, rdbuf, readsize);
if (ret != sizeof(rdbuf)) {
dev_err(&tsdata->client->dev,
"%s: i2c_master_recv failed(), ret=%d\n",
@@ -73,8 +83,8 @@ static void pixcir_ts_parse(struct pixcir_i2c_ts_data *tsdata,
}
touch = rdbuf[0] & 0x7;
- if (touch > PIXCIR_MAX_SLOTS)
- touch = PIXCIR_MAX_SLOTS;
+ if (touch > tsdata->max_fingers)
+ touch = tsdata->max_fingers;
report->num_touches = touch;
bufptr = &rdbuf[2];
@@ -83,7 +93,12 @@ static void pixcir_ts_parse(struct pixcir_i2c_ts_data *tsdata,
report->touches[i].x = (bufptr[1] << 8) | bufptr[0];
report->touches[i].y = (bufptr[3] << 8) | bufptr[2];
- bufptr = bufptr + 4;
+ if (chip->has_hw_ids) {
+ report->touches[i].id = bufptr[4];
+ bufptr = bufptr + 5;
+ } else {
+ bufptr = bufptr + 4;
+ }
}
}
@@ -95,22 +110,35 @@ static void pixcir_ts_report(struct pixcir_i2c_ts_data *ts,
struct pixcir_touch *touch;
int n, i, slot;
struct device *dev = &ts->client->dev;
+ const struct pixcir_i2c_chip_data *chip = &ts->pdata->chip;
n = report->num_touches;
if (n > PIXCIR_MAX_SLOTS)
n = PIXCIR_MAX_SLOTS;
- for (i = 0; i < n; i++) {
- touch = &report->touches[i];
- pos[i].x = touch->x;
- pos[i].y = touch->y;
- }
+ if (!chip->has_hw_ids) {
+ for (i = 0; i < n; i++) {
+ touch = &report->touches[i];
+ pos[i].x = touch->x;
+ pos[i].y = touch->y;
+ }
- input_mt_assign_slots(ts->input, slots, pos, n);
+ input_mt_assign_slots(ts->input, slots, pos, n);
+ }
for (i = 0; i < n; i++) {
touch = &report->touches[i];
- slot = slots[i];
+
+ if (chip->has_hw_ids) {
+ slot = input_mt_get_slot_by_key(ts->input, touch->id);
+ if (slot < 0) {
+ dev_dbg(dev, "no free slot for id 0x%x\n",
+ touch->id);
+ continue;
+ }
+ } else {
+ slot = slots[i];
+ }
input_mt_slot(ts->input, slot);
input_mt_report_slot_state(ts->input,
@@ -130,7 +158,7 @@ static void pixcir_ts_report(struct pixcir_i2c_ts_data *ts,
static irqreturn_t pixcir_ts_isr(int irq, void *dev_id)
{
struct pixcir_i2c_ts_data *tsdata = dev_id;
- const struct pixcir_ts_platform_data *pdata = tsdata->chip;
+ const struct pixcir_ts_platform_data *pdata = tsdata->pdata;
struct pixcir_report_data report;
while (tsdata->running) {
@@ -399,6 +427,11 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
return -EINVAL;
}
+ if (pdata->chip.max_fingers <= 0) {
+ dev_err(dev, "Invalid max_fingers in pdata\n");
+ return -EINVAL;
+ }
+
tsdata = devm_kzalloc(dev, sizeof(*tsdata), GFP_KERNEL);
if (!tsdata)
return -ENOMEM;
@@ -411,7 +444,7 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
tsdata->client = client;
tsdata->input = input;
- tsdata->chip = pdata;
+ tsdata->pdata = pdata;
input->name = client->name;
input->id.bustype = BUS_I2C;
@@ -427,7 +460,14 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
input_set_abs_params(input, ABS_MT_POSITION_X, 0, pdata->x_max, 0, 0);
input_set_abs_params(input, ABS_MT_POSITION_Y, 0, pdata->y_max, 0, 0);
- error = input_mt_init_slots(input, PIXCIR_MAX_SLOTS,
+ tsdata->max_fingers = tsdata->pdata->chip.max_fingers;
+ if (tsdata->max_fingers > PIXCIR_MAX_SLOTS) {
+ tsdata->max_fingers = PIXCIR_MAX_SLOTS;
+ dev_info(dev, "Limiting maximum fingers to %d\n",
+ tsdata->max_fingers);
+ }
+
+ error = input_mt_init_slots(input, tsdata->max_fingers,
INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
if (error) {
dev_err(dev, "Error initializing Multi-Touch slots\n");
diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h
index 160cf35..7bae83b 100644
--- a/include/linux/input/pixcir_ts.h
+++ b/include/linux/input/pixcir_ts.h
@@ -43,10 +43,22 @@ enum pixcir_int_mode {
#define PIXCIR_INT_ENABLE (1UL << 3)
#define PIXCIR_INT_POL_HIGH (1UL << 2)
+/**
+ * struct pixcir_irc_chip_data - chip related data
+ * @max_fingers: Max number of fingers reported simultaneously by h/w
+ * @has_hw_ids: Hardware supports finger tracking IDs
+ *
+ */
+struct pixcir_i2c_chip_data {
+ u8 max_fingers;
+ bool has_hw_ids;
+};
+
struct pixcir_ts_platform_data {
int x_max;
int y_max;
int gpio_attb; /* GPIO connected to ATTB line */
+ struct pixcir_i2c_chip_data chip;
};
#endif
--
1.8.3.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v7 3/5] Input: pixcir_i2c_ts: Add device tree support
2014-06-17 9:31 [PATCH v7 0/5] Input: pixcir_i2c_ts: Add Type-B Multi-touch and DT support Roger Quadros
2014-06-17 9:31 ` [PATCH v7 1/5] Input: pixcir_i2c_ts: Use Type-B Multi-Touch protocol Roger Quadros
2014-06-17 9:31 ` [PATCH v7 2/5] Input: pixcir_i2c_ts: support upto 5 fingers and hardware provided tracking IDs Roger Quadros
@ 2014-06-17 9:31 ` Roger Quadros
2014-06-17 9:31 ` [PATCH v7 4/5] ARM: dts: am43x-epos-evm: Update binding for touchscreen size Roger Quadros
` (3 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Roger Quadros @ 2014-06-17 9:31 UTC (permalink / raw)
To: dmitry.torokhov, tony
Cc: rydberg, balbi, dmurphy, mugunthanvnm, nsekhar, linux-input,
linux-kernel, linux-omap, Roger Quadros
Provide device tree support and binding information.
Also provide support for a new chip "pixcir_tangoc".
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
.../bindings/input/touchscreen/pixcir_i2c_ts.txt | 26 ++++++++
.../devicetree/bindings/vendor-prefixes.txt | 1 +
drivers/input/touchscreen/pixcir_i2c_ts.c | 78 ++++++++++++++++++++++
3 files changed, 105 insertions(+)
create mode 100644 Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
diff --git a/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt b/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
new file mode 100644
index 0000000..6e55109
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
@@ -0,0 +1,26 @@
+* Pixcir I2C touchscreen controllers
+
+Required properties:
+- compatible: must be "pixcir,pixcir_ts" or "pixcir,pixcir_tangoc"
+- reg: I2C address of the chip
+- interrupts: interrupt to which the chip is connected
+- attb-gpio: GPIO connected to the ATTB line of the chip
+- touchscreen-size-x: horizontal resolution of touchscreen (in pixels)
+- touchscreen-size-y: vertical resolution of touchscreen (in pixels)
+
+Example:
+
+ i2c@00000000 {
+ /* ... */
+
+ pixcir_ts@5c {
+ compatible = "pixcir,pixcir_ts";
+ reg = <0x5c>;
+ interrupts = <2 0>;
+ attb-gpio = <&gpf 2 0 2>;
+ touchscreen-size-x = <800>;
+ touchscreen-size-y = <600>;
+ };
+
+ /* ... */
+ };
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 4d7f375..364f18f 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -98,6 +98,7 @@ panasonic Panasonic Corporation
phytec PHYTEC Messtechnik GmbH
picochip Picochip Ltd
plathome Plat'Home Co., Ltd.
+pixcir PIXCIR MICROELECTRONICS Co., Ltd
powervr PowerVR (deprecated, use img)
qca Qualcomm Atheros, Inc.
qcom Qualcomm Technologies, Inc
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 083af4f..ed2fe96 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -26,6 +26,9 @@
#include <linux/input/mt.h>
#include <linux/input/pixcir_ts.h>
#include <linux/gpio.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
+#include <linux/of_device.h>
#define PIXCIR_MAX_SLOTS 5 /* Max fingers supported by driver */
@@ -407,16 +410,70 @@ unlock:
static SIMPLE_DEV_PM_OPS(pixcir_dev_pm_ops,
pixcir_i2c_ts_suspend, pixcir_i2c_ts_resume);
+#ifdef CONFIG_OF
+static const struct of_device_id pixcir_of_match[];
+
+static struct pixcir_ts_platform_data *pixcir_parse_dt(struct device *dev)
+{
+ struct pixcir_ts_platform_data *pdata;
+ struct device_node *np = dev->of_node;
+
+ const struct of_device_id *match;
+
+ match = of_match_device(of_match_ptr(pixcir_of_match), dev);
+ if (!match)
+ return ERR_PTR(-EINVAL);
+
+ pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+ if (!pdata)
+ return ERR_PTR(-ENOMEM);
+
+ pdata->chip = *(const struct pixcir_i2c_chip_data *)match->data;
+
+ pdata->gpio_attb = of_get_named_gpio(np, "attb-gpio", 0);
+ /* gpio_attb validity is checked in probe */
+
+ if (of_property_read_u32(np, "touchscreen-size-x", &pdata->x_max)) {
+ dev_err(dev, "Failed to get touchscreen-size-x property\n");
+ return ERR_PTR(-EINVAL);
+ }
+ pdata->x_max -= 1;
+
+ if (of_property_read_u32(np, "touchscreen-size-y", &pdata->y_max)) {
+ dev_err(dev, "Failed to get touchscreen-size-y property\n");
+ return ERR_PTR(-EINVAL);
+ }
+ pdata->y_max -= 1;
+
+ dev_dbg(dev, "%s: x %d, y %d, gpio %d\n", __func__,
+ pdata->x_max + 1, pdata->y_max + 1, pdata->gpio_attb);
+
+ return pdata;
+}
+#else
+static struct pixcir_ts_platform_data *pixcir_parse_dt(struct device *dev)
+{
+ return ERR_PTR(-EINVAL);
+}
+#endif
+
static int pixcir_i2c_ts_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
const struct pixcir_ts_platform_data *pdata =
dev_get_platdata(&client->dev);
struct device *dev = &client->dev;
+ struct device_node *np = dev->of_node;
struct pixcir_i2c_ts_data *tsdata;
struct input_dev *input;
int error;
+ if (np && !pdata) {
+ pdata = pixcir_parse_dt(dev);
+ if (IS_ERR(pdata))
+ return PTR_ERR(pdata);
+ }
+
if (!pdata) {
dev_err(&client->dev, "platform data not defined\n");
return -EINVAL;
@@ -522,15 +579,36 @@ static int pixcir_i2c_ts_remove(struct i2c_client *client)
static const struct i2c_device_id pixcir_i2c_ts_id[] = {
{ "pixcir_ts", 0 },
+ { "pixcir_tangoc", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, pixcir_i2c_ts_id);
+#ifdef CONFIG_OF
+static const struct pixcir_i2c_chip_data pixcir_ts_data = {
+ .max_fingers = 2,
+ /* no hw id support */
+};
+
+static const struct pixcir_i2c_chip_data pixcir_tangoc_data = {
+ .max_fingers = 5,
+ .has_hw_ids = true,
+};
+
+static const struct of_device_id pixcir_of_match[] = {
+ { .compatible = "pixcir,pixcir_ts", .data = &pixcir_ts_data },
+ { .compatible = "pixcir,pixcir_tangoc", .data = &pixcir_tangoc_data },
+ { }
+};
+MODULE_DEVICE_TABLE(of, pixcir_of_match);
+#endif
+
static struct i2c_driver pixcir_i2c_ts_driver = {
.driver = {
.owner = THIS_MODULE,
.name = "pixcir_ts",
.pm = &pixcir_dev_pm_ops,
+ .of_match_table = of_match_ptr(pixcir_of_match),
},
.probe = pixcir_i2c_ts_probe,
.remove = pixcir_i2c_ts_remove,
--
1.8.3.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v7 4/5] ARM: dts: am43x-epos-evm: Update binding for touchscreen size
2014-06-17 9:31 [PATCH v7 0/5] Input: pixcir_i2c_ts: Add Type-B Multi-touch and DT support Roger Quadros
` (2 preceding siblings ...)
2014-06-17 9:31 ` [PATCH v7 3/5] Input: pixcir_i2c_ts: Add device tree support Roger Quadros
@ 2014-06-17 9:31 ` Roger Quadros
2014-06-17 9:50 ` Tony Lindgren
2014-06-17 9:31 ` [PATCH v7 5/5] ARM: dts: am437x-gp-evm: " Roger Quadros
` (2 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Roger Quadros @ 2014-06-17 9:31 UTC (permalink / raw)
To: dmitry.torokhov, tony
Cc: rydberg, balbi, dmurphy, mugunthanvnm, nsekhar, linux-input,
linux-kernel, linux-omap, Roger Quadros, Benoit Cousson
Update the bindings for touchscreen size.
CC: Benoit Cousson <bcousson@baylibre.com>
CC: Tony Lindgren <tony@atomide.com>
CC: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
arch/arm/boot/dts/am43x-epos-evm.dts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts
index 19f1f7e..f3fe017 100644
--- a/arch/arm/boot/dts/am43x-epos-evm.dts
+++ b/arch/arm/boot/dts/am43x-epos-evm.dts
@@ -340,8 +340,8 @@
attb-gpio = <&gpio1 17 GPIO_ACTIVE_HIGH>;
- x-size = <1024>;
- y-size = <600>;
+ touchscreen-size-x = <1024>;
+ touchscreen-size-y = <600>;
};
};
--
1.8.3.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v7 5/5] ARM: dts: am437x-gp-evm: Update binding for touchscreen size
2014-06-17 9:31 [PATCH v7 0/5] Input: pixcir_i2c_ts: Add Type-B Multi-touch and DT support Roger Quadros
` (3 preceding siblings ...)
2014-06-17 9:31 ` [PATCH v7 4/5] ARM: dts: am43x-epos-evm: Update binding for touchscreen size Roger Quadros
@ 2014-06-17 9:31 ` Roger Quadros
2014-06-17 9:50 ` Tony Lindgren
2014-06-17 9:51 ` [PATCH v7 0/5] Input: pixcir_i2c_ts: Add Type-B Multi-touch and DT support Tony Lindgren
2014-07-03 9:34 ` Roger Quadros
6 siblings, 1 reply; 12+ messages in thread
From: Roger Quadros @ 2014-06-17 9:31 UTC (permalink / raw)
To: dmitry.torokhov, tony
Cc: rydberg, balbi, dmurphy, mugunthanvnm, nsekhar, linux-input,
linux-kernel, linux-omap, Roger Quadros, Benoit Cousson
Update the bindings for touchscreen size.
CC: Benoit Cousson <bcousson@baylibre.com>
CC: Tony Lindgren <tony@atomide.com>
CC: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
arch/arm/boot/dts/am437x-gp-evm.dts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/am437x-gp-evm.dts b/arch/arm/boot/dts/am437x-gp-evm.dts
index 003766c..2674132 100644
--- a/arch/arm/boot/dts/am437x-gp-evm.dts
+++ b/arch/arm/boot/dts/am437x-gp-evm.dts
@@ -277,8 +277,8 @@
attb-gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
- x-size = <1024>;
- y-size = <600>;
+ touchscreen-size-x = <1024>;
+ touchscreen-size-y = <600>;
};
};
--
1.8.3.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v7 4/5] ARM: dts: am43x-epos-evm: Update binding for touchscreen size
2014-06-17 9:31 ` [PATCH v7 4/5] ARM: dts: am43x-epos-evm: Update binding for touchscreen size Roger Quadros
@ 2014-06-17 9:50 ` Tony Lindgren
0 siblings, 0 replies; 12+ messages in thread
From: Tony Lindgren @ 2014-06-17 9:50 UTC (permalink / raw)
To: Roger Quadros
Cc: dmitry.torokhov, rydberg, balbi, dmurphy, mugunthanvnm, nsekhar,
linux-input, linux-kernel, linux-omap, Benoit Cousson
* Roger Quadros <rogerq@ti.com> [140617 02:33]:
> Update the bindings for touchscreen size.
>
> CC: Benoit Cousson <bcousson@baylibre.com>
> CC: Tony Lindgren <tony@atomide.com>
> CC: Mugunthan V N <mugunthanvnm@ti.com>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
This should be fine to queue along with the driver changes:
Acked-by: Tony Lindgren <tony@atomide.com>
> ---
> arch/arm/boot/dts/am43x-epos-evm.dts | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts
> index 19f1f7e..f3fe017 100644
> --- a/arch/arm/boot/dts/am43x-epos-evm.dts
> +++ b/arch/arm/boot/dts/am43x-epos-evm.dts
> @@ -340,8 +340,8 @@
>
> attb-gpio = <&gpio1 17 GPIO_ACTIVE_HIGH>;
>
> - x-size = <1024>;
> - y-size = <600>;
> + touchscreen-size-x = <1024>;
> + touchscreen-size-y = <600>;
> };
> };
>
> --
> 1.8.3.2
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v7 5/5] ARM: dts: am437x-gp-evm: Update binding for touchscreen size
2014-06-17 9:31 ` [PATCH v7 5/5] ARM: dts: am437x-gp-evm: " Roger Quadros
@ 2014-06-17 9:50 ` Tony Lindgren
0 siblings, 0 replies; 12+ messages in thread
From: Tony Lindgren @ 2014-06-17 9:50 UTC (permalink / raw)
To: Roger Quadros
Cc: dmitry.torokhov, rydberg, balbi, dmurphy, mugunthanvnm, nsekhar,
linux-input, linux-kernel, linux-omap, Benoit Cousson
* Roger Quadros <rogerq@ti.com> [140617 02:33]:
> Update the bindings for touchscreen size.
>
> CC: Benoit Cousson <bcousson@baylibre.com>
> CC: Tony Lindgren <tony@atomide.com>
> CC: Mugunthan V N <mugunthanvnm@ti.com>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
This too:
Acked-by: Tony Lindgren <tony@atomide.com>
> ---
> arch/arm/boot/dts/am437x-gp-evm.dts | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/boot/dts/am437x-gp-evm.dts b/arch/arm/boot/dts/am437x-gp-evm.dts
> index 003766c..2674132 100644
> --- a/arch/arm/boot/dts/am437x-gp-evm.dts
> +++ b/arch/arm/boot/dts/am437x-gp-evm.dts
> @@ -277,8 +277,8 @@
>
> attb-gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
>
> - x-size = <1024>;
> - y-size = <600>;
> + touchscreen-size-x = <1024>;
> + touchscreen-size-y = <600>;
> };
> };
>
> --
> 1.8.3.2
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v7 0/5] Input: pixcir_i2c_ts: Add Type-B Multi-touch and DT support
2014-06-17 9:31 [PATCH v7 0/5] Input: pixcir_i2c_ts: Add Type-B Multi-touch and DT support Roger Quadros
` (4 preceding siblings ...)
2014-06-17 9:31 ` [PATCH v7 5/5] ARM: dts: am437x-gp-evm: " Roger Quadros
@ 2014-06-17 9:51 ` Tony Lindgren
2014-06-17 9:52 ` Roger Quadros
2014-07-03 9:34 ` Roger Quadros
6 siblings, 1 reply; 12+ messages in thread
From: Tony Lindgren @ 2014-06-17 9:51 UTC (permalink / raw)
To: Roger Quadros
Cc: dmitry.torokhov, rydberg, balbi, dmurphy, mugunthanvnm, nsekhar,
linux-input, linux-kernel, linux-omap
* Roger Quadros <rogerq@ti.com> [140617 02:33]:
> Hi Dmitry,
>
> These are the pending patches that didn't go through in the 3.16 merge window.
> Please queue them for -next. Thanks.
>
> The series does the following
> - convert to Type-B multi touch protocol
> - support upto 5 fingers with hardware supplied tracking IDs
> - device tree support
>
> Tony,
>
> The last 2 patches fix the touch screen size property in the device tree since
> we now use the unified touch screen properties.
OK I acked those two pathes so Dmitry can take them too
when the driver changes get merged.
Regards,
Tony
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v7 0/5] Input: pixcir_i2c_ts: Add Type-B Multi-touch and DT support
2014-06-17 9:51 ` [PATCH v7 0/5] Input: pixcir_i2c_ts: Add Type-B Multi-touch and DT support Tony Lindgren
@ 2014-06-17 9:52 ` Roger Quadros
0 siblings, 0 replies; 12+ messages in thread
From: Roger Quadros @ 2014-06-17 9:52 UTC (permalink / raw)
To: Tony Lindgren
Cc: dmitry.torokhov, rydberg, balbi, dmurphy, mugunthanvnm, nsekhar,
linux-input, linux-kernel, linux-omap
On 06/17/2014 12:51 PM, Tony Lindgren wrote:
> * Roger Quadros <rogerq@ti.com> [140617 02:33]:
>> Hi Dmitry,
>>
>> These are the pending patches that didn't go through in the 3.16 merge window.
>> Please queue them for -next. Thanks.
>>
>> The series does the following
>> - convert to Type-B multi touch protocol
>> - support upto 5 fingers with hardware supplied tracking IDs
>> - device tree support
>>
>> Tony,
>>
>> The last 2 patches fix the touch screen size property in the device tree since
>> we now use the unified touch screen properties.
>
> OK I acked those two pathes so Dmitry can take them too
> when the driver changes get merged.
>
Thanks Tony.
cheers,
-roger
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v7 0/5] Input: pixcir_i2c_ts: Add Type-B Multi-touch and DT support
2014-06-17 9:31 [PATCH v7 0/5] Input: pixcir_i2c_ts: Add Type-B Multi-touch and DT support Roger Quadros
` (5 preceding siblings ...)
2014-06-17 9:51 ` [PATCH v7 0/5] Input: pixcir_i2c_ts: Add Type-B Multi-touch and DT support Tony Lindgren
@ 2014-07-03 9:34 ` Roger Quadros
2014-07-28 9:16 ` Roger Quadros
6 siblings, 1 reply; 12+ messages in thread
From: Roger Quadros @ 2014-07-03 9:34 UTC (permalink / raw)
To: dmitry.torokhov, tony
Cc: rydberg, balbi, dmurphy, mugunthanvnm, nsekhar, linux-input,
linux-kernel, linux-omap
Hi Dmitry,
Gentle reminder to pick this series for -next. Thanks :).
cheers,
-roger
On 06/17/2014 12:31 PM, Roger Quadros wrote:
> Hi Dmitry,
>
> These are the pending patches that didn't go through in the 3.16 merge window.
> Please queue them for -next. Thanks.
>
> The series does the following
> - convert to Type-B multi touch protocol
> - support upto 5 fingers with hardware supplied tracking IDs
> - device tree support
>
> Tony,
>
> The last 2 patches fix the touch screen size property in the device tree since
> we now use the unified touch screen properties.
>
> cheers,
> -roger
>
> Changelog:
>
> v7:
> - Rebased on 3.16-rc1.
>
> v6:
> - Use unified touchscreen bindings.
> - Update pointer math i.e. bufptr += 4 instead of &bufptr[4];
>
> v5:
> - Changed ts->exiting flag to ts->running in patch 2.
> - Don't call pixcir_stop() from .suspend() if wakeup is required.
>
> v4:
> - Imporved pixcir_stop() as per Dmitry's suggestion.
> - Removed unnecessary input_unregister_device() from .remove().
>
> v3:
> - Rebased to 3.15-rc3
> - Fixed suspend while touchscreen in use
> - Fixed module removal while touchscreen in use
>
> v2:
> - Addressed review comments and re-arranged patch order
>
> v1:
> - http://article.gmane.org/gmane.linux.kernel/1616417
>
> --
>
> Roger Quadros (5):
> Input: pixcir_i2c_ts: Use Type-B Multi-Touch protocol
> Input: pixcir_i2c_ts: support upto 5 fingers and hardware provided
> tracking IDs
> Input: pixcir_i2c_ts: Add device tree support
> ARM: dts: am43x-epos-evm: Update binding for touchscreen size
> ARM: dts: am437x-gp-evm: Update binding for touchscreen size
>
> .../bindings/input/touchscreen/pixcir_i2c_ts.txt | 26 +++
> .../devicetree/bindings/vendor-prefixes.txt | 1 +
> arch/arm/boot/dts/am437x-gp-evm.dts | 4 +-
> arch/arm/boot/dts/am43x-epos-evm.dts | 4 +-
> drivers/input/touchscreen/pixcir_i2c_ts.c | 251 ++++++++++++++++++---
> include/linux/input/pixcir_ts.h | 12 +
> 6 files changed, 259 insertions(+), 39 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v7 0/5] Input: pixcir_i2c_ts: Add Type-B Multi-touch and DT support
2014-07-03 9:34 ` Roger Quadros
@ 2014-07-28 9:16 ` Roger Quadros
0 siblings, 0 replies; 12+ messages in thread
From: Roger Quadros @ 2014-07-28 9:16 UTC (permalink / raw)
To: dmitry.torokhov, tony
Cc: rydberg, balbi, dmurphy, mugunthanvnm, nsekhar, linux-input,
linux-kernel, linux-omap
Hi Dmitry,
Gentle ping. Would be nice to get these into 3.17. Thanks :).
cheers,
-roger
On 07/03/2014 12:34 PM, Roger Quadros wrote:
> Hi Dmitry,
>
> Gentle reminder to pick this series for -next. Thanks :).
>
> cheers,
> -roger
>
> On 06/17/2014 12:31 PM, Roger Quadros wrote:
>> Hi Dmitry,
>>
>> These are the pending patches that didn't go through in the 3.16 merge window.
>> Please queue them for -next. Thanks.
>>
>> The series does the following
>> - convert to Type-B multi touch protocol
>> - support upto 5 fingers with hardware supplied tracking IDs
>> - device tree support
>>
>> Tony,
>>
>> The last 2 patches fix the touch screen size property in the device tree since
>> we now use the unified touch screen properties.
>>
>> cheers,
>> -roger
>>
>> Changelog:
>>
>> v7:
>> - Rebased on 3.16-rc1.
>>
>> v6:
>> - Use unified touchscreen bindings.
>> - Update pointer math i.e. bufptr += 4 instead of &bufptr[4];
>>
>> v5:
>> - Changed ts->exiting flag to ts->running in patch 2.
>> - Don't call pixcir_stop() from .suspend() if wakeup is required.
>>
>> v4:
>> - Imporved pixcir_stop() as per Dmitry's suggestion.
>> - Removed unnecessary input_unregister_device() from .remove().
>>
>> v3:
>> - Rebased to 3.15-rc3
>> - Fixed suspend while touchscreen in use
>> - Fixed module removal while touchscreen in use
>>
>> v2:
>> - Addressed review comments and re-arranged patch order
>>
>> v1:
>> - http://article.gmane.org/gmane.linux.kernel/1616417
>>
>> --
>>
>> Roger Quadros (5):
>> Input: pixcir_i2c_ts: Use Type-B Multi-Touch protocol
>> Input: pixcir_i2c_ts: support upto 5 fingers and hardware provided
>> tracking IDs
>> Input: pixcir_i2c_ts: Add device tree support
>> ARM: dts: am43x-epos-evm: Update binding for touchscreen size
>> ARM: dts: am437x-gp-evm: Update binding for touchscreen size
>>
>> .../bindings/input/touchscreen/pixcir_i2c_ts.txt | 26 +++
>> .../devicetree/bindings/vendor-prefixes.txt | 1 +
>> arch/arm/boot/dts/am437x-gp-evm.dts | 4 +-
>> arch/arm/boot/dts/am43x-epos-evm.dts | 4 +-
>> drivers/input/touchscreen/pixcir_i2c_ts.c | 251 ++++++++++++++++++---
>> include/linux/input/pixcir_ts.h | 12 +
>> 6 files changed, 259 insertions(+), 39 deletions(-)
>> create mode 100644 Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
>>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2014-07-28 9:16 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-17 9:31 [PATCH v7 0/5] Input: pixcir_i2c_ts: Add Type-B Multi-touch and DT support Roger Quadros
2014-06-17 9:31 ` [PATCH v7 1/5] Input: pixcir_i2c_ts: Use Type-B Multi-Touch protocol Roger Quadros
2014-06-17 9:31 ` [PATCH v7 2/5] Input: pixcir_i2c_ts: support upto 5 fingers and hardware provided tracking IDs Roger Quadros
2014-06-17 9:31 ` [PATCH v7 3/5] Input: pixcir_i2c_ts: Add device tree support Roger Quadros
2014-06-17 9:31 ` [PATCH v7 4/5] ARM: dts: am43x-epos-evm: Update binding for touchscreen size Roger Quadros
2014-06-17 9:50 ` Tony Lindgren
2014-06-17 9:31 ` [PATCH v7 5/5] ARM: dts: am437x-gp-evm: " Roger Quadros
2014-06-17 9:50 ` Tony Lindgren
2014-06-17 9:51 ` [PATCH v7 0/5] Input: pixcir_i2c_ts: Add Type-B Multi-touch and DT support Tony Lindgren
2014-06-17 9:52 ` Roger Quadros
2014-07-03 9:34 ` Roger Quadros
2014-07-28 9:16 ` Roger Quadros
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).