tpec.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* ThinkPad embedded-controller sensors and power sources (X201/Arrandale class). */
  2. #ifndef TPEC_H
  3. #define TPEC_H
  4. #include "power_src.h"
  5. #define TPEC_TEMP_COUNT 16
  6. /* Temperatures are indexed like thinkpad_acpi's temp1..temp16:
  7. * temp_c[0..7] come from EC 0x78..0x7F, temp_c[8..15] from EC 0xC0..0xC7.
  8. * -128 means the EC reports the sensor as not present. */
  9. struct tpec_info {
  10. int present;
  11. char vendor[16];
  12. char product[32];
  13. char version[32];
  14. int temp_c[TPEC_TEMP_COUNT];
  15. unsigned int fan_rpm;
  16. unsigned int fan_level; /* raw EC 0x2F value */
  17. };
  18. /* Probe SMBIOS + the EC once on the BSP; logs the result to COM1. Does
  19. * nothing (present = 0) unless SMBIOS identifies a Lenovo/IBM machine and the
  20. * EC answers, so boards without one are never touched. */
  21. void tpec_init(void);
  22. /* Whether the ThinkPad EC was found; probes on first use. */
  23. int tpec_present(void);
  24. /* Read the current temperatures, fan speed and fan level. present is 0 when
  25. * no ThinkPad EC was found. */
  26. void tpec_read(struct tpec_info *out);
  27. /* Read the AC adapter and battery state through the H8 battery information
  28. * pages into the shared snapshot; detail also reads design capacity, the
  29. * capacity unit and the manufacturer/model strings. The only EC write is
  30. * the page selector at 0x81, and it is restored when it had to be changed. */
  31. void tpec_power_read(struct power_info *out, int detail);
  32. #endif