Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers/ft5x06: fix vendor ID for FT6xx6 and FTxxxx register addresses #19860

Merged
merged 2 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions drivers/ft5x06/ft5x06.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
19 changes: 12 additions & 7 deletions drivers/ft5x06/include/ft5x06_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 (0xcd)
#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.
Expand Down Expand Up @@ -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)
Expand Down