cros_ec.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* Chrome OS embedded controller power/sensor backend. */
  2. #ifndef CROS_EC_H
  3. #define CROS_EC_H
  4. #include "power_src.h"
  5. #define CROS_EC_TEMP_MAX 24
  6. #define CROS_EC_FAN_MAX 4
  7. /* -128 means the EC reports the sensor as absent/unavailable. fan_present
  8. * is a bitmask over fan_rpm[]; fan_duty is the raw EC_ACPI_MEM_FAN_DUTY
  9. * value (0xff means automatic). switches follows EC_MEMMAP_SWITCHES
  10. * (bit 0 lid open, bit 1 power button pressed). */
  11. struct cros_ec_sensors {
  12. int present;
  13. unsigned int acpi_version;
  14. unsigned int battery_version;
  15. unsigned int thermal_version;
  16. int temp_c[CROS_EC_TEMP_MAX];
  17. unsigned int fan_rpm[CROS_EC_FAN_MAX];
  18. unsigned int fan_present;
  19. unsigned int fan_duty;
  20. unsigned int switches;
  21. };
  22. /* Probe once on the BSP; skips the probe when the ThinkPad EC is present.
  23. * Logs the result to COM1. */
  24. void cros_ec_init(void);
  25. int cros_ec_present(void);
  26. /* Fill the generic AC/battery snapshot; detail also reads design data and
  27. * the manufacturer/model/serial strings. */
  28. void cros_ec_power_read(struct power_info *out, int detail);
  29. /* Read the EC temperature/fan/switch snapshot. */
  30. void cros_ec_sensors_read(struct cros_ec_sensors *out);
  31. #endif