File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -329,6 +329,9 @@ void read_touchpad_in_report(void)
329
329
int xfer_len = 0 ;
330
330
int16_t x , y ;
331
331
uint8_t response_byte = 0x08 ;
332
+
333
+ /* Make sure report id is set to an invalid value */
334
+ data [2 ] = 0 ;
332
335
/*dont trigger disable state during our own transactions*/
333
336
gpio_disable_interrupt (GPIO_EC_I2C_3_SDA );
334
337
i2c_lock (I2C_PORT_TOUCHPAD , 1 );
@@ -338,6 +341,11 @@ void read_touchpad_in_report(void)
338
341
if (rv != EC_SUCCESS )
339
342
goto read_failed ;
340
343
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
+ }
341
349
xfer_len = MIN (126 , xfer_len - 2 );
342
350
rv = i2c_xfer_unlocked (I2C_PORT_TOUCHPAD ,
343
351
TOUCHPAD_I2C_HID_EP | I2C_FLAG_ADDR16_LITTLE_ENDIAN ,
@@ -354,6 +362,10 @@ void read_touchpad_in_report(void)
354
362
/* try again some other time later if the TP keeps interrupting us */
355
363
detected_host_packet = true;
356
364
inreport_retries = 0 ;
365
+ MCHP_I2C_CTRL (MCHP_I2C_CTRL4 ) = BIT (7 ) |
366
+ BIT (6 ) |
367
+ BIT (3 ) |
368
+ BIT (0 );
357
369
CPRINTS ("PS2M Too many retries" );
358
370
} else {
359
371
hook_call_deferred (& retry_tp_read_evt_deferred_data , 25 * MSEC );
You can’t perform that action at this time.
0 commit comments