sb_notify.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * sb_notify.h
  3. * Samsung Mobile Battery Notify Header
  4. *
  5. * Copyright (C) 2012 Samsung Electronics, Inc.
  6. *
  7. *
  8. * This software is licensed under the terms of the GNU General Public
  9. * License version 2, as published by the Free Software Foundation, and
  10. * may be copied, distributed, and modified under those terms.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. */
  18. #ifndef __SB_NOTIFY_H
  19. #define __SB_NOTIFY_H __FILE__
  20. #include <linux/notifier.h>
  21. #include <linux/battery/sb_def.h>
  22. enum sbn_type {
  23. SB_NOTIFY_UNKNOWN = 0,
  24. SB_NOTIFY_DEV_PROBE,
  25. SB_NOTIFY_DEV_SHUTDOWN,
  26. SB_NOTIFY_DEV_LIST,
  27. SB_NOTIFY_EVENT_MISC,
  28. SB_NOTIFY_EVENT_SIOP,
  29. SB_NOTIFY_EVENT_SLATE_MODE,
  30. SB_NOTIFY_MAX,
  31. };
  32. struct sbn_dev_list {
  33. const char **list;
  34. unsigned int count;
  35. };
  36. struct sbn_bit_event {
  37. unsigned int value;
  38. unsigned int mask;
  39. };
  40. #define SB_NOTIFY_DISABLE (-3661)
  41. #if IS_ENABLED(CONFIG_SB_NOTIFY)
  42. int sb_notify_call(enum sbn_type ntype, sb_data *ndata);
  43. int sb_notify_register(struct notifier_block *nb,
  44. notifier_fn_t notifier, const char *name, enum sb_dev_type type);
  45. int sb_notify_unregister(struct notifier_block *nb);
  46. #else
  47. static inline int sb_notify_call(enum sbn_type ntype, sb_data *ndata)
  48. { return SB_NOTIFY_DISABLE; }
  49. static inline int sb_notify_register(struct notifier_block *nb,
  50. notifier_fn_t notifier, const char *name, enum sb_dev_type type)
  51. { return SB_NOTIFY_DISABLE; }
  52. static inline int sb_notify_unregister(struct notifier_block *nb)
  53. { return SB_NOTIFY_DISABLE; }
  54. #endif
  55. #endif /* __SB_NOTIFY_H */