From 0df9480126d1f71c5adfa28d03ce679a8b93df1c Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Sun, 6 Aug 2023 16:09:40 +0200 Subject: [PATCH 1/2] drivers/fx5x06: fix vendor ID for FT6xx6 The vendor ID of FT6xx6 touch panel driver ICs is `0x11` instead of `0xcd`. --- drivers/ft5x06/include/ft5x06_constants.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ft5x06/include/ft5x06_constants.h b/drivers/ft5x06/include/ft5x06_constants.h index 76d80eb5759a..8d9dbb588dda 100644 --- a/drivers/ft5x06/include/ft5x06_constants.h +++ b/drivers/ft5x06/include/ft5x06_constants.h @@ -34,7 +34,7 @@ extern "C" { /** * @brief Vendor ID for FT6X06 and FT6X36 models. */ -#define FT6XX6_VENDOR_ID (0xcd) +#define FT6XX6_VENDOR_ID (0x11) /** * @brief Vendor ID for FT5606, FT5X16, FT5X06I, FT5336, FT3316, FT5436I, FT5336I, FT5X46 models. From a9f3ce121a199d650191724b87e23afc28d43ea8 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Tue, 15 Aug 2023 00:06:02 +0200 Subject: [PATCH 2/2] drivers/ft5x06: fix register addresses --- drivers/ft5x06/ft5x06.c | 16 ++++++++-------- drivers/ft5x06/include/ft5x06_constants.h | 19 ++++++++++++------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/drivers/ft5x06/ft5x06.c b/drivers/ft5x06/ft5x06.c index 95fd046f598c..baa5b5385e4c 100644 --- a/drivers/ft5x06/ft5x06.c +++ b/drivers/ft5x06/ft5x06.c @@ -54,17 +54,17 @@ int ft5x06_init(ft5x06_t *dev, const ft5x06_params_t *params, ft5x06_event_cb_t return -EPROTO; } - uint8_t expected_id; if (dev->params.type == FT5X06_TYPE_FT6X06 || dev->params.type == FT5X06_TYPE_FT6X36) { - expected_id = FT6XX6_VENDOR_ID; + if ((vendor_id != FT5X06_VENDOR_ID_2) && (vendor_id != FT5X06_VENDOR_ID_3)) { + DEBUG("[ft5x06] init: invalid vendor ID: '0x%02x' (expected: 0x%02x or 0x%02x)\n", + vendor_id, FT5X06_VENDOR_ID_2, FT5X06_VENDOR_ID_3); + i2c_release(FT5X06_BUS); + return -ENODEV; + } } - else { - expected_id = FT5X06_VENDOR_ID; - } - - if (expected_id != vendor_id) { + else if (vendor_id != FT5X06_VENDOR_ID_1) { DEBUG("[ft5x06] init: invalid vendor ID: '0x%02x' (expected: 0x%02x)\n", - vendor_id, expected_id); + vendor_id, FT5X06_VENDOR_ID_1); i2c_release(FT5X06_BUS); return -ENODEV; } diff --git a/drivers/ft5x06/include/ft5x06_constants.h b/drivers/ft5x06/include/ft5x06_constants.h index 8d9dbb588dda..8663dfe6f72f 100644 --- a/drivers/ft5x06/include/ft5x06_constants.h +++ b/drivers/ft5x06/include/ft5x06_constants.h @@ -32,14 +32,19 @@ extern "C" { #define FT5X06_I2C_DEFAULT_ADDRESS (0x38) /** - * @brief Vendor ID for FT6X06 and FT6X36 models. + * @brief Vendor ID for FT5606, FT5X16, FT5X06I, FT5336, FT3316, FT5436I, FT5336I, FT5X46 models. */ -#define FT6XX6_VENDOR_ID (0x11) +#define FT5X06_VENDOR_ID_1 (0x51) /** - * @brief Vendor ID for FT5606, FT5X16, FT5X06I, FT5336, FT3316, FT5436I, FT5336I, FT5X46 models. + * @brief Vendor ID used for most FT6X06 and FT6X36 as well as FT3X67 models. + */ +#define FT5X06_VENDOR_ID_2 (0x11) + +/** + * @brief Vendor ID used for some FT6X06 and FT6X36 models. */ -#define FT5X06_VENDOR_ID (0x51) +#define FT5X06_VENDOR_ID_3 (0xcd) /** * @brief Maximum touches count for FT6X06 and FT6X36 models. @@ -81,9 +86,9 @@ extern "C" { #define FT5X06_TOUCH5_YH_REG (0x1D) #define FT5X06_TOUCH5_YL_REG (0x1E) #define FT5X06_G_AUTO_CLB_MODE_REG (0xA0) -#define FT5X06_G_CIPHER_REG (0xA1) -#define FT5X06_G_LIB_VERSION_H_REG (0xA2) -#define FT5X06_G_LIB_VERSION_L_REG (0xA3) +#define FT5X06_G_LIB_VERSION_H_REG (0xA1) +#define FT5X06_G_LIB_VERSION_L_REG (0xA2) +#define FT5X06_G_CIPHER_REG (0xA3) #define FT5X06_G_MODE_REG (0xA4) #define FT5X06_G_PMODE_REG (0xA5) #define FT5X06_G_FIRMID_REG (0xA6)