Skip to content

Commit 21c9dec

Browse files
committed
Fixed: set the touchpad power on before we setup the standard mouse mode
TETS:The touchpad will not delay after idle a moment Signed-off-by: Josh-Tsai <josh_tsai@compal.com>
1 parent 7cd11b7 commit 21c9dec

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

baseboard/fwk/ps2mouse.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,18 @@ void set_ps2_mouse_emulation(bool disable)
294294
}
295295
void set_power(bool standby)
296296
{
297-
int data = BIT(11) + standby ? 1 : 0;
297+
uint16_t data = BIT(11) | (standby ? 0x01 : 0x0);
298298

299-
i2c_write_offset16(I2C_PORT_TOUCHPAD, TOUCHPAD_I2C_HID_EP | I2C_FLAG_ADDR16_LITTLE_ENDIAN, PCT3854_COMMAND, data, 1);
299+
i2c_write_offset16(I2C_PORT_TOUCHPAD,
300+
TOUCHPAD_I2C_HID_EP | I2C_FLAG_ADDR16_LITTLE_ENDIAN, PCT3854_COMMAND, data, 2);
301+
}
302+
303+
void set_reset(void)
304+
{
305+
uint16_t data = BIT(8);
306+
307+
i2c_write_offset16(I2C_PORT_TOUCHPAD,
308+
TOUCHPAD_I2C_HID_EP | I2C_FLAG_ADDR16_LITTLE_ENDIAN, PCT3854_COMMAND, data, 2);
300309
}
301310

302311
void setup_touchpad(void)
@@ -491,6 +500,8 @@ void mouse_interrupt_handler_task(void *p)
491500
CPRINTS("PS2M Configuring for ps2 emulation mode");
492501
/*tp takes about 80 ms to come up, wait a bit*/
493502
usleep(200*MSEC);
503+
set_power(false);
504+
set_reset();
494505
setup_touchpad();
495506

496507
gpio_enable_interrupt(GPIO_SOC_TP_INT_L);
@@ -501,12 +512,15 @@ void mouse_interrupt_handler_task(void *p)
501512
}
502513
if (power_state == POWER_S0S3 || power_state == POWER_S5) {
503514
/* Power Down */
515+
set_power(true);
504516
gpio_disable_interrupt(GPIO_SOC_TP_INT_L);
505517
gpio_disable_interrupt(GPIO_EC_I2C_3_SDA);
506518
}
507519
}
508520
if (evt & PS2MOUSE_EVT_REENABLE) {
509521
CPRINTS("PS2M renabling");
522+
set_power(false);
523+
set_reset();
510524
setup_touchpad();
511525
gpio_enable_interrupt(GPIO_SOC_TP_INT_L);
512526
gpio_enable_interrupt(GPIO_EC_I2C_3_SDA);

0 commit comments

Comments
 (0)