Skip to contentSkip to conversation

Input: Add driver for GOODiX GTx5 series touchsereen

PATCH Superseded Wang Yafei 2 participants 6 messages Jun 19, 2017

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Wang Yafei

author
#0 lore raw

PATCH v2 1/1 Input: Add driver for GOODiX GTx5 series touchsereen

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.

---
Goodix driver that the kernel already have, is for our gt9xx series touchscreen controllers. This new driver is for out new generation touchscreen controllers, consider this two generations are very different with each other. We wrote a new driver instead of make a patch on the old driver.

Since v1:
- replace touchscreen properties according to the description in Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
- Droped all compat stuff for older kernels
- Removed Android stuff (EARLY_SUSPEND, CONFIG_FB)
- Use device_property_read_* get device properties
- use get-unaligned_*() API
- Use dev_err() dev_dbg() for logging
- remove pinctrl functions
- remove some unused functions

---
 drivers/input/touchscreen/Kconfig                  |    1 +
 drivers/input/touchscreen/Makefile                 |    1 +
 .../input/touchscreen/goodix-ts-sunrise/Kconfig    |   36 +
 .../input/touchscreen/goodix-ts-sunrise/Makefile   |    6 +
 .../goodix-ts-sunrise/goodix_gtx5_i2c.c            |  895 ++++++++++++
 .../goodix-ts-sunrise/goodix_gtx5_update.c         | 1454 ++++++++++++++++++++
 .../touchscreen/goodix-ts-sunrise/goodix_ts_core.c | 1366 ++++++++++++++++++
 .../touchscreen/goodix-ts-sunrise/goodix_ts_core.h |  553 ++++++++
 .../goodix-ts-sunrise/goodix_ts_tools.c            |  542 ++++++++
 9 files changed, 4854 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
drivers/input/touchscreen/Kconfig +1 -0
index cf26ca4..f3642bb 100644
@@ -15,6 +15,7 @@ config TOUCHSCREEN_PROPERTIES
 	def_tristate INPUT
 	depends on INPUT
 
+source "drivers/input/touchscreen/goodix-ts-sunrise/Kconfig"
 config TOUCHSCREEN_88PM860X
 	tristate "Marvell 88PM860x touchscreen"
 	depends on MFD_88PM860X
drivers/input/touchscreen/Makefile +1 -0
index 18e4769..d9408c0 100644
@@ -6,6 +6,7 @@
 
 wm97xx-ts-y := wm97xx-core.o
 
+obj-$(CONFIG_TOUCHSCREEN_GOODIX_GTX5)	+= goodix-ts-sunrise/
 obj-$(CONFIG_TOUCHSCREEN_PROPERTIES)	+= of_touchscreen.o
 obj-$(CONFIG_TOUCHSCREEN_88PM860X)	+= 88pm860x-ts.o
 obj-$(CONFIG_TOUCHSCREEN_AD7877)	+= ad7877.o
drivers/input/touchscreen/goodix-ts-sunrise/Kconfig new file +36 -0
new file mode 100755
index 0000000..8e16595
@@ -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
drivers/input/touchscreen/goodix-ts-sunrise/Makefile new file +6 -0
new file mode 100755
index 0000000..690f256
@@ -0,0 +1,6 @@
+# Goodix Touchscreen Makefile
+
+obj-$(CONFIG_TOUCHSCREEN_GOODIX_GTX5)           += goodix_gtx5_i2c.o
+obj-$(CONFIG_TOUCHSCREEN_GOODIX_GTX5)           += goodix_ts_core.o
+obj-$(CONFIG_TOUCHSCREEN_GOODIX_GTX5_TOOLS)    += goodix_ts_tools.o
+obj-$(CONFIG_TOUCHSCREEN_GOODIX_GTX5_UPDATE)    += goodix_gtx5_update.o
drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_i2c.c new file +895 -0

895 lines not on this page · raw message

drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_update.c new file +1454 -0

1,454 lines not on this page · raw message

drivers/input/touchscreen/goodix-ts-sunrise/goodix_ts_core.c new file +1366 -0

595 lines not on this page · raw message

drivers/input/touchscreen/goodix-ts-sunrise/goodix_ts_core.h new file +553 -0

553 lines not on this page · raw message

drivers/input/touchscreen/goodix-ts-sunrise/goodix_ts_tools.c new file +542 -0

542 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.7.4

Part of the diff is not shown here. View the raw message.

#1 lore raw

[PATCH] Input: fix platform_no_drv_owner.cocci warnings

