summaryrefslogtreecommitdiff
path: root/src/mainboard/lenovo/x60
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2022-12-02 17:59:35 +0200
committerKyösti Mälkki <kyosti.malkki@gmail.com>2022-12-07 04:51:39 +0000
commit791f7a4f63fe80dd64da69164143808343c025d5 (patch)
tree0abc6d3f720bb4a9942ca918fcb88898d2467cba /src/mainboard/lenovo/x60
parentdbbbb8f5c139e190e8b8cdf0564d34b07ceacd83 (diff)
mb/lenovo/t60,x60: Split dock_(dis)connect() function
Avoid calling a function named mainboard_io_trap_handler() when the dock (dis)connect is not triggered from IO trap. Change-Id: Idc258a390f2de2c32d38a0e35fcce896d058d1b9 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/70363 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'src/mainboard/lenovo/x60')
-rw-r--r--src/mainboard/lenovo/x60/smihandler.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/src/mainboard/lenovo/x60/smihandler.c b/src/mainboard/lenovo/x60/smihandler.c
index e1a97f57ee..13c6406c4d 100644
--- a/src/mainboard/lenovo/x60/smihandler.c
+++ b/src/mainboard/lenovo/x60/smihandler.c
@@ -29,27 +29,37 @@ static void mainboard_smi_save_cmos(void)
outb(tmp72, 0x72);
}
+static void mainboard_smi_dock_connect(void)
+{
+ ec_clr_bit(0x03, 2);
+ mdelay(250);
+ if (!dock_connect()) {
+ ec_set_bit(0x03, 2);
+ /* set dock LED to indicate status */
+ ec_write(0x0c, 0x09);
+ ec_write(0x0c, 0x88);
+ } else {
+ /* blink dock LED to indicate failure */
+ ec_write(0x0c, 0x08);
+ ec_write(0x0c, 0xc9);
+ }
+}
+
+static void mainboard_smi_dock_disconnect(void)
+{
+ ec_clr_bit(0x03, 2);
+ dock_disconnect();
+}
+
int mainboard_io_trap_handler(int smif)
{
switch (smif) {
case SMI_DOCK_CONNECT:
- ec_clr_bit(0x03, 2);
- mdelay(250);
- if (!dock_connect()) {
- ec_set_bit(0x03, 2);
- /* set dock LED to indicate status */
- ec_write(0x0c, 0x09);
- ec_write(0x0c, 0x88);
- } else {
- /* blink dock LED to indicate failure */
- ec_write(0x0c, 0x08);
- ec_write(0x0c, 0xc9);
- }
+ mainboard_smi_dock_connect();
break;
case SMI_DOCK_DISCONNECT:
- ec_clr_bit(0x03, 2);
- dock_disconnect();
+ mainboard_smi_dock_disconnect();
break;
case SMI_SAVE_CMOS:
@@ -108,12 +118,12 @@ static void mainboard_smi_handle_ec_sci(void)
case 0x27:
/* Undock Key */
case 0x50:
- mainboard_io_trap_handler(SMI_DOCK_DISCONNECT);
+ mainboard_smi_dock_disconnect();
break;
/* Dock Event */
case 0x37:
case 0x58:
- mainboard_io_trap_handler(SMI_DOCK_CONNECT);
+ mainboard_smi_dock_connect();
break;
default:
break;