libpayload: configs: Add new config.featuretest to broaden CI
[coreboot.git] / src / mainboard / lenovo / t410 / dock.c
blob37a2908c1d6330af3a4c5c93577a24f356a70d92
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 /* UNTESTED */
23 ec_set_bit(0x02, 0);
24 ec_set_bit(0x1a, 0);
25 ec_set_bit(0xfe, 4);
28 void dock_disconnect(void)
30 /* UNTESTED */
31 ec_clr_bit(0x02, 0);
32 ec_clr_bit(0x1a, 0);
33 ec_clr_bit(0xfe, 4);
36 int dock_present(void)
38 const int gpio_num_array[] = {3, 4, 5, -1};
40 return get_gpios(gpio_num_array) != 7;