Michael Niewöhner | e1e65cb | 2021-12-01 19:09:13 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #ifndef EC_CLEVO_IT5570E_COMMANDS_H |
| 4 | #define EC_CLEVO_IT5570E_COMMANDS_H |
| 5 | |
| 6 | #ifndef __ACPI__ |
| 7 | #define ECRAM CONFIG_EC_CLEVO_IT5570E_MEM_BASE |
| 8 | |
| 9 | /* EC RAM fields and bits */ |
| 10 | #define FANC 0x1c8 |
| 11 | #define RINF 0x1db |
| 12 | #define TP_TOGGLE_CTRLALTF9 (BIT(4) | BIT(2)) |
| 13 | #define ECKS 0x1e2 |
| 14 | #define SWFN 3 |
| 15 | // #### 0x1e6 |
| 16 | #define G3FG 2 |
| 17 | #define FOAC 6 |
| 18 | #define KBBO 0x1e9 |
| 19 | // #### 0x1eb |
| 20 | #define DGPT 3 |
| 21 | #define APRD 7 |
| 22 | #define PL2B 0x1f0 |
| 23 | #define PL2T 0x1f2 |
| 24 | #define TAUT 0x1f4 |
| 25 | #define FCMD 0x1f8 |
| 26 | #define FDAT 0x1f9 |
| 27 | #define FBUF 0x1fa |
| 28 | #define FBF1 0x1fb |
| 29 | #define FBF2 0x1fc |
| 30 | #define FBF3 0x1fd |
| 31 | #endif // __ACPI__ |
| 32 | |
| 33 | /* EC commands */ |
| 34 | #define ECCMD_NOP 0x00 /* dummy, triggers FCMDs */ |
| 35 | #define ECCMD_ENABLE_ACPI_MODE 0x90 |
| 36 | #define ECCMD_DISABLE_ACPI_MODE 0x91 |
| 37 | #define ECCMD_READ_MODEL 0x92 |
| 38 | #define ECCMD_READ_FW_VER 0x93 |
| 39 | #define ECCMD_ENABLE_HOTKEYS 0x98 |
| 40 | #define ECCMD_GET_DEVICES_STATE 0x9a |
| 41 | #define ECCMD_SET_INV_DEVICE_STATE 0x9c |
| 42 | #define DEVICE_CAMERA 2 |
| 43 | #define DEVICE_STATE(state) (!(state) << 7) |
| 44 | #define ECCMD_SET_BATLOW_ALARM 0x9d |
| 45 | #define ECCMD_SETUP_DEVICES 0xa8 |
| 46 | |
| 47 | /* FCMD commands */ |
| 48 | #define FCMD_DEVICES 0xb8 |
| 49 | #define FDAT_DEVICE_SET_INV_STATE 0xc2 /* inverted! en=0xc2|0, dis=0xc2|1 */ |
| 50 | #define FCMD_KLED 0xca |
| 51 | #define FDAT_KBLED_WHITE_SET_LEVEL 0x00 |
| 52 | #define FDAT_KBLED_WHITE_GET_LEVEL 0x01 |
| 53 | #define FCMD_FLEXICHARGER 0xcb |
| 54 | #define FCMD_SET_KBLED_TIMEOUT 0xd4 |
| 55 | |
| 56 | #ifndef __ACPI__ |
| 57 | enum camera_state { |
| 58 | CAMERA_STATE_DISABLE, |
| 59 | CAMERA_STATE_ENABLE, |
| 60 | CAMERA_STATE_KEEP, |
| 61 | }; |
| 62 | |
| 63 | char *ec_read_model(void); |
| 64 | char *ec_read_fw_version(void); |
| 65 | void ec_set_acpi_mode(bool state); |
| 66 | void ec_set_aprd(void); |
| 67 | void ec_set_enter_g3_in_s4s5(bool state); |
| 68 | void ec_set_dgpu_present(bool state); |
| 69 | void ec_set_fn_win_swap(bool state); |
| 70 | void ec_set_ac_fan_always_on(bool state); |
| 71 | void ec_set_kbled_timeout(uint16_t timeout); |
| 72 | void ec_set_flexicharger(bool state, uint8_t start, uint8_t stop); |
| 73 | void ec_set_camera_boot_state(enum camera_state state); |
| 74 | void ec_set_tp_toggle_mode(uint8_t mode); |
| 75 | #endif // __ACPI__ |
| 76 | |
| 77 | #endif /* EC_CLEVO_IT5570E_COMMANDS_H */ |