diff --git a/drivers/input/touchscreen/himax_v2_mmi/himax_common.h b/drivers/input/touchscreen/himax_v2_mmi/himax_common.h old mode 100644 new mode 100755 index e71b9888424e..de840b5acb7d --- a/drivers/input/touchscreen/himax_v2_mmi/himax_common.h +++ b/drivers/input/touchscreen/himax_v2_mmi/himax_common.h @@ -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*/ diff --git a/drivers/input/touchscreen/himax_v2_mmi/himax_ic_incell_core.c b/drivers/input/touchscreen/himax_v2_mmi/himax_ic_incell_core.c old mode 100644 new mode 100755 index cbe20b0b58f9..85cde1dea749 --- a/drivers/input/touchscreen/himax_v2_mmi/himax_ic_incell_core.c +++ b/drivers/input/touchscreen/himax_v2_mmi/himax_ic_incell_core.c @@ -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); diff --git a/drivers/input/touchscreen/himax_v2_mmi/himax_platform_QCT_SPI.c b/drivers/input/touchscreen/himax_v2_mmi/himax_platform_QCT_SPI.c index 158418998e35..6ae8b79a9aaa 100755 --- a/drivers/input/touchscreen/himax_v2_mmi/himax_platform_QCT_SPI.c +++ b/drivers/input/touchscreen/himax_v2_mmi/himax_platform_QCT_SPI.c @@ -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);