drivers/input/touchscreen/goodix-ts-sunrise/goodix_ts_core.c:1335:3-8: No need to set .owner here. The core will do it.

drivers/input/touchscreen/goodix-ts-sunrise/goodix_ts_core.c:1335:3-8: No need to set .owner here. The core will do it.

Remove .owner field if calls are used which set it automatically

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

---

 goodix_ts_core.c |    1 -
 1 file changed, 1 deletion(-)
drivers/input/touchscreen/goodix-ts-sunrise/goodix_ts_core.c +0 -1
@@ -1332,7 +1332,6 @@ MODULE_DEVICE_TABLE(platform, ts_core_id
 static struct platform_driver goodix_ts_driver = {
 	.driver = {
 		.name = GOODIX_CORE_DRIVER_NAME,
-		.owner = THIS_MODULE,
 		.pm = &dev_pm_ops,
 	},
 	.probe = goodix_ts_probe,
#2 lore raw

[PATCH] Input: fix semicolon.cocci warnings

In reply to Wang Yafei
drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_update.c:752:2-3: Unneeded semicolon

drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_update.c:752:2-3: Unneeded semicolon

Remove unneeded semicolon.

Generated by: scripts/coccinelle/misc/semicolon.cocci

---

 goodix_gtx5_update.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_update.c +1 -1
@@ -749,7 +749,7 @@ static int goodix_send_fw_packet(struct
 	if (r < 0) {
 		dev_err(ts_dev->dev, "Error occurred when wait ISP idle\n");
 		return r;
-	};
+	}
 
 	/* check ISP result */
 	r = goodix_isp_flash_done(ts_dev);
#3 lore raw

[PATCH] Input: fix platform_no_drv_owner.cocci warnings

In reply to Wang Yafei
drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_i2c.c:872:3-8: No need to set .owner here. The core will do it.

drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_i2c.c:872:3-8: No need to set .owner here. The core will do it.

Remove .owner field if calls are used which set it automatically

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

---

 goodix_gtx5_i2c.c |    1 -
 1 file changed, 1 deletion(-)
drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_i2c.c +0 -1
@@ -869,7 +869,6 @@ MODULE_DEVICE_TABLE(i2c, gtx5_id_table);
 static struct i2c_driver goodix_i2c_driver = {
 	.driver = {
 		.name = TS_DRIVER_NAME,
-		.owner = THIS_MODULE,
 		.of_match_table = of_match_ptr(gtx5_of_matchs),
 	},
 	.probe = goodix_i2c_probe,
#4 lore raw
In reply to Wang Yafei
coccinelle warnings: (new ones prefixed by >>)

Hi Wang,

[auto build test WARNING on input/next]
[also build test WARNING on v4.12-rc5 next-20170619]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Wang-Yafei/Input-Add-driver-for-GOODiX-GTx5-series-touchsereen/20170619-200451
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next

coccinelle warnings: (new ones prefixed by >>)

>> drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_i2c.c:872:3-8: No need to set .owner here. The core will do it.
--
>> drivers/input/touchscreen/goodix-ts-sunrise/goodix_ts_core.c:1335:3-8: No need to set .owner here. The core will do it.
--
>> drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_update.c:752:2-3: Unneeded semicolon

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#5 lore raw
In reply to Wang Yafei
reproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross…

Hi Wang,

[auto build test ERROR on input/next]
[also build test ERROR on v4.12-rc5 next-20170619]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Wang-Yafei/Input-Add-driver-for-GOODiX-GTx5-series-touchsereen/20170619-200451
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: alpha-allmodconfig (attached as .config)
compiler: alpha-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705

reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=alpha

All errors (new ones prefixed by >>):

drivers/built-in.o: In function `goodix_i2c_write':

>> drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_i2c.o:(.text+0x13cb34): undefined reference to `i2c_transfer'
   drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_i2c.o:(.text+0x13cb40): undefined reference to `i2c_transfer'
   drivers/built-in.o: In function `goodix_i2c_read':
   drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_i2c.o:(.text+0x13d160): undefined reference to `i2c_transfer'
   drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_i2c.o:(.text+0x13d16c): undefined reference to `i2c_transfer'
   drivers/built-in.o: In function `goodix_i2c_init':
>> drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_i2c.o:(.init.text+0xa068): undefined reference to `i2c_register_driver'

drivers/input/touchscreen/goodix-ts-sunrise/goodix_gtx5_i2c.o:(.init.text+0xa078): undefined reference to `i2c_register_driver'

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation