From 859f51409148c7f61ffab7f2ed98e11395e2cc4e Mon Sep 17 00:00:00 2001 From: "Ivan.li" Date: Thu, 30 Mar 2023 09:02:24 +0800 Subject: [PATCH 1/2] fixup! drivers: amlogic: VIM3: TP: Added 10inch GT9xx driver support Signed-off-by: Ivan.li Change-Id: If9e81eefc2a1493189129127a050ca91711c230e --- arch/arm64/boot/dts/amlogic/kvim3_linux.dts | 2 +- .../amlogic/input/touchscreen/gt9xx/gt9xx.c | 42 +++++++++---------- .../amlogic/input/touchscreen/gt9xx/gt9xx.h | 4 +- .../input/touchscreen/gt9xx/gt9xx_update.c | 28 ++++++------- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/arch/arm64/boot/dts/amlogic/kvim3_linux.dts b/arch/arm64/boot/dts/amlogic/kvim3_linux.dts index 57c8ef90ceb94..49407949fe0f9 100644 --- a/arch/arm64/boot/dts/amlogic/kvim3_linux.dts +++ b/arch/arm64/boot/dts/amlogic/kvim3_linux.dts @@ -887,7 +887,7 @@ compatible = "goodix,gt9xx"; status = "okay"; reg = <0x5d>; - reset_pin = <6>; + reset-gpio = <&gpio_expander 6 GPIO_ACTIVE_HIGH>; tp-size = <89>; rotation = <1>; goodix,cfg-group0 = [ diff --git a/drivers/amlogic/input/touchscreen/gt9xx/gt9xx.c b/drivers/amlogic/input/touchscreen/gt9xx/gt9xx.c index 18c9bef0c1707..c794b9e7b23f3 100644 --- a/drivers/amlogic/input/touchscreen/gt9xx/gt9xx.c +++ b/drivers/amlogic/input/touchscreen/gt9xx/gt9xx.c @@ -30,7 +30,7 @@ static const char *goodix_input_phys = "input/ts"; static struct workqueue_struct *goodix_wq; struct i2c_client * i2c_connect_client = NULL; int gtp_rst_gpio; -int gtp_int_gpio; +//int gtp_int_gpio; static u32 rotation; u8 config[GTP_CONFIG_MAX_LENGTH + GTP_ADDR_LENGTH] = {GTP_REG_CONFIG_DATA >> 8, GTP_REG_CONFIG_DATA & 0xff}; @@ -1072,9 +1072,9 @@ static irqreturn_t goodix_ts_irq_handler(int irq, void *dev_id) *******************************************************/ void gtp_int_sync(s32 ms) { - GTP_GPIO_OUTPUT(gtp_int_gpio, 0); + //GTP_GPIO_OUTPUT(gtp_int_gpio, 0); msleep(ms); - GTP_GPIO_AS_INT(gtp_int_gpio); + //GTP_GPIO_AS_INT(gtp_int_gpio); } @@ -1097,7 +1097,7 @@ void gtp_reset_guitar(struct i2c_client *client, s32 ms) GTP_GPIO_OUTPUT(gtp_rst_gpio, 0); // begin select I2C slave addr msleep(ms); // T2: > 10ms // HIGH: 0x28/0x29, LOW: 0xBA/0xBB - GTP_GPIO_OUTPUT(gtp_int_gpio, client->addr == 0x14); + //GTP_GPIO_OUTPUT(gtp_int_gpio, client->addr == 0x14); msleep(2); // T3: > 100us GTP_GPIO_OUTPUT(gtp_rst_gpio, 1); @@ -1204,7 +1204,7 @@ static s8 gtp_enter_sleep(struct goodix_ts_data * ts) } #endif - GTP_GPIO_OUTPUT(gtp_int_gpio, 0); + //GTP_GPIO_OUTPUT(gtp_int_gpio, 0); msleep(5); while(retry++ < 5) @@ -1243,7 +1243,7 @@ static s8 gtp_wakeup_sleep(struct goodix_ts_data * ts) { u8 opr_buf[3] = {0x41, 0x80}; - GTP_GPIO_OUTPUT(gtp_int_gpio, 1); + //GTP_GPIO_OUTPUT(gtp_int_gpio, 1); msleep(5); for (retry = 0; retry < 10; ++retry) @@ -1317,7 +1317,7 @@ static s8 gtp_wakeup_sleep(struct goodix_ts_data * ts) gtp_irq_enable(ts); #else - GTP_GPIO_OUTPUT(gtp_int_gpio, 1); + //GTP_GPIO_OUTPUT(gtp_int_gpio, 1); msleep(5); #endif @@ -1735,7 +1735,7 @@ static s8 gtp_i2c_test(struct i2c_client *client) Executive outcomes. >= 0: succeed, < 0: failed *******************************************************/ -static s8 gtp_request_io_port(struct goodix_ts_data *ts) +/*static s8 gtp_request_io_port(struct goodix_ts_data *ts) { s32 ret = 0; @@ -1762,7 +1762,7 @@ static s8 gtp_request_io_port(struct goodix_ts_data *ts) gtp_reset_guitar(ts->client, 20); return 0; -} +}*/ /******************************************************* Function: @@ -1789,8 +1789,8 @@ static s8 gtp_request_irq(struct goodix_ts_data *ts) if (ret) { GTP_ERROR("Request IRQ failed!ERRNO:%d.", ret); - GTP_GPIO_AS_INPUT(gtp_int_gpio); - GTP_GPIO_FREE(gtp_int_gpio); + //GTP_GPIO_AS_INPUT(gtp_int_gpio); + //GTP_GPIO_FREE(gtp_int_gpio); hrtimer_init(&ts->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); ts->timer.function = goodix_ts_timer_handler; @@ -2334,7 +2334,7 @@ static void gtp_parse_dt(struct device *dev) u32 temp_val; int ret = 0; - gtp_int_gpio = of_get_named_gpio(np, "irq-gpio", 0); + //gtp_int_gpio = of_get_named_gpio(np, "irq-gpio", 0); gtp_rst_gpio = of_get_named_gpio(np, "reset-gpio", 0); ret = of_property_read_u32(np, "rotation", &temp_val); @@ -2486,8 +2486,8 @@ static int goodix_ts_probe(struct i2c_client *client, const struct i2c_device_id goto err_power_switch; } #else /* use gpio defined in gt9xx.h */ - gtp_rst_gpio = GTP_RST_PORT; - gtp_int_gpio = GTP_INT_PORT; + //gtp_rst_gpio = GTP_RST_PORT; + //gtp_int_gpio = GTP_INT_PORT; #endif INIT_WORK(&ts->work, goodix_ts_work_func); @@ -2502,12 +2502,12 @@ static int goodix_ts_probe(struct i2c_client *client, const struct i2c_device_id #endif i2c_set_clientdata(client, ts); ts->gtp_rawdiff_mode = 0; - ret = gtp_request_io_port(ts); + /*ret = gtp_request_io_port(ts); if (ret < 0) { GTP_ERROR("GTP request IO port failed."); goto err_request_io_port; - } + }*/ #if GTP_COMPATIBLE_MODE gtp_get_chip_type(ts); @@ -2606,9 +2606,9 @@ static int goodix_ts_probe(struct i2c_client *client, const struct i2c_device_id gtp_esd_switch(client, SWITCH_OFF); #endif err_chip_init: - GTP_GPIO_FREE(gtp_int_gpio); - GTP_GPIO_FREE(gtp_rst_gpio); -err_request_io_port: + //GTP_GPIO_FREE(gtp_int_gpio); + //GTP_GPIO_FREE(gtp_rst_gpio); +//err_request_io_port: #ifdef GTP_CONFIG_OF gtp_power_switch(client, 0); err_power_switch: @@ -2655,8 +2655,8 @@ static int goodix_ts_remove(struct i2c_client *client) { if (ts->use_irq) { - GTP_GPIO_AS_INPUT(gtp_int_gpio); - GTP_GPIO_FREE(gtp_int_gpio); + //GTP_GPIO_AS_INPUT(gtp_int_gpio); + //GTP_GPIO_FREE(gtp_int_gpio); free_irq(client->irq, ts); } else diff --git a/drivers/amlogic/input/touchscreen/gt9xx/gt9xx.h b/drivers/amlogic/input/touchscreen/gt9xx/gt9xx.h index abb8fd32f929b..c341e853bd11f 100644 --- a/drivers/amlogic/input/touchscreen/gt9xx/gt9xx.h +++ b/drivers/amlogic/input/touchscreen/gt9xx/gt9xx.h @@ -73,9 +73,9 @@ #define GTP_GESTURE_WAKEUP 1 // gesture wakeup -#define GTP_DEBUG_ON 1 +#define GTP_DEBUG_ON 0 #define GTP_DEBUG_ARRAY_ON 1 -#define GTP_DEBUG_FUNC_ON 1 +#define GTP_DEBUG_FUNC_ON 0 #if GTP_COMPATIBLE_MODE typedef enum diff --git a/drivers/amlogic/input/touchscreen/gt9xx/gt9xx_update.c b/drivers/amlogic/input/touchscreen/gt9xx/gt9xx_update.c index fdcdcc7539b4f..35c8b9d1b6eb6 100644 --- a/drivers/amlogic/input/touchscreen/gt9xx/gt9xx_update.c +++ b/drivers/amlogic/input/touchscreen/gt9xx/gt9xx_update.c @@ -476,7 +476,7 @@ s32 gup_enter_update_mode(struct i2c_client *client) msleep(2); //step2:select I2C slave addr,INT:0--0xBA;1--0x28. - GTP_GPIO_OUTPUT(gtp_int_gpio, (client->addr == 0x14)); + //GTP_GPIO_OUTPUT(gtp_int_gpio, (client->addr == 0x14)); msleep(2); //step3:RST output high reset guitar @@ -523,7 +523,7 @@ s32 gup_enter_update_mode(struct i2c_client *client) void gup_leave_update_mode(void) { - GTP_GPIO_AS_INT(gtp_int_gpio); + //GTP_GPIO_AS_INT(gtp_int_gpio); GTP_DEBUG("[leave_update_mode]reset chip."); gtp_reset_guitar(i2c_connect_client, 20); @@ -2831,21 +2831,21 @@ void gup_output_pulse(int t) unsigned long flags; //s32 i; - GTP_GPIO_OUTPUT(gtp_int_gpio, 0); + //GTP_GPIO_OUTPUT(gtp_int_gpio, 0); msleep(10); local_irq_save(flags); - GTP_GPIO_OUTPUT(gtp_int_gpio, 1); + //GTP_GPIO_OUTPUT(gtp_int_gpio, 1); msleep(50); - GTP_GPIO_OUTPUT(gtp_int_gpio, 0); + //GTP_GPIO_OUTPUT(gtp_int_gpio, 0); msleep(t - 50); - GTP_GPIO_OUTPUT(gtp_int_gpio, 1); + //GTP_GPIO_OUTPUT(gtp_int_gpio, 1); local_irq_restore(flags); msleep(20); - GTP_GPIO_OUTPUT(gtp_int_gpio, 0); + //GTP_GPIO_OUTPUT(gtp_int_gpio, 0); } static void gup_sys_clk_init(void) @@ -2906,7 +2906,7 @@ s32 gup_clk_calibration(void) gup_sys_clk_init(); gup_clk_calibration_pin_select(1);//use GIO1 to do the calibration - GTP_GPIO_OUTPUT(gtp_int_gpio, 0); + //GTP_GPIO_OUTPUT(gtp_int_gpio, 0); ts = i2c_get_clientdata(i2c_connect_client); @@ -2933,25 +2933,25 @@ s32 gup_clk_calibration(void) } #else - GTP_GPIO_OUTPUT(gtp_int_gpio, 0); + //GTP_GPIO_OUTPUT(gtp_int_gpio, 0); //local_irq_save(flags); do_gettimeofday(&start); - GTP_GPIO_OUTPUT(gtp_int_gpio, 1); + //GTP_GPIO_OUTPUT(gtp_int_gpio, 1); //local_irq_restore(flags); msleep(1); - GTP_GPIO_OUTPUT(gtp_int_gpio, 0); + //GTP_GPIO_OUTPUT(gtp_int_gpio, 0); msleep(1); //local_irq_save(flags); do_gettimeofday(&end); - GTP_GPIO_OUTPUT(gtp_int_gpio, 1); + //GTP_GPIO_OUTPUT(gtp_int_gpio, 1); //local_irq_restore(flags); count = gup_clk_count_get(); msleep(20); - GTP_GPIO_OUTPUT(gtp_int_gpio, 0); + //GTP_GPIO_OUTPUT(gtp_int_gpio, 0); usec = end.tv_usec - start.tv_usec; sec = end.tv_sec - start.tv_sec; @@ -2990,7 +2990,7 @@ s32 gup_clk_calibration(void) i2c_write_bytes(i2c_connect_client, 0x41F9, &buf, 1); #endif - GTP_GPIO_AS_INT(gtp_int_gpio); + //GTP_GPIO_AS_INT(gtp_int_gpio); return i; } From af987b076af0a04997177b95a584767a1b97b053 Mon Sep 17 00:00:00 2001 From: "Ivan.li" Date: Thu, 30 Mar 2023 10:36:24 +0800 Subject: [PATCH 2/2] arm64: dts: VIM3L: Added ts101 touch support Signed-off-by: Ivan.li Change-Id: Ibfc40943cefb838a8fdc7079e9222e0fb8d9704f --- arch/arm64/boot/dts/amlogic/kvim3l_linux.dts | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/kvim3l_linux.dts b/arch/arm64/boot/dts/amlogic/kvim3l_linux.dts index 1355c48eafdc6..5608663397ce9 100644 --- a/arch/arm64/boot/dts/amlogic/kvim3l_linux.dts +++ b/arch/arm64/boot/dts/amlogic/kvim3l_linux.dts @@ -1059,6 +1059,33 @@ status = "okay"; }; + gt9xx@5d { + compatible = "goodix,gt9xx"; + status = "okay"; + reg = <0x5d>; + reset-gpio = <&gpio_expander 6 GPIO_ACTIVE_HIGH>; + tp-size = <89>; + rotation = <1>; + goodix,cfg-group0 = [ + 41 80 07 B0 04 0A 3D 00 01 08 28 + 05 64 50 03 05 00 00 00 00 23 13 + 00 17 19 1C 13 90 30 AA 17 15 31 + 0D 00 00 01 9B 03 24 00 00 00 00 + 00 00 00 00 00 00 00 0F 23 94 D5 + 02 07 00 00 04 A3 10 00 8C 13 00 + 7B 16 00 69 1B 00 5B 20 00 5B 00 + 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 01 04 05 06 07 08 09 0C + 0D 0E 0F 10 11 14 15 16 17 18 19 + FF FF FF FF FF FF FF FF FF FF 00 + 02 04 06 07 08 0A 0C 0D 0E 0F 10 + 11 12 13 14 19 1B 1C 1E 1F 20 21 + 22 23 24 25 26 27 28 29 2A FF FF + FF FF FF FF FF FF FF FF 6F 01]; + }; + bq25703:bq25703@6b { compatible = "bq25703"; reg = <0x6b>;