From ee196714997bf9a90aed830529b1e1732de02349 Mon Sep 17 00:00:00 2001 From: Frederic Meeuwissen <13856291+Frederic98@users.noreply.github.com> Date: Tue, 21 Jul 2026 16:34:16 +0200 Subject: [PATCH 1/3] [EMB-486] Add support for goodix touchscreen controller - Include goodix driver in kernel (not as a module) - Add the chip in a new device tree node - Remove ulticontroller 4.1 (NGP is now back on the standard 4.0 version) - Add polling support from upstream linux --- configs/sx8m_defconfig | 2 +- debian/postinst | 7 +- dts/ulticontroller4.0-lvds-1024x600.dts | 7 ++ dts/ulticontroller4.1-lvds-1024x600.dts | 13 --- patches/0005-Add-polled-touch-goodix.patch | 102 +++++++++++++++++++++ 5 files changed, 111 insertions(+), 20 deletions(-) delete mode 100644 dts/ulticontroller4.1-lvds-1024x600.dts create mode 100644 patches/0005-Add-polled-touch-goodix.patch diff --git a/configs/sx8m_defconfig b/configs/sx8m_defconfig index 2905247d..3ffd617a 100644 --- a/configs/sx8m_defconfig +++ b/configs/sx8m_defconfig @@ -399,7 +399,7 @@ CONFIG_KEYBOARD_CROS_EC=y CONFIG_INPUT_TOUCHSCREEN=y CONFIG_TOUCHSCREEN_ATMEL_MXT=m CONFIG_TOUCHSCREEN_EXC3000=m -CONFIG_TOUCHSCREEN_GOODIX=m +CONFIG_TOUCHSCREEN_GOODIX=y CONFIG_TOUCHSCREEN_EDT_FT5X06=m CONFIG_TOUCHSCREEN_FTS=m CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_I2C=m diff --git a/debian/postinst b/debian/postinst index 28460d5c..84bbcf8d 100755 --- a/debian/postinst +++ b/debian/postinst @@ -10,7 +10,6 @@ ARTNUM_FILE="/etc/ultimaker_firmware" TARGET_DTS="cgtsx8m-ultimain5.dtb" UC32_DTS="ulticontroller3.2-lvds-800x320.dtb" UC4_DTS="ulticontroller4.0-lvds-1024x600.dtb" -UC4_INV_DTS="ulticontroller4.1-lvds-1024x600.dtb" if [ "$1" = "configure" ]; then # During the bootstrap configuration stage, if the kernel is configured @@ -26,14 +25,10 @@ if [ "$1" = "configure" ]; then echo "-> Setting Ulticontroller 3.2 LVDS device tree." ln -sf "${UC32_DTS}" "/boot/${TARGET_DTS}" ;; - 227380 | 105*) + 227380 | 105* | 109*) echo "-> Setting Ulticontroller 4.0 LVDS device tree." ln -sf "${UC4_DTS}" "/boot/${TARGET_DTS}" ;; - 109*) - echo "-> Setting Ulticontroller 4.0 LVDS Inverted device tree." - ln -sf "${UC4_INV_DTS}" "/boot/${TARGET_DTS}" - ;; # Fallback to the larger screen *) echo "-> Falling back to Ulticontroller 4.0 LVDS device tree." diff --git a/dts/ulticontroller4.0-lvds-1024x600.dts b/dts/ulticontroller4.0-lvds-1024x600.dts index 6a927c17..a583d75d 100644 --- a/dts/ulticontroller4.0-lvds-1024x600.dts +++ b/dts/ulticontroller4.0-lvds-1024x600.dts @@ -38,6 +38,13 @@ touchscreen-inverted-x; touchscreen-inverted-y; }; + panel_touchscreen_ngp: gt928@5d { + compatible = "goodix,gt911"; + reg = <0x5d>; + reset-gpios = <&panel_gpio 3 GPIO_ACTIVE_LOW>; + touchscreen-size-x = <1024>; + touchscreen-size-y = <600>; + }; panel_gpio: pca9536@41 { compatible = "nxp,pca9536"; diff --git a/dts/ulticontroller4.1-lvds-1024x600.dts b/dts/ulticontroller4.1-lvds-1024x600.dts deleted file mode 100644 index 2d0352ba..00000000 --- a/dts/ulticontroller4.1-lvds-1024x600.dts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (C) 2020 - Ultimaker B.V. - * Copyright (C) 2020 - Raymond Siudak -*/ - -#include "ulticontroller4.0-lvds-1024x600.dts" - -&i2c2 { - panel_touchscreen: ft5426@38 { - /delete-property/ touchscreen-inverted-x; - /delete-property/ touchscreen-inverted-y; - }; -}; \ No newline at end of file diff --git a/patches/0005-Add-polled-touch-goodix.patch b/patches/0005-Add-polled-touch-goodix.patch new file mode 100644 index 00000000..fc2cf3f5 --- /dev/null +++ b/patches/0005-Add-polled-touch-goodix.patch @@ -0,0 +1,102 @@ +diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c +index a3e8a51c914495..252dcae039f8d5 100644 +--- a/drivers/input/touchscreen/goodix.c ++++ b/drivers/input/touchscreen/goodix.c +@@ -44,9 +44,11 @@ + #define GOODIX_HAVE_KEY BIT(4) + #define GOODIX_BUFFER_STATUS_TIMEOUT 20 + +-#define RESOLUTION_LOC 1 +-#define MAX_CONTACTS_LOC 5 +-#define TRIGGER_LOC 6 ++#define RESOLUTION_LOC 1 ++#define MAX_CONTACTS_LOC 5 ++#define TRIGGER_LOC 6 ++ ++#define GOODIX_POLL_INTERVAL_MS 17 /* 17ms = 60fps */ + + /* Our special handling for GPIO accesses through ACPI is x86 specific */ + #if defined CONFIG_X86 && defined CONFIG_ACPI +@@ -497,6 +499,14 @@ static void goodix_process_events(struct goodix_ts_data *ts) + input_sync(ts->input_dev); + } + ++static void goodix_ts_work_i2c_poll(struct input_dev *input) ++{ ++ struct goodix_ts_data *ts = input_get_drvdata(input); ++ ++ goodix_process_events(ts); ++ goodix_i2c_write_u8(ts->client, GOODIX_READ_COOR_ADDR, 0); ++} ++ + /** + * goodix_ts_irq_handler - The IRQ handler + * +@@ -513,13 +523,29 @@ static irqreturn_t goodix_ts_irq_handler(int irq, void *dev_id) + return IRQ_HANDLED; + } + ++static void goodix_enable_irq(struct goodix_ts_data *ts) ++{ ++ if (ts->client->irq) ++ enable_irq(ts->client->irq); ++} ++ ++static void goodix_disable_irq(struct goodix_ts_data *ts) ++{ ++ if (ts->client->irq) ++ disable_irq(ts->client->irq); ++} ++ + static void goodix_free_irq(struct goodix_ts_data *ts) + { +- devm_free_irq(&ts->client->dev, ts->client->irq, ts); ++ if (ts->client->irq) ++ devm_free_irq(&ts->client->dev, ts->client->irq, ts); + } + + static int goodix_request_irq(struct goodix_ts_data *ts) + { ++ if (!ts->client->irq) ++ return 0; ++ + return devm_request_threaded_irq(&ts->client->dev, ts->client->irq, + NULL, goodix_ts_irq_handler, + ts->irq_flags, ts->client->name, ts); +@@ -1219,6 +1245,18 @@ static int goodix_configure_dev(struct goodix_ts_data *ts) + return error; + } + ++ input_set_drvdata(ts->input_dev, ts); ++ ++ if (!ts->client->irq) { ++ error = input_setup_polling(ts->input_dev, goodix_ts_work_i2c_poll); ++ if (error) { ++ dev_err(&ts->client->dev, ++ "could not set up polling mode, %d\n", error); ++ return error; ++ } ++ input_set_poll_interval(ts->input_dev, GOODIX_POLL_INTERVAL_MS); ++ } ++ + error = input_register_device(ts->input_dev); + if (error) { + dev_err(&ts->client->dev, +@@ -1422,7 +1460,7 @@ static int goodix_suspend(struct device *dev) + + /* We need gpio pins to suspend/resume */ + if (ts->irq_pin_access_method == IRQ_PIN_ACCESS_NONE) { +- disable_irq(client->irq); ++ goodix_disable_irq(ts); + return 0; + } + +@@ -1466,7 +1504,7 @@ static int goodix_resume(struct device *dev) + int error; + + if (ts->irq_pin_access_method == IRQ_PIN_ACCESS_NONE) { +- enable_irq(client->irq); ++ goodix_enable_irq(ts); + return 0; + } + From ac80ee3b12c3be9bde2996e342edb0c951b0247a Mon Sep 17 00:00:00 2001 From: Frederic Meeuwissen <13856291+Frederic98@users.noreply.github.com> Date: Wed, 22 Jul 2026 10:40:42 +0200 Subject: [PATCH 2/3] [EMB-486] Update documentation --- dts/Readme.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dts/Readme.md b/dts/Readme.md index 093a70f4..0aba9cfd 100644 --- a/dts/Readme.md +++ b/dts/Readme.md @@ -2,8 +2,7 @@ We have 3 device trees, one for each display currently supported by **Ultimainboard 5**: -- *Ulticontroller 4.1-lvds-1024x600.dts (NGP Protos): `ulticontroller4.1-lvds-1024x600.dts` -- *Ulticontroller 4.0 at 1024x600 (Factor 4, Falcon): `ulticontroller4.0-lvds-1024x600.dts` +- *Ulticontroller 4.0 at 1024x600 (Factor 4, Factor 4+, NGP): `ulticontroller4.0-lvds-1024x600.dts` - *Ultricontroller 3.2 LVDS* at 800x600 (S6 and S8): `ulticontroller3.2-lvds-800x320.dts` Both device trees sources includes the Ultimainboard 5 device tree: `ultimainboard5-lvds.dtsi`. From 980c855862f60d287189e43965d0767c959bedfe Mon Sep 17 00:00:00 2001 From: Frederic Meeuwissen <13856291+Frederic98@users.noreply.github.com> Date: Wed, 22 Jul 2026 10:41:02 +0200 Subject: [PATCH 3/3] [EMB-486] Update linux submodule --- linux | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux b/linux index 5d357fe6..e7cecd60 160000 --- a/linux +++ b/linux @@ -1 +1 @@ -Subproject commit 5d357fe6adf1d853f7a883da0794dd7fca5090d4 +Subproject commit e7cecd607603652008304fc8283f26297d2a78bf