max77888.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /*
  2. * max77888.h - Driver for the Maxim 77803
  3. *
  4. * Copyright (C) 2011 Samsung Electrnoics
  5. * SangYoung Son <hello.son@samsung.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  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. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. *
  21. * This driver is based on max8997.h
  22. *
  23. * MAX77888 has Charger, Flash LED, Haptic, MUIC devices.
  24. * The devices share the same I2C bus and included in
  25. * this mfd driver.
  26. */
  27. #ifndef __LINUX_MFD_MAX77888_H
  28. #define __LINUX_MFD_MAX77888_H
  29. #include <linux/regulator/consumer.h>
  30. #include <linux/battery/sec_charger.h>
  31. enum {
  32. MAX77888_MUIC_DETACHED = 0,
  33. MAX77888_MUIC_ATTACHED
  34. };
  35. enum {
  36. MAX77888_MUIC_DOCK_DETACHED = 0,
  37. MAX77888_MUIC_DOCK_DESKDOCK,
  38. MAX77888_MUIC_DOCK_CARDOCK,
  39. MAX77888_MUIC_DOCK_AUDIODOCK = 7,
  40. MAX77888_MUIC_DOCK_SMARTDOCK = 8
  41. };
  42. /* MAX77686 regulator IDs */
  43. enum max77888_regulators {
  44. MAX77888_ESAFEOUT1 = 0,
  45. MAX77888_ESAFEOUT2,
  46. MAX77888_CHARGER,
  47. MAX77888_REG_MAX,
  48. };
  49. struct max77888_charger_reg_data {
  50. u8 addr;
  51. u8 data;
  52. };
  53. #if defined(CONFIG_CHARGER_MAX77888)
  54. struct max77888_charger_platform_data {
  55. struct max77888_charger_reg_data *init_data;
  56. int num_init_data;
  57. sec_battery_platform_data_t *sec_battery;
  58. #if defined(CONFIG_WIRELESS_CHARGING) || defined(CONFIG_CHARGER_MAX77888)
  59. int wpc_irq_gpio;
  60. int vbus_irq_gpio;
  61. bool wc_pwr_det;
  62. #endif
  63. };
  64. #endif
  65. #ifdef CONFIG_SS_VIBRATOR
  66. #define MAX8997_MOTOR_REG_CONFIG2 0x2
  67. #define MOTOR_LRA (1<<7)
  68. #define MOTOR_EN (1<<6)
  69. #define EXT_PWM (0<<5)
  70. #define DIVIDER_128 (1<<1)
  71. #define DIVIDER_256 0x3
  72. struct max77888_haptic_platform_data {
  73. u32 max_timeout;
  74. u32 duty;
  75. u32 period;
  76. u32 reg2;
  77. char *regulator_name;
  78. u32 pwm_id;
  79. void (*init_hw) (void);
  80. void (*motor_en) (bool);
  81. };
  82. #endif
  83. #ifdef CONFIG_LEDS_MAX77888
  84. struct max77888_led_platform_data;
  85. #endif
  86. struct max77888_regulator_data {
  87. int id;
  88. struct regulator_init_data *initdata;
  89. };
  90. struct max77888_platform_data {
  91. /* IRQ */
  92. u32 irq_base;
  93. u32 irq_base_flags;
  94. int irq_gpio;
  95. #ifdef CONFIG_MUIC_RESET_PIN_ENABLE
  96. int irq_reset_gpio;
  97. #endif
  98. u32 irq_gpio_flags;
  99. unsigned int wc_irq_gpio;
  100. bool wakeup;
  101. struct max77888_muic_data *muic;
  102. // bool (*is_default_uart_path_cp) (void);
  103. struct max77888_regulator_data *regulators;
  104. int num_regulators;
  105. #ifdef CONFIG_SS_VIBRATOR
  106. /* haptic motor data */
  107. struct max77888_haptic_platform_data *haptic_data;
  108. #endif
  109. #ifdef CONFIG_LEDS_MAX77888
  110. /* led (flash/torch) data */
  111. struct max77888_led_platform_data *led_data;
  112. #endif
  113. /* charger data */
  114. #ifdef CONFIG_BATTERY_MAX77888_CHARGER
  115. struct max77888_charger_platform_data *charger_data;
  116. #endif
  117. #if defined(CONFIG_CHARGER_MAX77888)
  118. sec_battery_platform_data_t *charger_data;
  119. #endif
  120. };
  121. enum cable_type_muic;
  122. struct max77888_muic_data {
  123. void (*usb_cb) (u8 attached);
  124. void (*uart_cb) (u8 attached);
  125. int (*charger_cb) (enum cable_type_muic);
  126. void (*dock_cb) (int type);
  127. void (*mhl_cb) (int attached);
  128. void (*init_cb) (void);
  129. int (*set_safeout) (int path);
  130. bool(*is_mhl_attached) (void);
  131. int (*cfg_uart_gpio) (void);
  132. void (*jig_uart_cb) (int path);
  133. #if defined(CONFIG_MUIC_DET_JACK)
  134. void (*earjack_cb) (int attached);
  135. void (*sendend_cb) (int pressed);
  136. #endif
  137. int (*host_notify_cb) (int enable);
  138. int gpio_usb_sel;
  139. int sw_path;
  140. int uart_path;
  141. void (*jig_state) (int jig_state);
  142. void (*check_id_state)(int state);
  143. };
  144. extern struct class *sec_class;
  145. extern struct max77888_muic_data max77888_muic;
  146. extern int muic_otg_control(int enable);
  147. extern struct max77888_regulator_data max77888_regulators[];
  148. extern struct max77888_haptic_platform_data max77888_haptic_pdata;
  149. #ifdef CONFIG_LEDS_MAX77888
  150. extern struct max77888_led_platform_data max77888_led_pdata;
  151. #endif
  152. #ifdef CONFIG_VIDEO_MHL_V2
  153. int acc_register_notifier(struct notifier_block *nb);
  154. #endif
  155. #endif /* __LINUX_MFD_MAX77888_H */