mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 05:39:54 -04:00
himax_v2_mmi: Add edge Inhibition sys entry
Add an sys entry to enable different edge inhibition function. echo 0,1,2,3 to edge_en. 0 turn_off 1 Vertical inhibition 2 Horizental clockwise inhibition 3 Horizental anticlockwise inhibition Change-Id: I2f6b0645ecfbe042da537a2fab0f4102278fd5ef Signed-off-by: haojl2 <haojl2@motorola.com> Reviewed-on: https://gerrit.mot.com/1366922 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Jianqi Yang <yangj@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
735d3b40a1
commit
5b95e58597
4 changed files with 140 additions and 0 deletions
|
|
@ -249,6 +249,12 @@ EXPORT_SYMBOL(HX_PROC_SEND_FLAG);
|
|||
struct proc_dir_entry *himax_proc_psensor_file = NULL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HX_EDGE_LIMIT
|
||||
#define HIMAX_PROC_EDGE_LIMIT_FILE "edge_en"
|
||||
struct proc_dir_entry *himax_proc_edge_limit_file = NULL;
|
||||
#endif
|
||||
|
||||
#if defined(HX_SMART_WAKEUP) || defined(CONFIG_TOUCHSCREEN_HIMAX_INSPECT)
|
||||
bool FAKE_POWER_KEY_SEND = true;
|
||||
#endif
|
||||
|
|
@ -745,6 +751,68 @@ static const struct file_operations himax_proc_psensor_ops = {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HX_EDGE_LIMIT
|
||||
static ssize_t himax_edge_limit_read(struct file *file, char *buf,
|
||||
size_t len, loff_t *pos)
|
||||
{
|
||||
size_t count = 0;
|
||||
struct himax_ts_data *ts = private_ts;
|
||||
char *temp_buf;
|
||||
|
||||
if (!HX_PROC_SEND_FLAG) {
|
||||
temp_buf = kzalloc(len, GFP_KERNEL);
|
||||
count = snprintf(temp_buf, PAGE_SIZE, "%d\n", ts->edge_limit_enable);
|
||||
|
||||
if (copy_to_user(buf, temp_buf, len))
|
||||
I("%s,here:%d\n", __func__, __LINE__);
|
||||
|
||||
kfree(temp_buf);
|
||||
HX_PROC_SEND_FLAG = 1;
|
||||
} else {
|
||||
HX_PROC_SEND_FLAG = 0;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t himax_edge_limit_write(struct file *file, const char *buff,
|
||||
size_t len, loff_t *pos)
|
||||
{
|
||||
struct himax_ts_data *ts = private_ts;
|
||||
char buf[80] = {0};
|
||||
|
||||
if (len >= 80) {
|
||||
I("%s: no command exceeds 80 chars.\n", __func__);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if (copy_from_user(buf, buff, len)) {
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if (buf[0] == '0')
|
||||
ts->edge_limit_enable = 0;
|
||||
else if (buf[0] == '1')
|
||||
ts->edge_limit_enable = 1;/*Portrait*/
|
||||
else if (buf[0] == '2')
|
||||
ts->edge_limit_enable = 2;/*Landscape-Right*/
|
||||
else if (buf[0] == '3')
|
||||
ts->edge_limit_enable = 3;/*Landscape-Left*/
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
g_core_fp.fp_set_edge_limit_enable(ts->edge_limit_enable, ts->suspended);
|
||||
I("%s: edge_limit_enable = %d.\n", __func__, ts->edge_limit_enable);
|
||||
return len;
|
||||
}
|
||||
|
||||
static struct file_operations himax_proc_edge_limit_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.read = himax_edge_limit_read,
|
||||
.write = himax_edge_limit_write,
|
||||
};
|
||||
#endif
|
||||
|
||||
int himax_common_proc_init(void)
|
||||
{
|
||||
himax_touch_proc_dir = proc_mkdir(HIMAX_PROC_TOUCH_FOLDER, NULL);
|
||||
|
|
@ -799,8 +867,21 @@ int himax_common_proc_init(void)
|
|||
goto fail_5;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HX_EDGE_LIMIT
|
||||
himax_proc_edge_limit_file = proc_create(HIMAX_PROC_EDGE_LIMIT_FILE, 0666,
|
||||
himax_touch_proc_dir, &himax_proc_edge_limit_ops);
|
||||
|
||||
if (himax_proc_edge_limit_file == NULL) {
|
||||
E(" %s: proc edge limit file create failed!\n", __func__);
|
||||
goto fail_6;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
#ifdef HX_EDGE_LIMIT
|
||||
remove_proc_entry(HIMAX_PROC_EDGE_LIMIT_FILE, himax_touch_proc_dir);
|
||||
fail_6:
|
||||
#endif
|
||||
#ifdef HX_SMART_WAKEUP
|
||||
#ifdef HX_P_SENSOR
|
||||
remove_proc_entry(HIMAX_PROC_PSENSOR_FILE, himax_touch_proc_dir);
|
||||
|
|
@ -823,6 +904,10 @@ fail_1:
|
|||
void himax_common_proc_deinit(void)
|
||||
{
|
||||
remove_proc_entry(HIMAX_PROC_SELF_TEST_FILE, himax_touch_proc_dir);
|
||||
|
||||
#ifdef HX_EDGE_LIMIT
|
||||
remove_proc_entry(HIMAX_PROC_EDGE_LIMIT_FILE, himax_touch_proc_dir);
|
||||
#endif
|
||||
#ifdef HX_HIGH_SENSE
|
||||
remove_proc_entry(HIMAX_PROC_HSEN_FILE, himax_touch_proc_dir);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@
|
|||
/*#define HX_ZERO_FLASH*/
|
||||
/*#if defined(HX_ZERO_FLASH)*/
|
||||
/*#define HX_CODE_OVERLAY*/
|
||||
/*#define HX_EDGE_LIMIT*/
|
||||
/*#endif*/
|
||||
/*#define HX_EN_DYNAMIC_NAME*/ /* Support dynamic load fw name ,default is close */
|
||||
/*#undef CONFIG_FB*/ /* Enable it if driver go into suspend/resume twice */
|
||||
|
|
@ -417,6 +418,11 @@ struct himax_ts_data {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HX_EDGE_LIMIT
|
||||
uint8_t edge_limit_enable;
|
||||
uint8_t edge_limit_en[8];
|
||||
#endif
|
||||
|
||||
#ifdef HX_HIGH_SENSE
|
||||
uint8_t HSEN_enable;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -311,6 +311,10 @@ struct hx_guest_info {
|
|||
#define fw_data_ulpm_33 0x33
|
||||
#define fw_data_ulpm_aa 0xAA
|
||||
|
||||
#define fw_func_edge_portrait_pwd 0xA55AA55A
|
||||
#define fw_func_edge_lsp_left_pwd 0xA11AA11A
|
||||
#define fw_func_edge_lsp_right_pwd 0xA33AA33A
|
||||
|
||||
#define on_fw_addr_smwp_enable 0xA2
|
||||
#define on_fw_usb_detect_addr 0xA4
|
||||
#define on_fw_addr_program_reload_from 0x00000000
|
||||
|
|
@ -514,6 +518,9 @@ struct fw_operation {
|
|||
uint8_t addr_flag_reset_event[4];
|
||||
uint8_t addr_hsen_enable[4];
|
||||
uint8_t addr_smwp_enable[4];
|
||||
#ifdef HX_EDGE_LIMIT
|
||||
uint8_t addr_edge_limit_enable[4];
|
||||
#endif
|
||||
uint8_t addr_program_reload_from[4];
|
||||
uint8_t addr_program_reload_to[4];
|
||||
uint8_t addr_program_reload_page_write[4];
|
||||
|
|
@ -837,6 +844,9 @@ struct himax_core_fp {
|
|||
void (*fp_set_reload_cmd)(uint8_t *write_data, int idx, uint32_t cmd_from, uint32_t cmd_to, uint32_t cmd_beat);
|
||||
bool (*fp_program_reload)(void);
|
||||
void (*fp_set_SMWP_enable)(uint8_t SMWP_enable, bool suspended);
|
||||
#ifdef HX_EDGE_LIMIT
|
||||
void (*fp_set_edge_limit_enable)(uint8_t edge_limit_enable, bool suspended);
|
||||
#endif
|
||||
void (*fp_set_HSEN_enable)(uint8_t HSEN_enable, bool suspended);
|
||||
void (*fp_diag_register_set)(uint8_t diag_command, uint8_t storage_type);
|
||||
#ifdef HX_TP_SELF_TEST_DRIVER
|
||||
|
|
|
|||
|
|
@ -958,6 +958,39 @@ static void himax_mcu_set_SMWP_enable(uint8_t SMWP_enable, bool suspended)
|
|||
} while ((tmp_data[3] != back_data[3] || tmp_data[2] != back_data[2] || tmp_data[1] != back_data[1] || tmp_data[0] != back_data[0]) && retry_cnt < HIMAX_REG_RETRY_TIMES);
|
||||
}
|
||||
|
||||
#ifdef HX_EDGE_LIMIT
|
||||
static void himax_mcu_set_edge_limit_enable(uint8_t edge_limit_enable, bool suspended)
|
||||
{
|
||||
uint8_t tmp_data[DATA_LEN_4];
|
||||
uint8_t back_data[DATA_LEN_4];
|
||||
uint8_t retry_cnt = 0;
|
||||
|
||||
do {
|
||||
if (edge_limit_enable == 0x01) {/*Portrait*/
|
||||
himax_in_parse_assign_cmd(fw_func_edge_portrait_pwd, tmp_data, 4);
|
||||
g_core_fp.fp_register_write(pfw_op->addr_edge_limit_enable, DATA_LEN_4, tmp_data, 0);
|
||||
himax_in_parse_assign_cmd(fw_func_edge_portrait_pwd, back_data, 4);
|
||||
} else if (edge_limit_enable == 0x02) {/*Landscape-Right*/
|
||||
himax_in_parse_assign_cmd(fw_func_edge_lsp_right_pwd, tmp_data, 4);
|
||||
g_core_fp.fp_register_write(pfw_op->addr_edge_limit_enable, DATA_LEN_4, tmp_data, 0);
|
||||
himax_in_parse_assign_cmd(fw_func_edge_lsp_right_pwd, back_data, 4);
|
||||
} else if (edge_limit_enable == 0x03) {/*Landscape-Left*/
|
||||
himax_in_parse_assign_cmd(fw_func_edge_lsp_left_pwd, tmp_data, 4);
|
||||
g_core_fp.fp_register_write(pfw_op->addr_edge_limit_enable, DATA_LEN_4, tmp_data, 0);
|
||||
himax_in_parse_assign_cmd(fw_func_edge_lsp_left_pwd, back_data, 4);
|
||||
} else {
|
||||
himax_in_parse_assign_cmd(fw_data_safe_mode_release_pw_reset, tmp_data, 4);
|
||||
g_core_fp.fp_register_write(pfw_op->addr_edge_limit_enable, DATA_LEN_4, tmp_data, 0);
|
||||
himax_in_parse_assign_cmd(fw_data_safe_mode_release_pw_reset, back_data, 4);
|
||||
}
|
||||
|
||||
g_core_fp.fp_register_read(pfw_op->addr_edge_limit_enable, DATA_LEN_4, tmp_data, 0);
|
||||
I("%s: tmp_data[0]=%d, SMWP_enable=%d, retry_cnt=%d \n", __func__, tmp_data[0], edge_limit_enable, retry_cnt);
|
||||
retry_cnt++;
|
||||
} while ((tmp_data[3] != back_data[3] || tmp_data[2] != back_data[2] || tmp_data[1] != back_data[1] || tmp_data[0] != back_data[0]) && retry_cnt < HIMAX_REG_RETRY_TIMES);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void himax_mcu_set_HSEN_enable(uint8_t HSEN_enable, bool suspended)
|
||||
{
|
||||
uint8_t tmp_data[DATA_LEN_4];
|
||||
|
|
@ -2380,6 +2413,9 @@ static void himax_mcu_resend_cmd_func(bool suspended)
|
|||
#ifdef HX_SMART_WAKEUP
|
||||
g_core_fp.fp_set_SMWP_enable(ts->SMWP_enable, suspended);
|
||||
#endif
|
||||
#ifdef HX_EDGE_LIMIT
|
||||
g_core_fp.fp_set_edge_limit_enable(ts->edge_limit_enable, suspended);
|
||||
#endif
|
||||
#ifdef HX_HIGH_SENSE
|
||||
g_core_fp.fp_set_HSEN_enable(ts->HSEN_enable, suspended);
|
||||
#endif
|
||||
|
|
@ -3311,6 +3347,9 @@ static void himax_mcu_fp_init(void)
|
|||
g_core_fp.fp_black_gest_ctrl = himax_mcu_black_gest_ctrl;
|
||||
#endif
|
||||
g_core_fp.fp_set_SMWP_enable = himax_mcu_set_SMWP_enable;
|
||||
#ifdef HX_EDGE_LIMIT
|
||||
g_core_fp.fp_set_edge_limit_enable = himax_mcu_set_edge_limit_enable;
|
||||
#endif
|
||||
g_core_fp.fp_set_HSEN_enable = himax_mcu_set_HSEN_enable;
|
||||
g_core_fp.fp_usb_detect_set = himax_mcu_usb_detect_set;
|
||||
g_core_fp.fp_diag_register_set = himax_mcu_diag_register_set;
|
||||
|
|
|
|||
Loading…
Reference in a new issue