sb_tx.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * sb_tx.h
  3. * Samsung Mobile Wireless TX Header
  4. *
  5. * Copyright (C) 2021 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_TX_H
  19. #define __SB_TX_H __FILE__
  20. #define TX_MODULE_NAME "sb-tx"
  21. /* tx_event */
  22. #define SB_TX_EVENT_TX_STATUS 0x00000001
  23. #define SB_TX_EVENT_RX_CONNECT 0x00000002
  24. #define SB_TX_EVENT_TX_FOD 0x00000004
  25. #define SB_TX_EVENT_TX_HIGH_TEMP 0x00000008
  26. #define SB_TX_EVENT_RX_UNSAFE_TEMP 0x00000010
  27. #define SB_TX_EVENT_RX_CHG_SWITCH 0x00000020
  28. #define SB_TX_EVENT_RX_CS100 0x00000040
  29. #define SB_TX_EVENT_TX_OTG_ON 0x00000080
  30. #define SB_TX_EVENT_TX_LOW_TEMP 0x00000100
  31. #define SB_TX_EVENT_TX_SOC_DRAIN 0x00000200
  32. #define SB_TX_EVENT_TX_CRITICAL_EOC 0x00000400
  33. #define SB_TX_EVENT_TX_CAMERA_ON 0x00000800
  34. #define SB_TX_EVENT_TX_OCP 0x00001000
  35. #define SB_TX_EVENT_TX_MISALIGN 0x00002000
  36. #define SB_TX_EVENT_TX_ETC 0x00004000
  37. #define SB_TX_EVENT_TX_RETRY 0x00008000
  38. #define SB_TX_EVENT_TX_5V_TA 0x00010000
  39. #define SB_TX_EVENT_TX_AC_MISSING 0x00020000
  40. #define SB_TX_EVENT_ALL_MASK 0x0003ffff
  41. #define SB_TX_EVENT_TX_ERR (SB_TX_EVENT_TX_FOD | \
  42. SB_TX_EVENT_TX_HIGH_TEMP | SB_TX_EVENT_RX_UNSAFE_TEMP | \
  43. SB_TX_EVENT_RX_CHG_SWITCH | SB_TX_EVENT_RX_CS100 | \
  44. SB_TX_EVENT_TX_OTG_ON | SB_TX_EVENT_TX_LOW_TEMP | \
  45. SB_TX_EVENT_TX_SOC_DRAIN | SB_TX_EVENT_TX_CRITICAL_EOC | \
  46. SB_TX_EVENT_TX_CAMERA_ON | SB_TX_EVENT_TX_OCP | \
  47. SB_TX_EVENT_TX_MISALIGN | SB_TX_EVENT_TX_ETC | \
  48. SB_TX_EVENT_TX_5V_TA | SB_TX_EVENT_TX_AC_MISSING)
  49. #define SB_TX_RETRY_NONE 0x0000
  50. #define SB_TX_RETRY_MISALIGN 0x0001
  51. #define SB_TX_RETRY_CAMERA 0x0002
  52. #define SB_TX_RETRY_CALL 0x0004
  53. #define SB_TX_RETRY_MIX_TEMP 0x0008
  54. #define SB_TX_RETRY_HIGH_TEMP 0x0010
  55. #define SB_TX_RETRY_LOW_TEMP 0x0020
  56. #define SB_TX_RETRY_OCP 0x0040
  57. enum power_supply_property;
  58. union power_supply_propval;
  59. #define SB_TX_DISABLE (-2222)
  60. #if defined(CONFIG_WIRELESS_TX_MODE)
  61. int sb_tx_init(struct sec_battery_info *battery, char *wrl_name);
  62. int sb_tx_set_enable(bool tx_enable, int cable_type);
  63. bool sb_tx_get_enable(void);
  64. int sb_tx_set_event(int value, int mask);
  65. /* for set/get properties - called in wireless set/get property */
  66. int sb_tx_psy_set_property(enum power_supply_property psp, const union power_supply_propval *value);
  67. int sb_tx_psy_get_property(enum power_supply_property psp, union power_supply_propval *value);
  68. /* for monitor tx state - called in battery drv */
  69. int sb_tx_monitor(int cable_type, int capacity, int lcd_state);
  70. /* temporary function */
  71. int sb_tx_init_aov(void);
  72. bool sb_tx_is_aov_enabled(int cable_type);
  73. int sb_tx_monitor_aov(int vout, bool phm);
  74. #else
  75. static inline int sb_tx_init(struct sec_battery_info *battery, char *wrl_name) { return SB_TX_DISABLE; }
  76. static inline int sb_tx_set_enable(bool tx_enable, int cable_type) { return SB_TX_DISABLE; }
  77. static inline bool sb_tx_get_enable(void) { return false; }
  78. static inline int sb_tx_set_event(int value, int mask) { return SB_TX_DISABLE; }
  79. /* for set/get properties - called in wireless set/get property */
  80. static inline int sb_tx_psy_set_property(enum power_supply_property psp, const union power_supply_propval *value)
  81. { return SB_TX_DISABLE; }
  82. static inline int sb_tx_psy_get_property(enum power_supply_property psp, union power_supply_propval *value)
  83. { return SB_TX_DISABLE; }
  84. /* for monitor tx state - called in battery drv */
  85. static inline int sb_tx_monitor(int cable_type, int capacity, int lcd_state) { return SB_TX_DISABLE; }
  86. /* temporary function */
  87. static inline int sb_tx_init_aov(void) { return SB_TX_DISABLE; }
  88. static inline bool sb_tx_is_aov_enabled(int cable_type) { return false; }
  89. static inline int sb_tx_monitor_aov(int vout, bool phm) { return SB_TX_DISABLE; }
  90. #endif
  91. #endif /* __SB_TX_H */