From 53bf9eb154304e100c0fbe480572a146b87f37be Mon Sep 17 00:00:00 2001 From: "makarand.karvekar" Date: Tue, 27 Jul 2010 12:36:51 -0500 Subject: [PATCH] touch: firmware 09 support Added new objects grip, palm and Digitizer HID. Ignoring info block checksum for now, issues seen on some HW having incorrect info data. Change-Id: I812d3099dd273e99a87ca3fe8dfce3bcdfbede7e Signed-off-by: makarand.karvekar --- drivers/input/touchscreen/qtouch_obp_ts.c | 59 ++++++++++++++-- include/linux/qtouch_obp_ts.h | 85 +++++++++++++++++------ 2 files changed, 116 insertions(+), 28 deletions(-) diff --git a/drivers/input/touchscreen/qtouch_obp_ts.c b/drivers/input/touchscreen/qtouch_obp_ts.c index 058387855568..4e34d5ab834b 100644 --- a/drivers/input/touchscreen/qtouch_obp_ts.c +++ b/drivers/input/touchscreen/qtouch_obp_ts.c @@ -30,6 +30,8 @@ #include #include +#define IGNORE_CHECKSUM_MISMATCH + struct qtm_object { struct qtm_obj_entry entry; uint8_t report_id_min; @@ -488,16 +490,16 @@ static int qtouch_hw_init(struct qtouch_ts_data *ts) } } - /* configure the grip suppression table */ + /* configure the grip face suppression table */ obj = find_obj(ts, QTM_OBJ_PROCI_GRIPFACESUPPRESSION); if (obj && obj->entry.num_inst > 0) { ret = qtouch_write_addr(ts, obj->entry.addr, - &ts->pdata->grip_suppression_cfg, + &ts->pdata->grip_face_suppression_cfg, min(sizeof - (ts->pdata->grip_suppression_cfg), + (ts->pdata->grip_face_suppression_cfg), obj->entry.size)); if (ret != 0) { - pr_err("%s: Can't write the grip suppression config\n", + pr_err("%s: Can't write the grip face suppression config\n", __func__); return ret; } @@ -602,6 +604,48 @@ static int qtouch_hw_init(struct qtouch_ts_data *ts) } } + /* configure the grip suppression table */ + obj = find_obj(ts, QTM_OBJ_PROCI_GRIPSUPPRESSION); + if (obj && obj->entry.num_inst > 0) { + ret = qtouch_write_addr(ts, obj->entry.addr, + &ts->pdata->gripsuppression_t40_cfg, + min(sizeof(ts->pdata->gripsuppression_t40_cfg), + obj->entry.size)); + if (ret != 0) { + pr_err("%s: Can't write the grip suppression config\n", + __func__); + return ret; + } + } + + /* configure the palm suppression table */ + obj = find_obj(ts, QTM_OBJ_PROCI_PALMSUPPRESSION); + if (obj && obj->entry.num_inst > 0) { + ret = qtouch_write_addr(ts, obj->entry.addr, + &ts->pdata->palm_suppression_cfg, + min(sizeof(ts->pdata->palm_suppression_cfg), + obj->entry.size)); + if (ret != 0) { + pr_err("%s: Can't write the palm suppression config\n", + __func__); + return ret; + } + } + + /* configure the Digitizer HID config */ + obj = find_obj(ts, QTM_OBJ_SPT_DIGITIZER); + if (obj && obj->entry.num_inst > 0) { + ret = qtouch_write_addr(ts, obj->entry.addr, + &ts->pdata->spt_digitizer_cfg, + min(sizeof(ts->pdata->spt_digitizer_cfg), + obj->entry.size)); + if (ret != 0) { + pr_err("%s: Can't write the Digitizer HID config\n", + __func__); + return ret; + } + } + ret = qtouch_force_calibration(ts); if (ret != 0) { pr_err("%s: Unable to recalibrate after reset\n", __func__); @@ -1251,11 +1295,12 @@ static int qtouch_process_info_block(struct qtouch_ts_data *ts) #endif } - pr_info("%s: %s found.\n family 0x%x, variant 0x%x, ver 0x%x\n" - " build 0x%x, matrix %dx%d, %d objects.\n", __func__, + pr_info("%s: %s found.\n" + " family 0x%x, variant 0x%x, ver 0x%x, build 0x%x\n" + " matrix %dx%d, %d objects, info blk chksum 0x%x\n", __func__, QTOUCH_TS_NAME, qtm_info.family_id, qtm_info.variant_id, qtm_info.version, qtm_info.build, qtm_info.matrix_x_size, - qtm_info.matrix_y_size, qtm_info.num_objs); + qtm_info.matrix_y_size, qtm_info.num_objs, our_csum); ts->eeprom_checksum = ts->pdata->nv_checksum; ts->family_id = qtm_info.family_id; diff --git a/include/linux/qtouch_obp_ts.h b/include/linux/qtouch_obp_ts.h index e33dac29275e..ba6915d2c95b 100644 --- a/include/linux/qtouch_obp_ts.h +++ b/include/linux/qtouch_obp_ts.h @@ -33,7 +33,7 @@ #define QTM_OBP_BOOT_CRC_PASSED 0x04 #define QTM_OBP_SLEEP_WAIT_FOR_BOOT 100 -#define QTM_OBP_SLEEP_WAIT_FOR_RESET 500 +#define QTM_OBP_SLEEP_WAIT_FOR_RESET 6000 #define QTM_OBP_SLEEP_WAIT_FOR_BACKUP 500 #define QTM_OBP_SLEEP_RESET_HOLD 20 #define QTM_OBP_SLEEP_WAIT_FOR_HW_RESET 40 @@ -69,9 +69,15 @@ enum { QTM_OBJ_PROCI_TWO_TOUCH_GESTURE_PROC = 27, QTM_OBJ_SPT_CTE_CONFIG = 28, QTM_OBJ_NOISESUPPRESSION_1 = 36, + QTM_OBJ_DEBUG_DIAGNOSTIC = 37, + QTM_OBJ_SPT_USERDATA = 38, + QTM_OBJ_PROCI_GRIPSUPPRESSION = 40, + QTM_OBJ_PROCI_PALMSUPPRESSION = 41, + QTM_OBJ_SPT_DIGITIZER = 43, + QTM_OBJ_SPT_MESSAGECOUNT = 44, /* Max number of objects currently defined */ - QTM_OBP_MAX_OBJECT_NUM = QTM_OBJ_NOISESUPPRESSION_1 + 1, + QTM_OBP_MAX_OBJECT_NUM = QTM_OBJ_SPT_MESSAGECOUNT + 1, }; /* OBP structures as defined by the wire protocol. */ @@ -179,13 +185,15 @@ struct qtm_gen_power_cfg { /* GEN_ACQUIRECONFIG_T8 */ struct qtm_gen_acquire_cfg { uint8_t charge_time; /* in 250ns */ - uint8_t atouch_drift; /* in 200ms */ + uint8_t reserve1; uint8_t touch_drift; /* in 200ms */ uint8_t drift_susp; /* in 200ms */ uint8_t touch_autocal; /* in 200ms */ - uint8_t sync; + uint8_t reserve5; uint8_t atch_cal_suspend_time; uint8_t atch_cal_suspend_thres; + uint8_t atch_cal_force_thres; + uint8_t atch_cal_force_ratio; } __attribute__ ((packed)); /* TOUCH_MULTITOUCHSCREEN_T9 */ @@ -219,6 +227,9 @@ struct qtm_touch_multi_cfg { uint8_t y_edge_ctrl; uint8_t y_edge_dist; uint8_t jump_limit; + uint8_t tch_thres_hyst; + uint8_t xpitch; + uint8_t ypitch; } __attribute__ ((packed)); /* TOUCH_KEYARRAY_T15 */ @@ -232,8 +243,8 @@ struct qtm_touch_keyarray_cfg { uint8_t burst_len; uint8_t tch_det_thr; uint8_t tch_det_int; - uint8_t rsvd1; - uint8_t rsvd2; + uint8_t reserve9; + uint8_t reserve10; } __attribute__ ((packed)); /* PROCG_SIGNALFILTER_T16 */ @@ -279,14 +290,14 @@ struct qtm_spt_gpio_pwm_cfg { } __attribute__ ((packed)); /* PROCI_GRIPFACESUPPRESSION_T20 */ -struct qtm_proci_grip_suppression_cfg { +struct qtm_proci_grip_face_suppression_cfg { uint8_t ctrl; uint8_t xlogrip; uint8_t xhigrip; uint8_t ylogrip; uint8_t yhigrip; uint8_t maxtchs; - uint8_t reserve0; + uint8_t reserve6; uint8_t szthr1; uint8_t szthr2; uint8_t shpthr1; @@ -297,20 +308,22 @@ struct qtm_proci_grip_suppression_cfg { /* PROCG_NOISESUPPRESSION_T22 */ struct qtm_procg_noise_suppression_cfg { uint8_t ctrl; - uint8_t outlier_filter_len; - uint8_t reserve0; - uint16_t gcaf_upper_limit; - uint16_t gcaf_lower_limit; - uint8_t gcaf_low_count; - uint8_t noise_threshold; uint8_t reserve1; + uint8_t reserve2; + uint8_t reserve3; + uint8_t reserve4; + uint8_t reserve5; + uint8_t reserve6; + uint8_t reserve7; + uint8_t noise_thres; + uint8_t reserve9; uint8_t freq_hop_scale; uint8_t burst_freq_0; uint8_t burst_freq_1; uint8_t burst_freq_2; uint8_t burst_freq_3; uint8_t burst_freq_4; - uint8_t idle_gcaf_valid; + uint8_t reserve16; } __attribute__ ((packed)); /* TOUCH_PROXIMITY_T23 */ @@ -320,7 +333,7 @@ struct qtm_touch_proximity_cfg { uint8_t y_origin; uint8_t x_size; uint8_t y_size; - uint8_t reserve0; + uint8_t reserve5; uint8_t blen; uint16_t tch_thresh; uint8_t tch_detect_int; @@ -332,7 +345,7 @@ struct qtm_touch_proximity_cfg { /* PROCI_ONETOUCHGESTUREPROCESSOR_T24 */ struct qtm_proci_one_touch_gesture_proc_cfg { uint8_t ctrl; - uint8_t reserve0; + uint8_t num_gestures; uint16_t gesture_enable; uint8_t pres_proc; uint8_t tap_time_out; @@ -362,8 +375,8 @@ struct qtm_spt_self_test_cfg { /* PROCI_TWOTOUCHGESTUREPROCESSOR_T27 */ struct qtm_proci_two_touch_gesture_proc_cfg { uint8_t ctrl; - uint8_t reserved0; - uint8_t reserved1; + uint8_t num_gestures; + uint8_t reserve2; uint8_t gesture_enable; uint8_t rotate_threshold; uint16_t zoom_threshold; @@ -373,7 +386,7 @@ struct qtm_proci_two_touch_gesture_proc_cfg { struct qtm_spt_cte_config_cfg { uint8_t ctrl; uint8_t command; - uint8_t mode; + uint8_t reserve2; uint8_t idle_gcaf_depth; uint8_t active_gcaf_depth; uint8_t voltage; @@ -396,6 +409,33 @@ struct qtm_proci_noise1_suppression_cfg { uint8_t x_short; } __attribute__ ((packed)); +/* QTM_OBJ_PROCI_GRIPSUPPRESSION T40 */ +struct qtm_proci_gripsuppression_cfg { + uint8_t ctrl; + uint8_t xlo_grip; + uint8_t xhi_grip; + uint8_t ylo_grip; + uint8_t yhi_grip; +} __attribute__ ((packed)); + +/* QTM_OBJ_PROCI_PALMSUPPRESSION T41 */ +struct qtm_proci_palm_suppression_cfg { + uint8_t ctrl; + uint8_t small_obj_thr; + uint8_t sig_spread_thr; + uint8_t large_obj_thr; + uint8_t distance_thr; + uint8_t sup_ext_to; +} __attribute__ ((packed)); + +/* QTM_OBJ_SPT_DIGITIZER T43 */ +struct qtm_spt_digitizer_cfg { + uint8_t ctrl; + uint8_t hid_idlerate; + uint16_t xlength; + uint16_t ylength; +} __attribute__ ((packed)); + /*******************************/ /******** platform data ********/ /*******************************/ @@ -485,7 +525,7 @@ struct qtouch_ts_platform_data { struct qtm_proci_linear_tbl_cfg linear_tbl_cfg; struct spt_comms_config_cfg comms_config_cfg; struct qtm_spt_gpio_pwm_cfg gpio_pwm_cfg; - struct qtm_proci_grip_suppression_cfg grip_suppression_cfg; + struct qtm_proci_grip_face_suppression_cfg grip_face_suppression_cfg; struct qtm_procg_noise_suppression_cfg noise_suppression_cfg; struct qtm_touch_proximity_cfg touch_proximity_cfg; struct qtm_proci_one_touch_gesture_proc_cfg one_touch_gesture_proc_cfg; @@ -493,6 +533,9 @@ struct qtouch_ts_platform_data { struct qtm_proci_two_touch_gesture_proc_cfg two_touch_gesture_proc_cfg; struct qtm_spt_cte_config_cfg cte_config_cfg; struct qtm_proci_noise1_suppression_cfg noise1_suppression_cfg; + struct qtm_proci_gripsuppression_cfg gripsuppression_t40_cfg; + struct qtm_proci_palm_suppression_cfg palm_suppression_cfg; + struct qtm_spt_digitizer_cfg spt_digitizer_cfg; struct virt_keys vkeys; }; -- 2.34.1