coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
dock.c
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-only */
2
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
>
9
10
void
h8_mb_init
(
void
)
11
{
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"
);
17
}
18
}
19
20
void
dock_connect
(
void
)
21
{
22
/* UNTESTED */
23
ec_set_bit
(0x02, 0);
24
ec_set_bit
(0x1a, 0);
25
ec_set_bit
(0xfe, 4);
26
}
27
28
void
dock_disconnect
(
void
)
29
{
30
/* UNTESTED */
31
ec_clr_bit
(0x02, 0);
32
ec_clr_bit
(0x1a, 0);
33
ec_clr_bit
(0xfe, 4);
34
}
35
36
int
dock_present
(
void
)
37
{
38
const
int
gpio_num_array[] = {3, 4, 5, -1};
39
40
return
get_gpios
(gpio_num_array) != 7;
41
}
printk
#define printk(level,...)
Definition:
stdlib.h:16
console.h
ec_set_bit
void ec_set_bit(u8 addr, u8 bit)
Definition:
ec.c:133
ec_clr_bit
void ec_clr_bit(u8 addr, u8 bit)
Definition:
ec.c:138
ec.h
h8.h
device.h
BIOS_DEBUG
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition:
loglevel.h:128
get_gpios
unsigned int get_gpios(const int *gpio_num_array)
Definition:
gpio.c:107
gpio.h
dock_connect
void dock_connect(void)
Definition:
dock.c:215
dock_disconnect
void dock_disconnect(void)
Definition:
dock.c:234
h8_mb_init
void h8_mb_init(void)
Definition:
dock.c:10
dock_present
int dock_present(void)
Definition:
dock.c:36
dock.h
src
mainboard
lenovo
t410
dock.c
Generated by
1.9.1