blob: d3803c0700dc3db9f0bdeea1c9448a3defb483cc [file] [log] [blame]
Sven Schnelleffcd1432011-04-11 19:43:32 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2011 Sven Schnelle <svens@stackframe.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Sven Schnelleffcd1432011-04-11 19:43:32 +000014 */
15
16#ifndef EC_LENOVO_H8_H
17#define EC_LENOVO_H8_H
18
Vladimir Serbinenko38a60622015-05-27 09:57:35 +020019#include <stdint.h>
20
Sven Schnelleffcd1432011-04-11 19:43:32 +000021void h8_trackpoint_enable(int on);
22void h8_wlan_enable(int on);
23void h8_set_audio_mute(int on);
Sven Schnelle86e1aea2011-06-16 16:43:04 +020024void h8_usb_power_enable(int on);
Sven Schnelleffcd1432011-04-11 19:43:32 +000025void h8_enable_event(int event);
26void h8_disable_event(int event);
Sven Schnellecf7dffe2011-04-27 19:47:28 +000027int h8_ultrabay_device_present(void);
Peter Stuge77a5abe2013-07-06 19:44:47 +020028u8 h8_build_id_and_function_spec_version(char *buf, u8 buf_len);
Sven Schnelleffcd1432011-04-11 19:43:32 +000029
Vladimir Serbinenko161e9cc2013-11-27 21:36:25 +010030#if !IS_ENABLED (CONFIG_H8_DOCK_EARLY_INIT)
31void h8_mainboard_init_dock (void);
32#endif
33
Sven Schnelleffcd1432011-04-11 19:43:32 +000034/* EC registers */
35#define H8_CONFIG0 0x00
36#define H8_CONFIG0_EVENTS_ENABLE 0x02
37#define H8_CONFIG0_HOTKEY_ENABLE 0x04
38#define H8_CONFIG0_SMM_H8_ENABLE 0x20
39#define H8_CONFIG0_TC_ENABLE 0x80
40
41#define H8_CONFIG1 0x01
42#define H8_CONFIG1_BKLT_LID 0x01
43#define H8_CONFIG1_UBAY_PWR 0x20
44
45#define H8_CONFIG2 0x02
46#define H8_CONFIG2_USB_DOCK 0x01
47#define H8_CONFIG2_DOCK_SPEAKER_MUTE 0x02
48#define H8_CONFIG2_DOCK_SPEAKER_MUTE_POL 0x04
49
50#define H8_CONFIG3 0x03
51
52#define H8_SOUND_ENABLE0 0x04
53#define H8_SOUND_ENABLE1 0x05
54#define H8_SOUND_REG 0x06
55#define H8_SOUND_REPEAT 0x07
56
57#define H8_TRACKPOINT_CTRL 0x0B
58#define H8_TRACKPOINT_AUTO 0x01
59#define H8_TRACKPOINT_OFF 0x02
60#define H8_TRACKPOINT_ON 0x03
61
62#define H8_LED_CONTROL 0x0c
63#define H8_LED_CONTROL_OFF 0x00
64#define H8_LED_CONTROL_ON 0x80
65#define H8_LED_CONTROL_BLINK 0xc0
66
67#define H8_LED_CONTROL_POWER_LED 0x00
68#define H8_LED_CONTROL_BAT0_LED 0x01
69#define H8_LED_CONTROL_BAT1_LED 0x02
70#define H8_LED_CONTROL_UBAY_LED 0x04
71#define H8_LED_CONTROL_SUSPEND_LED 0x07
72#define H8_LED_CONTROL_DOCK_LED1 0x08
73#define H8_LED_CONTROL_DOCK_LED2 0x09
74
Sven Schnelle3e2f6792011-04-12 18:18:24 +000075#define H8_FAN_CONTROL 0x2f
76#define H8_FAN_CONTROL_AUTO 0x80
Sven Schnelle1b8068e2011-06-05 20:47:49 +020077
78#define H8_VOLUME_CONTROL 0x30
79#define H8_VOLUME_CONTROL_MUTE 0x40
Sven Schnelleffcd1432011-04-11 19:43:32 +000080/* Embedded controller events */
81#define H8_EVENT_FN_F1 0x10
82#define H8_EVENT_FN_F2 0x11
83#define H8_EVENT_FN_F3 0x12
84#define H8_EVENT_FN_F4 0x13
85#define H8_EVENT_FN_HOME 0x14
86#define H8_EVENT_FN_END 0x15
87#define H8_EVENT_FN_F7 0x16
88#define H8_EVENT_FN_F8 0x17
89#define H8_EVENT_FN_F9 0x18
90#define H8_EVENT_FN_THINKVANTAGE 0x19
91#define H8_EVENT_FN_F11 0x1a
92#define H8_EVENT_FN_F12 0x1b
93#define H8_EVENT_FN_1 0x1c
94#define H8_EVENT_FN_2 0x1d
95#define H8_EVENT_FN_PGUP 0x1f
96
97#define H8_EVENT_AC_ON 0x26
98#define H8_EVENT_AC_OFF 0x27
99
100#define H8_EVENT_PWRSW_PRESS 0x28
101#define H8_EVENT_PWRSW_RELEASE 0x29
102
103#define H8_EVENT_LIDSW_CLOSE 0x2a
104#define H8_EVENT_LIDSW_PUSH 0x2b
105
106#define H8_EVENT_UBAY_UNLOCK 0x2c
107#define H8_EVENT_UBAY_LOCK 0x2d
108
109#define H8_EVENT_KEYPRESS 0x33
110
111#define H8_EVENT_FN_PRESS 0x39
112
Sven Schnellecf7dffe2011-04-27 19:47:28 +0000113#define H8_STATUS0 0x46
114#define H8_STATUS1 0x47
115#define H8_STATUS2 0x48
116
Sven Schnelleffcd1432011-04-11 19:43:32 +0000117#define H8_EVENT_BAT0 0x4a
118#define H8_EVENT_BAT0_STATE 0x4b
119
120#define H8_EVENT_BAT1 0x4c
121#define H8_EVENT_BAT1_STATE 0x4d
122
123#define H8_EVENT_FN_F5 0x64
124#define H8_EVENT_FN_F6 0x65
Edward O'Callaghanb57fef92014-06-17 20:13:08 +1000125
126#endif /* EC_LENOVO_H8_H */