Re: [PATCH v2] Input: Add generic driver for Zeitec touchscreens

2015-07-29 Thread Bogdan George Stefan
Dimitry,

Please let me know if there is anything I can provide for this driver.

Thank you,
Bogdan

On Thu, Jun 18, 2015 at 11:39 AM, Bogdan George Stefan
 wrote:
> Dimitry,
>
> You can control how many fingers work on a device via the firmware
> that you load. I've asked the Zeitec guys to confirm. So, to answer
> your question, if you want to build a system with a touch that
> supports only 7 fingers, you can pick any part from Zeitec and give
> the supplier the right firmware.
>
> Thank you,
> Bogdan Stefan
>
> On Fri, Jun 12, 2015 at 3:45 AM, Dmitry Torokhov
>  wrote:
>>
>> Hi Bogdan,
>>
>> On Tue, Jun 02, 2015 at 10:43:01AM +0300, Bogdan George Stefan wrote:
>> > Dimitry,
>> >
>> > I know 0xB2 should provide that information according to the
>> > datasheet, however here is what Zeitec guys had to say when I asked
>> > them why it does not work:
>> >
>> > "0xB2 is deprecated.
>> > It only supports in Zet6221/31 serious but zet9172/zet6273."
>> >
>> > If you like, I can attach my conversation with them.
>> >
>>
>> Not really, but I would like to understand how the part selection works.
>> Are they the same parts or different parts? Let's say you want to build
>> a system and you want part that reports up to 7 contacts. How do you
>> communicate this to the supplier? The number of contacts - is it
>> controller by the config file you load into the controller, or they have
>> separate parts for different contact count or what?
>>
>> Thanks.
>>
>> --
>> Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] Input: Add generic driver for Zeitec touchscreens

2015-06-18 Thread Bogdan George Stefan
Dimitry,

You can control how many fingers work on a device via the firmware
that you load. I've asked the Zeitec guys to confirm. So, to answer
your question, if you want to build a system with a touch that
supports only 7 fingers, you can pick any part from Zeitec and give
the supplier the right firmware.

Thank you,
Bogdan Stefan

On Fri, Jun 12, 2015 at 3:45 AM, Dmitry Torokhov
 wrote:
>
> Hi Bogdan,
>
> On Tue, Jun 02, 2015 at 10:43:01AM +0300, Bogdan George Stefan wrote:
> > Dimitry,
> >
> > I know 0xB2 should provide that information according to the
> > datasheet, however here is what Zeitec guys had to say when I asked
> > them why it does not work:
> >
> > "0xB2 is deprecated.
> > It only supports in Zet6221/31 serious but zet9172/zet6273."
> >
> > If you like, I can attach my conversation with them.
> >
>
> Not really, but I would like to understand how the part selection works.
> Are they the same parts or different parts? Let's say you want to build
> a system and you want part that reports up to 7 contacts. How do you
> communicate this to the supplier? The number of contacts - is it
> controller by the config file you load into the controller, or they have
> separate parts for different contact count or what?
>
> Thanks.
>
> --
> Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] Input: Add generic driver for Zeitec touchscreens

2015-06-12 Thread Dmitry Torokhov
Hi Bogdan,

On Tue, Jun 02, 2015 at 10:43:01AM +0300, Bogdan George Stefan wrote:
> Dimitry,
> 
> I know 0xB2 should provide that information according to the
> datasheet, however here is what Zeitec guys had to say when I asked
> them why it does not work:
> 
> "0xB2 is deprecated.
> It only supports in Zet6221/31 serious but zet9172/zet6273."
> 
> If you like, I can attach my conversation with them.
>

Not really, but I would like to understand how the part selection works.
Are they the same parts or different parts? Let's say you want to build
a system and you want part that reports up to 7 contacts. How do you
communicate this to the supplier? The number of contacts - is it
controller by the config file you load into the controller, or they have
separate parts for different contact count or what?

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] Input: Add generic driver for Zeitec touchscreens

2015-06-02 Thread Bogdan George Stefan
Dimitry,

I know 0xB2 should provide that information according to the
datasheet, however here is what Zeitec guys had to say when I asked
them why it does not work:

"0xB2 is deprecated.
It only supports in Zet6221/31 serious but zet9172/zet6273."

If you like, I can attach my conversation with them.

Thank you,
Bogdan

On Sat, May 30, 2015 at 3:14 AM, Dmitry Torokhov
 wrote:
