diff options
| author | Mohan Pallaka <mpallaka@codeaurora.org> | 2013-07-23 15:35:28 +0530 |
|---|---|---|
| committer | Abinaya P <abinayap@codeaurora.org> | 2016-08-17 16:47:23 +0530 |
| commit | cb040c2f612803398eed9271c3aea2ade4aec39d (patch) | |
| tree | f95cb1f0bad37a3e00471d955cca3b5d112cffbd /drivers/input/touchscreen | |
| parent | 8f5d6d8fd0e762c0db47b3a4a995b261f6ce3dc6 (diff) | |
input: ft5x06_ts: Add firmware upgrade support for ft6x06
Focaltech 6x06 controller series uses a different reset
register compared to earlier supported controllers. Use
appropriate reset registers based on controller's id.
This patch is propagated from 3.18 kernel
'commit 88dd4c27a3f6 ("input: ft5x06_ts: Add firmware
upgrade support for ft6x06")'
Change-Id: Ia72fa9c256f9e6e2db79388b0152f4d6724ec457
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
Diffstat (limited to 'drivers/input/touchscreen')
| -rw-r--r-- | drivers/input/touchscreen/ft5x06_ts.c | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/drivers/input/touchscreen/ft5x06_ts.c b/drivers/input/touchscreen/ft5x06_ts.c index 2f30e9234708..99f86224999d 100644 --- a/drivers/input/touchscreen/ft5x06_ts.c +++ b/drivers/input/touchscreen/ft5x06_ts.c @@ -76,7 +76,8 @@ #define FT_PMODE_HIBERNATE 0x03 #define FT_FACTORYMODE_VALUE 0x40 #define FT_WORKMODE_VALUE 0x00 -#define FT_RST_CMD_REG 0xFC +#define FT_RST_CMD_REG1 0xFC +#define FT_RST_CMD_REG2 0xBC #define FT_READ_ID_REG 0x90 #define FT_ERASE_APP_REG 0x61 #define FT_ERASE_PANEL_REG 0x63 @@ -98,6 +99,7 @@ #define FT5316_ID 0x0A #define FT5306I_ID 0x55 +#define FT6X06_ID 0x06 #define FT_UPGRADE_AA 0xAA #define FT_UPGRADE_55 0x55 @@ -134,6 +136,14 @@ #define FT6208_UPGRADE_READID_DELAY 10 #define FT6208_UPGRADE_EARSE_DELAY 2000 +/*upgrade config of FT6x06*/ +#define FT6X06_UPGRADE_AA_DELAY 100 +#define FT6X06_UPGRADE_55_DELAY 30 +#define FT6X06_UPGRADE_ID_1 0x79 +#define FT6X06_UPGRADE_ID_2 0x08 +#define FT6X06_UPGRADE_READID_DELAY 10 +#define FT6X06_UPGRADE_EARSE_DELAY 2000 + #define FT_UPGRADE_INFO(x, y) do { \ x->delay_55 = y##_UPGRADE_55_DELAY; \ x->delay_aa = y##_UPGRADE_AA_DELAY; \ @@ -162,7 +172,7 @@ #define FT_FW_LAST_PKT 0x6ffa #define FT_EARSE_DLY_MS 100 -#define FT_UPGRADE_LOOP 3 +#define FT_UPGRADE_LOOP 10 #define FT_CAL_START 0x04 #define FT_CAL_FIN 0x00 #define FT_CAL_STORE 0x05 @@ -580,6 +590,9 @@ static int ft5x06_ts_resume(struct device *dev) msleep(FT_RESET_DLY); gpio_set_value_cansleep(data->pdata->reset_gpio, 1); } + + msleep(FT_STARTUP_DLY); + enable_irq(data->client->irq); data->suspended = false; @@ -679,6 +692,9 @@ static int ft5x06_get_upgrade_info(u8 family_id, struct upgrade_info *info) case FT5316_ID: FT_UPGRADE_INFO(info, FT5316); break; + case FT6X06_ID: + FT_UPGRADE_INFO(info, FT6X06); + break; default: return -EINVAL; } @@ -691,6 +707,7 @@ static int ft5x06_fw_upgrade_start(struct i2c_client *client, { struct ft5x06_ts_data *ts_data = i2c_get_clientdata(client); struct upgrade_info info; + u8 reset_reg; u8 w_buf[FT_MAX_WR_BUF] = {0}, r_buf[FT_MAX_RD_BUF] = {0}; u8 pkt_buf[FT_FW_PKT_LEN + FT_FW_PKT_META_LEN]; int rc, i, j, temp; @@ -703,22 +720,27 @@ static int ft5x06_fw_upgrade_start(struct i2c_client *client, return -EINVAL; } - for (i = 0; i < FT_UPGRADE_LOOP; i++) { - /* reset - write 0xaa and 0x55 to register 0xfc */ - ft5x0x_write_reg(client, FT_RST_CMD_REG, FT_UPGRADE_AA); + for (i = 0, j = 0; i < FT_UPGRADE_LOOP; i++) { + /* reset - write 0xaa and 0x55 to reset register */ + if (ts_data->family_id == FT6X06_ID) + reset_reg = FT_RST_CMD_REG2; + else + reset_reg = FT_RST_CMD_REG1; + + ft5x0x_write_reg(client, reset_reg, FT_UPGRADE_AA); msleep(info.delay_aa); - ft5x0x_write_reg(client, FT_RST_CMD_REG, FT_UPGRADE_55); + ft5x0x_write_reg(client, reset_reg, FT_UPGRADE_55); msleep(info.delay_55); /* Enter upgrade mode */ w_buf[0] = FT_UPGRADE_55; w_buf[1] = FT_UPGRADE_AA; do { - i++; + j++; rc = ft5x06_i2c_write(client, w_buf, 2); msleep(FT_RETRY_DLY); - } while (rc <= 0 && i < FT_MAX_TRIES); + } while (rc <= 0 && j < FT_MAX_TRIES); /* check READ_ID */ msleep(info.delay_readid); @@ -821,6 +843,8 @@ static int ft5x06_fw_upgrade_start(struct i2c_client *client, ft5x06_i2c_write(client, w_buf, 1); msleep(FT_STARTUP_DLY); + dev_info(&client->dev, "Firmware upgrade successful\n"); + return 0; } |
