coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
h8.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef EC_LENOVO_H8_H
4 #define EC_LENOVO_H8_H
5 
6 #include <stdint.h>
7 #include <device/device.h>
8 
10  UAO_OFF = 0,
12  UAO_AC_ONLY = 2
13 };
14 
15 void h8_trackpoint_enable(int on);
16 void h8_wlan_enable(int on);
17 void h8_set_audio_mute(int on);
19 void h8_usb_power_enable(int on);
20 void h8_enable_event(int event);
21 void h8_disable_event(int event);
24 void h8_usb_always_on(void);
25 
26 int h8_get_fn_key(void);
27 int h8_get_sense_ready(void);
28 
29 void h8_bluetooth_enable(int on);
30 bool h8_bluetooth_nv_enable(void);
31 bool h8_has_bdc(const struct device *dev);
32 
33 void h8_wwan_enable(int on);
34 bool h8_wwan_nv_enable(void);
35 bool h8_has_wwan(const struct device *dev);
36 
37 void h8_ssdt_generator(const struct device *dev);
38 /*
39  * boards needing specific h8-related inits could override it
40  */
41 void h8_mb_init(void);
42 
43 /* EC registers */
44 #define H8_CONFIG0 0x00
45 #define H8_CONFIG0_EVENTS_ENABLE 0x02
46 #define H8_CONFIG0_HOTKEY_ENABLE 0x04
47 #define H8_CONFIG0_SMM_H8_ENABLE 0x20
48 #define H8_CONFIG0_TC_ENABLE 0x80
49 
50 #define H8_CONFIG1 0x01
51 #define H8_CONFIG1_BKLT_LID 0x01
52 #define H8_CONFIG1_UBAY_PWR 0x20
53 
54 #define H8_CONFIG2 0x02
55 #define H8_CONFIG2_USB_DOCK 0x01
56 #define H8_CONFIG2_DOCK_SPEAKER_MUTE 0x02
57 #define H8_CONFIG2_DOCK_SPEAKER_MUTE_POL 0x04
58 
59 #define H8_CONFIG3 0x03
60 
61 #define H8_SOUND_ENABLE0 0x04
62 #define H8_SOUND_ENABLE1 0x05
63 #define H8_SOUND_REG 0x06
64 #define H8_SOUND_REPEAT 0x07
65 
66 #define H8_TRACKPOINT_CTRL 0x0B
67 #define H8_TRACKPOINT_AUTO 0x01
68 #define H8_TRACKPOINT_OFF 0x02
69 #define H8_TRACKPOINT_ON 0x03
70 
71 #define H8_LED_CONTROL 0x0c
72 #define H8_LED_CONTROL_OFF 0x00
73 #define H8_LED_CONTROL_ON 0x80
74 #define H8_LED_CONTROL_PULSE 0xa0 /* Some models, power LED only*/
75 #define H8_LED_CONTROL_BLINK 0xc0
76 
77 #define H8_LED_CONTROL_POWER_LED 0x00
78 #define H8_LED_CONTROL_BAT0_LED 0x01
79 #define H8_LED_CONTROL_BAT1_LED 0x02
80 #define H8_LED_CONTROL_UBAY_LED 0x04
81 #define H8_LED_CONTROL_SUSPEND_LED 0x07
82 #define H8_LED_CONTROL_DOCK_LED1 0x08
83 #define H8_LED_CONTROL_DOCK_LED2 0x09
84 #define H8_LED_CONTROL_ACDC_LED 0x0c
85 #define H8_LED_CONTROL_MUTE_LED 0x0e
86 
87 #define H8_USB_ALWAYS_ON 0x0d
88 #define H8_USB_ALWAYS_ON_ENABLE 0x01
89 #define H8_USB_ALWAYS_ON_AC_ONLY 0x0c
90 
91 #define H8_FAN_CONTROL 0x2f
92 #define H8_FAN_CONTROL_AUTO 0x80
93 
94 #define H8_VOLUME_CONTROL 0x30
95 #define H8_VOLUME_CONTROL_MUTE 0x40
96 /* Embedded controller events */
97 #define H8_EVENT_FN_F1 0x10
98 #define H8_EVENT_FN_F2 0x11
99 #define H8_EVENT_FN_F3 0x12
100 #define H8_EVENT_FN_F4 0x13
101 #define H8_EVENT_FN_HOME 0x14
102 #define H8_EVENT_FN_END 0x15
103 #define H8_EVENT_FN_F7 0x16
104 #define H8_EVENT_FN_F8 0x17
105 #define H8_EVENT_FN_F9 0x18
106 #define H8_EVENT_FN_THINKVANTAGE 0x19
107 #define H8_EVENT_FN_F11 0x1a
108 #define H8_EVENT_FN_F12 0x1b
109 #define H8_EVENT_FN_1 0x1c
110 #define H8_EVENT_FN_2 0x1d
111 #define H8_EVENT_FN_PGUP 0x1f
112 
113 #define H8_EVENT_AC_ON 0x26
114 #define H8_EVENT_AC_OFF 0x27
115 
116 #define H8_EVENT_PWRSW_PRESS 0x28
117 #define H8_EVENT_PWRSW_RELEASE 0x29
118 
119 #define H8_EVENT_LIDSW_CLOSE 0x2a
120 #define H8_EVENT_LIDSW_PUSH 0x2b
121 
122 #define H8_EVENT_UBAY_UNLOCK 0x2c
123 #define H8_EVENT_UBAY_LOCK 0x2d
124 
125 #define H8_EVENT_KEYPRESS 0x33
126 
127 #define H8_EVENT_FN_PRESS 0x39
128 
129 #define H8_STATUS0 0x46
130 #define H8_STATUS0_FN_KEY_DOWN 0x01
131 #define H8_STATUS1 0x47
132 #define H8_STATUS2 0x48
133 #define H8_STATUS3 0x49
134 
135 #define H8_EVENT_BAT0 0x4a
136 #define H8_EVENT_BAT0_STATE 0x4b
137 
138 #define H8_EVENT_BAT1 0x4c
139 #define H8_EVENT_BAT1_STATE 0x4d
140 
141 #define H8_EVENT_FN_F5 0x64
142 #define H8_EVENT_FN_F6 0x65
143 
144 #endif /* EC_LENOVO_H8_H */
void h8_enable_event(int event)
Definition: h8.c:107
void h8_wwan_enable(int on)
Definition: wwan.c:14
int h8_get_sense_ready(void)
Return the EC sense status register state.
Definition: sense.c:19
void h8_usb_power_enable(int on)
Definition: h8.c:151
bool h8_has_wwan(const struct device *dev)
Definition: wwan.c:25
void h8_trackpoint_enable(int on)
Definition: h8.c:17
bool h8_has_bdc(const struct device *dev)
Definition: bluetooth.c:27
bool h8_bluetooth_nv_enable(void)
Definition: bluetooth.c:49
void h8_mb_init(void)
Definition: h8.c:222
void h8_usb_always_on(void)
void h8_wlan_enable(int on)
Definition: h8.c:24
void h8_set_audio_mute(int on)
Definition: h8.c:99
void h8_usb_always_on_enable(enum usb_always_on on)
Definition: h8.c:123
int h8_get_fn_key(void)
Return the state of Fn key.
Definition: sense.c:38
int h8_ultrabay_device_present(void)
Definition: h8.c:159
u8 h8_build_id_and_function_spec_version(char *buf, u8 buf_len)
Definition: h8.c:164
bool h8_wwan_nv_enable(void)
Definition: wwan.c:47
usb_always_on
Definition: h8.h:9
@ UAO_OFF
Definition: h8.h:10
@ UAO_AC_ONLY
Definition: h8.h:12
@ UAO_AC_AND_BATTERY
Definition: h8.h:11
void h8_disable_event(int event)
Definition: h8.c:115
void h8_bluetooth_enable(int on)
Definition: bluetooth.c:16
void h8_ssdt_generator(const struct device *dev)
Definition: ssdt.c:24
static uint8_t * buf
Definition: uart.c:7
uint8_t u8
Definition: stdint.h:45
Definition: device.h:107