> Hi Bogdan,
>
> On Thu, May 28, 2015 at 03:22:02PM +0300, Bogdan George Stefan wrote:
>> This driver adds support for Zeitec touchscreens. It has
>> been tested with ZET6273 and ZET9172.
>>
>> It supports ACPI and device tree enumeration. For ACPI you need ACPI
>> 5.1+ in order to be able to use named GPIOs.
>>
>> Screen resolution, the maximum number of fingers supported,
>> if the touchscreen has hardware keys are configurable
>> using ACPI/DT properties.
>>
>> Signed-off-by: Bogdan George Stefan 
>> ---
>> Changes since v1:
>>
>> Implemented most changes following Dmitry Torokhov's recommendations
>> from https://lkml.org/lkml/2015/5/15/319
>> The only things I kept are described below in the Notes section.
>> - fixed style issues
>> - reset is activated when gpio is set to high
>> - switched from i2c_transfer to i2c_master_recv/i2c_master_send
>> - removed redundant evbit initialization. However EV_ABS still needs
>> to be reported and it is set through input_set_capability
>> - replaced usleep_range with msleep where neede. Checking the patch
>> with -strict will report an issue on this. Hope this is not a problem
>> - fixed casts in zet_process_events
>> - removed  client->irq = gpiod_to_irq(ts->irq); from probe
>> - moved firmware loading from probe to open
>> - used proper casts in zet_suspend
>> - dropped zet_ts_remove as it was doing unnecesary things
>> Notes:
>> - I've kept the flags IRQF_TRIGGER_FALLING | IRQF_ONESHOT when calling
>> devm_request_threaded_irq. No the irq handler is not called whn only 
>> IRQF_ONESHOT
>> is used. Looking at other drivers, I saw that they use the same aproach. I 
>> am not
>> sure how to setup things in ACPI/DT so that the driver could work only with 
>> IRQF_ONESHOT
>
> Hmm, Rafael, do ACPI systems automatically set up IRQ triggers,
> similarly to what OF systems do (based on device tree data)?
>
>> - The number of thingers that can simultaneously touch the device and if it 
>> has
>> HW keys or not, cannot be read from the device. I've asked Zeitec on this.
>
> According to a random Zeitec datasheet I found on the web you send 0xB2
> command to the device to retrieve buch of information, including number
> of fingers and whether keys are supported.
>
> Thanks.
>
> --
> Dmitry
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] Input: Add generic driver for Zeitec touchscreens

2015-05-29 Thread Dmitry Torokhov
Hi Bogdan,

On Thu, May 28, 2015 at 03:22:02PM +0300, Bogdan George Stefan wrote:
> This driver adds support for Zeitec touchscreens. It has
> been tested with ZET6273 and ZET9172.
> 
> It supports ACPI and device tree enumeration. For ACPI you need ACPI
> 5.1+ in order to be able to use named GPIOs.
> 
> Screen resolution, the maximum number of fingers supported,
> if the touchscreen has hardware keys are configurable
> using ACPI/DT properties.
> 
> Signed-off-by: Bogdan George Stefan 
> ---
> Changes since v1:
> 
> Implemented most changes following Dmitry Torokhov's recommendations
> from https://lkml.org/lkml/2015/5/15/319
> The only things I kept are described below in the Notes section.
> - fixed style issues
> - reset is activated when gpio is set to high
> - switched from i2c_transfer to i2c_master_recv/i2c_master_send
> - removed redundant evbit initialization. However EV_ABS still needs
> to be reported and it is set through input_set_capability
> - replaced usleep_range with msleep where neede. Checking the patch
> with -strict will report an issue on this. Hope this is not a problem
> - fixed casts in zet_process_events
> - removed  client->irq = gpiod_to_irq(ts->irq); from probe
> - moved firmware loading from probe to open
> - used proper casts in zet_suspend
> - dropped zet_ts_remove as it was doing unnecesary things
> Notes:
> - I've kept the flags IRQF_TRIGGER_FALLING | IRQF_ONESHOT when calling
> devm_request_threaded_irq. No the irq handler is not called whn only 
> IRQF_ONESHOT
> is used. Looking at other drivers, I saw that they use the same aproach. I am 
> not
> sure how to setup things in ACPI/DT so that the driver could work only with 
> IRQF_ONESHOT

Hmm, Rafael, do ACPI systems automatically set up IRQ triggers,
similarly to what OF systems do (based on device tree data)?

> - The number of thingers that can simultaneously touch the device and if it 
> has
> HW keys or not, cannot be read from the device. I've asked Zeitec on this.

According to a random Zeitec datasheet I found on the web you send 0xB2
command to the device to retrieve buch of information, including number
of fingers and whether keys are supported.

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] Input: Add generic driver for Zeitec touchscreens

2015-05-28 Thread Bogdan George Stefan
This driver adds support for Zeitec touchscreens. It has
been tested with ZET6273 and ZET9172.

