mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 06:09:23 -04:00
Ocean: DLKM: Improve ili9881h touch driver
- Improve code style - Change hardware test process - Optimize interrupt handler function Change-Id: I6eaaf2ac456626fb48ae5f661d0bb189e8aff30f Signed-off-by: wengjun1 <wengjun1@motorola.com> Reviewed-on: https://gerrit.mot.com/1214000 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Huosheng Liao <liaohs@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
2461976329
commit
1f7e132206
9 changed files with 177 additions and 93 deletions
|
|
@ -207,7 +207,7 @@ enum ili9881_types {
|
|||
* Other settings
|
||||
*/
|
||||
#define CSV_PATH "/sdcard"
|
||||
#define INI_NAME_PATH "/sdcard/mp.ini"
|
||||
#define INI_NAME_PATH "mp.ini"
|
||||
#define UPDATE_FW_PATH "/mnt/sdcard/ILITEK_FW"
|
||||
#define ILITEK_FW_FILENAME "ILITEK_FW.bin"
|
||||
#define POWER_STATUS_PATH "/sys/class/power_supply/battery/status"
|
||||
|
|
|
|||
|
|
@ -626,7 +626,7 @@ EXPORT_SYMBOL(core_config_check_cdc_busy);
|
|||
|
||||
int core_config_check_int_status(bool high)
|
||||
{
|
||||
int timer = 1000, res = ERROR;
|
||||
int timer = 5000, res = ERROR;
|
||||
|
||||
/* From FW request, timeout should at least be 5 sec */
|
||||
while (timer) {
|
||||
|
|
@ -644,7 +644,7 @@ int core_config_check_int_status(bool high)
|
|||
}
|
||||
}
|
||||
|
||||
mdelay(5);
|
||||
mdelay(1);
|
||||
timer--;
|
||||
}
|
||||
|
||||
|
|
@ -655,6 +655,25 @@ int core_config_check_int_status(bool high)
|
|||
}
|
||||
EXPORT_SYMBOL(core_config_check_int_status);
|
||||
|
||||
|
||||
|
||||
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) {
|
||||
timer--;
|
||||
mdelay(1);
|
||||
}
|
||||
if (core_mp->mp_isr_check_busy_free == true)
|
||||
res = 0;
|
||||
|
||||
return res;
|
||||
}
|
||||
EXPORT_SYMBOL(core_config_check_int_isr_flag);
|
||||
|
||||
|
||||
int core_config_get_project_id(uint8_t *pid_data)
|
||||
{
|
||||
int i = 0, res = 0;
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ extern int core_config_ice_mode_enable(void);
|
|||
extern int core_config_set_watch_dog(bool enable);
|
||||
extern int core_config_check_cdc_busy(int count, int delay);
|
||||
extern int core_config_check_int_status(bool high);
|
||||
extern int core_config_check_int_isr_flag(void);
|
||||
extern void core_config_ic_suspend(void);
|
||||
extern void core_config_ic_resume(void);
|
||||
extern void core_config_ic_reset(void);
|
||||
|
|
|
|||
|
|
@ -118,7 +118,6 @@ int core_i2c_write(uint8_t nSlaveId, uint8_t *pBuf, uint16_t nSize)
|
|||
txbuf[nSize] = check_sum;
|
||||
msgs[0].buf = txbuf;
|
||||
msgs[0].len = nSize + 1;
|
||||
dump_data(txbuf, 8, nSize + 1, nSize + 1, "summer_i2c_dump");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,20 +41,7 @@
|
|||
#include "parser.h"
|
||||
#include "finger_report.h"
|
||||
|
||||
#define EXEC_READ 0
|
||||
#define EXEC_WRITE 1
|
||||
|
||||
#define INT_CHECK 0
|
||||
#define POLL_CHECK 1
|
||||
#define DELAY_CHECK 2
|
||||
#define RETRY_COUNT 3
|
||||
|
||||
#define NORMAL_CSV_PASS_NAME "mp_pass"
|
||||
#define NORMAL_CSV_FAIL_NAME "mp_fail"
|
||||
#define OPPO_CSV_PASS_NAME "oppo_mp_pass"
|
||||
#define OPPO_CSV_FAIL_NAME "oppo_mp_fail"
|
||||
#define OPPO_CSV_LCM_PASS_NAME "oppo_mp_lcm_pass"
|
||||
#define OPPO_CSV_LCM_FAIL_NAME "oppo_mp_lcm_fail"
|
||||
|
||||
#define CSV_FILE_SIZE (500 * 1024)
|
||||
|
||||
|
|
@ -178,8 +165,8 @@ void dump_data(void *data, int type, int len, int row_len, const char *name)
|
|||
return;
|
||||
}
|
||||
|
||||
printk("\n\n");
|
||||
printk("Dump %s data\n", name);
|
||||
printk(KERN_CONT "\n\n");
|
||||
printk(KERN_CONT "Dump %s data\n", name);
|
||||
|
||||
if (type == 8)
|
||||
p8 = (uint8_t *) data;
|
||||
|
|
@ -188,15 +175,15 @@ void dump_data(void *data, int type, int len, int row_len, const char *name)
|
|||
|
||||
for (i = 0 ; i < len ; i++) {
|
||||
if (type == 8)
|
||||
printk(" %4x ", p8[i]);
|
||||
printk(KERN_CONT " %4x ", p8[i]);
|
||||
else if (type == 32)
|
||||
printk(" %4x ", p32[i]);
|
||||
printk(KERN_CONT " %4x ", p32[i]);
|
||||
else if (type == 10)
|
||||
printk(" %4d ", p32[i]);
|
||||
printk(KERN_CONT " %4d ", p32[i]);
|
||||
if ((i % row) == row-1)
|
||||
printk("\n");
|
||||
printk(KERN_CONT "\n");
|
||||
}
|
||||
printk("\n\n");
|
||||
printk(KERN_CONT "\n\n");
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(dump_data);
|
||||
|
|
@ -320,10 +307,10 @@ static void mp_compare_cdc_show_result(int32_t *tmp, char *csv, int *csv_len, in
|
|||
out:
|
||||
if (type == TYPE_JUGE) {
|
||||
if (mp_result == MP_PASS) {
|
||||
pr_info("\n Result : PASS\n");
|
||||
DUMP(DEBUG_MP_TEST, "\n Result : PASS\n");
|
||||
tmp_len += snprintf(csv + tmp_len, (CSV_FILE_SIZE-tmp_len), "Result : PASS\n");
|
||||
} else {
|
||||
pr_info("\n Result : FAIL\n");
|
||||
DUMP(DEBUG_MP_TEST, "\n Result : FAIL\n");
|
||||
tmp_len += snprintf(csv + tmp_len, (CSV_FILE_SIZE-tmp_len), "Result : FAIL\n");
|
||||
}
|
||||
}
|
||||
|
|
@ -728,7 +715,7 @@ static int mp_cdc_get_pv5_4_command(uint8_t *cmd, int len, int index)
|
|||
else if (strncmp(key, "Noise Peak to Peak(With Panel) (LCM OFF)", strlen(key)) == 0)
|
||||
key = "Noise Peak To Peak(With Panel)";
|
||||
|
||||
ipio_info("%s gets %s command from INI.\n", tItems[index].desp, key);
|
||||
ipio_debug(DEBUG_MP_TEST, "%s gets %s command from INI.\n", tItems[index].desp, key);
|
||||
|
||||
ret = core_parser_get_int_data("PV5_4 Command", key, str);
|
||||
if (ret < 0) {
|
||||
|
|
@ -748,7 +735,7 @@ static int mp_cdc_init_cmd_common(uint8_t *cmd, int len, int index)
|
|||
int ret = 0;
|
||||
|
||||
if (protocol->major >= 5 && protocol->mid >= 4) {
|
||||
ipio_info("Get CDC command with protocol v5.4\n");
|
||||
ipio_debug(DEBUG_MP_TEST, "Get CDC command with protocol v5.4\n");
|
||||
protocol->cdc_len = 15;
|
||||
return mp_cdc_get_pv5_4_command(cmd, len, index);
|
||||
}
|
||||
|
|
@ -807,6 +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;
|
||||
res = core_write(core_config->slave_i2c_addr, cmd, protocol->cdc_len);
|
||||
if (res < 0) {
|
||||
ipio_err("I2C Write Error while initialising cdc\n");
|
||||
|
|
@ -814,17 +802,18 @@ static int allnode_mutual_cdc_data(int index)
|
|||
}
|
||||
|
||||
/* Check busy */
|
||||
ipio_info("Check busy method = %d\n", core_mp->busy_cdc);
|
||||
if (core_mp->busy_cdc == POLL_CHECK) {
|
||||
res = core_config_check_cdc_busy(50, 50);
|
||||
} else if (core_mp->busy_cdc == INT_CHECK) {
|
||||
res = core_config_check_int_status(true);
|
||||
} else if (core_mp->busy_cdc == DELAY_CHECK) {
|
||||
mdelay(600);
|
||||
} else if (core_mp->busy_cdc == ISR_CHECK) {
|
||||
core_config_check_int_isr_flag();
|
||||
}
|
||||
|
||||
if (res < 0) {
|
||||
ipio_err("Check busy timeout !\n");
|
||||
ipio_err("Check busy timeout ! %d\n", core_mp->busy_cdc);
|
||||
res = ERROR;
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -1199,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;
|
||||
res = core_write(core_config->slave_i2c_addr, cmd, protocol->cdc_len);
|
||||
if (res < 0) {
|
||||
ipio_err("I2C Write Error while initialising cdc\n");
|
||||
|
|
@ -1207,17 +1196,17 @@ int allnode_open_cdc_data(int mode, int *buf, int *dac)
|
|||
}
|
||||
|
||||
/* Check busy */
|
||||
ipio_info("Check busy method = %d\n", core_mp->busy_cdc);
|
||||
if (core_mp->busy_cdc == POLL_CHECK) {
|
||||
res = core_config_check_cdc_busy(50, 50);
|
||||
} else if (core_mp->busy_cdc == INT_CHECK) {
|
||||
res = core_config_check_int_status(true);
|
||||
} else if (core_mp->busy_cdc == DELAY_CHECK) {
|
||||
mdelay(600);
|
||||
} else if (core_mp->busy_cdc == ISR_CHECK) {
|
||||
core_config_check_int_isr_flag();
|
||||
}
|
||||
|
||||
if (res < 0) {
|
||||
ipio_err("Check busy timeout !\n");
|
||||
ipio_err("Check busy timeout ! %d\n", core_mp->busy_cdc);
|
||||
res = ERROR;
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -1501,7 +1490,7 @@ int codeToOhm(int32_t Code)
|
|||
}
|
||||
|
||||
if (Code == 0) {
|
||||
ipio_debug(DEBUG_MP_TEST, "0,");
|
||||
ipio_debug(DEBUG_MP_TEST, "code is invalid\n");
|
||||
} else {
|
||||
temp = ((douTVCH - douTVCL) * douVariation * (douTDF1 - douTDF2) * (1<<12) / (9 * Code * douCint)) * 100;
|
||||
temp = (temp - douRinternal) / 1000;
|
||||
|
|
@ -1834,11 +1823,10 @@ void core_mp_retry(int index)
|
|||
|
||||
/* Switch to Demo mode */
|
||||
core_fr_mode_control(&protocol->demo_mode);
|
||||
ilitek_platform_disable_irq();
|
||||
|
||||
/* Switch to test mode */
|
||||
core_fr_mode_control(&protocol->test_mode);
|
||||
ilitek_platform_disable_irq();
|
||||
|
||||
|
||||
tItems[index].do_test(index);
|
||||
tItems[index].test_count++;
|
||||
|
|
@ -2425,8 +2413,9 @@ int core_mp_init(void)
|
|||
core_mp->st_len = core_config->tp_info->side_touch_type;
|
||||
|
||||
core_mp->tdf = 240;
|
||||
core_mp->busy_cdc = INT_CHECK;
|
||||
|
||||
core_mp->busy_cdc = ISR_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;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,22 @@
|
|||
#define TYPE_NO_JUGE 1
|
||||
#define TYPE_JUGE 2
|
||||
|
||||
#define EXEC_READ 0
|
||||
#define EXEC_WRITE 1
|
||||
|
||||
#define INT_CHECK 0
|
||||
#define POLL_CHECK 1
|
||||
#define DELAY_CHECK 2
|
||||
#define ISR_CHECK 3
|
||||
#define RETRY_COUNT 0
|
||||
|
||||
#define NORMAL_CSV_PASS_NAME "mp_pass"
|
||||
#define NORMAL_CSV_FAIL_NAME "mp_fail"
|
||||
#define OPPO_CSV_PASS_NAME "oppo_mp_pass"
|
||||
#define OPPO_CSV_FAIL_NAME "oppo_mp_fail"
|
||||
#define OPPO_CSV_LCM_PASS_NAME "oppo_mp_lcm_pass"
|
||||
#define OPPO_CSV_LCM_FAIL_NAME "oppo_mp_lcm_fail"
|
||||
|
||||
struct mp_test_P540_open {
|
||||
int32_t *cbk_700;
|
||||
int32_t *cbk_250;
|
||||
|
|
@ -154,7 +170,8 @@ struct core_mp_test_data {
|
|||
|
||||
int tdf;
|
||||
bool retry;
|
||||
bool busy_cdc;
|
||||
int busy_cdc;
|
||||
bool mp_isr_check_busy_free;
|
||||
bool ctrl_lcm;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
#include "../common.h"
|
||||
#include "parser.h"
|
||||
#include "config.h"
|
||||
#include <linux/firmware.h>
|
||||
#include "../platform.h"
|
||||
|
||||
#define PARSER_MAX_CFG_BUF (512 * 3)
|
||||
#define PARSER_MAX_KEY_NUM (600 * 3)
|
||||
|
|
@ -88,13 +90,11 @@ static int get_ini_phy_line(char *data, char *buffer, int maxlen)
|
|||
|
||||
break;
|
||||
} else if (ch1 == 0x00) {
|
||||
//iRetNum = -1;
|
||||
break; /* file end */
|
||||
}
|
||||
|
||||
buffer[i++] = ch1;
|
||||
}
|
||||
|
||||
buffer[i] = '\0';
|
||||
return iRetNum;
|
||||
}
|
||||
|
|
@ -132,7 +132,6 @@ static int get_ini_phy_data(char *data, int fsize)
|
|||
|
||||
temp = strnstr(data, TYPE_MARK, fsize);
|
||||
if (temp != NULL) {
|
||||
ipio_debug(DEBUG_PARSER, "Find Type mark, locat = %ld", temp-data);
|
||||
if (core_config->core_type == CORE_TYPE_B)
|
||||
offset = temp-data;
|
||||
else
|
||||
|
|
@ -333,7 +332,6 @@ void core_parser_nodetype(int32_t *type_ptr, char *desp)
|
|||
memcpy(str, &ilitek_ini_file_data[i].pKeyValue[index1], (j - index1));
|
||||
temp = katoi(str);
|
||||
type_ptr[count] = temp;
|
||||
printk("%04d, ", temp);
|
||||
count++;
|
||||
}
|
||||
record = ilitek_ini_file_data[i].pKeyValue[j];
|
||||
|
|
@ -341,7 +339,6 @@ void core_parser_nodetype(int32_t *type_ptr, char *desp)
|
|||
|
||||
}
|
||||
}
|
||||
printk("\n");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -431,7 +428,7 @@ int core_parser_get_int_data(char *section, char *keyname, char *rv)
|
|||
}
|
||||
|
||||
len = snprintf(rv, sizeof(value), "%s", value);
|
||||
printk("section =%s,keyname =%s,value = %s,rv =%s\n", section, keyname, value, rv);//summer
|
||||
|
||||
return len;
|
||||
}
|
||||
EXPORT_SYMBOL(core_parser_get_int_data);
|
||||
|
|
@ -439,28 +436,19 @@ EXPORT_SYMBOL(core_parser_get_int_data);
|
|||
|
||||
int core_parser_path(char *path)
|
||||
{
|
||||
int res = 0, fsize = 0;
|
||||
int res = 0, fsize = 0, i = 0;
|
||||
char *tmp = NULL;
|
||||
struct file *f = NULL;
|
||||
struct inode *inode;
|
||||
mm_segment_t old_fs;
|
||||
loff_t pos = 0;
|
||||
const struct firmware *mp_ini;
|
||||
|
||||
ipio_info("path = %s\n", path);
|
||||
f = filp_open(path, O_RDONLY, 0);
|
||||
if (ERR_ALLOC_MEM(f)) {
|
||||
ipio_err("Failed to open the file at %ld.\n", PTR_ERR(f));
|
||||
res = -ENOENT;
|
||||
return res;
|
||||
res = request_firmware(&mp_ini, path, &ipd->client->dev);
|
||||
if (res < 0) {
|
||||
ipio_err("Failed to open the file Name %s.\n", path);
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
#if KERNEL_VERSION(3, 18, 0) >= LINUX_VERSION_CODE
|
||||
inode = f->f_dentry->d_inode;
|
||||
#else
|
||||
inode = f->f_path.dentry->d_inode;
|
||||
#endif
|
||||
ipio_info("path = %s\n", path);
|
||||
|
||||
fsize = inode->i_size;
|
||||
fsize = mp_ini->size;
|
||||
ipio_info("fsize = %d\n", fsize);
|
||||
if (fsize <= 0) {
|
||||
ipio_err("The size of file is invaild\n");
|
||||
|
|
@ -475,11 +463,10 @@ int core_parser_path(char *path)
|
|||
goto out;
|
||||
}
|
||||
|
||||
/* ready to map user's memory to obtain data by reading files */
|
||||
old_fs = get_fs();
|
||||
set_fs(get_ds());
|
||||
vfs_read(f, tmp, fsize, &pos);
|
||||
set_fs(old_fs);
|
||||
|
||||
for (i = 0 ; i < fsize ; i++)
|
||||
tmp[i] = mp_ini->data[i];
|
||||
|
||||
tmp[fsize] = 0x00;
|
||||
|
||||
init_ilitek_ini_data();
|
||||
|
|
@ -494,7 +481,7 @@ int core_parser_path(char *path)
|
|||
|
||||
out:
|
||||
ipio_kfree((void **)&tmp);
|
||||
filp_close(f, NULL);
|
||||
release_firmware(mp_ini);
|
||||
return res;
|
||||
}
|
||||
EXPORT_SYMBOL(core_parser_path);
|
||||
|
|
|
|||
|
|
@ -358,18 +358,25 @@ static irqreturn_t ilitek_platform_irq_handler(int irq, void *dev_id)
|
|||
{
|
||||
ipio_debug(DEBUG_IRQ, "IRQ = %d\n", ipd->isEnableIRQ);
|
||||
|
||||
if (ipd->isEnableIRQ) {
|
||||
ilitek_platform_disable_irq();
|
||||
#ifdef USE_KTHREAD
|
||||
ipd->irq_trigger = true;
|
||||
ipio_debug(DEBUG_IRQ, "kthread: irq_trigger = %d\n",
|
||||
ipd->irq_trigger);
|
||||
wake_up_interruptible(&waiter);
|
||||
#else
|
||||
schedule_work(&ipd->report_work_queue);
|
||||
#endif /* USE_KTHREAD */
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
if (ipd->isEnableIRQ) {
|
||||
ilitek_platform_disable_irq();
|
||||
#ifdef USE_KTHREAD
|
||||
ipd->irq_trigger = true;
|
||||
ipio_debug(DEBUG_IRQ, "kthread: irq_trigger = %d\n",
|
||||
ipd->irq_trigger);
|
||||
wake_up_interruptible(&waiter);
|
||||
#else
|
||||
schedule_work(&ipd->report_work_queue);
|
||||
#endif /* USE_KTHREAD */
|
||||
}
|
||||
}
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
|
|
@ -423,6 +430,8 @@ static int kthread_handler(void *arg)
|
|||
int res = 0;
|
||||
char *str = (char *)arg;
|
||||
|
||||
DEFINE_WAIT_FUNC(wait, woken_wake_function);
|
||||
|
||||
if (strcmp(str, "boot_fw") == 0) {
|
||||
/* FW Upgrade event */
|
||||
core_firmware->isboot = true;
|
||||
|
|
@ -449,7 +458,13 @@ static int kthread_handler(void *arg)
|
|||
ipio_debug(DEBUG_IRQ,
|
||||
"kthread: before->irq_trigger = %d\n",
|
||||
ipd->irq_trigger);
|
||||
set_current_state(TASK_INTERRUPTIBLE);
|
||||
add_wait_queue(&waiter, &wait);
|
||||
for (;;) {
|
||||
if (ipd->irq_trigger)
|
||||
break;
|
||||
wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
|
||||
}
|
||||
remove_wait_queue(&waiter, &wait);
|
||||
wait_event_interruptible(waiter, ipd->irq_trigger);
|
||||
ipd->irq_trigger = false;
|
||||
set_current_state(TASK_RUNNING);
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@
|
|||
#include "core/parser.h"
|
||||
#include "core/gesture.h"
|
||||
|
||||
#define USER_STR_BUFF 128
|
||||
#define USER_STR_BUFF 2000
|
||||
#define ILITEK_IOCTL_MAGIC 100
|
||||
#define ILITEK_IOCTL_MAXNR 18
|
||||
#define ILITEK_IOCTL_MAXNR 21
|
||||
|
||||
#define ILITEK_IOCTL_I2C_WRITE_DATA _IOWR(ILITEK_IOCTL_MAGIC, 0, uint8_t*)
|
||||
#define ILITEK_IOCTL_I2C_SET_WRITE_LENGTH _IOWR(ILITEK_IOCTL_MAGIC, 1, int)
|
||||
|
|
@ -64,7 +64,10 @@
|
|||
#define ILITEK_IOCTL_TP_MODE_STATUS _IOWR(ILITEK_IOCTL_MAGIC, 18, int*)
|
||||
#define ILITEK_IOCTL_ICE_MODE_SWITCH _IOWR(ILITEK_IOCTL_MAGIC, 19, int)
|
||||
|
||||
unsigned char g_user_buf[USER_STR_BUFF] = { 0 };
|
||||
#define ILITEK_IOCTL_MP_WRITE_CDC_FLAG_FALSE _IOWR(ILITEK_IOCTL_MAGIC, 20, int*)
|
||||
#define ILITEK_IOCTL_MP_READ_CDC_FLAG _IOWR(ILITEK_IOCTL_MAGIC, 21, int*)
|
||||
|
||||
unsigned char *g_user_buf;
|
||||
static struct class *touchscreen_class;
|
||||
static struct device *touchscreen_class_dev;
|
||||
|
||||
|
|
@ -354,7 +357,10 @@ static ssize_t ilitek_proc_oppo_mp_lcm_on_read(struct file *filp,
|
|||
/* Switch to test mode */
|
||||
core_fr_mode_control(&protocol->test_mode);
|
||||
|
||||
ilitek_platform_disable_irq();
|
||||
if (core_mp->busy_cdc != ISR_CHECK)
|
||||
ilitek_platform_disable_irq();
|
||||
|
||||
core_fr->isEnableFR = false;
|
||||
|
||||
core_mp->oppo_run = true;
|
||||
|
||||
|
|
@ -369,6 +375,9 @@ static ssize_t ilitek_proc_oppo_mp_lcm_on_read(struct file *filp,
|
|||
core_mp_run_test("Doze Raw Data", true);
|
||||
core_mp_run_test("Doze Peak To Peak", true);
|
||||
|
||||
if (core_mp->busy_cdc == ISR_CHECK)
|
||||
ilitek_platform_disable_irq();
|
||||
|
||||
core_mp_show_result();
|
||||
|
||||
core_mp->oppo_run = false;
|
||||
|
|
@ -389,6 +398,9 @@ static ssize_t ilitek_proc_oppo_mp_lcm_on_read(struct file *filp,
|
|||
mdelay(10);
|
||||
core_config_ic_reset();
|
||||
|
||||
core_fr->isEnableFR = true;
|
||||
ilitek_platform_enable_irq();
|
||||
|
||||
out:
|
||||
*pPos = len;
|
||||
return len;
|
||||
|
|
@ -415,7 +427,10 @@ static ssize_t ilitek_proc_oppo_mp_lcm_off_read(struct file *filp,
|
|||
goto out;
|
||||
}
|
||||
|
||||
ilitek_platform_disable_irq();
|
||||
if (core_mp->busy_cdc != ISR_CHECK)
|
||||
ilitek_platform_disable_irq();
|
||||
|
||||
core_fr->isEnableFR = false;
|
||||
|
||||
/* Enter to suspend and move gesture code to iram */
|
||||
core_config->isEnableGesture = true;
|
||||
|
|
@ -436,7 +451,6 @@ static ssize_t ilitek_proc_oppo_mp_lcm_off_read(struct file *filp,
|
|||
/* Switch to test mode which moves mp code to iram */
|
||||
core_fr_mode_control(&protocol->test_mode);
|
||||
|
||||
ilitek_platform_disable_irq();
|
||||
|
||||
/* Indicates running mp test is called by oppo node */
|
||||
core_mp->oppo_run = true;
|
||||
|
|
@ -448,6 +462,9 @@ static ssize_t ilitek_proc_oppo_mp_lcm_off_read(struct file *filp,
|
|||
core_mp_run_test("Raw Data_TD (LCM OFF)", true);
|
||||
core_mp_run_test("Peak To Peak_TD (LCM OFF)", true);
|
||||
|
||||
if (core_mp->busy_cdc == ISR_CHECK)
|
||||
ilitek_platform_disable_irq();
|
||||
|
||||
core_mp_show_result();
|
||||
|
||||
core_mp->oppo_run = false;
|
||||
|
|
@ -466,6 +483,7 @@ static ssize_t ilitek_proc_oppo_mp_lcm_off_read(struct file *filp,
|
|||
mdelay(10);
|
||||
core_config_ic_reset();
|
||||
|
||||
core_fr->isEnableFR = true;
|
||||
ilitek_platform_enable_irq();
|
||||
|
||||
out:
|
||||
|
|
@ -495,8 +513,10 @@ static ssize_t ilitek_proc_mp_test_read(struct file *filp, char __user *buff,
|
|||
/* Switch to Test mode nad move mp code */
|
||||
core_fr_mode_control(&protocol->test_mode);
|
||||
|
||||
ilitek_platform_disable_irq();
|
||||
if (core_mp->busy_cdc != ISR_CHECK)
|
||||
ilitek_platform_disable_irq();
|
||||
|
||||
core_fr->isEnableFR = false;
|
||||
/* Start to run MP test */
|
||||
core_mp->run = true;
|
||||
|
||||
|
|
@ -529,6 +549,10 @@ static ssize_t ilitek_proc_mp_test_read(struct file *filp, char __user *buff,
|
|||
core_mp_run_test("Doze Peak To Peak", true);
|
||||
/*core_mp_run_test("Pin Test ( INT and RST )", true); */
|
||||
|
||||
|
||||
if (core_mp->busy_cdc == ISR_CHECK)
|
||||
ilitek_platform_disable_irq();
|
||||
|
||||
core_mp_show_result();
|
||||
|
||||
core_mp->run = false;
|
||||
|
|
@ -551,6 +575,8 @@ static ssize_t ilitek_proc_mp_test_read(struct file *filp, char __user *buff,
|
|||
ilitek_platform_tp_hw_reset(true);
|
||||
#endif
|
||||
|
||||
|
||||
core_fr->isEnableFR = true;
|
||||
ilitek_platform_enable_irq();
|
||||
|
||||
out:
|
||||
|
|
@ -607,7 +633,7 @@ static ssize_t ilitek_proc_mp_test_write(struct file *filp, const char *buff,
|
|||
|
||||
for (i = 0 ; i < core_mp->mp_items; i++) {
|
||||
if (strcmp(cmd, tItems[i].name) == 0) {
|
||||
strlcpy(str, tItems[i].desp, strlen(str));
|
||||
strlcpy(str, tItems[i].desp, strlen(str)+1);
|
||||
tItems[i].run = 1;
|
||||
tItems[i].max = va[1];
|
||||
tItems[i].min = va[2];
|
||||
|
|
@ -657,7 +683,7 @@ static ssize_t ilitek_proc_debug_level_read(struct file *filp,
|
|||
|
||||
memset(g_user_buf, 0, USER_STR_BUFF * sizeof(unsigned char));
|
||||
|
||||
len = snprintf(g_user_buf, sizeof(g_user_buf), "%d", ipio_debug_level);
|
||||
len = snprintf(g_user_buf, USER_STR_BUFF, "%d", ipio_debug_level);
|
||||
|
||||
ipio_info("Current DEBUG Level = %d\n", ipio_debug_level);
|
||||
ipio_info("You can set one of levels for debug as below:\n");
|
||||
|
|
@ -716,7 +742,7 @@ static ssize_t ilitek_proc_gesture_read(struct file *filp, char __user *buff,
|
|||
|
||||
memset(g_user_buf, 0, USER_STR_BUFF * sizeof(unsigned char));
|
||||
|
||||
len = snprintf(g_user_buf, sizeof(g_user_buf), "%d", core_config->isEnableGesture);
|
||||
len = snprintf(g_user_buf, USER_STR_BUFF, "%d", core_config->isEnableGesture);
|
||||
|
||||
ipio_info("isEnableGesture = %d\n", core_config->isEnableGesture);
|
||||
|
||||
|
|
@ -777,7 +803,7 @@ static ssize_t ilitek_proc_check_battery_read(struct file *filp,
|
|||
|
||||
memset(g_user_buf, 0, USER_STR_BUFF * sizeof(unsigned char));
|
||||
|
||||
len = snprintf(g_user_buf, sizeof(g_user_buf), "%d", ipd->isEnablePollCheckPower);
|
||||
len = snprintf(g_user_buf, USER_STR_BUFF, "%d", ipd->isEnablePollCheckPower);
|
||||
|
||||
ipio_info("isEnablePollCheckPower = %d\n", ipd->isEnablePollCheckPower);
|
||||
|
||||
|
|
@ -845,7 +871,7 @@ static ssize_t ilitek_proc_fw_process_read(struct file *filp,
|
|||
|
||||
memset(g_user_buf, 0, USER_STR_BUFF * sizeof(unsigned char));
|
||||
|
||||
len = snprintf(g_user_buf, sizeof(g_user_buf), "%02d", core_firmware->update_status);
|
||||
len = snprintf(g_user_buf, USER_STR_BUFF, "%02d", core_firmware->update_status);
|
||||
|
||||
ipio_info("update status = %d\n", core_firmware->update_status);
|
||||
|
||||
|
|
@ -1431,6 +1457,29 @@ static long ilitek_proc_ioctl(struct file *filp, unsigned int cmd,
|
|||
}
|
||||
}
|
||||
break;
|
||||
case ILITEK_IOCTL_MP_WRITE_CDC_FLAG_FALSE:
|
||||
res = copy_from_user(szBuf, (uint8_t *) arg, 1);
|
||||
if (res < 0) {
|
||||
ipio_err("Failed to copy data from user space\n");
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ILITEK_IOCTL_MP_READ_CDC_FLAG:
|
||||
|
||||
res =
|
||||
copy_to_user((int *)arg, &core_mp->mp_isr_check_busy_free,
|
||||
sizeof(int));
|
||||
ipio_debug(DEBUG_IOCTL, "core_mp->mp_isr_check_busy_free = %d\n", core_mp->mp_isr_check_busy_free);
|
||||
if (res < 0) {
|
||||
ipio_err("Failed to copy mp_isr_check_busy_free flag to user space\n");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
res = -ENOTTY;
|
||||
|
|
@ -1638,6 +1687,13 @@ int ilitek_proc_init(void)
|
|||
{
|
||||
int i = 0, res = 0;
|
||||
|
||||
g_user_buf = kcalloc(USER_STR_BUFF, sizeof(char), GFP_KERNEL);
|
||||
|
||||
if (ERR_ALLOC_MEM(g_user_buf)) {
|
||||
ipio_err("Failed to allocate buffers for user space\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
proc_dir_ilitek = proc_mkdir("ilitek", NULL);
|
||||
|
||||
for (; i < ARRAY_SIZE(proc_table); i++) {
|
||||
|
|
@ -1679,6 +1735,7 @@ void ilitek_proc_remove(void)
|
|||
|
||||
remove_proc_entry("ilitek", NULL);
|
||||
netlink_kernel_release(_gNetLinkSkb);
|
||||
ipio_kfree((void **)&g_user_buf);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(ilitek_proc_remove);
|
||||
|
|
|
|||
Loading…
Reference in a new issue