msi-ec.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * msi-ec: MSI laptops' embedded controller driver.
  4. *
  5. * Copyright (C) 2023 Jose Angel Pastrana <japp0005@red.ujaen.es>
  6. * Copyright (C) 2023 Aakash Singh <mail@singhaakash.dev>
  7. * Copyright (C) 2023 Nikita Kravets <teackot@gmail.com>
  8. */
  9. #ifndef _MSI_EC_H_
  10. #define _MSI_EC_H_
  11. #include <linux/types.h>
  12. #define MSI_EC_DRIVER_NAME "msi-ec"
  13. #define MSI_EC_ADDR_UNKNOWN 0xff01 // unknown address
  14. #define MSI_EC_ADDR_UNSUPP 0xff01 // unsupported parameter
  15. // Firmware info addresses are universal
  16. #define MSI_EC_FW_VERSION_ADDRESS 0xa0
  17. #define MSI_EC_FW_DATE_ADDRESS 0xac
  18. #define MSI_EC_FW_TIME_ADDRESS 0xb4
  19. #define MSI_EC_FW_VERSION_LENGTH 12
  20. #define MSI_EC_FW_DATE_LENGTH 8
  21. #define MSI_EC_FW_TIME_LENGTH 8
  22. struct msi_ec_charge_control_conf {
  23. int address;
  24. int offset_start;
  25. int offset_end;
  26. int range_min;
  27. int range_max;
  28. };
  29. struct msi_ec_webcam_conf {
  30. int address;
  31. int block_address;
  32. int bit;
  33. };
  34. struct msi_ec_fn_win_swap_conf {
  35. int address;
  36. int bit;
  37. };
  38. struct msi_ec_cooler_boost_conf {
  39. int address;
  40. int bit;
  41. };
  42. #define MSI_EC_MODE_NULL { NULL, 0 }
  43. struct msi_ec_mode {
  44. const char *name;
  45. int value;
  46. };
  47. struct msi_ec_shift_mode_conf {
  48. int address;
  49. struct msi_ec_mode modes[5]; // fixed size for easier hard coding
  50. };
  51. struct msi_ec_super_battery_conf {
  52. int address;
  53. int mask;
  54. };
  55. struct msi_ec_fan_mode_conf {
  56. int address;
  57. struct msi_ec_mode modes[5]; // fixed size for easier hard coding
  58. };
  59. struct msi_ec_cpu_conf {
  60. int rt_temp_address;
  61. int rt_fan_speed_address; // realtime
  62. int rt_fan_speed_base_min;
  63. int rt_fan_speed_base_max;
  64. int bs_fan_speed_address; // basic
  65. int bs_fan_speed_base_min;
  66. int bs_fan_speed_base_max;
  67. };
  68. struct msi_ec_gpu_conf {
  69. int rt_temp_address;
  70. int rt_fan_speed_address; // realtime
  71. };
  72. struct msi_ec_led_conf {
  73. int micmute_led_address;
  74. int mute_led_address;
  75. int bit;
  76. };
  77. #define MSI_EC_KBD_BL_STATE_MASK 0x3
  78. struct msi_ec_kbd_bl_conf {
  79. int bl_mode_address;
  80. int bl_modes[2];
  81. int max_mode;
  82. int bl_state_address;
  83. int state_base_value;
  84. int max_state;
  85. };
  86. struct msi_ec_conf {
  87. const char * const *allowed_fw;
  88. struct msi_ec_charge_control_conf charge_control;
  89. struct msi_ec_webcam_conf webcam;
  90. struct msi_ec_fn_win_swap_conf fn_win_swap;
  91. struct msi_ec_cooler_boost_conf cooler_boost;
  92. struct msi_ec_shift_mode_conf shift_mode;
  93. struct msi_ec_super_battery_conf super_battery;
  94. struct msi_ec_fan_mode_conf fan_mode;
  95. struct msi_ec_cpu_conf cpu;
  96. struct msi_ec_gpu_conf gpu;
  97. struct msi_ec_led_conf leds;
  98. struct msi_ec_kbd_bl_conf kbd_bl;
  99. };
  100. #endif // _MSI_EC_H_