[PATCH 2/2] Input: goodix_berlin - Add support for Berlin-A series
The current implementation of the goodix_berlin driver lacks support for revisions A and B of the Berlin IC. This change adds support for the gt9897 IC, which is a Berlin-A revision part. The differences between revision D and A are rather minor, a handful of address changes and a slightly larger read buffer. They were taken from the driver published by Goodix, which does a few more things that don't appear to be necessary for the touchscreen to work properly. Signed-off-by: Jens Reidel --- drivers/input/touchscreen/goodix_berlin.h | 9 .../input/touchscreen/goodix_berlin_core.c| 27 +--- drivers/input/touchscreen/goodix_berlin_i2c.c | 6 ++- drivers/input/touchscreen/goodix_berlin_spi.c | 44 +++ 4 files changed, 72 insertions(+), 14 deletions(-) diff --git a/drivers/input/touchscreen/goodix_berlin.h b/drivers/input/touchscreen/goodix_berlin.h index 38b6f9ddbdef..a5232e58c166 100644 --- a/drivers/input/touchscreen/goodix_berlin.h +++ b/drivers/input/touchscreen/goodix_berlin.h @@ -12,6 +12,15 @@ #include +enum goodix_berlin_ic_type { + IC_TYPE_BERLIN_A, + IC_TYPE_BERLIN_D, +}; + +struct goodix_berlin_ic_data { + enum goodix_berlin_ic_type ic_type; +}; + struct device; struct input_id; struct regmap; diff --git a/drivers/input/touchscreen/goodix_berlin_core.c b/drivers/input/touchscreen/goodix_berlin_core.c index 3fc03cf0ca23..b892ab901d64 100644 --- a/drivers/input/touchscreen/goodix_berlin_core.c +++ b/drivers/input/touchscreen/goodix_berlin_core.c @@ -12,7 +12,7 @@ * to the previous generations. * * Currently the driver only handles Multitouch events with already - * programmed firmware and "config" for "Revision D" Berlin IC. + * programmed firmware and "config" for "Revision A/D" Berlin IC. * * Support is missing for: * - ESD Management @@ -20,7 +20,7 @@ * - "Config" update/flashing * - Stylus Events * - Gesture Events - * - Support for older revisions (A & B) + * - Support for revision B */ #include @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -54,9 +55,11 @@ #define GOODIX_BERLIN_DEV_CONFIRM_VAL 0xAA #define GOODIX_BERLIN_BOOTOPTION_ADDR 0x1 #define GOODIX_BERLIN_FW_VERSION_INFO_ADDR 0x10014 +#define GOODIX_BERLIN_FW_VERSION_INFO_ADDR_A 0x1000C #define GOODIX_BERLIN_IC_INFO_MAX_LEN SZ_1K #define GOODIX_BERLIN_IC_INFO_ADDR 0x10070 +#define GOODIX_BERLIN_IC_INFO_ADDR_A 0x10068 #define GOODIX_BERLIN_CHECKSUM_SIZEsizeof(u16) @@ -297,9 +300,16 @@ static void goodix_berlin_power_off(struct goodix_berlin_core *cd) static int goodix_berlin_read_version(struct goodix_berlin_core *cd) { + const struct goodix_berlin_ic_data *ic_data = of_device_get_match_data(cd->dev); + int fw_version_info_addr; int error; - error = regmap_raw_read(cd->regmap, GOODIX_BERLIN_FW_VERSION_INFO_ADDR, + if (ic_data->ic_type == IC_TYPE_BERLIN_A) + fw_version_info_addr = GOODIX_BERLIN_FW_VERSION_INFO_ADDR_A; + else + fw_version_info_addr = GOODIX_BERLIN_FW_VERSION_INFO_ADDR; + + error = regmap_raw_read(cd->regmap, fw_version_info_addr, &cd->fw_version, sizeof(cd->fw_version)); if (error) { dev_err(cd->dev, "error reading fw version, %d\n", error); @@ -358,16 +368,23 @@ static int goodix_berlin_parse_ic_info(struct goodix_berlin_core *cd, static int goodix_berlin_get_ic_info(struct goodix_berlin_core *cd) { + const struct goodix_berlin_ic_data *ic_data = of_device_get_match_data(cd->dev); u8 *afe_data __free(kfree) = NULL; __le16 length_raw; u16 length; + int ic_info_addr; int error; + if (ic_data->ic_type == IC_TYPE_BERLIN_A) + ic_info_addr = GOODIX_BERLIN_IC_INFO_ADDR_A; + else + ic_info_addr = GOODIX_BERLIN_IC_INFO_ADDR; + afe_data = kzalloc(GOODIX_BERLIN_IC_INFO_MAX_LEN, GFP_KERNEL); if (!afe_data) return -ENOMEM; - error = regmap_raw_read(cd->regmap, GOODIX_BERLIN_IC_INFO_ADDR, + error = regmap_raw_read(cd->regmap, ic_info_addr, &length_raw, sizeof(length_raw)); if (error) { dev_err(cd->dev, "failed get ic info length, %d\n", error); @@ -380,7 +397,7 @@ static int goodix_berlin_get_ic_info(struct goodix_berlin_core *cd) return -EINVAL; } - error = regmap_raw_read(cd->regmap, GOODIX_BERLIN_IC_INFO_ADDR, + error = regmap_raw_read(cd->regmap, ic_info_addr, afe_data, length); if (error) { dev_err(cd->dev, "failed get ic info data, %d\n", error)
[PATCH 1/2] dt-bindings: input: goodix,gt9916: Document gt9897 compatible
Document the Goodix GT9897 which is a Berlin-A series touchscreen controller IC by Goodix. Signed-off-by: Jens Reidel --- .../devicetree/bindings/input/touchscreen/goodix,gt9916.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix,gt9916.yaml b/Documentation/devicetree/bindings/input/touchscreen/goodix,gt9916.yaml index d90f045ac06c..c40d92b7f4af 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/goodix,gt9916.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/goodix,gt9916.yaml @@ -19,6 +19,7 @@ allOf: properties: compatible: enum: + - goodix,gt9897 - goodix,gt9916 reg: -- 2.48.1
[PATCH 0/2] Add Goodix Berlin-A series support
This series adds support for the Goodix Berlin-A series touch ICs (gt9897). This was tested on a Xiaomi 11 Lite 5G NE (xiaomi-lisa), which uses the gt9897 IC connected over SPI. I am not aware of any device that has gt9897 connected over I2C and therefore could not test it, so I didn't add a compatible in the I2C driver. To: Dmitry Torokhov To: Rob Herring To: Krzysztof Kozlowski To: Conor Dooley To: Bastien Nocera To: Hans de Goede To: Neil Armstrong Cc: Luca Weiss Cc: linux-in...@vger.kernel.org Cc: devicet...@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: phone-de...@vger.kernel.org Cc: li...@mainlining.org Cc: ~postmarketos/upstream...@lists.sr.ht Signed-off-by: Jens Reidel Jens Reidel (2): dt-bindings: input: goodix,gt9916: Document gt9897 compatible Input: goodix_berlin - Add support for Berlin-A series .../input/touchscreen/goodix,gt9916.yaml | 1 + drivers/input/touchscreen/goodix_berlin.h | 9 .../input/touchscreen/goodix_berlin_core.c| 27 +--- drivers/input/touchscreen/goodix_berlin_i2c.c | 6 ++- drivers/input/touchscreen/goodix_berlin_spi.c | 44 +++ 5 files changed, 73 insertions(+), 14 deletions(-) -- 2.48.1
[PATCH v2 2/2] Input: goodix_berlin - Add support for Berlin-A series
The current implementation of the goodix_berlin driver lacks support for revisions A and B of the Berlin IC. This change adds support for the gt9897 IC, which is a Berlin-A revision part. The differences between revision D and A are rather minor, a handful of address changes and a slightly larger read buffer. They were taken from the driver published by Goodix, which does a few more things that don't appear to be necessary for the touchscreen to work properly. Signed-off-by: Jens Reidel Tested-by: Luca Weiss --- drivers/input/touchscreen/goodix_berlin.h | 13 ++ .../input/touchscreen/goodix_berlin_core.c| 15 --- drivers/input/touchscreen/goodix_berlin_i2c.c | 9 +++- drivers/input/touchscreen/goodix_berlin_spi.c | 45 ++- 4 files changed, 61 insertions(+), 21 deletions(-) diff --git a/drivers/input/touchscreen/goodix_berlin.h b/drivers/input/touchscreen/goodix_berlin.h index 38b6f9ddbdef..b186a7fb3586 100644 --- a/drivers/input/touchscreen/goodix_berlin.h +++ b/drivers/input/touchscreen/goodix_berlin.h @@ -12,6 +12,19 @@ #include +#define GOODIX_BERLIN_FW_VERSION_INFO_ADDR_A 0x1000C +#define GOODIX_BERLIN_FW_VERSION_INFO_ADDR_D 0x10014 + +#define GOODIX_BERLIN_IC_INFO_ADDR_A 0x10068 +#define GOODIX_BERLIN_IC_INFO_ADDR_D 0x10070 + +struct goodix_berlin_ic_data { + int fw_version_info_addr; + int ic_info_addr; + ssize_t read_dummy_len; + ssize_t read_prefix_len; +}; + struct device; struct input_id; struct regmap; diff --git a/drivers/input/touchscreen/goodix_berlin_core.c b/drivers/input/touchscreen/goodix_berlin_core.c index 3fc03cf0ca23..f9fbde63ab52 100644 --- a/drivers/input/touchscreen/goodix_berlin_core.c +++ b/drivers/input/touchscreen/goodix_berlin_core.c @@ -12,7 +12,7 @@ * to the previous generations. * * Currently the driver only handles Multitouch events with already - * programmed firmware and "config" for "Revision D" Berlin IC. + * programmed firmware and "config" for "Revision A/D" Berlin IC. * * Support is missing for: * - ESD Management @@ -20,7 +20,7 @@ * - "Config" update/flashing * - Stylus Events * - Gesture Events - * - Support for older revisions (A & B) + * - Support for revision B */ #include @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -53,10 +54,8 @@ #define GOODIX_BERLIN_DEV_CONFIRM_VAL 0xAA #define GOODIX_BERLIN_BOOTOPTION_ADDR 0x1 -#define GOODIX_BERLIN_FW_VERSION_INFO_ADDR 0x10014 #define GOODIX_BERLIN_IC_INFO_MAX_LEN SZ_1K -#define GOODIX_BERLIN_IC_INFO_ADDR 0x10070 #define GOODIX_BERLIN_CHECKSUM_SIZEsizeof(u16) @@ -297,9 +296,10 @@ static void goodix_berlin_power_off(struct goodix_berlin_core *cd) static int goodix_berlin_read_version(struct goodix_berlin_core *cd) { + const struct goodix_berlin_ic_data *ic_data = device_get_match_data(cd->dev); int error; - error = regmap_raw_read(cd->regmap, GOODIX_BERLIN_FW_VERSION_INFO_ADDR, + error = regmap_raw_read(cd->regmap, ic_data->fw_version_info_addr, &cd->fw_version, sizeof(cd->fw_version)); if (error) { dev_err(cd->dev, "error reading fw version, %d\n", error); @@ -358,6 +358,7 @@ static int goodix_berlin_parse_ic_info(struct goodix_berlin_core *cd, static int goodix_berlin_get_ic_info(struct goodix_berlin_core *cd) { + const struct goodix_berlin_ic_data *ic_data = device_get_match_data(cd->dev); u8 *afe_data __free(kfree) = NULL; __le16 length_raw; u16 length; @@ -367,7 +368,7 @@ static int goodix_berlin_get_ic_info(struct goodix_berlin_core *cd) if (!afe_data) return -ENOMEM; - error = regmap_raw_read(cd->regmap, GOODIX_BERLIN_IC_INFO_ADDR, + error = regmap_raw_read(cd->regmap, ic_data->ic_info_addr, &length_raw, sizeof(length_raw)); if (error) { dev_err(cd->dev, "failed get ic info length, %d\n", error); @@ -380,7 +381,7 @@ static int goodix_berlin_get_ic_info(struct goodix_berlin_core *cd) return -EINVAL; } - error = regmap_raw_read(cd->regmap, GOODIX_BERLIN_IC_INFO_ADDR, + error = regmap_raw_read(cd->regmap, ic_data->ic_info_addr, afe_data, length); if (error) { dev_err(cd->dev, "failed get ic info data, %d\n", error); diff --git a/drivers/input/touchscreen/goodix_berlin_i2c.c b/drivers/input/touchscreen/goodix_berlin_i2c.c index ad7a60d94338..7db234c74db8 100644 --- a/drivers/input/touchscreen/goodix_berlin_i2c.c +++ b/drivers/input/touchscreen/goodix_berlin_i2c.c @@ -46,15 +46,20 @@ static int goodix_berlin_i2c_
[PATCH v2 1/2] dt-bindings: input: goodix,gt9916: Document gt9897 compatible
Document the Goodix GT9897 which is a Berlin-A series touchscreen controller IC by Goodix. Acked-by: Rob Herring (Arm) Signed-off-by: Jens Reidel --- .../devicetree/bindings/input/touchscreen/goodix,gt9916.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix,gt9916.yaml b/Documentation/devicetree/bindings/input/touchscreen/goodix,gt9916.yaml index d90f045ac06c..c40d92b7f4af 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/goodix,gt9916.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/goodix,gt9916.yaml @@ -19,6 +19,7 @@ allOf: properties: compatible: enum: + - goodix,gt9897 - goodix,gt9916 reg: -- 2.48.1
[PATCH v3 0/2] Add Goodix Berlin-A series support
This series adds support for the Goodix Berlin-A series touch ICs (gt9897). This was tested on a Xiaomi 11 Lite 5G NE (xiaomi-lisa), which uses the gt9897 IC connected over SPI. I am not aware of any device that has gt9897 connected over I2C and therefore could not test it, so I didn't add a compatible in the I2C driver. Changes in v3: - Store the ic data in the goodix_berlin_core struct and pass it to goodix_berlin_probe from the i2c/spi probes (requested by Neil) - Resent from my now preferred e-mail for kernel work Changes in v2: - Added Rob's A-b tag (patch no. 1) - Added Luca's T-b tag (patch no. 2) - Updated the i2c and spi device id tables with the driver data and switched to spi_get_device_match_data where possible (requested by Neil) - Switched to device_get_match_data in goodix_berlin_core.c - Move all revision specific addresses and other properties into the goodix_berlin_ic_data struct (requested by Dmitry) - Link to v1: https://lore.kernel.org/all/20250203174309.21574-1-adr...@travitia.xyz/ To: Dmitry Torokhov To: Rob Herring To: Krzysztof Kozlowski To: Conor Dooley To: Bastien Nocera To: Hans de Goede To: Neil Armstrong Cc: Luca Weiss Cc: linux-in...@vger.kernel.org Cc: devicet...@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: phone-de...@vger.kernel.org Cc: li...@mainlining.org Cc: ~postmarketos/upstream...@lists.sr.ht Signed-off-by: Jens Reidel Jens Reidel (2): dt-bindings: input: goodix,gt9916: Document gt9897 compatible Input: goodix_berlin - Add support for Berlin-A series .../input/touchscreen/goodix,gt9916.yaml | 1 + drivers/input/touchscreen/goodix_berlin.h | 16 ++- .../input/touchscreen/goodix_berlin_core.c| 21 drivers/input/touchscreen/goodix_berlin_i2c.c | 14 -- drivers/input/touchscreen/goodix_berlin_spi.c | 48 ++- 5 files changed, 74 insertions(+), 26 deletions(-) -- 2.48.1
[PATCH v3 1/2] dt-bindings: input: goodix,gt9916: Document gt9897 compatible
Document the Goodix GT9897 which is a Berlin-A series touchscreen controller IC by Goodix. Acked-by: Rob Herring (Arm) Signed-off-by: Jens Reidel --- .../devicetree/bindings/input/touchscreen/goodix,gt9916.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix,gt9916.yaml b/Documentation/devicetree/bindings/input/touchscreen/goodix,gt9916.yaml index d90f045ac06c..c40d92b7f4af 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/goodix,gt9916.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/goodix,gt9916.yaml @@ -19,6 +19,7 @@ allOf: properties: compatible: enum: + - goodix,gt9897 - goodix,gt9916 reg: -- 2.48.1
[PATCH v3 2/2] Input: goodix_berlin - Add support for Berlin-A series
The current implementation of the goodix_berlin driver lacks support for revisions A and B of the Berlin IC. This change adds support for the gt9897 IC, which is a Berlin-A revision part. The differences between revision D and A are rather minor, a handful of address changes and a slightly larger read buffer. They were taken from the driver published by Goodix, which does a few more things that don't appear to be necessary for the touchscreen to work properly. Tested-by: Luca Weiss Signed-off-by: Jens Reidel --- drivers/input/touchscreen/goodix_berlin.h | 16 ++- .../input/touchscreen/goodix_berlin_core.c| 21 drivers/input/touchscreen/goodix_berlin_i2c.c | 14 -- drivers/input/touchscreen/goodix_berlin_spi.c | 48 ++- 4 files changed, 73 insertions(+), 26 deletions(-) diff --git a/drivers/input/touchscreen/goodix_berlin.h b/drivers/input/touchscreen/goodix_berlin.h index 38b6f9ddbdef..d8bbd4853206 100644 --- a/drivers/input/touchscreen/goodix_berlin.h +++ b/drivers/input/touchscreen/goodix_berlin.h @@ -12,12 +12,26 @@ #include +#define GOODIX_BERLIN_FW_VERSION_INFO_ADDR_A 0x1000C +#define GOODIX_BERLIN_FW_VERSION_INFO_ADDR_D 0x10014 + +#define GOODIX_BERLIN_IC_INFO_ADDR_A 0x10068 +#define GOODIX_BERLIN_IC_INFO_ADDR_D 0x10070 + +struct goodix_berlin_ic_data { + int fw_version_info_addr; + int ic_info_addr; + ssize_t read_dummy_len; + ssize_t read_prefix_len; +}; + struct device; struct input_id; struct regmap; int goodix_berlin_probe(struct device *dev, int irq, const struct input_id *id, - struct regmap *regmap); + struct regmap *regmap, + const struct goodix_berlin_ic_data *ic_data); extern const struct dev_pm_ops goodix_berlin_pm_ops; extern const struct attribute_group *goodix_berlin_groups[]; diff --git a/drivers/input/touchscreen/goodix_berlin_core.c b/drivers/input/touchscreen/goodix_berlin_core.c index f7ea443b152e..02a1d9a465f2 100644 --- a/drivers/input/touchscreen/goodix_berlin_core.c +++ b/drivers/input/touchscreen/goodix_berlin_core.c @@ -12,7 +12,7 @@ * to the previous generations. * * Currently the driver only handles Multitouch events with already - * programmed firmware and "config" for "Revision D" Berlin IC. + * programmed firmware and "config" for "Revision A/D" Berlin IC. * * Support is missing for: * - ESD Management @@ -20,7 +20,7 @@ * - "Config" update/flashing * - Stylus Events * - Gesture Events - * - Support for older revisions (A & B) + * - Support for revision B */ #include @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -53,10 +54,8 @@ #define GOODIX_BERLIN_DEV_CONFIRM_VAL 0xAA #define GOODIX_BERLIN_BOOTOPTION_ADDR 0x1 -#define GOODIX_BERLIN_FW_VERSION_INFO_ADDR 0x10014 #define GOODIX_BERLIN_IC_INFO_MAX_LEN SZ_1K -#define GOODIX_BERLIN_IC_INFO_ADDR 0x10070 #define GOODIX_BERLIN_CHECKSUM_SIZEsizeof(u16) @@ -175,6 +174,8 @@ struct goodix_berlin_core { /* Runtime parameters extracted from IC_INFO buffer */ u32 touch_data_addr; + const struct goodix_berlin_ic_data *ic_data; + struct goodix_berlin_event event; }; @@ -299,7 +300,7 @@ static int goodix_berlin_read_version(struct goodix_berlin_core *cd) { int error; - error = regmap_raw_read(cd->regmap, GOODIX_BERLIN_FW_VERSION_INFO_ADDR, + error = regmap_raw_read(cd->regmap, cd->ic_data->fw_version_info_addr, &cd->fw_version, sizeof(cd->fw_version)); if (error) { dev_err(cd->dev, "error reading fw version, %d\n", error); @@ -367,7 +368,7 @@ static int goodix_berlin_get_ic_info(struct goodix_berlin_core *cd) if (!afe_data) return -ENOMEM; - error = regmap_raw_read(cd->regmap, GOODIX_BERLIN_IC_INFO_ADDR, + error = regmap_raw_read(cd->regmap, cd->ic_data->ic_info_addr, &length_raw, sizeof(length_raw)); if (error) { dev_err(cd->dev, "failed get ic info length, %d\n", error); @@ -380,8 +381,8 @@ static int goodix_berlin_get_ic_info(struct goodix_berlin_core *cd) return -EINVAL; } - error = regmap_raw_read(cd->regmap, GOODIX_BERLIN_IC_INFO_ADDR, - afe_data, length); + error = regmap_raw_read(cd->regmap, cd->ic_data->ic_info_addr, afe_data, + length); if (error) { dev_err(cd->dev, "failed get ic info data, %d\n", error); return error; @@ -716,7 +717,8 @@ const struct attribute_group *goodix_berlin_groups[] = { EXPORT_SYMBOL_GPL(goo
[PATCH v4 1/2] dt-bindings: input: goodix,gt9916: Document gt9897 compatible
Document the Goodix GT9897 which is a Berlin-A series touchscreen controller IC by Goodix. Acked-by: Rob Herring (Arm) Signed-off-by: Jens Reidel --- .../devicetree/bindings/input/touchscreen/goodix,gt9916.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix,gt9916.yaml b/Documentation/devicetree/bindings/input/touchscreen/goodix,gt9916.yaml index d90f045ac06c..c40d92b7f4af 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/goodix,gt9916.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/goodix,gt9916.yaml @@ -19,6 +19,7 @@ allOf: properties: compatible: enum: + - goodix,gt9897 - goodix,gt9916 reg: -- 2.48.1
[PATCH v4 0/2] Add Goodix Berlin-A series support
This series adds support for the Goodix Berlin-A series touch ICs (gt9897). This was tested on a Xiaomi 11 Lite 5G NE (xiaomi-lisa), which uses the gt9897 IC connected over SPI. I am not aware of any device that has gt9897 connected over I2C and therefore could not test it, so I didn't add a compatible in the I2C driver. Changes in v4: - Fix the build for the i2c driver - Add Neil's R-b tag (patch no. 2) - Link to v3: https://lore.kernel.org/all/20250307094823.478152-1-adr...@mainlining.org/ Changes in v3: - Store the ic data in the goodix_berlin_core struct and pass it to goodix_berlin_probe from the i2c/spi probes (requested by Neil) - Resent from my now preferred e-mail for kernel work - Link to v2: https://lore.kernel.org/all/20250214052959.222668-1-adr...@travitia.xyz/ Changes in v2: - Added Rob's A-b tag (patch no. 1) - Added Luca's T-b tag (patch no. 2) - Updated the i2c and spi device id tables with the driver data and switched to spi_get_device_match_data where possible (requested by Neil) - Switched to device_get_match_data in goodix_berlin_core.c - Move all revision specific addresses and other properties into the goodix_berlin_ic_data struct (requested by Dmitry) - Link to v1: https://lore.kernel.org/all/20250203174309.21574-1-adr...@travitia.xyz/ To: Dmitry Torokhov To: Rob Herring To: Krzysztof Kozlowski To: Conor Dooley To: Bastien Nocera To: Hans de Goede To: Neil Armstrong Cc: Luca Weiss Cc: linux-in...@vger.kernel.org Cc: devicet...@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: phone-de...@vger.kernel.org Cc: li...@mainlining.org Cc: ~postmarketos/upstream...@lists.sr.ht Signed-off-by: Jens Reidel Jens Reidel (2): dt-bindings: input: goodix,gt9916: Document gt9897 compatible Input: goodix_berlin - Add support for Berlin-A series .../input/touchscreen/goodix,gt9916.yaml | 1 + drivers/input/touchscreen/goodix_berlin.h | 16 ++- .../input/touchscreen/goodix_berlin_core.c| 21 drivers/input/touchscreen/goodix_berlin_i2c.c | 14 -- drivers/input/touchscreen/goodix_berlin_spi.c | 48 ++- 5 files changed, 74 insertions(+), 26 deletions(-) -- 2.48.1
[PATCH v4 2/2] Input: goodix_berlin - Add support for Berlin-A series
The current implementation of the goodix_berlin driver lacks support for revisions A and B of the Berlin IC. This change adds support for the gt9897 IC, which is a Berlin-A revision part. The differences between revision D and A are rather minor, a handful of address changes and a slightly larger read buffer. They were taken from the driver published by Goodix, which does a few more things that don't appear to be necessary for the touchscreen to work properly. Reviewed-by: Neil Armstrong Tested-by: Luca Weiss Signed-off-by: Jens Reidel --- drivers/input/touchscreen/goodix_berlin.h | 16 ++- .../input/touchscreen/goodix_berlin_core.c| 21 drivers/input/touchscreen/goodix_berlin_i2c.c | 14 -- drivers/input/touchscreen/goodix_berlin_spi.c | 48 ++- 4 files changed, 73 insertions(+), 26 deletions(-) diff --git a/drivers/input/touchscreen/goodix_berlin.h b/drivers/input/touchscreen/goodix_berlin.h index 38b6f9ddbdef..d8bbd4853206 100644 --- a/drivers/input/touchscreen/goodix_berlin.h +++ b/drivers/input/touchscreen/goodix_berlin.h @@ -12,12 +12,26 @@ #include +#define GOODIX_BERLIN_FW_VERSION_INFO_ADDR_A 0x1000C +#define GOODIX_BERLIN_FW_VERSION_INFO_ADDR_D 0x10014 + +#define GOODIX_BERLIN_IC_INFO_ADDR_A 0x10068 +#define GOODIX_BERLIN_IC_INFO_ADDR_D 0x10070 + +struct goodix_berlin_ic_data { + int fw_version_info_addr; + int ic_info_addr; + ssize_t read_dummy_len; + ssize_t read_prefix_len; +}; + struct device; struct input_id; struct regmap; int goodix_berlin_probe(struct device *dev, int irq, const struct input_id *id, - struct regmap *regmap); + struct regmap *regmap, + const struct goodix_berlin_ic_data *ic_data); extern const struct dev_pm_ops goodix_berlin_pm_ops; extern const struct attribute_group *goodix_berlin_groups[]; diff --git a/drivers/input/touchscreen/goodix_berlin_core.c b/drivers/input/touchscreen/goodix_berlin_core.c index f7ea443b152e..02a1d9a465f2 100644 --- a/drivers/input/touchscreen/goodix_berlin_core.c +++ b/drivers/input/touchscreen/goodix_berlin_core.c @@ -12,7 +12,7 @@ * to the previous generations. * * Currently the driver only handles Multitouch events with already - * programmed firmware and "config" for "Revision D" Berlin IC. + * programmed firmware and "config" for "Revision A/D" Berlin IC. * * Support is missing for: * - ESD Management @@ -20,7 +20,7 @@ * - "Config" update/flashing * - Stylus Events * - Gesture Events - * - Support for older revisions (A & B) + * - Support for revision B */ #include @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -53,10 +54,8 @@ #define GOODIX_BERLIN_DEV_CONFIRM_VAL 0xAA #define GOODIX_BERLIN_BOOTOPTION_ADDR 0x1 -#define GOODIX_BERLIN_FW_VERSION_INFO_ADDR 0x10014 #define GOODIX_BERLIN_IC_INFO_MAX_LEN SZ_1K -#define GOODIX_BERLIN_IC_INFO_ADDR 0x10070 #define GOODIX_BERLIN_CHECKSUM_SIZEsizeof(u16) @@ -175,6 +174,8 @@ struct goodix_berlin_core { /* Runtime parameters extracted from IC_INFO buffer */ u32 touch_data_addr; + const struct goodix_berlin_ic_data *ic_data; + struct goodix_berlin_event event; }; @@ -299,7 +300,7 @@ static int goodix_berlin_read_version(struct goodix_berlin_core *cd) { int error; - error = regmap_raw_read(cd->regmap, GOODIX_BERLIN_FW_VERSION_INFO_ADDR, + error = regmap_raw_read(cd->regmap, cd->ic_data->fw_version_info_addr, &cd->fw_version, sizeof(cd->fw_version)); if (error) { dev_err(cd->dev, "error reading fw version, %d\n", error); @@ -367,7 +368,7 @@ static int goodix_berlin_get_ic_info(struct goodix_berlin_core *cd) if (!afe_data) return -ENOMEM; - error = regmap_raw_read(cd->regmap, GOODIX_BERLIN_IC_INFO_ADDR, + error = regmap_raw_read(cd->regmap, cd->ic_data->ic_info_addr, &length_raw, sizeof(length_raw)); if (error) { dev_err(cd->dev, "failed get ic info length, %d\n", error); @@ -380,8 +381,8 @@ static int goodix_berlin_get_ic_info(struct goodix_berlin_core *cd) return -EINVAL; } - error = regmap_raw_read(cd->regmap, GOODIX_BERLIN_IC_INFO_ADDR, - afe_data, length); + error = regmap_raw_read(cd->regmap, cd->ic_data->ic_info_addr, afe_data, + length); if (error) { dev_err(cd->dev, "failed get ic info data, %d\n", error); return error; @@ -716,7 +717,8 @@ const struct attribute_group *go
[PATCH 1/2] dt-bindings: input: touchscreen: edt-ft5x06: Document FT8716 support
Document FocalTech FT8716 support by adding the compatible. Signed-off-by: Jens Reidel --- .../devicetree/bindings/input/touchscreen/edt-ft5x06.yaml| 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml index 70a922e213f2..ed23acd0c9a2 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml @@ -43,6 +43,7 @@ properties: - focaltech,ft5452 - focaltech,ft6236 - focaltech,ft8201 + - focaltech,ft8716 - focaltech,ft8719 reg: -- 2.48.1
[PATCH 2/2] Input: edt-ft5x06 - add support for FocalTech FT8716
This driver is compatible with the FocalTech FT8716 touchscreen, which supports up to 10 concurrent touch points. Add a compatible for it. Signed-off-by: Jens Reidel --- drivers/input/touchscreen/edt-ft5x06.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index 0d7bf18e2508..c72ae6535114 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -1495,6 +1495,10 @@ static const struct edt_i2c_chip_data edt_ft8201_data = { .max_support_points = 10, }; +static const struct edt_i2c_chip_data edt_ft8716_data = { + .max_support_points = 10, +}; + static const struct edt_i2c_chip_data edt_ft8719_data = { .max_support_points = 10, }; @@ -1507,6 +1511,7 @@ static const struct i2c_device_id edt_ft5x06_ts_id[] = { /* Note no edt- prefix for compatibility with the ft6236.c driver */ { .name = "ft6236", .driver_data = (long)&edt_ft6236_data }, { .name = "ft8201", .driver_data = (long)&edt_ft8201_data }, + { .name = "ft8716", .driver_data = (long)&edt_ft8716_data }, { .name = "ft8719", .driver_data = (long)&edt_ft8719_data }, { /* sentinel */ } }; @@ -1523,6 +1528,7 @@ static const struct of_device_id edt_ft5x06_of_match[] = { /* Note focaltech vendor prefix for compatibility with ft6236.c */ { .compatible = "focaltech,ft6236", .data = &edt_ft6236_data }, { .compatible = "focaltech,ft8201", .data = &edt_ft8201_data }, + { .compatible = "focaltech,ft8716", .data = &edt_ft8716_data }, { .compatible = "focaltech,ft8719", .data = &edt_ft8719_data }, { /* sentinel */ } }; -- 2.48.1
[PATCH 0/2] Add FT8716 support
This series adds support for the FocalTech FT8716 touchscreen to the edt-ft5x06 driver. It was tested on the BQ Aquaris X (bq-bardock) and BQ Aquaris X Pro (bq-bardockpro). Jens Reidel (2): dt-bindings: input: touchscreen: edt-ft5x06: Document FT8716 support Input: edt-ft5x06 - add support for FocalTech FT8716 .../devicetree/bindings/input/touchscreen/edt-ft5x06.yaml | 1 + drivers/input/touchscreen/edt-ft5x06.c | 6 ++ 2 files changed, 7 insertions(+) -- 2.48.1
[PATCH v2 0/2] Add Goodix Berlin-A series support
This series adds support for the Goodix Berlin-A series touch ICs (gt9897). This was tested on a Xiaomi 11 Lite 5G NE (xiaomi-lisa), which uses the gt9897 IC connected over SPI. I am not aware of any device that has gt9897 connected over I2C and therefore could not test it, so I didn't add a compatible in the I2C driver. Changes in v2: - Added Rob's A-b tag (patch no. 1) - Added Luca's T-b tag (patch no. 2) - Updated the i2c and spi device id tables with the driver data and switched to spi_get_device_match_data where possible (requested by Neil) - Switched to device_get_match_data in goodix_berlin_core.c - Move all revision specific addresses and other properties into the goodix_berlin_ic_data struct (requested by Dmitry) - Link to v1: https://lore.kernel.org/all/20250203174309.21574-1-adr...@travitia.xyz/ To: Dmitry Torokhov To: Rob Herring To: Krzysztof Kozlowski To: Conor Dooley To: Bastien Nocera To: Hans de Goede To: Neil Armstrong Cc: Luca Weiss Cc: linux-in...@vger.kernel.org Cc: devicet...@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: phone-de...@vger.kernel.org Cc: li...@mainlining.org Cc: ~postmarketos/upstream...@lists.sr.ht Signed-off-by: Jens Reidel Jens Reidel (2): dt-bindings: input: goodix,gt9916: Document gt9897 compatible Input: goodix_berlin - Add support for Berlin-A series .../input/touchscreen/goodix,gt9916.yaml | 1 + drivers/input/touchscreen/goodix_berlin.h | 13 ++ .../input/touchscreen/goodix_berlin_core.c| 15 --- drivers/input/touchscreen/goodix_berlin_i2c.c | 9 +++- drivers/input/touchscreen/goodix_berlin_spi.c | 45 ++- 5 files changed, 62 insertions(+), 21 deletions(-) -- 2.48.1