max77803.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /*
  2. * max77803.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. * MAX77803 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_MAX77803_H
  28. #define __LINUX_MFD_MAX77803_H
  29. #include <linux/regulator/consumer.h>
  30. #include <linux/battery/sec_charger.h>
  31. enum {
  32. MAX77803_MUIC_DETACHED = 0,
  33. MAX77803_MUIC_ATTACHED
  34. };
  35. /* ATTACHED Dock Type */
  36. enum {
  37. MAX77803_MUIC_DOCK_DETACHED,
  38. MAX77803_MUIC_DOCK_DESKDOCK,
  39. MAX77803_MUIC_DOCK_CARDOCK,
  40. MAX77803_MUIC_DOCK_AUDIODOCK = 7,
  41. MAX77803_MUIC_DOCK_SMARTDOCK = 8,
  42. };
  43. /* MAX77686 regulator IDs */
  44. enum max77803_regulators {
  45. MAX77803_ESAFEOUT1 = 0,
  46. MAX77803_ESAFEOUT2,
  47. MAX77803_CHARGER,
  48. MAX77803_REG_MAX,
  49. };
  50. struct max77803_charger_reg_data {
  51. u8 addr;
  52. u8 data;
  53. };
  54. struct max77803_charger_platform_data {
  55. struct max77803_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_MAX77803)
  59. int wpc_irq_gpio;
  60. int vbus_irq_gpio;
  61. bool wc_pwr_det;
  62. #endif
  63. };
  64. #ifdef CONFIG_SS_VIBRATOR
  65. #define MAX8997_MOTOR_REG_CONFIG2 0x2
  66. #define MOTOR_LRA (1<<7)
  67. #define MOTOR_EN (1<<6)
  68. #define EXT_PWM (0<<5)
  69. #define DIVIDER_128 (1<<1)
  70. #define DIVIDER_256 0x3
  71. struct max77803_haptic_platform_data {
  72. u32 max_timeout;
  73. u32 duty;
  74. u32 period;
  75. u32 reg2;
  76. char *regulator_name;
  77. u32 pwm_id;
  78. void (*init_hw) (void);
  79. void (*motor_en) (bool);
  80. };
  81. #endif
  82. #ifdef CONFIG_LEDS_MAX77803
  83. struct max77803_led_platform_data;
  84. #endif
  85. struct max77803_regulator_data {
  86. int id;
  87. struct regulator_init_data *initdata;
  88. };
  89. struct max77803_platform_data {
  90. /* IRQ */
  91. u32 irq_base;
  92. u32 irq_base_flags;
  93. int irq_gpio;
  94. u32 irq_gpio_flags;
  95. unsigned int wc_irq_gpio;
  96. bool wakeup;
  97. struct max77803_muic_data *muic_data;
  98. struct max77803_regulator_data *regulators;
  99. int num_regulators;
  100. #ifdef CONFIG_SS_VIBRATOR
  101. /* haptic motor data */
  102. struct max77803_haptic_platform_data *haptic_data;
  103. #endif
  104. #ifdef CONFIG_LEDS_MAX77803
  105. /* led (flash/torch) data */
  106. struct max77803_led_platform_data *led_data;
  107. #endif
  108. #if defined(CONFIG_CHARGER_MAX77803)
  109. sec_battery_platform_data_t *charger_data;
  110. #endif
  111. };
  112. enum cable_type_muic;
  113. struct max77803_muic_data {
  114. void (*usb_cb) (u8 attached);
  115. void (*uart_cb) (u8 attached);
  116. int (*charger_cb) (enum cable_type_muic);
  117. void (*dock_cb) (int type);
  118. void (*mhl_cb) (int attached);
  119. void (*init_cb) (void);
  120. int (*set_safeout) (int path);
  121. bool(*is_mhl_attached) (void);
  122. int (*cfg_uart_gpio) (void);
  123. void (*jig_uart_cb) (int path);
  124. int (*host_notify_cb) (int enable);
  125. int gpio_usb_sel;
  126. int sw_path;
  127. int uart_path;
  128. void (*jig_state) (int jig_state);
  129. };
  130. #ifdef CONFIG_MFD_MAX77803
  131. extern struct max77803_muic_data max77803_muic;
  132. extern struct max77803_regulator_data max77803_regulators[];
  133. extern int muic_otg_control(int enable);
  134. extern struct max77803_haptic_platform_data max77803_haptic_pdata;
  135. extern struct max77803_led_platform_data max77803_led_pdata;
  136. #endif
  137. #if defined (CONFIG_VIDEO_MHL_V2) || defined (CONFIG_VIDEO_MHL_SII8246)
  138. int acc_register_notifier(struct notifier_block *nb);
  139. #endif
  140. #endif /* __LINUX_MFD_MAX77803_H */