From cc754b8c11f42e70f593e9f755c9eadad734ce8b Mon Sep 17 00:00:00 2001 From: Xu Jianqun Date: Mon, 28 Dec 2015 15:34:39 +0800 Subject: [PATCH] ARM64: dts: rockchip: support gt9xx for Rockchip platform Add support gt9xx driver for Rockchip platform goodix touchscreen. There is a goodix driver on upstream but it not work well, so use the old driver until someone debug the upstream driver. Change-Id: Id8711a63150da4bdcd8e78f3b2a82157e1b3de4f Signed-off-by: Xu Jianqun --- .../boot/dts/rockchip/rk3368-tb-sheep.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3368-tb.dtsi | 11 +++++++++++ arch/arm64/configs/rockchip_defconfig | 2 +- drivers/input/touchscreen/Kconfig | 9 +++++++++ drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/gt9xx/gt9xx.c | 19 ++++++++++--------- 6 files changed, 33 insertions(+), 11 deletions(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3368-tb-sheep.dts b/arch/arm64/boot/dts/rockchip/rk3368-tb-sheep.dts index 27e1bdf3f481..b45d2c540f07 100644 --- a/arch/arm64/boot/dts/rockchip/rk3368-tb-sheep.dts +++ b/arch/arm64/boot/dts/rockchip/rk3368-tb-sheep.dts @@ -48,7 +48,7 @@ compatible = "rockchip,sheep", "rockchip,rk3368"; }; ->911 { +>9xx { status = "okay"; }; diff --git a/arch/arm64/boot/dts/rockchip/rk3368-tb.dtsi b/arch/arm64/boot/dts/rockchip/rk3368-tb.dtsi index b78518014256..925ce1a2d8ee 100644 --- a/arch/arm64/boot/dts/rockchip/rk3368-tb.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3368-tb.dtsi @@ -324,6 +324,17 @@ interrupts = <12 0>; status = "disabled"; }; + + gt9xx: gt9xx@14 { + compatible = "goodix,gt9xx"; + reg = <0x14>; + touch-gpio = <&gpio0 12 IRQ_TYPE_LEVEL_LOW>; + reset-gpio = <&gpio0 11 GPIO_ACTIVE_HIGH>; + max-x = <1200>; + max-y = <1900>; + tp-size = <911>; + status = "disabled"; + }; }; &pwm0 { diff --git a/arch/arm64/configs/rockchip_defconfig b/arch/arm64/configs/rockchip_defconfig index b4b326bb4718..586af125691f 100644 --- a/arch/arm64/configs/rockchip_defconfig +++ b/arch/arm64/configs/rockchip_defconfig @@ -259,7 +259,7 @@ CONFIG_TABLET_USB_GTCO=y CONFIG_TABLET_USB_HANWANG=y CONFIG_TABLET_USB_KBTAB=y CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_GOODIX=y +CONFIG_TOUCHSCREEN_GT9XX=y CONFIG_INPUT_MISC=y CONFIG_INPUT_UINPUT=y # CONFIG_SERIO is not set diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index ae33da7ab51f..e705afd4d866 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -335,6 +335,15 @@ config TOUCHSCREEN_GOODIX To compile this driver as a module, choose M here: the module will be called goodix. +config TOUCHSCREEN_GT9XX + tristate "Goodix gt9xx support for rockchip platform" + depends on I2C && ARCH_ROCKCHIP + help + Say Y here if you have a touchscreen interface using the gt9xx + on Rockchip platform, and your board-specific initialization + code includes that in its table of IIC devices. + If unsure, say N. + config TOUCHSCREEN_ILI210X tristate "Ilitek ILI210X based touchscreen" depends on I2C diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index cbaa6abb08da..922becb12d0e 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -38,6 +38,7 @@ obj-$(CONFIG_TOUCHSCREEN_EGALAX) += egalax_ts.o obj-$(CONFIG_TOUCHSCREEN_FT6236) += ft6236.o obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o obj-$(CONFIG_TOUCHSCREEN_GOODIX) += goodix.o +obj-$(CONFIG_TOUCHSCREEN_GT9XX) += gt9xx/ obj-$(CONFIG_TOUCHSCREEN_ILI210X) += ili210x.o obj-$(CONFIG_TOUCHSCREEN_IMX6UL_TSC) += imx6ul_tsc.o obj-$(CONFIG_TOUCHSCREEN_INEXIO) += inexio.o diff --git a/drivers/input/touchscreen/gt9xx/gt9xx.c b/drivers/input/touchscreen/gt9xx/gt9xx.c index 1bac1f8a53e3..3cf920246466 100755 --- a/drivers/input/touchscreen/gt9xx/gt9xx.c +++ b/drivers/input/touchscreen/gt9xx/gt9xx.c @@ -158,15 +158,18 @@ s32 gtp_i2c_read(struct i2c_client *client, u8 *buf, s32 len) msgs[0].addr = client->addr; msgs[0].len = GTP_ADDR_LENGTH; msgs[0].buf = &buf[0]; +#ifdef CONFIG_I2C_ROCKCHIP_COMPAT msgs[0].scl_rate=200 * 1000; //msgs[0].scl_rate = 300 * 1000; // for Rockchip, etc. - +#endif msgs[1].flags = I2C_M_RD; msgs[1].addr = client->addr; msgs[1].len = len - GTP_ADDR_LENGTH; msgs[1].buf = &buf[GTP_ADDR_LENGTH]; +#ifdef CONFIG_I2C_ROCKCHIP_COMPAT msgs[1].scl_rate=200 * 1000; - //msgs[1].scl_rate = 300 * 1000; + //msgs[1].scl_rate = 300 * 1000; // for Rockchip, etc. +#endif while(retries < 5) { @@ -228,9 +231,10 @@ s32 gtp_i2c_write(struct i2c_client *client,u8 *buf,s32 len) msg.addr = client->addr; msg.len = len; msg.buf = buf; +#ifdef CONFIG_I2C_ROCKCHIP_COMPAT msg.scl_rate=200 * 1000; //msg.scl_rate = 300 * 1000; // for Rockchip, etc - +#endif while(retries < 5) { ret = i2c_transfer(client->adapter, &msg, 1); @@ -1676,8 +1680,6 @@ static ssize_t gt91xx_config_write_proc(struct file *filp, const char __user *bu { s32 ret = 0; - GTP_DEBUG("write count %d\n", count); - if (count > GTP_CONFIG_MAX_LENGTH) { GTP_ERROR("size not match [%d:%zu]\n", GTP_CONFIG_MAX_LENGTH, count); @@ -1943,7 +1945,7 @@ static int goodix_ts_early_suspend(struct tp_device *tp_d) // delay 48 + 10ms to ensure reliability msleep(58); regulator_tp = regulator_get(NULL,"vcc_tp"); - if(regulator_tp ==NULL) + if(IS_ERR(regulator_tp)) { printk("!!!!%s:%d:get regulator_tp failed\n",__func__,__LINE__); return 0; @@ -1978,7 +1980,7 @@ static int goodix_ts_early_resume(struct tp_device *tp_d) GTP_INFO("System resume."); regulator_tp = regulator_get(NULL, "vcc_tp"); - if(regulator_tp ==NULL) + if(IS_ERR(regulator_tp)) { printk("!!!!%s:%d:get regulator_tp failed\n",__func__,__LINE__); return 0; @@ -2567,14 +2569,13 @@ static int goodix_ts_probe(struct i2c_client *client, const struct i2c_device_id struct device_node *np = client->dev.of_node; enum of_gpio_flags rst_flags, pwr_flags; u32 val; - printk("___%s() start____ \n", __func__); + printk("%s() start\n", __func__); GTP_DEBUG_FUNC(); //do NOT remove these logs GTP_INFO("GTP Driver Version: %s", GTP_DRIVER_VERSION); - GTP_INFO("GTP Driver Built@%s, %s", __TIME__, __DATE__); GTP_INFO("GTP I2C Address: 0x%02x", client->addr); i2c_connect_client = client; -- 2.34.1