It supports ACPI and device tree enumeration. For ACPI you need ACPI
5.1+ in order to be able to use named GPIOs.

Screen resolution, the maximum number of fingers supported,
if the touchscreen has hardware keys are configurable
using ACPI/DT properties.

Signed-off-by: Bogdan George Stefan 
---
Changes since v1:

Implemented most changes following Dmitry Torokhov's recommendations
from https://lkml.org/lkml/2015/5/15/319
The only things I kept are described below in the Notes section.
- fixed style issues
- reset is activated when gpio is set to high
- switched from i2c_transfer to i2c_master_recv/i2c_master_send
- removed redundant evbit initialization. However EV_ABS still needs
to be reported and it is set through input_set_capability
- replaced usleep_range with msleep where neede. Checking the patch
with -strict will report an issue on this. Hope this is not a problem
- fixed casts in zet_process_events
- removed  client->irq = gpiod_to_irq(ts->irq); from probe
- moved firmware loading from probe to open
- used proper casts in zet_suspend
- dropped zet_ts_remove as it was doing unnecesary things
Notes:
- I've kept the flags IRQF_TRIGGER_FALLING | IRQF_ONESHOT when calling
devm_request_threaded_irq. No the irq handler is not called whn only 
IRQF_ONESHOT
is used. Looking at other drivers, I saw that they use the same aproach. I am 
not
sure how to setup things in ACPI/DT so that the driver could work only with 
IRQF_ONESHOT
- The number of thingers that can simultaneously touch the device and if it has
HW keys or not, cannot be read from the device. I've asked Zeitec on this.

 drivers/input/touchscreen/Kconfig  |  12 +
 drivers/input/touchscreen/Makefile |   1 +
 drivers/input/touchscreen/zeitec.c | 550 +
 3 files changed, 563 insertions(+)
 create mode 100644 drivers/input/touchscreen/zeitec.c

diff --git a/drivers/input/touchscreen/Kconfig 
b/drivers/input/touchscreen/Kconfig
index 80f6386..2046633 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -27,6 +27,18 @@ config TOUCHSCREEN_88PM860X
  To compile this driver as a module, choose M here: the
  module will be called 88pm860x-ts.
 
+config TOUCHSCREEN_ZEITEC
+   tristate "Generic ZEITEC touchscreen"
+   depends on I2C
+   help
+ Say Y here if you have the Zeitec touchscreen connected to
+ your system.
+
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here: the
+ module will be called zeitec.
+
 config TOUCHSCREEN_ADS7846
tristate "ADS7846/TSC2046/AD7873 and AD(S)7843 based touchscreens"
depends on SPI_MASTER
diff --git a/drivers/input/touchscreen/Makefile 
b/drivers/input/touchscreen/Makefile
index 44deea7..7593fea 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -84,3 +84,4 @@ obj-$(CONFIG_TOUCHSCREEN_W90X900) += w90p910_ts.o
 obj-$(CONFIG_TOUCHSCREEN_SX8654)   += sx8654.o
 obj-$(CONFIG_TOUCHSCREEN_TPS6507X) += tps6507x-ts.o
 obj-$(CONFIG_TOUCHSCREEN_ZFORCE)   += zforce_ts.o
+obj-$(CONFIG_TOUCHSCREEN_ZEITEC)   += zeitec.o
diff --git a/drivers/input/touchscreen/zeitec.c 
b/drivers/input/touchscreen/zeitec.c
new file mode 100644
index 000..bffa6f9
--- /dev/null
+++ b/drivers/input/touchscreen/zeitec.c
@@ -0,0 +1,550 @@
+/*
+ * Driver for Zeitec touchscreens.
+ *
+ * Copyright (c) 2015 Intel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "../../gpio/gpiolib.h"
+
+#define FLASH_SIZE_ZET6273 0xA000
+#define ZET_TOTAL_PKT_SIZE 70
+#define ZET_MODEL_PKT_SIZE 17
+
+#define ZET_ROM_TYPE_UNKNOWN   0x00
+#define ZET_ROM_TYPE_SRAM  0x02
+#define ZET_ROM_TYPE_OTP   0x06
+#define ZET_ROM_TYPE_FLASH 0x0F
+
+#define ZET_FLASH_PAGE_LEN 128
+
+#define ZET_CMD_GET_CODEOPTION 0x27
+#define ZET_CMD_GET_INFORMATION0xB2
+#define ZET_CMD_WRITE_PASSWORD 0x20
+#define ZET_CMD_WRITE_PROGRAM  0x22
+#define ZET_CMD_READ_CODE_OPTION   0x27
+#define ZET_CMD_RESET_MCU  0x29
+#define ZET_CMD_WRITE_SF