From: Luka Panio <lukapanio@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Henrik Rydberg <rydberg@bitmath.org>,
Douglas Anderson <dianders@chromium.org>,
linux-input@vger.kernel.org, devicetree@vger.kernel.org,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Luka Panio <lukapanio@gmail.com>
Subject: [PATCH 3/7] Input: edt-ft5x06 - add an optional controller boot hook
Date: Sat, 17 Oct 2026 16:07:51 +0200 [thread overview]
Message-ID: <20261017140827.290666-4-lukapanio@gmail.com> (raw)
In-Reply-To: <20261017140827.290666-1-lukapanio@gmail.com>
Some FocalTech TDDI controllers have no flash and run their firmware
from RAM, which is lost whenever the controller is reset or powered
down. Allow the chip data to provide a boot callback that is run right
after the controller is taken out of reset, both at probe time before
the controller is identified and when resuming from the power-off sleep
mode before the register settings are restored.
The boot ROM of these controllers only accepts commands shortly after
reset, so skip the 300 ms settle delay for them and pass the reset GPIO
to the callback, letting it restart the boot ROM when it retries.
Signed-off-by: Luka Panio <lukapanio@gmail.com>
---
drivers/input/touchscreen/edt-ft5x06.c | 25 +++++++++++++++++++++++--
drivers/input/touchscreen/edt-ft5x06.h | 2 ++
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index 536d633d97a7..e57611e48217 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -148,6 +148,7 @@ struct edt_ft5x06_ts_data {
struct edt_reg_addr reg_addr;
enum edt_ver version;
+ int (*boot)(struct device *dev, struct gpio_desc *reset_gpio);
unsigned int crc_errors;
unsigned int header_errors;
};
@@ -1131,7 +1132,16 @@ static int edt_ft5x06_ts_init_hw(struct edt_ft5x06_ts_data *tsdata)
if (tsdata->reset_gpio) {
usleep_range(5000, 6000);
gpiod_set_value_cansleep(tsdata->reset_gpio, 0);
- msleep(300);
+ /* Controllers with a boot callback handle their own timing */
+ if (!tsdata->boot)
+ msleep(300);
+ }
+
+ if (tsdata->boot) {
+ error = tsdata->boot(dev, tsdata->reset_gpio);
+ if (error)
+ return dev_err_probe(dev, error,
+ "failed to boot the controller\n");
}
error = edt_ft5x06_ts_identify(tsdata);
@@ -1233,6 +1243,7 @@ int edt_ft5x06_probe(struct device *dev, struct regmap *regmap, int irq,
}
tsdata->max_support_points = chip_data->max_support_points;
+ tsdata->boot = chip_data->boot;
tsdata->vcc = devm_regulator_get(dev, "vcc");
if (IS_ERR(tsdata->vcc))
@@ -1437,7 +1448,17 @@ static int edt_ft5x06_ts_resume(struct device *dev)
usleep_range(1000, 2000);
gpiod_set_value_cansleep(reset_gpio, 0);
- msleep(300);
+
+ if (tsdata->boot) {
+ ret = tsdata->boot(dev, reset_gpio);
+ if (ret) {
+ dev_err(dev, "Failed to boot the controller: %d\n",
+ ret);
+ return ret;
+ }
+ } else {
+ msleep(300);
+ }
edt_ft5x06_restore_reg_parameters(tsdata);
enable_irq(tsdata->irq);
diff --git a/drivers/input/touchscreen/edt-ft5x06.h b/drivers/input/touchscreen/edt-ft5x06.h
index deadc756cd74..7eaeb562d11f 100644
--- a/drivers/input/touchscreen/edt-ft5x06.h
+++ b/drivers/input/touchscreen/edt-ft5x06.h
@@ -13,10 +13,12 @@ struct attribute_group;
struct dentry;
struct dev_pm_ops;
struct device;
+struct gpio_desc;
struct regmap;
struct edt_ft5x06_chip_data {
int max_support_points;
+ int (*boot)(struct device *dev, struct gpio_desc *reset_gpio);
};
int edt_ft5x06_probe(struct device *dev, struct regmap *regmap, int irq,
--
2.55.0
next prev parent reply other threads:[~2026-10-17 14:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-17 14:07 [PATCH 0/7] Input: edt-ft5x06 - add SPI transport and FocalTech FT8722 support Luka Panio
2026-10-17 14:07 ` [PATCH 1/7] Input: edt-ft5x06 - split the bus independent core from the I2C driver Luka Panio
2026-10-17 14:07 ` [PATCH 2/7] Input: edt-ft5x06 - move the controller bring-up into a helper Luka Panio
2026-10-17 14:16 ` sashiko-bot
2026-10-17 14:07 ` Luka Panio [this message]
2026-10-17 14:07 ` [PATCH 4/7] Input: edt-ft5x06 - allow a chip specific touch data register Luka Panio
2026-10-17 14:07 ` [PATCH 5/7] dt-bindings: input: touchscreen: edt-ft5x06: Add FocalTech FT8722 Luka Panio
2026-10-17 14:07 ` [PATCH 6/7] Input: edt-ft5x06 - add SPI transport and FT8722 support Luka Panio
2026-10-17 14:29 ` sashiko-bot
2026-10-17 14:07 ` [PATCH 7/7] Input: edt-ft5x06 - support following a DRM panel Luka Panio
2026-10-17 14:30 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261017140827.290666-4-lukapanio@gmail.com \
--to=lukapanio@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dianders@chromium.org \
--cc=dmitry.torokhov@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=krzk+dt@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=rydberg@bitmath.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox