[PATCH 7/7] Input: novatek-nvt-ts - add no-flash firmware download

From: Qianhui Xu

Date: Tue Dec 01 2026 - 19:32:49 EST


Controllers without on-board flash come out of reset with nothing but a
bootloader, so the host has to upload the image before they report touches.
The image is a container of up to 32 partitions, each with a file offset, a
SRAM address, a length and a CRC of the loaded data. Upload it whenever the
controller is powered up, as a no-flash part loses the firmware on power
down: identify the silicon, reset the bootloader, put the CRCs in the
checksum banks, push the partitions into SRAM in 15 KiB chunks, then assert
BOOT_RDY and wait for the reset state and the firmware info to come back.

firmware-name is optional and the image is not shipped with the kernel.
Without it the controller is used as is, which leaves a no-flash part quiet
but keeps the flash based ones working. The image seen so far is 253952
bytes in 4 partitions.

Signed-off-by: Qianhui Xu <xiaqinghuan@xxxxxxxxxxxxxxxx>
---
.../input/touchscreen/novatek,nvt-ts.yaml | 9 +-
drivers/input/touchscreen/Kconfig | 1 +
.../input/touchscreen/novatek-nvt-ts-core.c | 537 +++++++++++++++++-
.../input/touchscreen/novatek-nvt-ts-spi.c | 9 +
drivers/input/touchscreen/novatek-nvt-ts.h | 5 +
5 files changed, 559 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/input/touchscreen/novatek,nvt-ts.yaml b/Documentation/devicetree/bindings/input/touchscreen/novatek,nvt-ts.yaml
index 4b6b05397fee3..0911e780d16fd 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/novatek,nvt-ts.yaml
+++ b/Documentation/devicetree/bindings/input/touchscreen/novatek,nvt-ts.yaml
@@ -32,6 +32,12 @@ properties:
vcc-supply: true
iovcc-supply: true

+ firmware-name:
+ description:
+ Firmware file uploaded by the host at open time. Needed by the
+ controllers that have no on-board flash, optional otherwise, and the
+ file itself is not distributed with the kernel.
+
required:
- compatible
- reg
@@ -69,13 +75,14 @@ examples:
#size-cells = <0>;

touchscreen@0 {
- compatible = "novatek,nt36672a-ts";
+ compatible = "novatek,nt36536-ts";
reg = <0>;
spi-max-frequency = <4000000>;
interrupts-extended = <&tlmm 31 IRQ_TYPE_EDGE_RISING>;
reset-gpios = <&tlmm 32 GPIO_ACTIVE_LOW>;
vcc-supply = <&vreg_l22a_2p85>;
iovcc-supply = <&vreg_l14a_1p8>;
+ firmware-name = "novatek/nt36536-fw.bin";
touchscreen-size-x = <1080>;
touchscreen-size-y = <2246>;
};
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 9a276729a1630..2b7866a1a4fc3 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -693,6 +693,7 @@ config TOUCHSCREEN_MTOUCH

config TOUCHSCREEN_NOVATEK_NVT_TS_CORE
tristate
+ select FW_LOADER

config TOUCHSCREEN_NOVATEK_NVT_TS
tristate "Novatek NT11205 touchscreen support"
diff --git a/drivers/input/touchscreen/novatek-nvt-ts-core.c b/drivers/input/touchscreen/novatek-nvt-ts-core.c
index 4303d0901c91d..4d374235b2bfb 100644
--- a/drivers/input/touchscreen/novatek-nvt-ts-core.c
+++ b/drivers/input/touchscreen/novatek-nvt-ts-core.c
@@ -10,11 +10,13 @@
*/

#include <linux/delay.h>
+#include <linux/firmware.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/input/mt.h>
#include <linux/module.h>
#include <linux/property.h>
+#include <linux/slab.h>

#include <linux/unaligned.h>

@@ -32,6 +34,12 @@ static int nvt_ts_read_data(struct nvt_ts_data *data, u8 reg, u8 *buf, size_t co
return data->bus_ops->read(data, reg, buf, count);
}

+static int nvt_ts_write_data(struct nvt_ts_data *data, const u8 *buf,
+ size_t count)
+{
+ return data->bus_ops->write(data, buf, count);
+}
+
/*
* NT11205/NT36672A packet: one record per touch slot, 6 bytes each, 12 bit
* coordinates packed as x = b[1] << 4 | b[3] >> 4, y = b[2] << 4 | b[3] & 0xf.
@@ -158,6 +166,505 @@ static irqreturn_t nvt_ts_irq(int irq, void *dev_id)
return IRQ_HANDLED;
}

+/*
+ * NT36xxx firmware download
+ *
+ * The no-flash parts come out of reset with nothing but a bootloader; the host
+ * has to upload the image into SRAM and start it. The image is a container of
+ * partitions, each with a file offset, a SRAM address, a length and a CRC of
+ * the data the bootloader ends up with.
+ */
+#define NVT_TS_FW_XFER_LEN 15360
+#define NVT_TS_FW_MAX_PARTITIONS 32
+#define NVT_TS_FW_END_FLAG_LEN 3
+#define NVT_TS_FW_PID 0x6097
+
+#define NVT_TS_FW_ENG_RESET_ADDR 0x7fff80
+#define NVT_TS_FW_TRIM_ADDR 0x1fb104
+#define NVT_TS_FW_BOOTLOADER_RST_ADDR 0x1fb43e
+#define NVT_TS_FW_BOOT_RDY_ADDR 0x1fb50d
+#define NVT_TS_FW_AUTO_COPY_ADDR 0x1fc825
+#define NVT_TS_FW_CASCADE_STRAP_ADDR 0x1fb12c
+#define NVT_TS_FW_ILM_DES_ADDR 0x1fcc30
+#define NVT_TS_FW_ILM_LENGTH_ADDR 0x1fcc34
+#define NVT_TS_FW_ILM_CRC_ADDR 0x1fcc38
+#define NVT_TS_FW_DLM_DES_ADDR 0x1fcc40
+#define NVT_TS_FW_DLM_LENGTH_ADDR 0x1fcc44
+#define NVT_TS_FW_DLM_CRC_ADDR 0x1fcc48
+#define NVT_TS_FW_EVENT_BUF_ADDR 0x130900
+
+#define NVT_TS_FW_EVENT_HOST_CMD 0x50
+#define NVT_TS_FW_EVENT_RESET_DONE 0x60
+#define NVT_TS_FW_EVENT_INFO 0x78
+#define NVT_TS_FW_RESET_STATE_MIN 0xa0
+#define NVT_TS_FW_RESET_STATE_MAX 0xaf
+
+struct nvt_ts_fw_partition {
+ u32 file_offs;
+ u32 sram_addr;
+ u32 size;
+ u32 crc;
+};
+
+static int nvt_ts_fw_set_page(struct nvt_ts_data *data, u32 addr)
+{
+ u8 buf[] = { 0xff, (addr >> 15) & 0xff, (addr >> 7) & 0xff };
+
+ return nvt_ts_write_data(data, buf, sizeof(buf));
+}
+
+static int nvt_ts_fw_write_byte(struct nvt_ts_data *data, u32 addr, u8 value)
+{
+ u8 buf[] = { (addr & 0x7f) | BIT(7), value };
+ int error;
+
+ error = nvt_ts_fw_set_page(data, addr);
+ if (error)
+ return error;
+
+ return nvt_ts_write_data(data, buf, sizeof(buf));
+}
+
+static int nvt_ts_fw_write_value(struct nvt_ts_data *data, u32 addr, u32 value,
+ unsigned int size)
+{
+ u8 buf[] = {
+ (addr & 0x7f) | BIT(7),
+ value & 0xff,
+ (value >> 8) & 0xff,
+ (value >> 16) & 0xff,
+ (value >> 24) & 0xff,
+ };
+ int error;
+
+ error = nvt_ts_fw_set_page(data, addr);
+ if (error)
+ return error;
+
+ return nvt_ts_write_data(data, buf, size + 1);
+}
+
+static int nvt_ts_fw_read_block(struct nvt_ts_data *data, u32 addr, u8 *buf,
+ size_t count)
+{
+ int error;
+
+ error = nvt_ts_fw_set_page(data, addr);
+ if (error)
+ return error;
+
+ return nvt_ts_read_data(data, addr & 0x7f, buf, count);
+}
+
+static int nvt_ts_fw_bootloader_reset(struct nvt_ts_data *data)
+{
+ int error;
+
+ error = nvt_ts_fw_write_byte(data, NVT_TS_FW_BOOTLOADER_RST_ADDR, 0x69);
+ if (error)
+ return error;
+
+ usleep_range(5000, 5500);
+
+ return 0;
+}
+
+static int nvt_ts_fw_identify(struct nvt_ts_data *data)
+{
+ u8 trim[7] = { (NVT_TS_FW_TRIM_ADDR & 0x7f) | BIT(7) };
+ u8 strap;
+ int error;
+
+ error = nvt_ts_fw_write_byte(data, NVT_TS_FW_ENG_RESET_ADDR, 0x5a);
+ if (error)
+ return error;
+
+ usleep_range(11000, 11500);
+
+ error = nvt_ts_fw_bootloader_reset(data);
+ if (error)
+ return error;
+
+ /* The bootloader latches the trim read address from a write */
+ error = nvt_ts_fw_set_page(data, NVT_TS_FW_TRIM_ADDR);
+ if (error)
+ return error;
+
+ error = nvt_ts_write_data(data, trim, sizeof(trim));
+ if (error)
+ return error;
+
+ error = nvt_ts_read_data(data, NVT_TS_FW_TRIM_ADDR & 0x7f, trim + 1,
+ sizeof(trim) - 1);
+ if (error)
+ return error;
+
+ dev_dbg(data->dev, "trim ID %*ph\n", (int)sizeof(trim) - 1, trim + 1);
+ /* The firmware image is only valid for this silicon */
+ if (trim[1] != 0x15 || trim[4] != 0x23 ||
+ trim[5] != 0x65 || trim[6] != 0x03)
+ return -ENODEV;
+
+ error = nvt_ts_fw_read_block(data, NVT_TS_FW_CASCADE_STRAP_ADDR, &strap,
+ 1);
+ if (error)
+ return error;
+
+ dev_dbg(data->dev, "cascade strap %02x\n", strap);
+
+ return 0;
+}
+
+static int nvt_ts_fw_add_partition(const struct firmware *fw,
+ struct nvt_ts_fw_partition *partitions,
+ unsigned int *num_partitions, u32 file_offs,
+ u32 sram_addr, u32 size, u32 crc)
+{
+ struct nvt_ts_fw_partition *partition;
+
+ if (!size)
+ return 0;
+ if (*num_partitions >= NVT_TS_FW_MAX_PARTITIONS)
+ return -E2BIG;
+ if (file_offs >= fw->size || size >= fw->size - file_offs)
+ return -EINVAL;
+ if (sram_addr > 0x7fffff || size > 0x7fffff - sram_addr)
+ return -EINVAL;
+
+ partition = &partitions[(*num_partitions)++];
+ partition->file_offs = file_offs;
+ partition->sram_addr = sram_addr;
+ partition->size = size;
+ partition->crc = crc;
+
+ return 0;
+}
+
+/*
+ * The image starts with a header that ends at the file offset stored in its
+ * first word, followed by the second header of a cascade pair. The end of the
+ * first header is marked by the only descriptor with a non-zero destination
+ * and a zero length.
+ */
+static int nvt_ts_fw_parse(const struct firmware *fw,
+ struct nvt_ts_fw_partition *partitions,
+ unsigned int *num_partitions, bool *cascade)
+{
+ const u8 *data = fw->data;
+ u32 header_end, limit, pos;
+ u32 file_offs, sram_addr, size, crc;
+ unsigned int i;
+ int error;
+
+ if (fw->size < 4096 ||
+ memcmp(data + fw->size - NVT_TS_FW_END_FLAG_LEN, "NVT",
+ NVT_TS_FW_END_FLAG_LEN))
+ return -EINVAL;
+ if (data[fw->size - 4096] + data[fw->size - 4095] != 0xff)
+ return -EINVAL;
+
+ header_end = get_unaligned_le32(data);
+ if (header_end < 0x30 || header_end > fw->size || header_end % 16)
+ return -EINVAL;
+
+ /* Overlay images need a separate DLM header parser */
+ if (data[0x28] & BIT(4))
+ return -EOPNOTSUPP;
+
+ *cascade = !!(data[0x20] & BIT(1));
+ if (*cascade && (data[0x29] & BIT(0)))
+ return -EOPNOTSUPP;
+
+ *num_partitions = 0;
+
+ limit = header_end;
+ for (pos = 0x30; pos <= header_end - 0x10; pos += 0x10) {
+ if (get_unaligned_le32(data + pos + 4) &&
+ !get_unaligned_le32(data + pos + 8)) {
+ limit = pos + 0x10;
+ break;
+ }
+ }
+ if (*cascade && limit > header_end / 2)
+ return -EINVAL;
+
+ for (i = 0; i < 2; i++) {
+ pos = i * 12;
+ file_offs = get_unaligned_le32(data + pos);
+ sram_addr = get_unaligned_le32(data + pos + 4);
+ size = get_unaligned_le32(data + pos + 8);
+ crc = get_unaligned_le32(data + 0x18 + i * 4);
+ if (!size)
+ return -EINVAL;
+
+ error = nvt_ts_fw_add_partition(fw, partitions, num_partitions,
+ file_offs, sram_addr, size, crc);
+ if (error)
+ return error;
+ }
+
+ for (pos = 0x30; pos <= limit - 0x10; pos += 0x10) {
+ sram_addr = get_unaligned_le32(data + pos);
+ size = get_unaligned_le32(data + pos + 4);
+ file_offs = get_unaligned_le32(data + pos + 8);
+ crc = get_unaligned_le32(data + pos + 12);
+
+ error = nvt_ts_fw_add_partition(fw, partitions, num_partitions,
+ file_offs, sram_addr, size, crc);
+ if (error)
+ return error;
+ }
+
+ if (*cascade) {
+ pos = 2 * limit - 0x10;
+ sram_addr = get_unaligned_le32(data + pos);
+ size = get_unaligned_le32(data + pos + 4);
+ file_offs = get_unaligned_le32(data + pos + 8);
+ crc = get_unaligned_le32(data + pos + 12);
+ if (!size || file_offs != limit)
+ return -EINVAL;
+
+ error = nvt_ts_fw_add_partition(fw, partitions, num_partitions,
+ file_offs, sram_addr, size, crc);
+ if (error)
+ return error;
+ }
+
+ return *num_partitions >= 2 ? 0 : -EINVAL;
+}
+
+static int nvt_ts_fw_write_partition(struct nvt_ts_data *data,
+ const struct firmware *fw,
+ const struct nvt_ts_fw_partition *partition,
+ u8 *xfer)
+{
+ size_t remaining = partition->size;
+ u32 file_offs = partition->file_offs;
+ u32 sram_addr = partition->sram_addr;
+ int error;
+
+ while (remaining) {
+ size_t len = min_t(size_t, remaining, NVT_TS_FW_XFER_LEN);
+
+ error = nvt_ts_fw_set_page(data, sram_addr);
+ if (error)
+ return error;
+
+ xfer[0] = (sram_addr & 0x7f) | BIT(7);
+ memcpy(xfer + 1, fw->data + file_offs, len);
+
+ error = nvt_ts_write_data(data, xfer, len + 1);
+ if (error)
+ return error;
+
+ sram_addr += len;
+ file_offs += len;
+ remaining -= len;
+ }
+
+ return 0;
+}
+
+static int nvt_ts_fw_set_crc_banks(struct nvt_ts_data *data,
+ const struct nvt_ts_fw_partition *partitions)
+{
+ int error;
+
+ error = nvt_ts_fw_write_value(data, NVT_TS_FW_ILM_DES_ADDR,
+ partitions[0].sram_addr, 3);
+ if (error)
+ return error;
+
+ error = nvt_ts_fw_write_value(data, NVT_TS_FW_ILM_LENGTH_ADDR,
+ partitions[0].size, 3);
+ if (error)
+ return error;
+
+ error = nvt_ts_fw_write_value(data, NVT_TS_FW_ILM_CRC_ADDR,
+ partitions[0].crc, 4);
+ if (error)
+ return error;
+
+ error = nvt_ts_fw_write_value(data, NVT_TS_FW_DLM_DES_ADDR,
+ partitions[1].sram_addr, 3);
+ if (error)
+ return error;
+
+ error = nvt_ts_fw_write_value(data, NVT_TS_FW_DLM_LENGTH_ADDR,
+ partitions[1].size, 3);
+ if (error)
+ return error;
+
+ return nvt_ts_fw_write_value(data, NVT_TS_FW_DLM_CRC_ADDR,
+ partitions[1].crc, 4);
+}
+
+static int nvt_ts_fw_wait_auto_copy(struct nvt_ts_data *data)
+{
+ u8 status;
+ int error, retry;
+
+ for (retry = 0; retry < 200; retry++) {
+ error = nvt_ts_fw_read_block(data, NVT_TS_FW_AUTO_COPY_ADDR,
+ &status, 1);
+ if (error)
+ return error;
+ if (!status)
+ return 0;
+
+ usleep_range(1000, 1500);
+ }
+
+ dev_err(data->dev, "auto-copy timed out, status %02x\n", status);
+
+ return -ETIMEDOUT;
+}
+
+static int nvt_ts_fw_wait_reset(struct nvt_ts_data *data)
+{
+ u8 state[5];
+ int error, retry;
+
+ for (retry = 0; retry < 100; retry++) {
+ usleep_range(10000, 11000);
+ error = nvt_ts_fw_read_block(data,
+ NVT_TS_FW_EVENT_BUF_ADDR |
+ NVT_TS_FW_EVENT_RESET_DONE,
+ state, sizeof(state));
+ if (error)
+ return error;
+ if (state[0] >= NVT_TS_FW_RESET_STATE_MIN &&
+ state[0] <= NVT_TS_FW_RESET_STATE_MAX)
+ return 0;
+ }
+
+ dev_err(data->dev, "reset state timeout: %*ph\n", (int)sizeof(state),
+ state);
+
+ return -ETIMEDOUT;
+}
+
+static int nvt_ts_fw_check_info(struct nvt_ts_data *data)
+{
+ u8 info[38];
+ u16 pid;
+ int error;
+
+ error = nvt_ts_fw_read_block(data, NVT_TS_FW_EVENT_BUF_ADDR |
+ NVT_TS_FW_EVENT_INFO, info, sizeof(info));
+ if (error)
+ return error;
+
+ if (info[0] + info[1] != 0xff)
+ return -EIO;
+
+ pid = (info[35] << 8) | info[34];
+ dev_dbg(data->dev, "firmware %02x.%02x event protocol %02x PID %04x\n",
+ info[0], info[13], info[12], pid);
+
+ return pid == NVT_TS_FW_PID ? 0 : -ENODEV;
+}
+
+static int nvt_ts_fw_upload(struct nvt_ts_data *data,
+ const struct firmware *fw)
+{
+ struct nvt_ts_fw_partition partitions[NVT_TS_FW_MAX_PARTITIONS] = {};
+ unsigned int num_partitions, i;
+ u8 reset_done[7] = { NVT_TS_FW_EVENT_RESET_DONE | BIT(7) };
+ u8 host_cmd[] = { NVT_TS_FW_EVENT_HOST_CMD | BIT(7), 0xae, 0 };
+ u8 *xfer;
+ bool cascade;
+ int error;
+
+ error = nvt_ts_fw_parse(fw, partitions, &num_partitions, &cascade);
+ if (error)
+ return error;
+
+ xfer = kmalloc(NVT_TS_FW_XFER_LEN + 1, GFP_KERNEL);
+ if (!xfer)
+ return -ENOMEM;
+
+ error = nvt_ts_fw_identify(data);
+ if (error)
+ goto out_free;
+
+ error = nvt_ts_fw_bootloader_reset(data);
+ if (error)
+ goto out_free;
+
+ error = nvt_ts_fw_set_crc_banks(data, partitions);
+ if (error)
+ goto out_free;
+
+ if (cascade) {
+ error = nvt_ts_fw_write_byte(data, NVT_TS_FW_AUTO_COPY_ADDR, 0x56);
+ if (error)
+ goto out_free;
+ }
+
+ for (i = 0; i < num_partitions; i++) {
+ error = nvt_ts_fw_write_partition(data, fw, &partitions[i], xfer);
+ if (error)
+ goto out_free;
+ }
+
+ if (cascade) {
+ error = nvt_ts_fw_wait_auto_copy(data);
+ if (error)
+ goto out_free;
+ }
+
+ error = nvt_ts_fw_set_page(data, NVT_TS_FW_EVENT_BUF_ADDR);
+ if (error)
+ goto out_free;
+
+ /* Clear a pending reset event, then ask for the CRC check and boot */
+ error = nvt_ts_write_data(data, reset_done, sizeof(reset_done));
+ if (error)
+ goto out_free;
+
+ error = nvt_ts_write_data(data, host_cmd, sizeof(host_cmd));
+ if (error)
+ goto out_free;
+
+ error = nvt_ts_fw_write_byte(data, NVT_TS_FW_BOOT_RDY_ADDR, 1);
+ if (error)
+ goto out_free;
+
+ error = nvt_ts_fw_wait_reset(data);
+ if (error)
+ goto out_free;
+
+ error = nvt_ts_fw_check_info(data);
+
+out_free:
+ kfree(xfer);
+
+ return error;
+}
+
+static int nvt_ts_load_firmware(struct nvt_ts_data *data)
+{
+ const struct firmware *fw;
+ int error;
+
+ if (!data->firmware_name)
+ return 0;
+
+ error = request_firmware(&fw, data->firmware_name, data->dev);
+ if (error) {
+ dev_err(data->dev, "failed to load %s: %d\n",
+ data->firmware_name, error);
+ return error;
+ }
+
+ error = nvt_ts_fw_upload(data, fw);
+
+ release_firmware(fw);
+
+ return error;
+}
+
static int nvt_ts_start(struct input_dev *dev)
{
struct nvt_ts_data *data = input_get_drvdata(dev);
@@ -169,9 +676,23 @@ static int nvt_ts_start(struct input_dev *dev)
return error;
}

- enable_irq(data->irq);
gpiod_set_value_cansleep(data->reset_gpio, 0);

+ /*
+ * A controller without on-board flash only starts reporting touches
+ * once its firmware has been uploaded, and it loses the firmware when
+ * it is powered down again.
+ */
+ error = nvt_ts_load_firmware(data);
+ if (error) {
+ gpiod_set_value_cansleep(data->reset_gpio, 1);
+ regulator_bulk_disable(ARRAY_SIZE(data->regulators),
+ data->regulators);
+ return error;
+ }
+
+ enable_irq(data->irq);
+
return 0;
}

@@ -237,6 +758,20 @@ int nvt_ts_probe(struct device *dev, const struct nvt_ts_bus_ops *bus_ops,
data->chip = chip;
data->irq = irq;

+ /*
+ * firmware-name is optional: without it the controller is used as is,
+ * which leaves the no-flash parts without firmware and thus without
+ * touches, but keeps the flash based ones working.
+ */
+ error = device_property_read_string(dev, "firmware-name",
+ &data->firmware_name);
+ if (error) {
+ data->firmware_name = NULL;
+ } else if (!bus_ops->write) {
+ dev_err(dev, "firmware-name given, but this bus cannot write\n");
+ return -EOPNOTSUPP;
+ }
+
/*
* VCC is the analog voltage supply
* IOVCC is the digital voltage supply
diff --git a/drivers/input/touchscreen/novatek-nvt-ts-spi.c b/drivers/input/touchscreen/novatek-nvt-ts-spi.c
index c7b36e29cb983..5b878695f5ac7 100644
--- a/drivers/input/touchscreen/novatek-nvt-ts-spi.c
+++ b/drivers/input/touchscreen/novatek-nvt-ts-spi.c
@@ -28,8 +28,17 @@ static int nvt_ts_spi_read(struct nvt_ts_data *data, u8 reg, u8 *buf,
return spi_write_then_read(spi, cmd, sizeof(cmd), buf, count);
}

+static int nvt_ts_spi_write(struct nvt_ts_data *data, const u8 *buf,
+ size_t count)
+{
+ struct spi_device *spi = to_spi_device(data->dev);
+
+ return spi_write(spi, buf, count);
+}
+
static const struct nvt_ts_bus_ops nvt_ts_spi_bus_ops = {
.read = nvt_ts_spi_read,
+ .write = nvt_ts_spi_write,
};

static int nvt_ts_spi_probe(struct spi_device *spi)
diff --git a/drivers/input/touchscreen/novatek-nvt-ts.h b/drivers/input/touchscreen/novatek-nvt-ts.h
index 0c661fbd6377a..80fe85363c564 100644
--- a/drivers/input/touchscreen/novatek-nvt-ts.h
+++ b/drivers/input/touchscreen/novatek-nvt-ts.h
@@ -51,12 +51,16 @@ struct nvt_ts_data;
/**
* struct nvt_ts_bus_ops - transport specific operations
* @read: read @count bytes of the controller into @buf
+ * @write: write @count bytes from @buf, the first byte of @buf being the
+ * register address with bit 7 set; optional, only bus attachments
+ * that can upload firmware implement it
*
* The controller exposes a flat register space; transports differ only in
* how a register read is framed on the wire.
*/
struct nvt_ts_bus_ops {
int (*read)(struct nvt_ts_data *data, u8 reg, u8 *buf, size_t count);
+ int (*write)(struct nvt_ts_data *data, const u8 *buf, size_t count);
};

/**
@@ -81,6 +85,7 @@ struct nvt_ts_data {
struct gpio_desc *reset_gpio;
struct regulator_bulk_data regulators[2];
struct touchscreen_properties prop;
+ const char *firmware_name;
int max_touches;
u8 buf[NVT_TS_MAX_PACKET];
};
--
2.53.0