Add lemp9
This commit is contained in:
9
src/board/system76/lemp9/include/board/acpi.h
Normal file
9
src/board/system76/lemp9/include/board/acpi.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef _BOARD_ACPI_H
|
||||
#define _BOARD_ACPI_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
uint8_t acpi_read(uint8_t addr);
|
||||
void acpi_write(uint8_t addr, uint8_t data);
|
||||
|
||||
#endif // _BOARD_ACPI_H
|
20
src/board/system76/lemp9/include/board/battery.h
Normal file
20
src/board/system76/lemp9/include/board/battery.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef _BOARD_BATTERY_H
|
||||
#define _BOARD_BATTERY_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern uint16_t battery_temp;
|
||||
extern uint16_t battery_voltage;
|
||||
extern uint16_t battery_current;
|
||||
extern uint16_t battery_charge;
|
||||
extern uint16_t battery_remaining_capacity;
|
||||
extern uint16_t battery_full_capacity;
|
||||
extern uint16_t battery_design_capacity;
|
||||
extern uint16_t battery_design_voltage;
|
||||
|
||||
int battery_charger_disable(void);
|
||||
int battery_charger_enable(void);
|
||||
void battery_event(void);
|
||||
void battery_debug(void);
|
||||
|
||||
#endif // _BOARD_BATTERY_H
|
6
src/board/system76/lemp9/include/board/cpu.h
Normal file
6
src/board/system76/lemp9/include/board/cpu.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef _BOARD_CPU_H
|
||||
#define _BOARD_CPU_H
|
||||
|
||||
#define F_CPU 9200000ULL
|
||||
|
||||
#endif // _BOARD_CPU_H
|
8
src/board/system76/lemp9/include/board/gctrl.h
Normal file
8
src/board/system76/lemp9/include/board/gctrl.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef _BOARD_GCTRL_H
|
||||
#define _BOARD_GCTRL_H
|
||||
|
||||
#include <ec/gctrl.h>
|
||||
|
||||
void gctrl_init(void);
|
||||
|
||||
#endif // _BOARD_GCTRL_H
|
15
src/board/system76/lemp9/include/board/gpio.h
Normal file
15
src/board/system76/lemp9/include/board/gpio.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef _BOARD_GPIO_H
|
||||
#define _BOARD_GPIO_H
|
||||
|
||||
#include <ec/gpio.h>
|
||||
|
||||
#define GPIO_ALT 0x00
|
||||
#define GPIO_IN 0x80
|
||||
#define GPIO_OUT 0x40
|
||||
#define GPIO_UP 0x04
|
||||
#define GPIO_DOWN 0x02
|
||||
|
||||
void gpio_init(void);
|
||||
void gpio_debug(void);
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
15
src/board/system76/lemp9/include/board/kbc.h
Normal file
15
src/board/system76/lemp9/include/board/kbc.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef _BOARD_KBC_H
|
||||
#define _BOARD_KBC_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ec/kbc.h>
|
||||
|
||||
extern bool kbc_first;
|
||||
extern bool kbc_second;
|
||||
|
||||
void kbc_init(void);
|
||||
bool kbc_scancode(struct Kbc * kbc, uint16_t key, bool pressed);
|
||||
void kbc_event(struct Kbc * kbc);
|
||||
|
||||
#endif // _BOARD_KBC_H
|
13
src/board/system76/lemp9/include/board/kbscan.h
Normal file
13
src/board/system76/lemp9/include/board/kbscan.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef _BOARD_KBSCAN_H
|
||||
#define _BOARD_KBSCAN_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ec/kbscan.h>
|
||||
|
||||
extern bool kbscan_enabled;
|
||||
|
||||
void kbscan_init(void);
|
||||
void kbscan_event(void);
|
||||
|
||||
#endif // _BOARD_KBSCAN_H
|
207
src/board/system76/lemp9/include/board/keymap.h
Normal file
207
src/board/system76/lemp9/include/board/keymap.h
Normal file
@@ -0,0 +1,207 @@
|
||||
#ifndef _BOARD_KEYMAP_H
|
||||
#define _BOARD_KEYMAP_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// Keymap output pins
|
||||
#define KM_OUT 16
|
||||
// Keymap input pins
|
||||
#define KM_IN 8
|
||||
// Keymap layers (normal, Fn)
|
||||
#define KM_LAY 2
|
||||
|
||||
uint16_t keymap(int output, int input, int layer);
|
||||
|
||||
uint16_t keymap_translate(uint16_t key);
|
||||
|
||||
// Key types
|
||||
#define KT_MASK (0xF000)
|
||||
|
||||
// Normal keys
|
||||
#define KT_NORMAL (0x0000)
|
||||
|
||||
// Layer selection
|
||||
#define KT_FN (0x1000)
|
||||
|
||||
// SCI
|
||||
#define KT_SCI (0x2000)
|
||||
|
||||
#define SCI_BRIGHTNESS_DOWN (0x11)
|
||||
#define SCI_BRIGHTNESS_UP (0x12)
|
||||
#define SCI_AIRPLANE_MODE (0x14)
|
||||
#define SCI_SUSPEND (0x15)
|
||||
|
||||
// See http://www.techtoys.com.hk/Downloads/Download/Microchip/PS2_driver/ScanCode.pdf
|
||||
|
||||
// Should send 0xE0 before scancode bytes
|
||||
#define K_E0 (0x0100)
|
||||
|
||||
// Hotkeys
|
||||
|
||||
#define K_PLAY_PAUSE (K_E0 | 0x34)
|
||||
#define K_MUTE (K_E0 | 0x23)
|
||||
#define K_VOLUME_DOWN (K_E0 | 0x21)
|
||||
#define K_VOLUME_UP (K_E0 | 0x32)
|
||||
// Custom scancode
|
||||
#define K_TOUCHPAD (K_E0 | 0x63)
|
||||
|
||||
// Function keys
|
||||
|
||||
#define K_F1 (0x05)
|
||||
#define K_F2 (0x06)
|
||||
#define K_F3 (0x04)
|
||||
#define K_F4 (0x0C)
|
||||
#define K_F5 (0x03)
|
||||
#define K_F6 (0x0B)
|
||||
#define K_F7 (0x83)
|
||||
#define K_F8 (0x0A)
|
||||
#define K_F9 (0x01)
|
||||
#define K_F10 (0x09)
|
||||
#define K_F11 (0x78)
|
||||
#define K_F12 (0x07)
|
||||
|
||||
// Number keys
|
||||
|
||||
#define K_0 (0x45)
|
||||
#define K_1 (0x16)
|
||||
#define K_2 (0x1E)
|
||||
#define K_3 (0x26)
|
||||
#define K_4 (0x25)
|
||||
#define K_5 (0x2E)
|
||||
#define K_6 (0x36)
|
||||
#define K_7 (0x3D)
|
||||
#define K_8 (0x3E)
|
||||
#define K_9 (0x46)
|
||||
|
||||
// Letter keys
|
||||
|
||||
#define K_A (0x1C)
|
||||
#define K_B (0x32)
|
||||
#define K_C (0x21)
|
||||
#define K_D (0x23)
|
||||
#define K_E (0x24)
|
||||
#define K_F (0x2B)
|
||||
#define K_G (0x34)
|
||||
#define K_H (0x33)
|
||||
#define K_I (0x43)
|
||||
#define K_J (0x3B)
|
||||
#define K_K (0x42)
|
||||
#define K_L (0x4B)
|
||||
#define K_M (0x3A)
|
||||
#define K_N (0x31)
|
||||
#define K_O (0x44)
|
||||
#define K_P (0x4D)
|
||||
#define K_Q (0x15)
|
||||
#define K_R (0x2D)
|
||||
#define K_S (0x1B)
|
||||
#define K_T (0x2C)
|
||||
#define K_U (0x3C)
|
||||
#define K_V (0x2A)
|
||||
#define K_W (0x1D)
|
||||
#define K_X (0x22)
|
||||
#define K_Y (0x35)
|
||||
#define K_Z (0x1A)
|
||||
|
||||
// Special keys
|
||||
|
||||
// Escape key
|
||||
#define K_ESC (0x76)
|
||||
|
||||
//TODO: Print screen, scroll lock, pause
|
||||
|
||||
// Tick/tilde key
|
||||
#define K_TICK (0x0E)
|
||||
// Minus/underline key
|
||||
#define K_MINUS (0x4E)
|
||||
// Equals/plus key
|
||||
#define K_EQUALS (0x55)
|
||||
// Backspace key
|
||||
#define K_BKSP (0x66)
|
||||
|
||||
// Tab key
|
||||
#define K_TAB (0x0D)
|
||||
// Bracket open key
|
||||
#define K_BRACE_OPEN (0x54)
|
||||
// Bracket close key
|
||||
#define K_BRACE_CLOSE (0x5B)
|
||||
// Backslash/pipe key
|
||||
#define K_BACKSLASH (0x5D)
|
||||
|
||||
// Capslock
|
||||
#define K_CAPS (0x58)
|
||||
// Semicolon key
|
||||
#define K_SEMICOLON (0x4C)
|
||||
// Quote key
|
||||
#define K_QUOTE (0x52)
|
||||
// Enter key
|
||||
#define K_ENTER (0x5A)
|
||||
|
||||
// Left shift
|
||||
#define K_LEFT_SHIFT (0x12)
|
||||
// Comma key
|
||||
#define K_COMMA (0x41)
|
||||
// Period key
|
||||
#define K_PERIOD (0x49)
|
||||
// Slash key
|
||||
#define K_SLASH (0x4A)
|
||||
// Right shift
|
||||
#define K_RIGHT_SHIFT (0x59)
|
||||
|
||||
// Left control key
|
||||
#define K_LEFT_CTRL (0x14)
|
||||
// Left super key
|
||||
#define K_LEFT_SUPER (K_E0 | 0x1F)
|
||||
// Left alt key
|
||||
#define K_LEFT_ALT (0x11)
|
||||
// Space key
|
||||
#define K_SPACE (0x29)
|
||||
// Right alt key
|
||||
#define K_RIGHT_ALT (K_E0 | 0x11)
|
||||
// Right super key
|
||||
#define K_RIGHT_SUPER (K_E0 | 0x27)
|
||||
// Application key
|
||||
#define K_APP (K_E0 | 0x2F)
|
||||
// Right control key
|
||||
#define K_RIGHT_CTRL (K_E0 | 0x14)
|
||||
|
||||
// Arrow keys and related
|
||||
|
||||
// Insert key
|
||||
#define K_INSERT (K_E0 | 0x70)
|
||||
// Delete key
|
||||
#define K_DEL (K_E0 | 0x71)
|
||||
// Home key
|
||||
#define K_HOME (K_E0 | 0x6C)
|
||||
// End key
|
||||
#define K_END (K_E0 | 0x69)
|
||||
// Page up key
|
||||
#define K_PGUP (K_E0 | 0x7D)
|
||||
// Page down key
|
||||
#define K_PGDN (K_E0 | 0x7A)
|
||||
|
||||
#define K_UP (K_E0 | 0x75)
|
||||
#define K_LEFT (K_E0 | 0x6B)
|
||||
#define K_DOWN (K_E0 | 0x72)
|
||||
#define K_RIGHT (K_E0 | 0x74)
|
||||
|
||||
// Numpad
|
||||
|
||||
#define K_NUM_LOCK (0x77)
|
||||
#define K_NUM_SLASH (K_E0 | 0x4A)
|
||||
#define K_NUM_ASTERISK (0x7C)
|
||||
#define K_NUM_MINUS (0x7B)
|
||||
#define K_NUM_PLUS (0x79)
|
||||
#define K_NUM_PERIOD (0x71)
|
||||
#define K_NUM_ENTER (K_E0 | 0x5A)
|
||||
#define K_NUM_0 (0x70)
|
||||
#define K_NUM_1 (0x69)
|
||||
#define K_NUM_2 (0x72)
|
||||
#define K_NUM_3 (0x7A)
|
||||
#define K_NUM_4 (0x6B)
|
||||
#define K_NUM_5 (0x73)
|
||||
#define K_NUM_6 (0x74)
|
||||
#define K_NUM_7 (0x6C)
|
||||
#define K_NUM_8 (0x75)
|
||||
#define K_NUM_9 (0x7D)
|
||||
|
||||
#endif // _BOARD_KEYMAP_H
|
14
src/board/system76/lemp9/include/board/peci.h
Normal file
14
src/board/system76/lemp9/include/board/peci.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef _BOARD_PECI_H
|
||||
#define _BOARD_PECI_H
|
||||
|
||||
#include <ec/peci.h>
|
||||
|
||||
extern int16_t peci_offset;
|
||||
extern int16_t peci_temp;
|
||||
extern uint8_t peci_duty;
|
||||
extern uint8_t peci_tcontrol;
|
||||
extern uint8_t peci_tjmax;
|
||||
|
||||
void peci_event(void);
|
||||
|
||||
#endif // _BOARD_PECI_H
|
10
src/board/system76/lemp9/include/board/pmc.h
Normal file
10
src/board/system76/lemp9/include/board/pmc.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef _BOARD_PMC_H
|
||||
#define _BOARD_PMC_H
|
||||
|
||||
#include <ec/pmc.h>
|
||||
|
||||
void pmc_init(void);
|
||||
bool pmc_sci(struct Pmc * pmc, uint8_t sci);
|
||||
void pmc_event(struct Pmc * pmc);
|
||||
|
||||
#endif // _BOARD_PMC_H
|
6
src/board/system76/lemp9/include/board/pnp.h
Normal file
6
src/board/system76/lemp9/include/board/pnp.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef _BOARD_PNP_H
|
||||
#define _BOARD_PNP_H
|
||||
|
||||
void pnp_enable(void);
|
||||
|
||||
#endif // _BOARD_PNP_H
|
6
src/board/system76/lemp9/include/board/power.h
Normal file
6
src/board/system76/lemp9/include/board/power.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef _BOARD_POWER_H
|
||||
#define _BOARD_POWER_H
|
||||
|
||||
void power_event(void);
|
||||
|
||||
#endif // _BOARD_POWER_H
|
8
src/board/system76/lemp9/include/board/ps2.h
Normal file
8
src/board/system76/lemp9/include/board/ps2.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef _BOARD_PS2_H
|
||||
#define _BOARD_PS2_H
|
||||
|
||||
#include <ec/ps2.h>
|
||||
|
||||
void ps2_init(void);
|
||||
|
||||
#endif // _BOARD_PS2_H
|
8
src/board/system76/lemp9/include/board/pwm.h
Normal file
8
src/board/system76/lemp9/include/board/pwm.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef _BOARD_PWM_H
|
||||
#define _BOARD_PWM_H
|
||||
|
||||
#include <ec/pwm.h>
|
||||
|
||||
void pwm_init(void);
|
||||
|
||||
#endif // _BOARD_PWM_H
|
6
src/board/system76/lemp9/include/board/scratch.h
Normal file
6
src/board/system76/lemp9/include/board/scratch.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef _BOARD_SCRATCH_H
|
||||
#define _BOARD_SCRATCH_H
|
||||
|
||||
void scratch_trampoline(void);
|
||||
|
||||
#endif // _BOARD_SCRATCH_H
|
8
src/board/system76/lemp9/include/board/smbus.h
Normal file
8
src/board/system76/lemp9/include/board/smbus.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef _BOARD_SMBUS_H
|
||||
#define _BOARD_SMBUS_H
|
||||
|
||||
#include <ec/smbus.h>
|
||||
|
||||
void smbus_init(void);
|
||||
|
||||
#endif // _BOARD_SMBUS_H
|
Reference in New Issue
Block a user