armbian_build/patch/kernel/archive/sunxi-6.6/patches.megous/input-cyttsp4-Make-the-driver-not-hog-the-system-s-workqueue.patch
Gunjan Gupta d1186b8a0e kernel: sunxi: Add patches for 6.6 kernel
I have changed the way the patches are generated a bit. Instead of using orange-pi branch from megous tree for 6.6 kernel, I have used the following kernel branches

	a83t-suspend, af8133j, anx, audio,
	axp, cam, drm, err, fixes, mbus,
	modem, opi3, pb, pinetab, pp, ppkb,
	samuel, speed, tbs-a711, ths

These branches were carefully chosen to include only allwinner related patches and remove importing of the rockchip related patches into the allwinner kernel.

Following patches are modified to fix patch application failure
- patches.armbian/arm64-dts-sun50i-h616-orangepi-zero2-reg_usb1_vbus-status-ok.patch
- patches.armbian/arm64-dts-sun50i-h616-orangepi-zero2-Enable-GPU-mali.patch
- patches.armbian/arm64-dts-allwinner-h616-Add-efuse_xlate-cpu-frequency-scaling-v1_6_2.patch
- patches.armbian/arm64-dts-allwinner-h616-LED-green_power_on-red_status_heartbeat.patch
- patches.armbian/arm64-dts-allwinner-overlay-Add-Overlays-for-sunxi64.patch
- patches.armbian/arm64-dts-sun50i-h616-bigtreetech-cb1.patch

Following patches are modified because of kernel api change to fix compilation failure
- patches.armbian/drv-gpu-drm-sun4i-Add-HDMI-audio-sun4i-hdmi-encoder.patch
- patches.armbian/drv-of-Device-Tree-Overlay-ConfigFS-interface.patch
2023-10-30 22:58:11 +05:30

106 lines
3.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Mon, 14 Oct 2019 18:00:32 +0200
Subject: input: cyttsp4: Make the driver not hog the system's workqueue
The driver's work items can take 100's of ms, use a separate
thread for this.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/input/touchscreen/cyttsp4_core.c | 20 +++++++---
drivers/input/touchscreen/cyttsp4_core.h | 3 +-
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c
index b8f100d7bbea..cb235f560439 100644
--- a/drivers/input/touchscreen/cyttsp4_core.c
+++ b/drivers/input/touchscreen/cyttsp4_core.c
@@ -720,7 +720,7 @@ static void cyttsp4_queue_startup_(struct cyttsp4 *cd)
{
if (cd->startup_state == STARTUP_NONE) {
cd->startup_state = STARTUP_QUEUED;
- schedule_work(&cd->startup_work);
+ queue_work(cd->wq, &cd->startup_work);
dev_dbg(cd->dev, "%s: cyttsp4_startup queued\n", __func__);
} else {
dev_dbg(cd->dev, "%s: startup_state = %d\n", __func__,
@@ -1236,9 +1236,7 @@ static void cyttsp4_watchdog_timer(struct timer_list *t)
dev_vdbg(cd->dev, "%s: Watchdog timer triggered\n", __func__);
- schedule_work(&cd->watchdog_work);
-
- return;
+ queue_work(cd->wq, &cd->watchdog_work);
}
static int cyttsp4_request_exclusive(struct cyttsp4 *cd, void *ownptr,
@@ -2047,6 +2045,13 @@ struct cyttsp4 *cyttsp4_probe(const struct cyttsp4_bus_ops *ops,
goto error_disable_vdd;
}
+ cd->wq = alloc_workqueue("cyttsp4", WQ_SYSFS, 0);
+ if (!cd->wq) {
+ rc = -ENOMEM;
+ dev_err(dev, "failed to allocate workqueue\n");
+ goto error_disable_vdd;
+ }
+
/* Initialize device info */
cd->dev = dev;
cd->bus_ops = ops;
@@ -2070,7 +2075,7 @@ struct cyttsp4 *cyttsp4_probe(const struct cyttsp4_bus_ops *ops,
if (rc) {
dev_err(cd->dev, "failed to request IRQ %d, err: %d\n",
cd->irq, rc);
- goto error_disable_vdd;
+ goto error_free_wq;
}
/* Setup watchdog timer */
@@ -2104,6 +2109,8 @@ struct cyttsp4 *cyttsp4_probe(const struct cyttsp4_bus_ops *ops,
cyttsp4_stop_wd_timer(cd);
pm_runtime_disable(dev);
cyttsp4_free_si_ptrs(cd);
+error_free_wq:
+ destroy_workqueue(cd->wq);
error_disable_vdd:
gpiod_set_value_cansleep(cd->reset_gpio, 1);
gpiod_set_value_cansleep(cd->power_gpio, 0);
@@ -2131,8 +2138,9 @@ int cyttsp4_remove(struct cyttsp4 *cd)
pm_runtime_suspend(dev);
pm_runtime_disable(dev);
- cancel_work_sync(&cd->startup_work);
cyttsp4_stop_wd_timer(cd);
+ cancel_work_sync(&cd->startup_work);
+ destroy_workqueue(cd->wq);
cyttsp4_free_si_ptrs(cd);
return 0;
}
diff --git a/drivers/input/touchscreen/cyttsp4_core.h b/drivers/input/touchscreen/cyttsp4_core.h
index cff547979b28..ac2d7b303f39 100644
--- a/drivers/input/touchscreen/cyttsp4_core.h
+++ b/drivers/input/touchscreen/cyttsp4_core.h
@@ -62,7 +62,7 @@ enum cyttsp_cmd_bits {
};
/* Timeout in ms. */
-#define CY_WATCHDOG_TIMEOUT 1000
+#define CY_WATCHDOG_TIMEOUT 10000
#define CY_MAX_PRINT_SIZE 512
#ifdef VERBOSE_DEBUG
@@ -316,6 +316,7 @@ struct cyttsp4 {
enum cyttsp4_startup_state startup_state;
int int_status;
wait_queue_head_t wait_q;
+ struct workqueue_struct *wq;
int irq;
struct work_struct startup_work;
struct work_struct watchdog_work;
--
Armbian