mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 15:49:17 -04:00
himax_v2_mmi: support set touch info in dts.
TP: Support set touch_info in dts. Change-Id: I14e0fecff77bd5c17b022823d8ae351f0986ec88 Signed-off-by: haojl2 <haojl2@motorola.com> Reviewed-on: https://gerrit.mot.com/1380183 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jianqi Yang <yangj@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
8740f92e79
commit
b3e5067a9b
3 changed files with 67 additions and 43 deletions
2
drivers/input/touchscreen/himax_v2_mmi/himax_common.h
Normal file → Executable file
2
drivers/input/touchscreen/himax_v2_mmi/himax_common.h
Normal file → Executable file
|
|
@ -78,7 +78,7 @@
|
|||
/*#define HX_PROTOCOL_A*/ /* for MTK special platform.If turning on,it will report to system by using specific format. */
|
||||
/*#define HX_RESUME_HW_RESET*/
|
||||
#define HX_PROTOCOL_B_3PA
|
||||
#define HX_FIX_TOUCH_INFO /* if open, you need to change the touch info in the fix_touch_info*/
|
||||
/*#define HX_FIX_TOUCH_INFO*/ /* if open, you need to change the touch info in the fix_touch_info*/
|
||||
/*#define HX_ZERO_FLASH*/
|
||||
/*#if defined(HX_ZERO_FLASH)*/
|
||||
/*#define HX_CODE_OVERLAY*/
|
||||
|
|
|
|||
74
drivers/input/touchscreen/himax_v2_mmi/himax_ic_incell_core.c
Normal file → Executable file
74
drivers/input/touchscreen/himax_v2_mmi/himax_ic_incell_core.c
Normal file → Executable file
|
|
@ -2089,51 +2089,47 @@ static void himax_mcu_touch_information(void)
|
|||
char data[DATA_LEN_8] = {0};
|
||||
uint8_t err_cnt = 0;
|
||||
|
||||
g_core_fp.fp_register_read(pdriver_op->addr_fw_define_rxnum_txnum_maxpt, DATA_LEN_8, data, 0);
|
||||
ic_data->HX_RX_NUM = data[2];
|
||||
ic_data->HX_TX_NUM = data[3];
|
||||
ic_data->HX_MAX_PT = data[4];
|
||||
/*I("%s : HX_RX_NUM=%d,ic_data->HX_TX_NUM=%d,ic_data->HX_MAX_PT=%d\n",__func__,ic_data->HX_RX_NUM,ic_data->HX_TX_NUM,ic_data->HX_MAX_PT);*/
|
||||
g_core_fp.fp_register_read(pdriver_op->addr_fw_define_xy_res_enable, DATA_LEN_4, data, 0);
|
||||
I(" DT-%s:touch_info: HX_RX_NUM = %d, HX_TX_NUM = %d, HX_BT_NUM = %d,HX_X_RES = %d,HX_Y_RES = %d, HX_MAX_PT = %d, HX_XY_REVERSE = %d, HX_INT_IS_EDGE = %d\n", __func__,
|
||||
ic_data->HX_RX_NUM,ic_data->HX_TX_NUM,ic_data->HX_BT_NUM,ic_data->HX_X_RES,ic_data->HX_Y_RES,ic_data->HX_MAX_PT,ic_data->HX_XY_REVERSE,ic_data->HX_INT_IS_EDGE);
|
||||
|
||||
/*I("%s : c_data->HX_XY_REVERSE=0x%2.2X\n",__func__,data[1]);*/
|
||||
if ((data[1] & 0x04) == 0x04)
|
||||
ic_data->HX_XY_REVERSE = true;
|
||||
else
|
||||
ic_data->HX_XY_REVERSE = false;
|
||||
if ((0 == ic_data->HX_RX_NUM) || (0 == ic_data->HX_TX_NUM) || (0 == ic_data->HX_X_RES) || (0 == ic_data->HX_Y_RES)) {
|
||||
g_core_fp.fp_register_read(pdriver_op->addr_fw_define_rxnum_txnum_maxpt, DATA_LEN_8, data, 0);
|
||||
ic_data->HX_RX_NUM = data[2];
|
||||
ic_data->HX_TX_NUM = data[3];
|
||||
ic_data->HX_MAX_PT = data[4];
|
||||
/*I("%s : HX_RX_NUM=%d,ic_data->HX_TX_NUM=%d,ic_data->HX_MAX_PT=%d\n",__func__,ic_data->HX_RX_NUM,ic_data->HX_TX_NUM,ic_data->HX_MAX_PT);*/
|
||||
g_core_fp.fp_register_read(pdriver_op->addr_fw_define_xy_res_enable, DATA_LEN_4, data, 0);
|
||||
|
||||
g_core_fp.fp_register_read(pdriver_op->addr_fw_define_x_y_res, DATA_LEN_4, data, 0);
|
||||
ic_data->HX_Y_RES = data[0] * 256 + data[1];
|
||||
ic_data->HX_X_RES = data[2] * 256 + data[3];
|
||||
/*I("%s : ic_data->HX_Y_RES=%d,ic_data->HX_X_RES=%d\n",__func__,ic_data->HX_Y_RES,ic_data->HX_X_RES);*/
|
||||
/*I("%s : c_data->HX_XY_REVERSE=0x%2.2X\n",__func__,data[1]);*/
|
||||
if ((data[1] & 0x04) == 0x04)
|
||||
ic_data->HX_XY_REVERSE = true;
|
||||
else
|
||||
ic_data->HX_XY_REVERSE = false;
|
||||
|
||||
g_core_fp.fp_register_read(pdriver_op->addr_fw_define_int_is_edge, DATA_LEN_4, data, 0);
|
||||
/*I("%s : data[0]=0x%2.2X,data[1]=0x%2.2X,data[2]=0x%2.2X,data[3]=0x%2.2X\n",__func__,data[0],data[1],data[2],data[3]);*/
|
||||
/*I("data[0] & 0x01 = %d\n",(data[0] & 0x01));*/
|
||||
if ((data[1] & 0x01) == 1)
|
||||
ic_data->HX_INT_IS_EDGE = true;
|
||||
else
|
||||
ic_data->HX_INT_IS_EDGE = false;
|
||||
g_core_fp.fp_register_read(pdriver_op->addr_fw_define_x_y_res, DATA_LEN_4, data, 0);
|
||||
ic_data->HX_Y_RES = data[0] * 256 + data[1];
|
||||
ic_data->HX_X_RES = data[2] * 256 + data[3];
|
||||
/*I("%s : ic_data->HX_Y_RES=%d,ic_data->HX_X_RES=%d\n",__func__,ic_data->HX_Y_RES,ic_data->HX_X_RES);*/
|
||||
|
||||
/*1. Read number of MKey R100070E8H to determin data size*/
|
||||
g_core_fp.fp_register_read(psram_op->addr_mkey, DATA_LEN_4, data, 0);
|
||||
/* I("%s: tmp_data[0] = 0x%02X,tmp_data[1] = 0x%02X,tmp_data[2] = 0x%02X,tmp_data[3] = 0x%02X\n",*/
|
||||
/*__func__, tmp_data[0], tmp_data[1], tmp_data[2], tmp_data[3]);*/
|
||||
ic_data->HX_BT_NUM = data[0] & 0x03;
|
||||
g_core_fp.fp_register_read(pdriver_op->addr_fw_define_int_is_edge, DATA_LEN_4, data, 0);
|
||||
/*I("%s : data[0]=0x%2.2X,data[1]=0x%2.2X,data[2]=0x%2.2X,data[3]=0x%2.2X\n",__func__,data[0],data[1],data[2],data[3]);*/
|
||||
/*I("data[0] & 0x01 = %d\n",(data[0] & 0x01));*/
|
||||
if ((data[1] & 0x01) == 1)
|
||||
ic_data->HX_INT_IS_EDGE = true;
|
||||
else
|
||||
ic_data->HX_INT_IS_EDGE = false;
|
||||
|
||||
err_cnt = himax_mcu_tp_info_check();
|
||||
if (err_cnt > 0)
|
||||
E("TP Info from IC is wrong, err_cnt = 0x%X", err_cnt);
|
||||
/*1. Read number of MKey R100070E8H to determin data size*/
|
||||
g_core_fp.fp_register_read(psram_op->addr_mkey, DATA_LEN_4, data, 0);
|
||||
/* I("%s: tmp_data[0] = 0x%02X,tmp_data[1] = 0x%02X,tmp_data[2] = 0x%02X,tmp_data[3] = 0x%02X\n",*/
|
||||
/*__func__, tmp_data[0], tmp_data[1], tmp_data[2], tmp_data[3]);*/
|
||||
ic_data->HX_BT_NUM = data[0] & 0x03;
|
||||
|
||||
err_cnt = himax_mcu_tp_info_check();
|
||||
if (err_cnt > 0)
|
||||
E("TP Info from IC is wrong, err_cnt = 0x%X", err_cnt);
|
||||
}
|
||||
|
||||
#else
|
||||
ic_data->HX_RX_NUM = FIX_HX_RX_NUM;
|
||||
ic_data->HX_TX_NUM = FIX_HX_TX_NUM;
|
||||
ic_data->HX_BT_NUM = FIX_HX_BT_NUM;
|
||||
ic_data->HX_X_RES = FIX_HX_X_RES;
|
||||
ic_data->HX_Y_RES = FIX_HX_Y_RES;
|
||||
ic_data->HX_MAX_PT = FIX_HX_MAX_PT;
|
||||
ic_data->HX_XY_REVERSE = FIX_HX_XY_REVERSE;
|
||||
ic_data->HX_INT_IS_EDGE = FIX_HX_INT_IS_EDGE;
|
||||
#endif
|
||||
I("%s:HX_RX_NUM =%d,HX_TX_NUM =%d,HX_MAX_PT=%d\n", __func__, ic_data->HX_RX_NUM, ic_data->HX_TX_NUM, ic_data->HX_MAX_PT);
|
||||
I("%s:HX_XY_REVERSE =%d,HX_Y_RES =%d,HX_X_RES=%d\n", __func__, ic_data->HX_XY_REVERSE, ic_data->HX_Y_RES, ic_data->HX_X_RES);
|
||||
|
|
|
|||
|
|
@ -104,7 +104,9 @@ int himax_parse_dt(struct himax_ts_data *ts,
|
|||
struct himax_i2c_platform_data *pdata)
|
||||
{
|
||||
int rc, coords_size = 0;
|
||||
int touch_info_size = 0;
|
||||
uint32_t coords[4] = {0};
|
||||
uint32_t touch_info[8] = {0};
|
||||
struct property *prop;
|
||||
struct device_node *dt = ts->dev->of_node;
|
||||
u32 data = 0;
|
||||
|
|
@ -150,6 +152,32 @@ int himax_parse_dt(struct himax_ts_data *ts,
|
|||
if (!gpio_is_valid(pdata->gpio_irq))
|
||||
I(" DT:gpio_irq value is not valid\n");
|
||||
|
||||
prop = of_find_property(dt, "himax,touch_info", NULL);
|
||||
if (prop) {
|
||||
touch_info_size = prop->length / sizeof(u32);
|
||||
if (touch_info_size != 8) {
|
||||
D(" %s:Invalid touch_info size %d\n", __func__, touch_info_size);
|
||||
} else {
|
||||
rc = of_property_read_u32_array(dt, "himax,touch_info", touch_info, touch_info_size);
|
||||
if (rc && (rc != -EINVAL)) {
|
||||
D(" %s:Fail to read touch_info %d\n", __func__, rc);
|
||||
} else {
|
||||
ic_data->HX_RX_NUM = touch_info[0];
|
||||
ic_data->HX_TX_NUM = touch_info[1];
|
||||
ic_data->HX_BT_NUM = touch_info[2];
|
||||
ic_data->HX_X_RES = touch_info[3];
|
||||
ic_data->HX_Y_RES = touch_info[4];
|
||||
ic_data->HX_MAX_PT = touch_info[5];
|
||||
ic_data->HX_XY_REVERSE = touch_info[6];
|
||||
ic_data->HX_INT_IS_EDGE = touch_info[7];
|
||||
D(" %s:success to read touch_info from dts \n", __func__);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
I(" DT-%s:touch_info: HX_RX_NUM = %d, HX_TX_NUM = %d, HX_BT_NUM = %d,HX_X_RES = %d,HX_Y_RES = %d, HX_MAX_PT = %d, HX_XY_REVERSE = %d, HX_INT_IS_EDGE = %d\n", __func__,
|
||||
ic_data->HX_RX_NUM,ic_data->HX_TX_NUM,ic_data->HX_BT_NUM,ic_data->HX_X_RES,ic_data->HX_Y_RES,ic_data->HX_MAX_PT,ic_data->HX_XY_REVERSE,ic_data->HX_INT_IS_EDGE);
|
||||
|
||||
|
||||
pdata->gpio_reset = of_get_named_gpio(dt, "himax,rst-gpio", 0);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue