summaryrefslogtreecommitdiff
path: root/driver/touchpad_st.c
Commit message (Collapse)AuthorAgeFilesLines
* tasks: convert TASK_EVENT_CUSTOM macro to bitJett Rink2019-04-241-2/+2
| | | | | | | | | | | | | | | | | | | | | We should ensure that all custom task definition are non-zero and fit with the globally defined events. Add compile time check and change semantics to specify bit number (instead of making all callers use the BIT macro). This also fixes an error with TASK_EVENT_PHY_TX_DONE for ITE being 0. The bug that made that happen hasn't landed on any firmware branches that use it though. BRANCH=none BUG=none TEST=builds Cq-Depend:chrome-internal:1178968,chrome-internal:1178952 Change-Id: I5e1d1312382d200280c548e9128e53f4eddd3e61 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1570607 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
* common: bit change 1 << constants with BIT(constants)Gwendal Grignou2019-03-261-1/+1
| | | | | | | | | | | | | | | | | Mechanical replacement of bit operation where operand is a constant. More bit operation exist, but prone to errors. Reveal a bug in npcx: chip/npcx/system-npcx7.c:114:54: error: conversion from 'long unsigned int' to 'uint8_t' {aka 'volatile unsigned char'} changes value from '16777215' to '255' [-Werror=overflow] BUG=None BRANCH=None TEST=None Change-Id: I006614026143fa180702ac0d1cc2ceb1b3c6eeb0 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518660 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* common: replace 1 << digits, with BIT(digits)Gwendal Grignou2019-03-261-19/+19
| | | | | | | | | | | | | | | | Requested for linux integration, use BIT instead of 1 << First step replace bit operation with operand containing only digits. Fix an error in motion_lid try to set bit 31 of a signed integer. BUG=None BRANCH=None TEST=compile Change-Id: Ie843611f2f68e241f0f40d4067f7ade726951d29 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518659 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* touchpad_st: do not generate 0 finger hid eventWei-Han Chen2018-11-191-1/+3
| | | | | | | | | | | | | | | | | When we receive a beacon, we will also try to collect finger events. In this case, there might be the case that there is not finger but dome switch is on. In this case, we should not report the click. BRANCH=nocturne BUG=b:119597909 TEST=manual on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I03fe4481d17f6e919ab9501b2a93fa19635e381f Reviewed-on: https://chromium-review.googlesource.com/1337253 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: ignore error 0x2AWei-Han Chen2018-11-131-1/+1
| | | | | | | | | | | | | BRANCH=nocturne BUG=b:118444760 TEST=local build and run on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I3799c9fd5e8e302c7cca35a5aca0b6bbc3879218 Reviewed-on: https://chromium-review.googlesource.com/1326781 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: remove beacon count logsWei-Han Chen2018-11-081-0/+3
| | | | | | | | | | | | | | | | Currently, beacon count is logged every second. Suppress the log and only print errors when beacon count is frozen. BRANCH=nocturne BUG=None TEST=manual on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I20eb992b5f006f425bb5a94bad8e0e5b3015a7ac Reviewed-on: https://chromium-review.googlesource.com/1322187 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: don't halt on error 0x24Wei-Han Chen2018-11-081-1/+2
| | | | | | | | | | | | | BRANCH=nocturne BUG=b:118444760 TEST=local build and run on device Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: Ie71d6e94009046f2a097b9a8ab0820959b35d610 Reviewed-on: https://chromium-review.googlesource.com/1322186 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* driver/touchpad_st: Ignore st_tp_reset return valueNicolas Boichat2018-10-241-2/+5
| | | | | | | | | | | | | | | | | | | | | Workaround for the bug described in b/118312397. Without this, EC FW is not able to request Full Panel Initialization (FPI), in some specific cases, if the last FPI on ST FW 32 previously failed. BUG=b:118312397 TEST= 1. Flash whiskers_v2.2.75-3a719f70b.fw (32.0) 2. During FPI, disconnect the base 3. Flash whiskers_v2.2.88-6c5576913.fw (34.0) 4. EC FW is unable to run FPI This FW fixes the issue in 4, and FPI is run on boot, when the EC FW realizes that Cx table is invalid. BRANCH=whiskers Change-Id: Ifb817d2c7d4a9311f3273b46964903b0f94dcdae Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1297092 Reviewed-by: Wei-Han Chen <stimim@chromium.org>
* touchpad_st: handle CX config error on initWei-Han Chen2018-10-151-22/+94
| | | | | | | | | | | | | | | During touchpad init process, TP might generate errors related to invalid CX config or invalid panel config. We try to catch these errors and take required actions. BRANCH=nocturne BUG=b:117203130 TEST=manual on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I405fdbcd7a3077fc8b237c8fff02fca7005c2195 Reviewed-on: https://chromium-review.googlesource.com/1270416 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: refactor st_tp_read_all_events()Wei-Han Chen2018-10-151-55/+57
| | | | | | | | | | | | | | | | | st_tp_read_all_events() will always return "number of events available in rx_buf.events[]". If there are any error, recommended action will be stored in "tp_control". BRANCH=nocturne BUG=b:117203130 TEST=manual on device Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I021b0b1baf19bee8ebe0f60dd264f3a52a656532 Reviewed-on: https://chromium-review.googlesource.com/1270401 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: preserve panel config section during updateWei-Han Chen2018-10-151-11/+19
| | | | | | | | | | | | | | | | We accidentially override panel config section, and this makes us have to do "panel initialization" everytime after tp firmware is updated. BRANCH=nocturne BUG=b:117203130 TEST=manual on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I10ce62297403f3e1dcadae62573255b00f82247d Reviewed-on: https://chromium-review.googlesource.com/1270415 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: embed FTB header in unpacked TP FWWei-Han Chen2018-10-151-29/+31
| | | | | | | | | | | | | | | | | | | To make it easier to decide if full panel initialization is required, we put the original FTB header in the beginning of unpacked TP FW. touchpad_update_write will clear CX data if CX version will be different. CQ-DEPEND=CL:*697971 BRANCH=nocturne BUG=b:117203130 TEST=manual on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I60351783b8c015fcb23431811c156bfca8d15b67 Reviewed-on: https://chromium-review.googlesource.com/1267876 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: touch_slot should be reset to 0Wei-Han Chen2018-10-111-0/+1
| | | | | | | | | | | | | | | | When we recover from touchpad error by resetting the touchpad, after TP reset, "touch_slot" should be reset to 0. BRANCH=nocturne BUG=b:117568885 TEST=manual on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I4dad1b2ad28885e376023d5e5274485aaa852ac3 Reviewed-on: https://chromium-review.googlesource.com/1274685 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: fix bug in dump_memoryWei-Han Chen2018-10-101-1/+1
| | | | | | | | | | | | | | | | in dump_memory, rx_len includes DUMMY_BYTE, but it should not be counted when we are printing. BRANCH=nocturne BUG=b:117398324 TEST=manual on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I9810e97b1fb0ce94973fc24963d6c6ea601759be Reviewed-on: https://chromium-review.googlesource.com/1267875 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: decide if full init is required by cx versionWei-Han Chen2018-10-091-5/+47
| | | | | | | | | | | | | | BRANCH=nocturne BUG=b:117203130 TEST=on whiskers: downgrade to v18, upgrade to v25, full init is triggered Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I74582aba181dab31eede1193b400abfc847c1151 Reviewed-on: https://chromium-review.googlesource.com/1258373 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: refactor to support panel initializationWei-Han Chen2018-10-091-20/+24
| | | | | | | | | | | | | | | | | | | | | | After ST firmware update, there are two ways of initialization: 1. Panel initialization 2. Full panel initialization Full panel initialization is only required if CX table format is changed. In the future, we will track versions of CX table format, and only request full initialization if required. BRANCH=nocturne BUG=b:117203130 TEST=on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I05dc2203213606addb27fd03f1c9ff937e4941f0 Reviewed-on: https://chromium-review.googlesource.com/1258691 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: make panel initialization synchronousWei-Han Chen2018-10-091-30/+39
| | | | | | | | | | | | | | | | the entire process would take up to 2 seconds. CQ-DEPEND=CL:1264236 BRANCH=nocturne BUG=b:117203130 TEST=manual on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I0cdcdb8caf3b1d9cf6a5787b93bf8cdb13832a74 Reviewed-on: https://chromium-review.googlesource.com/1264237 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: log heatmap enable / disableWei-Han Chen2018-10-051-1/+4
| | | | | | | | | | | | | BRANCH=nocturne BUG=None TEST=manual on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I6d336d6a35671b59e0821ecd38bd481b7c4e80e0 Reviewed-on: https://chromium-review.googlesource.com/1258692 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: update touchpad hung detection logicWei-Han Chen2018-10-051-8/+41
| | | | | | | | | | | | | | When idle count does not change, reset the touchpad if there are no fingers on touchpad. BRANCH=nocturne BUG=b:113315759 TEST=tested on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I8336bac2b31963e4c2cb671ced8502e6b176424d Reviewed-on: https://chromium-review.googlesource.com/1261615 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: read event fifo in heatmap modeWei-Han Chen2018-10-041-0/+4
| | | | | | | | | | | | | | | Beacon and error events are still available in heatmap mode. BRANCH=nocturne BUG=None TEST=manual on device Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I6ac2e20f62bedf7084edb567765fd5b5fe7ae800 Reviewed-on: https://chromium-review.googlesource.com/1258689 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: error event info is little endianWei-Han Chen2018-10-041-2/+2
| | | | | | | | | | | | | BRANCH=nocturne BUG=None TEST=manual on device Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I141c73e4c9736332b05bd1713dd40111148c6b66 Reviewed-on: https://chromium-review.googlesource.com/1256307 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: scale major & minorWei-Han Chen2018-10-041-2/+2
| | | | | | | | | | | | | | | | Pressure, major, minor values are adjusted in v25.0 firmware. This should reduce the chance of dropping a tap. BRANCH=nocturne BUG=b:116321493 TEST=manual on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: Ia9345f7a624e7db9b73926ee29e5e5631d63998a Reviewed-on: https://chromium-review.googlesource.com/1256306 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: new error types: 0xf1, 0xf2, 0xf3Wei-Han Chen2018-10-041-6/+7
| | | | | | | | | | | | | | | | 0xf1, 0xf2, 0xf3 are introduced since version 25.0. The suggested action is touchpad reset. BRANCH=nocturne BUG=b:113315759 TEST=manual on device Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I92842e28d6dc28fc1141e6232143f26f652971ac Reviewed-on: https://chromium-review.googlesource.com/1256305 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: memory corruption detectionWei-Han Chen2018-10-041-25/+121
| | | | | | | | | | | | | | | | | | | | The touchpad firmware will send out a beacon every second. Therefore, if there is no events (touch event / error event / beacon event) for more than 3 seconds, we should assume that touchpad hangs, and we should reset the touchpad. This requires touchpad FW >= v25.0. BRANCH=nocturne BUG=b:113315759 TEST=manual on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I6dc57705ebb8ef9f9d0ffde3c3243704b7ff88ee Reviewed-on: https://chromium-review.googlesource.com/1238753 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: show status report from STWei-Han Chen2018-10-031-0/+24
| | | | | | | | | | | | | BRANCH=nocturne BUG=b:113315759 TEST=manual on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: Ie1547d5cadcb6876b6e6ea25504aabd84d21b0c9 Reviewed-on: https://chromium-review.googlesource.com/1256304 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* usb_hid_touchpad: set confidence bit on finger leaveWei-Han Chen2018-09-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | When finger is leaving, the confidence should be '1', since it is not a plam. Some background: Since CL:617811, Linux kernel treats a finger whose confidence equal to 0 as a "palm", and override its width and height with max value. Therefore, when we are reporting a finger leaving event, if the confidence is 0, the finger will quickly become a fat finger (max width and heigh, locates at top-left corner), and then leave. This will confuse gesture library, and might cause unintended behaviors. BRANCH=nocturne BUG=b:116321493 TEST=manually on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I30be0e5efeb6c2215795565dce8c2da23892939f Reviewed-on: https://chromium-review.googlesource.com/1250584 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Tai-Hsu Lin <sheckylin@chromium.org>
* touchpad_st: integrate power control and system stateWei-Han Chen2018-09-261-16/+31
| | | | | | | | | | | | | | | | | | | | | | Previously, there was a static variable "enabled" in touchpad_power_control(). Logically, this value should be same as "SYSTEM_STATE_ACTIVE_MODE" in system_state. And, because system_state will be reset after touchpad reset, to make sure everything line up, we should get "enabled" from system_state instead. Also, when touchpad is being reset due to errors, power control should not enable / disable scanning. BRANCH=nocturne BUG=None TEST=manual on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I5485422759c68769e9ad249a2903f3f796b5b068 Reviewed-on: https://chromium-review.googlesource.com/1242576 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: read dummy byte while dumping memoryWei-Han Chen2018-09-261-2/+2
| | | | | | | | | | | | | | | | We forgot to add dummy byte while dumping memory. Also make sure all other spi_transaction calls take dummy byte into account. BRANCH=nocturne BUG=b:112877237 TEST=manual on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I5366e16103a0b1ba502dd34ba4c3536482b99776 Reviewed-on: https://chromium-review.googlesource.com/1242575 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* usb_hid_touchpad: fix logical max of width & heightWei-Han Chen2018-09-261-2/+3
| | | | | | | | | | | | | | | | Width and Height are 12 bits in USB HID descriptor. But the logical maximum was set to 255. Also scale up width and height reported by ST firmware. BRANCH=nocturne BUG=none TEST=manual on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I899af2b18120d9e877d45e1dc2c14404a412797b Reviewed-on: https://chromium-review.googlesource.com/1232798 Reviewed-by: Tai-Hsu Lin <sheckylin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: handle error type 0xffWei-Han Chen2018-09-191-0/+22
| | | | | | | | | | | | | | | | | | | When ST touchpad is down, or the SPI interface is not working properly (either hardware or software issue), we might receive events filled with 0xff. In this case, try if resetting touchpad can bring it back. To prevent infinite reboot, if the touchpad is not recovered after 3 reboots, stop it. BRANCH=nocturne BUG=None TEST=manual on device Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I8d2a8f0f4aa305af11f14a63f0bc4d53c2c23a49 Reviewed-on: https://chromium-review.googlesource.com/1230393 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: "dump_memory" can be enabled via console commandWei-Han Chen2018-09-161-4/+14
| | | | | | | | | | | | | | | | | | | | | Previously, dump_memory can only be enabled at compile time (through local build). Make this runtime configurable. Currently, it is default off, since dump_memory is very slow and might not be useful to enable for all users. The dump log through USB interface doesn't look good for now. We revisit the default value in the future. BRANCH=nocturne BUG=b:112877237 TEST=manual on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I422a5a23392298301995df4fbf8101b7a18a62ba Reviewed-on: https://chromium-review.googlesource.com/1212665 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: handle severe errorsWei-Han Chen2018-09-161-17/+165
| | | | | | | | | | | | | | | | | For errors that are noted as "FW shall halt" in spec, we should reset the touchpad, so it won't keep generating the same error and cause EC watchdog reboot the entire system. BRANCH=nocturne BUG=b:112877237 TEST=tested on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: Ie3c0a9930628caf1e55a243bd017f233756152a6 Reviewed-on: https://chromium-review.googlesource.com/1203351 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* driver/touchpad_st: add more debug commandsWei-Han Chen2018-09-031-0/+43
| | | | | | | | | | | | | | | | | | | | | | The following new commands are added to help debugging touchpad issues. +ST_TP_DEBUG_CMD_RESET_TOUCHPAD 0x00 ST_TP_DEBUG_CMD_CALIBRATE 0x01 +ST_TP_DEBUG_CMD_START_SCAN 0x02 +ST_TP_DEBUG_CMD_STOP_SCAN 0x03 +ST_TP_DEBUG_CMD_READ_BUF_HEADER 0x04 +ST_TP_DEBUG_CMD_READ_EVENTS 0x05 BRANCH=none BUG=b:70482333 TEST=manual on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: Id9a604560afda9304329d5ca7c21160df225bf15 Reviewed-on: https://chromium-review.googlesource.com/1184135 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* whiskers: Disable keyboard scanning and touchpad in tablet modeNicolas Boichat2018-09-031-13/+48
| | | | | | | | | | | | | | | | | | | | When in tablet mode, disable keyboard scanning and touchpad. Refactor touchpad_*.c power management to take both into account (there is some duplicated code here, that we may want to merge in the future). This will also prevent magic keyboard from working, but we are ok with this, at least for now. BRANCH=none BUG=b:73133611 TEST=In tablet mode, keyboard scanning and touchpad are both disabled. Change-Id: I51b7c50b90cca9b9f574c5c611daa89fe8a480bb Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1180639 Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Wei-Han Chen <stimim@chromium.org>
* touchpad_st: disable heatmap should always successWei-Han Chen2018-08-311-7/+8
| | | | | | | | | | | | | | | | | | We should only fail if host is trying to enable heatmap via `Set_Interface` command. Setting altsetting to 0 (disable heatmap) should always success. BRANCH=none BUG=b:113141452 TEST=tested on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I540ce7af46bd2bf84dccb0d21bf0ad89ade3c9e9 Reviewed-on: https://chromium-review.googlesource.com/1198943 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad heatmap: set subclass and protocolWei-Han Chen2018-08-311-2/+2
| | | | | | | | | | | | | | BRANCH=none TEST=make buildall -j TEST=test on whiskers BUG=b:70482333 Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: Ieadb743b428997ca1e7c9d45837f503d3023f779 Reviewed-on: https://chromium-review.googlesource.com/1198942 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* stm32: usb_hid_touchpad: add confidenceWei-Han Chen2018-08-311-1/+3
| | | | | | | | | | | | | | | | `confidence` is expected from a PTP-compliant touchpad BRANCH=none BUG=b:70482333 TEST=manual Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: Ibe7166f43cae5fb36bbcc4e6dfd9ae6525a7225e Reviewed-on: https://chromium-review.googlesource.com/1188170 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: handle new domeswitch APIWei-Han Chen2018-08-191-10/+8
| | | | | | | | | | | | | | | | 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 <stimim@chromium.org> Change-Id: I6ce21f48ec8aa62a4167a86581acd2e2abee7ce6 Reviewed-on: https://chromium-review.googlesource.com/1177524 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: fix heatmap modeWei-Han Chen2018-08-181-2/+6
| | | | | | | | | | | | | | | | The rx_buf was set incorrectly in heat map mode. Also add debug messages to help debugging. BRANCH=none BUG=b:70482333 TEST=test on full system, enable heatmap Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I325a9b7983a16634b95eecdc592c59222e48c7aa Reviewed-on: https://chromium-review.googlesource.com/1177093 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: remove support for 2 bytes per pixelWei-Han Chen2018-08-061-31/+4
| | | | | | | | | | | | | BRANCH=none BUG=b:70482333 TEST=test on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: If6660977ed598c8ed81eba98e7f1805dd8bb7976 Reviewed-on: https://chromium-review.googlesource.com/1163237 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: send domeswitch status in heatmap modeWei-Han Chen2018-08-061-5/+36
| | | | | | | | | | | | | BRANCH=none BUG=b:70482333 TEST=test on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I84b481b3d2dee9254cdf798aee01a3a4ce44ac88 Reviewed-on: https://chromium-review.googlesource.com/1160427 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: support 1 byte pixelsWei-Han Chen2018-08-061-7/+32
| | | | | | | | | | | | | | | | The latest release from ST is changed to 1 byte per pixel in heat map mode. BRANCH=none BUG=b:70482333 TEST=test on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I499bbea2636a65b06dacd81b358a7444bd8ac6c2 Reviewed-on: https://chromium-review.googlesource.com/1160426 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* usb_hid_touchpad: make max pressure configurableWei-Han Chen2018-08-031-5/+3
| | | | | | | | | | | | | | | | | | | | | | Maximum pressure is now defined by CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_Z. `hammer` is the only board using usb_hid_touchpad, the board.h is updated to reflect the change (for old boards "HAMMER" and "STAFF", we keep the value 1023, so they should behave the same). BRANCH=none BUG=b:70482333 TEST=make BOARD=whiskers TEST=make buildall -j TEST=manually on device Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I70b0a5b19dfbe3ac731ef2ead08578a7f7a1cb0b Reviewed-on: https://chromium-review.googlesource.com/1141676 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* driver/touchpad_st.c: support heat mapWei-Han Chen2018-07-191-4/+425
| | | | | | | | | | | | | BRANCH=none BUG=b:70482333 TEST=`make BOARD=whiskers` works w/ & w/o CONFIG_USB_ISOCHRONOUS Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: Ia05e778d9795a09ea6edceddd839992859d75050 Reviewed-on: https://chromium-review.googlesource.com/958897 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* whiskers touchpad: adjust value rangeWei-Han Chen2018-07-041-3/+5
| | | | | | | | | | | | | | | | | | | | | | | 1. In usb_hid_touchpad.h, `pressure` is defined as unsigned:10, while in touchpad_st.h, `z` is defined as unsigned:8, scale it up to match size of `pressure`. 3. Scale up `width` and `height` for similar reason. 2. Update physical dimension, so it match the real device. With this change, I can use EC touchpad on my Linux machine. BRANCH=none BUG=b:70482333 TEST=tested on Linux Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I651f2345ea48c7c9ed495e9684b762bde167092e Reviewed-on: https://chromium-review.googlesource.com/1125652 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* touchpad_st: Power off when USB is suspended without wakeWei-Han Chen2018-06-131-4/+31
| | | | | | | | | | | | | | | | | | | When USB is suspended and disable remote wakeup (SUS0), we can stop touchpad scanning to save some power. This CL also stops sending empty touchpad HID events when there is no finger events nor button events. BRANCH=whiskers BUG=b:70482333 TEST=`st_tp_stop_scan` is called on USB suspend Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: Iebf29d7371383b7493baa1059cfa8d56bbc2589c Reviewed-on: https://chromium-review.googlesource.com/1095119 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* drivers/touchpad_st.c: wait full initialize by re-calling deferredWei-Han Chen2018-06-071-35/+34
| | | | | | | | | | | | | | | | | | | | Full panel initialization can take about 1.6 seconds. If this is called by hook_call_deferred, it will block other HOOKS. Replace the 'while loop + sleep' by re-calling deferred every 100ms. BRANCH=whiskers BUG=b:109714732 TEST=sudo ./extra/usb_updater/usb_updater2 -d 18d1:5030 --tp_update <fw> TEST=sudo extra/usb_updater/usb_updater2 -d 18d1:5030 --tp_debug=01 TEST=(EC console) touchpad_st calibrate Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I665169524a06a7c359303a4a3dceced4a141f9ae Reviewed-on: https://chromium-review.googlesource.com/1086895 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* driver/touchpad_st.c: fix a bug in st_tp_resetWei-Han Chen2018-06-061-8/+12
| | | | | | | | | | | | | | | | | | | In st_tp_reset, we should exit the function when we received a controller ready event. The "break" statement only breaks inner for loop, not while loop. Fix this bug. BRANCH=whiskers BUG=b:70482333 TEST=sudo ./extra/usb_updater/usb_updater2 -d 18d1:5030 --tp_update <fw> TEST=sudo extra/usb_updater/usb_updater2 -d 18d1:5030 --tp_debug=01 TEST=(EC console) touchpad_st calibrate Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I92f94cce33c32ab26924fb91b50cd192d179ba90 Reviewed-on: https://chromium-review.googlesource.com/1086894 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* driver/touchpad_st.c: call full initialization via touchpad_debugWei-Han Chen2018-05-291-1/+12
| | | | | | | | | | | | | | BRANCH=none BUG=b:70482333 BUG=b:78483107 TEST=manual test on whiskers Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I57f96331d75a54c52f31305fee7090930ed845cd Reviewed-on: https://chromium-review.googlesource.com/1071314 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* driver/touchpad_st.c: add "st_tp_full_initialize"Wei-Han Chen2018-05-291-14/+62
| | | | | | | | | | | | | | | | | | | | This will be called after touchpad firmware is updated. "Full initialization" will trigger auto tuning. This function can also be called by console command `touchpad_st calibrate`. BRANCH=none BUG=b:70482333 BUG=b:78483107 TEST=manual Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I336dfa79ae5133750dc90ba07cbe9fc81318e84e Reviewed-on: https://chromium-review.googlesource.com/1049765 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>