DLKM/sar: Add fw mode detection for A96T346HW.

guam sar bringup:
Add fw mode detection for A96T346HW.

Change-Id: I81a0f4802fda3b276b870a3fa758528871d31a4a
Signed-off-by: Wen Xie <xiewen3@motorola.com>
Reviewed-on: https://gerrit.mot.com/1509854
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Wen Xie 2020-03-10 16:23:13 +08:00
commit 321c070657
2 changed files with 16 additions and 2 deletions

View file

@ -613,6 +613,13 @@ static void abov_platform_data_of_init(struct i2c_client *client,
LOG_ERR("firmware name read error!\n");
return;
}
ret = of_property_read_u32(np, "cap,fw_mode_ret", &pplatData->fw_mode_ret);
if (ret < 0) {
LOG_ERR("get cap,fw_mode_ret error,set default value.\n");
pplatData->fw_mode_ret = ABOV_DF_FW_MODE;
}
}
static ssize_t reset_show(struct class *class,
@ -1071,6 +1078,7 @@ static int abov_tk_fw_mode_enter(struct i2c_client *client)
{
int ret = 0;
unsigned char buf[40] = {0, };
pabovXX_t this = abov_sar_ptr;
buf[0] = 0xAC;
buf[1] = 0x5B;
@ -1083,8 +1091,8 @@ static int abov_tk_fw_mode_enter(struct i2c_client *client)
SLEEP(5);
ret = i2c_master_recv(client, buf, 1);
if (buf[0] != 0x39) {
LOG_ERR("Enter fw mode fail ...device id:0x%02x\n", buf[0]);
if (buf[0] != this->board->fw_mode_ret) {
LOG_ERR("Enter fw mode fail,device id:0x%02x\n", buf[0]);
return -EIO;
}

View file

@ -51,6 +51,11 @@
/* enable body stat */
#define ABOV_TCHCMPSTAT_TCHSTAT2_FLAG 0x30
/*
* A96T346DF FW MODE:0x39, A96T346HW FW MODE:0x3A
*/
#define ABOV_DF_FW_MODE 0x39
#define ABOV_HW_FW_MODE 0x3A
/**************************************
* define platform data
@ -137,6 +142,7 @@ struct abov_platform_data {
const char *cap_ch2_name;
pbuttonInformation_t pbuttonInformation;
const char *fw_name;
int fw_mode_ret;
int (*get_is_nirq_low)(unsigned irq_gpio);
int (*init_platform_hw)(void);