pmu.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Definitions for talking to the PMU. The PMU is a microcontroller
  4. * which controls battery charging and system power on PowerBook 3400
  5. * and 2400 models as well as the RTC and various other things.
  6. *
  7. * Copyright (C) 1998 Paul Mackerras.
  8. */
  9. #ifndef _LINUX_PMU_H
  10. #define _LINUX_PMU_H
  11. #include <uapi/linux/pmu.h>
  12. extern int find_via_pmu(void);
  13. extern int pmu_request(struct adb_request *req,
  14. void (*done)(struct adb_request *), int nbytes, ...);
  15. extern int pmu_queue_request(struct adb_request *req);
  16. extern void pmu_poll(void);
  17. extern void pmu_poll_adb(void); /* For use by xmon */
  18. extern void pmu_wait_complete(struct adb_request *req);
  19. /* For use before switching interrupts off for a long time;
  20. * warning: not stackable
  21. */
  22. #if defined(CONFIG_ADB_PMU)
  23. extern void pmu_suspend(void);
  24. extern void pmu_resume(void);
  25. #else
  26. static inline void pmu_suspend(void)
  27. {}
  28. static inline void pmu_resume(void)
  29. {}
  30. #endif
  31. extern void pmu_enable_irled(int on);
  32. extern void pmu_restart(void);
  33. extern void pmu_shutdown(void);
  34. extern void pmu_unlock(void);
  35. extern int pmu_present(void);
  36. extern int pmu_get_model(void);
  37. extern void pmu_backlight_set_sleep(int sleep);
  38. #define PMU_MAX_BATTERIES 2
  39. /* values for pmu_power_flags */
  40. #define PMU_PWR_AC_PRESENT 0x00000001
  41. /* values for pmu_battery_info.flags */
  42. #define PMU_BATT_PRESENT 0x00000001
  43. #define PMU_BATT_CHARGING 0x00000002
  44. #define PMU_BATT_TYPE_MASK 0x000000f0
  45. #define PMU_BATT_TYPE_SMART 0x00000010 /* Smart battery */
  46. #define PMU_BATT_TYPE_HOOPER 0x00000020 /* 3400/3500 */
  47. #define PMU_BATT_TYPE_COMET 0x00000030 /* 2400 */
  48. struct pmu_battery_info
  49. {
  50. unsigned int flags;
  51. unsigned int charge; /* current charge */
  52. unsigned int max_charge; /* maximum charge */
  53. signed int amperage; /* current, positive if charging */
  54. unsigned int voltage; /* voltage */
  55. unsigned int time_remaining; /* remaining time */
  56. };
  57. extern int pmu_battery_count;
  58. extern struct pmu_battery_info pmu_batteries[PMU_MAX_BATTERIES];
  59. extern unsigned int pmu_power_flags;
  60. /* Backlight */
  61. extern void pmu_backlight_init(void);
  62. /* some code needs to know if the PMU was suspended for hibernation */
  63. #if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32)
  64. extern int pmu_sys_suspended;
  65. #else
  66. /* if power management is not configured it can't be suspended */
  67. #define pmu_sys_suspended 0
  68. #endif
  69. #endif /* _LINUX_PMU_H */