Sven Schnelle | ffcd143 | 2011-04-11 19:43:32 +0000 | [diff] [blame] | 1 | /* |
| 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 Schnelle | ffcd143 | 2011-04-11 19:43:32 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #ifndef EC_LENOVO_H8_H |
| 17 | #define EC_LENOVO_H8_H |
| 18 | |
Vladimir Serbinenko | 38a6062 | 2015-05-27 09:57:35 +0200 | [diff] [blame] | 19 | #include <stdint.h> |
| 20 | |
Sven Schnelle | ffcd143 | 2011-04-11 19:43:32 +0000 | [diff] [blame] | 21 | void h8_trackpoint_enable(int on); |
| 22 | void h8_wlan_enable(int on); |
| 23 | void h8_set_audio_mute(int on); |
Sven Schnelle | 86e1aea | 2011-06-16 16:43:04 +0200 | [diff] [blame] | 24 | void h8_usb_power_enable(int on); |
Sven Schnelle | ffcd143 | 2011-04-11 19:43:32 +0000 | [diff] [blame] | 25 | void h8_enable_event(int event); |
| 26 | void h8_disable_event(int event); |
Sven Schnelle | cf7dffe | 2011-04-27 19:47:28 +0000 | [diff] [blame] | 27 | int h8_ultrabay_device_present(void); |
Peter Stuge | 77a5abe | 2013-07-06 19:44:47 +0200 | [diff] [blame] | 28 | u8 h8_build_id_and_function_spec_version(char *buf, u8 buf_len); |
Sven Schnelle | ffcd143 | 2011-04-11 19:43:32 +0000 | [diff] [blame] | 29 | |
Vladimir Serbinenko | 161e9cc | 2013-11-27 21:36:25 +0100 | [diff] [blame] | 30 | #if !IS_ENABLED (CONFIG_H8_DOCK_EARLY_INIT) |
| 31 | void h8_mainboard_init_dock (void); |
| 32 | #endif |
| 33 | |
Sven Schnelle | ffcd143 | 2011-04-11 19:43:32 +0000 | [diff] [blame] | 34 | /* 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 Schnelle | 3e2f679 | 2011-04-12 18:18:24 +0000 | [diff] [blame] | 75 | #define H8_FAN_CONTROL 0x2f |
| 76 | #define H8_FAN_CONTROL_AUTO 0x80 |
Sven Schnelle | 1b8068e | 2011-06-05 20:47:49 +0200 | [diff] [blame] | 77 | |
| 78 | #define H8_VOLUME_CONTROL 0x30 |
| 79 | #define H8_VOLUME_CONTROL_MUTE 0x40 |
Sven Schnelle | ffcd143 | 2011-04-11 19:43:32 +0000 | [diff] [blame] | 80 | /* 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 Schnelle | cf7dffe | 2011-04-27 19:47:28 +0000 | [diff] [blame] | 113 | #define H8_STATUS0 0x46 |
| 114 | #define H8_STATUS1 0x47 |
| 115 | #define H8_STATUS2 0x48 |
| 116 | |
Sven Schnelle | ffcd143 | 2011-04-11 19:43:32 +0000 | [diff] [blame] | 117 | #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'Callaghan | b57fef9 | 2014-06-17 20:13:08 +1000 | [diff] [blame] | 125 | |
| 126 | #endif /* EC_LENOVO_H8_H */ |