1 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 * msi-ec: MSI laptops' embedded controller driver.
6 * Copyright (C) 2023 Jose Angel Pastrana <japp0005@red.ujaen.es>
7 * Copyright (C) 2023 Aakash Singh <mail@singhaakash.dev>
8 * Copyright (C) 2023 Nikita Kravets <teackot@gmail.com>
14 #include <linux/types.h>
16 #define MSI_EC_DRIVER_NAME "msi-ec"
18 #define MSI_EC_ADDR_UNKNOWN 0xff01 // unknown address
19 #define MSI_EC_ADDR_UNSUPP 0xff01 // unsupported parameter
21 // Firmware info addresses are universal
22 #define MSI_EC_FW_VERSION_ADDRESS 0xa0
23 #define MSI_EC_FW_DATE_ADDRESS 0xac
24 #define MSI_EC_FW_TIME_ADDRESS 0xb4
25 #define MSI_EC_FW_VERSION_LENGTH 12
26 #define MSI_EC_FW_DATE_LENGTH 8
27 #define MSI_EC_FW_TIME_LENGTH 8
29 struct msi_ec_charge_control_conf
{
37 struct msi_ec_webcam_conf
{
43 struct msi_ec_fn_win_swap_conf
{
48 struct msi_ec_cooler_boost_conf
{
53 #define MSI_EC_MODE_NULL { NULL, 0 }
59 struct msi_ec_shift_mode_conf
{
61 struct msi_ec_mode modes
[5]; // fixed size for easier hard coding
64 struct msi_ec_super_battery_conf
{
69 struct msi_ec_fan_mode_conf
{
71 struct msi_ec_mode modes
[5]; // fixed size for easier hard coding
74 struct msi_ec_cpu_conf
{
76 int rt_fan_speed_address
; // realtime
77 int rt_fan_speed_base_min
;
78 int rt_fan_speed_base_max
;
79 int bs_fan_speed_address
; // basic
80 int bs_fan_speed_base_min
;
81 int bs_fan_speed_base_max
;
84 struct msi_ec_gpu_conf
{
86 int rt_fan_speed_address
; // realtime
89 struct msi_ec_led_conf
{
90 int micmute_led_address
;
95 #define MSI_EC_KBD_BL_STATE_MASK 0x3
96 struct msi_ec_kbd_bl_conf
{
101 int bl_state_address
;
102 int state_base_value
;
107 const char * const *allowed_fw
;
109 struct msi_ec_charge_control_conf charge_control
;
110 struct msi_ec_webcam_conf webcam
;
111 struct msi_ec_fn_win_swap_conf fn_win_swap
;
112 struct msi_ec_cooler_boost_conf cooler_boost
;
113 struct msi_ec_shift_mode_conf shift_mode
;
114 struct msi_ec_super_battery_conf super_battery
;
115 struct msi_ec_fan_mode_conf fan_mode
;
116 struct msi_ec_cpu_conf cpu
;
117 struct msi_ec_gpu_conf gpu
;
118 struct msi_ec_led_conf leds
;
119 struct msi_ec_kbd_bl_conf kbd_bl
;