channel: input add ilitek touch fw proc file

input add ilitek touch fw proc file
to get the fw state.

Change-Id: I0b20c52930eca68ffabfe2100771f0d34437e48c
Signed-off-by: dengwei1 <dengwei1@motorola.com>
Reviewed-on: https://gerrit.mot.com/1264419
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:
dengwei1 2018-11-05 11:26:06 +08:00 • committed by Wei Deng
commit f07839f5a3
4 changed files with 55 additions and 0 deletions

View file

@ -204,6 +204,7 @@ enum ili9881_types {
#define ILI9881_ICE_MODE_ADDR 0x181062
#define ILI9881_PID_ADDR 0x4009C
#define ILI9881_WDT_ADDR 0x5100C
#define ILI9881_PC_COUNTER_ADDR 0x44008
/*
* Other settings

View file

@ -118,6 +118,27 @@ static uint32_t check_chip_id(uint32_t pid_data)
return 0;
}
uint32_t core_config_read_pc_counter(void)
{
uint32_t pc_cnt = 0x0;
if (!core_config->icemodeenable) {
if (core_config_ice_mode_enable() < 0)
ipio_err("Failed to enter ice mode\n");
}
/* Read fw status if it was hanging on a unknown status */
pc_cnt = core_config_ice_mode_read(ILI9881_PC_COUNTER_ADDR);
ipio_info("pc counter = 0x%x\n", pc_cnt);
if (core_config->icemodeenable) {
if (core_config_ice_mode_disable() < 0)
ipio_err("Failed to disable ice mode\n");
}
return pc_cnt;
}
EXPORT_SYMBOL(core_config_read_pc_counter);
/*
* Read & Write one byte in ICE Mode.
*/

View file

@ -98,6 +98,7 @@ extern int core_config_ice_mode_write(uint32_t addr, uint32_t data, uint32_t siz
extern uint32_t core_config_read_write_onebyte(uint32_t addr);
extern int core_config_ice_mode_disable(void);
extern int core_config_ice_mode_enable(void);
extern uint32_t core_config_read_pc_counter(void);
/* Touch IC status */
extern int core_config_set_watch_dog(bool enable);

View file

@ -144,6 +144,33 @@ int str2hex(char *str)
EXPORT_SYMBOL(str2hex);
static ssize_t ilitek_proc_fw_pc_counter_read(struct file *pFile, char __user *buf, size_t nCount, loff_t *pos)
{
uint32_t pc;
if (*pos != 0)
return 0;
memset(g_user_buf, 0, USER_STR_BUFF * sizeof(unsigned char));
mutex_lock(&ipd->plat_mutex);
pc = core_config_read_pc_counter();
mutex_unlock(&ipd->plat_mutex);
nCount = snprintf(g_user_buf, PAGE_SIZE, "pc counter = 0x%x\n", pc);
pc = copy_to_user(buf, g_user_buf, nCount);
if (pc < 0) {
ipio_err("Failed to copy data to user space");
}
*pos += nCount;
return nCount;
}
static ssize_t ilitek_proc_debug_switch_read(struct file *pFile,
char __user *buff, size_t nCount,
loff_t *pPos)
@ -1564,6 +1591,10 @@ struct file_operations proc_debug_message_switch_fops = {
.read = ilitek_proc_debug_switch_read,
};
struct file_operations proc_fw_pc_counter_fops = {
.read = ilitek_proc_fw_pc_counter_read,
};
/**
* This struct lists all file nodes will be created under /proc filesystem.
*
@ -1593,6 +1624,7 @@ proc_node_t proc_table[] = {
{"oppo_mp_lcm_off", NULL, &proc_oppo_mp_lcm_off_fops, false},
{"debug_message", NULL, &proc_debug_message_fops, false},
{"debug_message_switch", NULL, &proc_debug_message_switch_fops, false},
{"fw_pc_counter", NULL, &proc_fw_pc_counter_fops, false},
};
#define NETLINK_USER 21