DLKM: Improve ili9881h touch driver

Adjust driver for match test process.

Change-Id: I97869d07d502f1f933eb1ae9e114046d617b649a
Signed-off-by: wengjun1 <wengjun1@motorola.com>
Reviewed-on: https://gerrit.mot.com/1215985
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jialei Hao <haojl2@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
wengjun1 2018-07-26 15:37:56 +08:00 • committed by Jun Weng
commit 6c77815498
7 changed files with 30 additions and 28 deletions

View file

@ -662,11 +662,11 @@ int core_config_check_int_isr_flag(void)
int timer = 5000, res = ERROR;
/* From FW request, timeout should at least be 5 sec */
while (core_mp->mp_isr_check_busy_free == false && timer > 0) {
while (core_config->interrupt_flag == false && timer > 0) {
timer--;
mdelay(1);
}
if (core_mp->mp_isr_check_busy_free == true)
if (core_config->interrupt_flag == true)
res = 0;
return res;

View file

@ -80,6 +80,7 @@ struct core_config_data {
bool isEnableGesture;
bool icemodeenable;
bool spi_pro_9881h11;
bool interrupt_flag;
TP_INFO *tp_info;
};

View file

@ -103,17 +103,16 @@ int core_i2c_write(uint8_t nSlaveId, uint8_t *pBuf, uint16_t nSize)
* NOTE: If TP driver is doing MP test and commanding 0xF1 to FW,
* we add a checksum to the last index and plus 1 with size.
*/
txbuf = kcalloc(nSize + 1, sizeof(uint8_t), GFP_KERNEL);
if (ERR_ALLOC_MEM(txbuf)) {
ipio_err("Failed to allocate txbuf mem\n");
res = -ENOMEM;
goto out;
}
if (protocol->major >= 5 && protocol->mid >= 4) {
if (!core_config->icemodeenable && pBuf[0] == 0xF1 &&
core_mp->run) {
ipio_info("core_fr->actual_fw_mode=%d,pBuf[0]=%x", core_fr->actual_fw_mode, pBuf[0]);
if (core_fr->actual_fw_mode == protocol->test_mode && pBuf[0] == 0xF1) {
check_sum = core_fr_calc_checksum(pBuf, nSize);
txbuf =
kcalloc(nSize + 1, sizeof(uint8_t), GFP_KERNEL);
if (ERR_ALLOC_MEM(txbuf)) {
ipio_err("Failed to allocate txbuf mem\n");
res = -ENOMEM;
goto out;
}
memcpy(txbuf, pBuf, nSize);
txbuf[nSize] = check_sum;
msgs[0].buf = txbuf;

View file

@ -794,7 +794,7 @@ static int allnode_mutual_cdc_data(int index)
dump_data(cmd, 8, protocol->cdc_len, 0, "Mutual CDC command");
core_mp->mp_isr_check_busy_free = false;
core_config->interrupt_flag = false;
res = core_write(core_config->slave_i2c_addr, cmd, protocol->cdc_len);
if (res < 0) {
ipio_err("I2C Write Error while initialising cdc\n");
@ -1188,7 +1188,7 @@ int allnode_open_cdc_data(int mode, int *buf, int *dac)
core_parser_get_u8_array(tmp, cmd);
dump_data(cmd, 8, sizeof(cmd), 0, "Open SP command");
core_mp->mp_isr_check_busy_free = false;
core_config->interrupt_flag = false;
res = core_write(core_config->slave_i2c_addr, cmd, protocol->cdc_len);
if (res < 0) {
ipio_err("I2C Write Error while initialising cdc\n");
@ -2413,9 +2413,8 @@ int core_mp_init(void)
core_mp->st_len = core_config->tp_info->side_touch_type;
core_mp->tdf = 240;
core_mp->busy_cdc = ISR_CHECK;
core_mp->busy_cdc = POLL_CHECK;
ipio_info("Check busy method = %d\n", core_mp->busy_cdc);
core_mp->mp_isr_check_busy_free = false;
core_mp->run = false;
core_mp->retry = true;
core_mp->oppo_run = false;

View file

@ -171,7 +171,6 @@ struct core_mp_test_data {
int tdf;
bool retry;
int busy_cdc;
bool mp_isr_check_busy_free;
bool ctrl_lcm;
};

View file

@ -359,11 +359,9 @@ static irqreturn_t ilitek_platform_irq_handler(int irq, void *dev_id)
ipio_debug(DEBUG_IRQ, "IRQ = %d\n", ipd->isEnableIRQ);
if (core_fr->actual_fw_mode == P5_0_FIRMWARE_TEST_MODE) {
if (core_mp->busy_cdc == ISR_CHECK) {
ipio_debug(DEBUG_IRQ, "MP INT enter irq\n");
core_mp->mp_isr_check_busy_free = true;
ipio_info("MP isr check busy is free ,%d\n", core_mp->mp_isr_check_busy_free);
}
core_config->interrupt_flag = true;
ipio_info("MP isr check busy is free ,%d\n", core_config->interrupt_flag);
} else {
if (ipd->isEnableIRQ) {
ilitek_platform_disable_irq();
@ -1096,7 +1094,6 @@ static int __init ilitek_platform_init(void)
#if (INTERFACE == I2C_INTERFACE)
ipio_info("TP driver add i2c interface\n");
res = i2c_add_driver(&tp_i2c_driver);
ipio_info("Summer %d \n", res);
if (res < 0) {
ipio_err("Failed to add i2c driver\n");
i2c_del_driver(&tp_i2c_driver);

View file

@ -1208,7 +1208,7 @@ static long ilitek_proc_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg)
{
int res = 0, length = 0;
uint8_t szBuf[512] = { 0 };
uint8_t *szBuf = NULL;
static uint16_t i2c_rw_length;
uint32_t id_to_user = 0x0;
char dbg[10] = { 0 };
@ -1225,6 +1225,12 @@ static long ilitek_proc_ioctl(struct file *filp, unsigned int cmd,
return -ENOTTY;
}
szBuf = kmalloc(2048 * sizeof(uint8_t), GFP_KERNEL);
if (ERR_ALLOC_MEM(szBuf)) {
ipio_err("Failed to allocate szBuf memory\n");
return -ENOMEM;
}
switch (cmd) {
case ILITEK_IOCTL_I2C_WRITE_DATA:
res = copy_from_user(szBuf, (uint8_t *) arg, i2c_rw_length);
@ -1366,7 +1372,7 @@ static long ilitek_proc_ioctl(struct file *filp, unsigned int cmd,
break;
case ILITEK_IOCTL_TP_DRV_VER:
length = snprintf(szBuf, sizeof(szBuf), "%s", DRIVER_VERSION);
length = snprintf(szBuf, 2048, "%s", DRIVER_VERSION);
if (!length) {
ipio_err
("Failed to convert driver version from definiation\n");
@ -1464,8 +1470,8 @@ static long ilitek_proc_ioctl(struct file *filp, unsigned int cmd,
} else {
ipio_debug(DEBUG_IOCTL, "ioctl write = %d\n", szBuf[0]);
if (szBuf[0] == 0) {
core_mp->mp_isr_check_busy_free = false;
ipio_debug(DEBUG_IOCTL, "core_mp->mp_isr_check_busy_free = %d\n", core_mp->mp_isr_check_busy_free);
core_config->interrupt_flag = false;
ipio_debug(DEBUG_IOCTL, "core_config->interrupt_flag = %d\n", core_config->interrupt_flag);
}
}
break;
@ -1473,11 +1479,11 @@ static long ilitek_proc_ioctl(struct file *filp, unsigned int cmd,
case ILITEK_IOCTL_MP_READ_CDC_FLAG:
res =
copy_to_user((int *)arg, &core_mp->mp_isr_check_busy_free,
copy_to_user((int *)arg, &core_config->interrupt_flag,
sizeof(int));
ipio_debug(DEBUG_IOCTL, "core_mp->mp_isr_check_busy_free = %d\n", core_mp->mp_isr_check_busy_free);
ipio_debug(DEBUG_IOCTL, "core_config->interrupt_flag = %d\n", core_config->interrupt_flag);
if (res < 0) {
ipio_err("Failed to copy mp_isr_check_busy_free flag to user space\n");
ipio_err("Failed to copy interrupt_flag flag to user space\n");
}
break;
@ -1485,6 +1491,7 @@ static long ilitek_proc_ioctl(struct file *filp, unsigned int cmd,
res = -ENOTTY;
break;
}
kfree((void **)szBuf);
return res;
}