Skip to content

Commit 60585d9

Browse files
authoredMay 11, 2022
Merge pull request #466 from FrameworkComputer/hx20.fix_ps2_mouse_hang
fix ps2m not work on boot
2 parents ac24e5a + 30216a3 commit 60585d9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
 

‎board/hx20/ps2mouse.c

+12
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,9 @@ void read_touchpad_in_report(void)
329329
int xfer_len = 0;
330330
int16_t x, y;
331331
uint8_t response_byte = 0x08;
332+
333+
/* Make sure report id is set to an invalid value */
334+
data[2] = 0;
332335
/*dont trigger disable state during our own transactions*/
333336
gpio_disable_interrupt(GPIO_EC_I2C_3_SDA);
334337
i2c_lock(I2C_PORT_TOUCHPAD, 1);
@@ -338,6 +341,11 @@ void read_touchpad_in_report(void)
338341
if (rv != EC_SUCCESS)
339342
goto read_failed;
340343
xfer_len = (data[1]<<8) + data[0];
344+
if (xfer_len == 0) {
345+
/* touchpad has reset per i2c-hid-protocol 7.3 */
346+
CPRINTS("PS2M Touchpad Reset");
347+
goto read_failed;
348+
}
341349
xfer_len = MIN(126, xfer_len-2);
342350
rv = i2c_xfer_unlocked(I2C_PORT_TOUCHPAD,
343351
TOUCHPAD_I2C_HID_EP | I2C_FLAG_ADDR16_LITTLE_ENDIAN,
@@ -354,6 +362,10 @@ void read_touchpad_in_report(void)
354362
/* try again some other time later if the TP keeps interrupting us */
355363
detected_host_packet = true;
356364
inreport_retries = 0;
365+
MCHP_I2C_CTRL(MCHP_I2C_CTRL4) = BIT(7) |
366+
BIT(6) |
367+
BIT(3) |
368+
BIT(0);
357369
CPRINTS("PS2M Too many retries");
358370
} else {
359371
hook_call_deferred(&retry_tp_read_evt_deferred_data, 25*MSEC);

0 commit comments

Comments
 (0)
Please sign in to comment.