Debian Codegraph @

src/mainboard/lenovo/t410/dock.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <console/console.h>
4 #include <device/device.h>
5 #include <gpio.h>
6 #include "dock.h"
7 #include <southbridge/intel/common/gpio.h>
8 #include <ec/lenovo/h8/h8.h>
9 #include <ec/acpi/ec.h>
10
11 void h8_mb_init(void)
12 {
13 if (dock_present()) {
14 printk(BIOS_DEBUG, "dock is connected\n");
15 dock_connect();
16 } else {
17 printk(BIOS_DEBUG, "dock is not connected\n");
18 }
19 }
20
21 void dock_connect(void)
22 {
23 /* UNTESTED */
24 ec_set_bit(0x02, 0);
25 ec_set_bit(0x1a, 0);
26 ec_set_bit(0xfe, 4);
27 }
28
29 void dock_disconnect(void)
30 {
31 /* UNTESTED */
32 ec_clr_bit(0x02, 0);
33 ec_clr_bit(0x1a, 0);
34 ec_clr_bit(0xfe, 4);
35 }
36
37 int dock_present(void)
38 {
39 const gpio_t gpio_num_array[] = {3, 4, 5};
40 return gpio_base2_value(gpio_num_array, ARRAY_SIZE(gpio_num_array)) != 7;
41 }