mb/ocp/tiogapass: Fix GPIOs
[coreboot2.git] / src / mainboard / lenovo / x201 / dock.c
blob7354eeeb41d19fcba872a1d93ecd76fd7bbae86c
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <device/device.h>
5 #include "dock.h"
6 #include <southbridge/intel/common/gpio.h>
7 #include <ec/lenovo/h8/h8.h>
8 #include <ec/acpi/ec.h>
10 void h8_mb_init(void)
12 if (dock_present()) {
13 printk(BIOS_DEBUG, "dock is connected\n");
14 dock_connect();
15 } else {
16 printk(BIOS_DEBUG, "dock is not connected\n");
20 void dock_connect(void)
22 ec_set_bit(0x02, 0);
23 ec_set_bit(0x1a, 0);
24 ec_set_bit(0xfe, 4);
26 set_gpio(28, GPIO_LEVEL_HIGH);
29 void dock_disconnect(void)
31 ec_clr_bit(0x02, 0);
32 ec_clr_bit(0x1a, 0);
33 ec_clr_bit(0xfe, 4);
35 set_gpio(28, GPIO_LEVEL_LOW);
38 int dock_present(void)
40 const int dock_id_gpio[] = { 3, 4, 5, -1};
42 return get_gpios(dock_id_gpio) != 7;