From 9370bb92b2d16684ee45cf24e879c93c509162da Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Thu, 19 Dec 2024 01:47:39 +0000 Subject: [PATCH] add wifi6 8852be driver --- kernel/drivers/input/touchscreen/gsl3673_800x1280.c | 62 +++++++++++++++++++++++++----- 1 files changed, 51 insertions(+), 11 deletions(-) diff --git a/kernel/drivers/input/touchscreen/gsl3673_800x1280.c b/kernel/drivers/input/touchscreen/gsl3673_800x1280.c index 1910290..da97d92 100644 --- a/kernel/drivers/input/touchscreen/gsl3673_800x1280.c +++ b/kernel/drivers/input/touchscreen/gsl3673_800x1280.c @@ -28,6 +28,7 @@ #include "tp_suspend.h" #include <linux/of_gpio.h> #define GSL_DEBUG 0 +#define GSL9XX_VDDIO_1800 #define TP2680A_ID 0x88 #define TP2680B_ID 0x82 @@ -59,9 +60,10 @@ #include "gsl3680_tab106.h" #define TP_SIZE_1366X768 #define Y_POL -#elif defined(CONFIG_TOUCHSCREEN_GSL3673_800X1280) +#elif IS_ENABLED(CONFIG_TOUCHSCREEN_GSL3673_800X1280) #define TP_SIZE_800X1280 - #include "gsl3673_800x1280.h" + #include "rochkchip_gslX680_8inch_800x1280_tg806_10.h" +// #include "gsl3673_800x1280.h" #else #include "gsl3680b_zm97f.h" #define HAVE_TOUCH_KEY @@ -103,7 +105,7 @@ #define GSL_STATUS_REG 0xe0 #define GSL_PAGE_REG 0xf0 -#define TPD_PROC_DEBUG +//#define TPD_PROC_DEBUG #ifdef TPD_PROC_DEBUG #include <linux/proc_fs.h> #include <linux/uaccess.h> @@ -206,6 +208,7 @@ struct tp_device tp; struct work_struct download_fw_work; struct work_struct resume_work; + struct delayed_work delayed_work_init; }; #if GSL_DEBUG @@ -400,6 +403,29 @@ return rc; } +static void gsl_io_control(struct i2c_client *client) +{ +#ifdef GSL9XX_VDDIO_1800 + u8 buf[4] = {0}; + int i; + + for (i = 0; i < 5; i++) { + buf[0] = 0; + buf[1] = 0; + buf[2] = 0xfe; + buf[3] = 0x1; + gsl_ts_write(client, 0xf0, buf, 4); + buf[0] = 0x5; + buf[1] = 0; + buf[2] = 0; + buf[3] = 0x80; + gsl_ts_write(client, 0x78, buf, 4); + usleep_range(5*1000, 5*1100); + } + usleep_range(50*1000, 50*1100); +#endif +} + static void startup_chip(struct i2c_client *client) { u8 tmp = 0x00; @@ -409,6 +435,7 @@ #endif gsl_ts_write(client, 0xe0, &tmp, 1); mdelay(5); + gsl_io_control(client); } static void reset_chip(struct i2c_client *client) @@ -459,6 +486,20 @@ } schedule_work(&ts->download_fw_work); return 0; +} + +static void gsl_delayed_work_init(struct work_struct *work) +{ + struct delayed_work *dwork = to_delayed_work(work); + struct gsl_ts *gsl3673_ts = container_of(dwork, struct gsl_ts, + delayed_work_init); + int rc; + + rc = init_chip(gsl3673_ts->client); + if (rc < 0) { + dev_err(&gsl3673_ts->client->dev, "gsl_probe: init_chip failed\n"); + cancel_work_sync(&gsl3673_ts->download_fw_work); + } } static int check_mem_data(struct i2c_client *client) @@ -1158,20 +1199,19 @@ #endif INIT_WORK(&ts->download_fw_work, gsl_download_fw_work); INIT_WORK(&ts->resume_work, gsl_resume_work); + INIT_DELAYED_WORK(&ts->delayed_work_init, gsl_delayed_work_init); - rc = init_chip(ts->client); - if (rc < 0) { - dev_err(&client->dev, "gsl_probe: init_chip failed\n"); - goto error_init_chip_fail; - } spin_lock_init(&ts->irq_lock); client->irq = gpio_to_irq(ts->irq); rc = devm_request_irq(&client->dev, client->irq, gsl_ts_irq, IRQF_TRIGGER_RISING, client->name, ts); if (rc < 0) { dev_err(&client->dev, "gsl_probe: request irq failed\n"); - return rc; + goto error_mutex_destroy; } + + schedule_delayed_work(&ts->delayed_work_init, + msecs_to_jiffies(800)); #ifdef GSL_MONITOR INIT_DELAYED_WORK(&gsl_monitor_work, gsl_monitor_worker); gsl_monitor_workqueue = create_singlethread_workqueue @@ -1183,8 +1223,6 @@ gsl_proc_flag = 0; #endif return 0; -error_init_chip_fail: - cancel_work_sync(&ts->download_fw_work); error_mutex_destroy: tp_unregister_fb(&ts->tp); return rc; @@ -1198,9 +1236,11 @@ cancel_delayed_work_sync(&gsl_monitor_work); destroy_workqueue(gsl_monitor_workqueue); #endif + tp_unregister_fb(&ts->tp); device_init_wakeup(&client->dev, 0); cancel_work_sync(&ts->work); destroy_workqueue(ts->wq); + cancel_delayed_work_sync(&ts->delayed_work_init); cancel_work_sync(&ts->download_fw_work); return 0; } -- Gitblit v1.6.2