@@ -326,6 +326,7 @@ static int inreport_retries;
326326void read_touchpad_in_report (void )
327327{
328328 int rv = EC_SUCCESS ;
329+ int need_reset = 0 ;
329330 uint8_t data [128 ];
330331 int xfer_len = 0 ;
331332 int16_t x , y ;
@@ -340,6 +341,8 @@ void read_touchpad_in_report(void)
340341
341342 /*dont trigger disable state during our own transactions*/
342343 gpio_disable_interrupt (GPIO_EC_I2C_3_SDA );
344+ /* need to disable SOC_TP_INT_L if we need to setup touchpad */
345+ gpio_disable_interrupt (GPIO_SOC_TP_INT_L );
343346 i2c_set_timeout (I2C_PORT_TOUCHPAD , 25 * MSEC );
344347 i2c_lock (I2C_PORT_TOUCHPAD , 1 );
345348 rv = i2c_xfer_unlocked (I2C_PORT_TOUCHPAD ,
@@ -349,9 +352,14 @@ void read_touchpad_in_report(void)
349352 goto read_failed ;
350353 xfer_len = (data [1 ]<<8 ) + data [0 ];
351354 if (xfer_len == 0 ) {
352- /* touchpad has reset per i2c-hid-protocol 7.3 */
353- CPRINTS ("PS2M Touchpad Reset" );
354- goto read_failed ;
355+ /**
356+ * touchpad has reset per i2c-hid-protocol 7.3
357+ * We need to complete the read protocol to make sure i2c state machine
358+ * is correct.
359+ */
360+ CPRINTS ("PS2M Touchpad need to reset" );
361+ xfer_len = 6 ;
362+ need_reset = 1 ;
355363 }
356364 xfer_len = MIN (126 , xfer_len - 2 );
357365 rv = i2c_xfer_unlocked (I2C_PORT_TOUCHPAD ,
@@ -385,7 +393,7 @@ void read_touchpad_in_report(void)
385393 }
386394 i2c_lock (I2C_PORT_TOUCHPAD , 0 );
387395 gpio_enable_interrupt (GPIO_EC_I2C_3_SDA );
388-
396+ gpio_enable_interrupt ( GPIO_SOC_TP_INT_L );
389397 if (mouse_state == PS2MSTATE_RESET ) {
390398 return ;
391399 }
@@ -416,13 +424,13 @@ void read_touchpad_in_report(void)
416424 current_pos [1 ] = x ;
417425 current_pos [2 ] = y ;
418426 send_movement_packet ();
419- } else {
420- if (rv == EC_SUCCESS ) {
421- CPRINTS ("PS2M Unexpected Report ID %d reconfiguring" , data [2 ]);
422- setup_touchpad ();
423- }
424427 }
425428
429+ if (need_reset ) {
430+ CPRINTS ("PS2M Unexpected Report ID %d reconfiguring" , data [2 ]);
431+ setup_touchpad ();
432+ need_reset = 0 ;
433+ }
426434}
427435/*
428436 * Looking at timing it takes the SOC about 2ms to grab a tp packet from start of
0 commit comments