From 8aac0772eaa9eb686d57f38ee61a616caa4accbe Mon Sep 17 00:00:00 2001 From: Wei-Han Chen Date: Thu, 16 Aug 2018 18:40:24 +0800 Subject: touchpad_st: handle new domeswitch API In latest ST firmware, domeswitch level is already reported, there is no domeswitch_chg anymore. BRANCH=none BUG=b:70482333 TEST=manual on device Signed-off-by: Wei-Han Chen Change-Id: I6ce21f48ec8aa62a4167a86581acd2e2abee7ce6 Reviewed-on: https://chromium-review.googlesource.com/1177524 Commit-Ready: Wei-Han Chen Tested-by: Wei-Han Chen Reviewed-by: Nicolas Boichat --- driver/touchpad_st.c | 18 ++++++++---------- driver/touchpad_st.h | 8 ++------ 2 files changed, 10 insertions(+), 16 deletions(-) (limited to 'driver') diff --git a/driver/touchpad_st.c b/driver/touchpad_st.c index 6650471663..11a85a90c8 100644 --- a/driver/touchpad_st.c +++ b/driver/touchpad_st.c @@ -200,16 +200,14 @@ static int st_tp_check_domeswitch_state(void) if (ret) return ret; - if (rx_buf.buffer_header.flags & ST_TP_BUFFER_HEADER_DOMESWITCH_CHG) { - /* - * dome_switch_level from device is inverted. - * That is, 0 => pressed, 1 => released. - */ - set_bits(&system_state, - (rx_buf.buffer_header.dome_switch_level ? - 0 : SYSTEM_STATE_DOME_SWITCH_LEVEL), - SYSTEM_STATE_DOME_SWITCH_LEVEL); - } + ret = rx_buf.buffer_header.flags & ST_TP_BUFFER_HEADER_DOMESWITCH_LVL; + /* + * Domeswitch level from device is inverted. + * That is, 0 => pressed, 1 => released. + */ + set_bits(&system_state, + ret ? 0 : SYSTEM_STATE_DOME_SWITCH_LEVEL, + SYSTEM_STATE_DOME_SWITCH_LEVEL); return 0; } diff --git a/driver/touchpad_st.h b/driver/touchpad_st.h index cae8d5f0f2..286c39cbab 100644 --- a/driver/touchpad_st.h +++ b/driver/touchpad_st.h @@ -176,16 +176,12 @@ struct st_tp_host_buffer_header_t { #define ST_TP_BUFFER_HEADER_HEAT_MAP_MT_RDY (1 << 3) #define ST_TP_BUFFER_HEADER_HEAT_MAP_SF_RDY (1 << 4) #define ST_TP_BUFFER_HEADER_HEAT_MAP_SS_RDY (1 << 5) -#define ST_TP_BUFFER_HEADER_DOMESWITCH_CHG (1 << 6) +#define ST_TP_BUFFER_HEADER_DOMESWITCH_LVL (1 << 6) uint8_t flags; uint8_t reserved[3]; uint8_t heatmap_miss_count; uint8_t event_count; uint8_t event_miss_count; - uint8_t dome_switch_down_count:3; - uint8_t dome_switch_up_count:3; - uint8_t dome_switch_level:1; - uint8_t dome_switch_overflow:1; } __packed; struct st_tp_host_buffer_heat_map_t { @@ -249,7 +245,7 @@ enum ST_TP_MODE { #define ST_TP_HEAT_MAP_THRESHOLD 10 /* A minimum version that supports heatmap mode. */ -#define ST_TP_MIN_HEATMAP_VERSION 11 +#define ST_TP_MIN_HEATMAP_VERSION 0x12 #endif /* __CROS_EC_TOUCHPAD_ST_H */ -- cgit v1.2.1