Re: [PATCH] Add driver for GOODiX GTx5 series touchsereen

2017-06-07 Thread Dmitry Torokhov
Hi Wang,

On Wed, Jun 07, 2017 at 12:05:51PM +0800, Wang Yafei wrote:
> This driver is for GOODiX GTx5 series touchscreen controllers
> such as GT8589, GT7589. This driver designed with hierarchial structure,
> for that can be modified to support subsequent controllers easily.
> Some zones of the touchscreen can be set to buttons(according to the
> hardware). That is why it handles button and multitouch events.
> 
> A brief description of driver structure
> - Core Layer: This layer responsible for basic input events report,
>   GPIO pinctrl, Interrupt, Power resources manager and submodules
>   manager.
> - Hardware Layer: This layer responsible for controllers initialization,
>   irq handle as well as bus read/write.
> - External Module Layer: This layer used for support more features
>   such as firmware update, debug tools and gesture wakeup.


What is the difference between this version and the version you posted a
couple of days ago?

A few high level comments/questions:

- is this for a different chip that what is handled by the Goodix driver
  that we already have in the kernel?

- you should be using standard touchscreen bindings described in
  Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt

- please use gpiod API without gpio fallbacks: you are submitting the
  driver for inclusion into mainline that does have gpiod API and for
  mainline it does not make sense to use fallbacks.

- similarly drop other compat stuff for older kernels

- please drop Android stiff (EARLY_SUSPEND, ets).

- use generic device properties (device_property_read_*()) instead of
  OF-specific variants.

- use get_unaligned_*() API to convert data on wire to CPU format
  instead of doing the same by hand.

- use dev_err(), dev_dbg(), etc for logging.

Thanks.

-- 
Dmitry


Re: [PATCH] Add driver for GOODiX GTx5 series touchsereen

2017-06-07 Thread Dmitry Torokhov
Hi Wang,

On Wed, Jun 07, 2017 at 12:05:51PM +0800, Wang Yafei wrote:
> This driver is for GOODiX GTx5 series touchscreen controllers
> such as GT8589, GT7589. This driver designed with hierarchial structure,
> for that can be modified to support subsequent controllers easily.
> Some zones of the touchscreen can be set to buttons(according to the
> hardware). That is why it handles button and multitouch events.
> 
> A brief description of driver structure
> - Core Layer: This layer responsible for basic input events report,
>   GPIO pinctrl, Interrupt, Power resources manager and submodules
>   manager.
> - Hardware Layer: This layer responsible for controllers initialization,
>   irq handle as well as bus read/write.
> - External Module Layer: This layer used for support more features
>   such as firmware update, debug tools and gesture wakeup.


What is the difference between this version and the version you posted a
couple of days ago?

A few high level comments/questions:

- is this for a different chip that what is handled by the Goodix driver
  that we already have in the kernel?

- you should be using standard touchscreen bindings described in
  Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt

- please use gpiod API without gpio fallbacks: you are submitting the
  driver for inclusion into mainline that does have gpiod API and for
  mainline it does not make sense to use fallbacks.

- similarly drop other compat stuff for older kernels

- please drop Android stiff (EARLY_SUSPEND, ets).

- use generic device properties (device_property_read_*()) instead of
  OF-specific variants.

- use get_unaligned_*() API to convert data on wire to CPU format
  instead of doing the same by hand.

- use dev_err(), dev_dbg(), etc for logging.

Thanks.

-- 
Dmitry


[PATCH] Add driver for GOODiX GTx5 series touchsereen

2017-06-06 Thread Wang Yafei
This driver is for GOODiX GTx5 series touchscreen controllers
such as GT8589, GT7589. This driver designed with hierarchial structure,
for that can be modified to support subsequent controllers easily.
Some zones of the touchscreen can be set to buttons(according to the
hardware). That is why it handles button and multitouch events.

A brief description of driver structure
- Core Layer: This layer responsible for basic input events report,
  GPIO pinctrl, Interrupt, Power resources manager and submodules
  manager.
- Hardware Layer: This layer responsible for controllers initialization,
  irq handle as well as bus read/write.
- External Module Layer: This layer used for support more features
  such as firmware update, debug tools and gesture wakeup.

Signed-off-by: Wang Yafei 

