vbus_notifier.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * include/linux/vbus_notifier.h
  3. *
  4. * header file supporting VBUS notifier call chain information
  5. *
  6. * Copyright (C) 2010 Samsung Electronics
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. *
  22. */
  23. #ifndef __VBUS_NOTIFIER_H__
  24. #define __VBUS_NOTIFIER_H__
  25. /* VBUS notifier call chain command */
  26. typedef enum {
  27. VBUS_NOTIFY_CMD_NONE = 0,
  28. VBUS_NOTIFY_CMD_FALLING,
  29. VBUS_NOTIFY_CMD_RISING,
  30. } vbus_notifier_cmd_t;
  31. /* VBUS notifier call sequence,
  32. * largest priority number device will be called first. */
  33. typedef enum {
  34. VBUS_NOTIFY_DEV_USB,
  35. VBUS_NOTIFY_DEV_CHARGER,
  36. VBUS_NOTIFY_DEV_MANAGER,
  37. VBUS_NOTIFY_DEV_MUIC,
  38. VBUS_NOTIFY_DEV_BATTERY,
  39. } vbus_notifier_device_t;
  40. typedef enum {
  41. STATUS_VBUS_UNKNOWN = 0,
  42. STATUS_VBUS_LOW,
  43. STATUS_VBUS_HIGH,
  44. } vbus_status_t;
  45. typedef enum {
  46. VBUS_NOTIFIER_NOT_READY = 0,
  47. VBUS_NOTIFIER_NOT_READY_DETECT,
  48. VBUS_NOTIFIER_READY,
  49. } vbus_notifier_stat_t;
  50. struct vbus_notifier_struct {
  51. vbus_notifier_stat_t status;
  52. vbus_status_t vbus_type;
  53. vbus_notifier_cmd_t cmd;
  54. };
  55. #define VBUS_NOTIFIER_BLOCK(name) \
  56. struct notifier_block (name)
  57. /* vbus notifier init/notify function
  58. * this function is for JUST VBUS device driver.
  59. * DON'T use function anywhrer else!!
  60. */
  61. extern void vbus_notifier_handle(vbus_status_t new_dev);
  62. /* vbus notifier register/unregister API
  63. * for used any where want to receive vbus attached device attach/detach. */
  64. extern int vbus_notifier_register(struct notifier_block *nb,
  65. notifier_fn_t notifier, vbus_notifier_device_t listener);
  66. extern int vbus_notifier_unregister(struct notifier_block *nb);
  67. #endif /* __VBUS_NOTIFIER_H__ */