---
 .../input/touchscreen/goodix-ts-sunrise/Kconfig|   36 +
 .../input/touchscreen/goodix-ts-sunrise/Makefile   |6 +
 .../goodix-ts-sunrise/goodix_gtx5_i2c.c|  939 
 .../goodix-ts-sunrise/goodix_gtx5_update.c | 1453 ++
 .../touchscreen/goodix-ts-sunrise/goodix_ts_core.c | 1618 
 .../touchscreen/goodix-ts-sunrise/goodix_ts_core.h |  585 +++
 .../goodix-ts-sunrise/goodix_ts_tools.c|  552 +++
 7 files changed, 5189 insertions(+)
 create mode 100755 drivers/input/touchscreen/goodix-ts-sunrise/Kconfig
 create mode 100755 drivers/input/touchscreen/goodix-ts-sunrise/Makefile
 create mode 100755 
drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_i2c.c
 create mode 100755 
drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_update.c
 create mode 100755 drivers/input/touchscreen/goodix-ts-sunrise/goodix_ts_core.c
 create mode 100755 drivers/input/touchscreen/goodix-ts-sunrise/goodix_ts_core.h
 create mode 100755 
drivers/input/touchscreen/goodix-ts-sunrise/goodix_ts_tools.c

diff --git a/drivers/input/touchscreen/goodix-ts-sunrise/Kconfig 
b/drivers/input/touchscreen/goodix-ts-sunrise/Kconfig
new file mode 100755
index 000..8e16595
--- /dev/null
+++ b/drivers/input/touchscreen/goodix-ts-sunrise/Kconfig
@@ -0,0 +1,36 @@
+#
+# Goodix touchscreen driver configuration
+#
+menuconfig TOUCHSCREEN_GOODIX_GTX5
+   bool "Goodix GTx5 touchscreen"
+   depends on I2C
+   default y
+   help
+ Say Y here if you have a Goodix GTx5xx touchscreen connected
+ to your system.
+
+ If unsure, say N.
+
+if TOUCHSCREEN_GOODIX_GTX5
+
+config TOUCHSCREEN_GOODIX_GTX5_UPDATE
+   tristate "Goodix GTx5xx firmware update module"
+   default y
+   help
+ Say Y here to enable support for doing firmware update.
+
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here.
+
+config TOUCHSCREEN_GOODIX_GTX5_TOOLS
+   tristate "Goodix touch tools support"
+   default n
+   help
+ Say Y here to enable debug tools.
+
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here.
+
+endif
diff --git a/drivers/input/touchscreen/goodix-ts-sunrise/Makefile 
b/drivers/input/touchscreen/goodix-ts-sunrise/Makefile
new file mode 100755
index 000..2d5b38d
--- /dev/null
+++ b/drivers/input/touchscreen/goodix-ts-sunrise/Makefile
@@ -0,0 +1,6 @@
+# Goodix Touchscreen Makefile
+
+obj-$(CONFIG_TOUCHSCREEN_GOODIX_GTX5)   += goodix_ts_core.o
+obj-$(CONFIG_TOUCHSCREEN_GOODIX_GTX5_TOOLS)+= goodix_ts_tools.o
+obj-$(CONFIG_TOUCHSCREEN_GOODIX_GTX5)   += goodix_gtx5_i2c.o
+obj-$(CONFIG_TOUCHSCREEN_GOODIX_GTX5_UPDATE)+= goodix_gtx5_update.o
diff --git a/drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_i2c.c 
b/drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_i2c.c
new file mode 100755
index 000..c2e2dee
--- /dev/null
+++ b/drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_i2c.c
@@ -0,0 +1,939 @@
+/*
+ * Goodix GTx5 I2C Dirver
+ * Hardware interface layer of touchdriver architecture.
+ *
+ * Copyright (C) 2015 - 2016 Goodix, Inc.
+ * Authors:  Wang Yafei 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be a reference
+ * to you, when you are integrating the GOODiX's CTP IC into your system,
+ * 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 "goodix_ts_core.h"
+
+#define TS_DT_COMPATIBLE   "goodix,gtx5"
+#define TS_DRIVER_NAME "goodix_i2c"
+#define I2C_MAX_TRANSFER_SIZE  256
+#define TS_ADDR_LENGTH 2
+
+#define TS_REG_COORDS_BASE 0x824E

[PATCH] Add driver for GOODiX GTx5 series touchsereen

2017-06-06 Thread Wang Yafei
This driver is for GOODiX GTx5 series touchscreen controllers
such as GT8589, GT7589. This driver designed with hierarchial structure,
for that can be modified to support subsequent controllers easily.
Some zones of the touchscreen can be set to buttons(according to the
hardware). That is why it handles button and multitouch events.

A brief description of driver structure
- Core Layer: This layer responsible for basic input events report,
  GPIO pinctrl, Interrupt, Power resources manager and submodules
  manager.
- Hardware Layer: This layer responsible for controllers initialization,
  irq handle as well as bus read/write.
- External Module Layer: This layer used for support more features
  such as firmware update, debug tools and gesture wakeup.

Signed-off-by: Wang Yafei 

---
 .../input/touchscreen/goodix-ts-sunrise/Kconfig|   36 +
 .../input/touchscreen/goodix-ts-sunrise/Makefile   |6 +
 .../goodix-ts-sunrise/goodix_gtx5_i2c.c|  939 
 .../goodix-ts-sunrise/goodix_gtx5_update.c | 1453 ++
 .../touchscreen/goodix-ts-sunrise/goodix_ts_core.c | 1618 
 .../touchscreen/goodix-ts-sunrise/goodix_ts_core.h |  585 +++
 .../goodix-ts-sunrise/goodix_ts_tools.c|  552 +++
 7 files changed, 5189 insertions(+)
 create mode 100755 drivers/input/touchscreen/goodix-ts-sunrise/Kconfig
 create mode 100755 drivers/input/touchscreen/goodix-ts-sunrise/Makefile
 create mode 100755 
drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_i2c.c
 create mode 100755 
drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_update.c
 create mode 100755 drivers/input/touchscreen/goodix-ts-sunrise/goodix_ts_core.c
 create mode 100755 drivers/input/touchscreen/goodix-ts-sunrise/goodix_ts_core.h
 create mode 100755 
drivers/input/touchscreen/goodix-ts-sunrise/goodix_ts_tools.c

diff --git a/drivers/input/touchscreen/goodix-ts-sunrise/Kconfig 
b/drivers/input/touchscreen/goodix-ts-sunrise/Kconfig
new file mode 100755
index 000..8e16595
--- /dev/null
+++ b/drivers/input/touchscreen/goodix-ts-sunrise/Kconfig
@@ -0,0 +1,36 @@
+#
+# Goodix touchscreen driver configuration
+#
+menuconfig TOUCHSCREEN_GOODIX_GTX5
+   bool "Goodix GTx5 touchscreen"
+   depends on I2C
+   default y
+   help
+ Say Y here if you have a Goodix GTx5xx touchscreen connected
+ to your system.
+
+ If unsure, say N.
+
+if TOUCHSCREEN_GOODIX_GTX5
+
+config TOUCHSCREEN_GOODIX_GTX5_UPDATE
+   tristate "Goodix GTx5xx firmware update module"
+   default y
+   help
+ Say Y here to enable support for doing firmware update.
+
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here.
+
+config TOUCHSCREEN_GOODIX_GTX5_TOOLS
+   tristate "Goodix touch tools support"
+   default n
+   help
+ Say Y here to enable debug tools.
+
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here.
+
+endif
diff --git a/drivers/input/touchscreen/goodix-ts-sunrise/Makefile 
b/drivers/input/touchscreen/goodix-ts-sunrise/Makefile
new file mode 100755
index 000..2d5b38d
--- /dev/null
+++ b/drivers/input/touchscreen/goodix-ts-sunrise/Makefile
@@ -0,0 +1,6 @@
+# Goodix Touchscreen Makefile
+
+obj-$(CONFIG_TOUCHSCREEN_GOODIX_GTX5)   += goodix_ts_core.o
+obj-$(CONFIG_TOUCHSCREEN_GOODIX_GTX5_TOOLS)+= goodix_ts_tools.o
+obj-$(CONFIG_TOUCHSCREEN_GOODIX_GTX5)   += goodix_gtx5_i2c.o
+obj-$(CONFIG_TOUCHSCREEN_GOODIX_GTX5_UPDATE)+= goodix_gtx5_update.o
diff --git a/drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_i2c.c 
b/drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_i2c.c
new file mode 100755
index 000..c2e2dee
--- /dev/null
+++ b/drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_i2c.c
@@ -0,0 +1,939 @@
+/*
+ * Goodix GTx5 I2C Dirver
+ * Hardware interface layer of touchdriver architecture.
+ *
+ * Copyright (C) 2015 - 2016 Goodix, Inc.
+ * Authors:  Wang Yafei 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be a reference
+ * to you, when you are integrating the GOODiX's CTP IC into your system,
+ * 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 "goodix_ts_core.h"
+
+#define TS_DT_COMPATIBLE   "goodix,gtx5"
+#define TS_DRIVER_NAME "goodix_i2c"
+#define I2C_MAX_TRANSFER_SIZE  256
+#define TS_ADDR_LENGTH 2
+
+#define TS_REG_COORDS_BASE 0x824E
+#define TS_REG_CMD 0x8040
+#define