rt8973.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * include/linux/mfd/rt8973.h
  3. *
  4. * Richtek RT8973 driver header file
  5. *
  6. * Copyright (C) 2013 Richtek Technology Corp.
  7. * Author: Patrick Chang <patrick_chang@richtek.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation; either version 2
  12. * of the License, or (at your option) any later version.
  13. */
  14. #ifndef LINUX_MFD_RT8973_H
  15. #define LINUX_MFD_RT8973_H
  16. #include <linux/i2c/tsu6721.h>
  17. /* Marvell MMP arch*/
  18. #ifdef CONFIG_ARCH_MMP
  19. #define SAMSUNG_MVRL_MUIC_RT8973 1
  20. #endif
  21. #ifdef CONFIG_SEC_FACTORY
  22. #if defined(CONFIG_MACH_KANAS3G_CTC) || defined(CONFIG_MACH_HEAT_AIO) || defined(CONFIG_MACH_KANAS3G_CMCC)
  23. #define MUIC_SUPPORT_CARDOCK_FUNCTION 1
  24. #endif
  25. #endif
  26. #if defined(CONFIG_RT8973_JIG_WAKEUP)
  27. extern int rt8973_dock_init(void);
  28. #endif
  29. enum {
  30. MUIC_RT8973_CABLE_TYPE_NONE = 0,
  31. MUIC_RT8973_CABLE_TYPE_UART, //adc 0x16
  32. MUIC_RT8973_CABLE_TYPE_USB, //adc 0x1f (none id)
  33. MUIC_RT8973_CABLE_TYPE_OTG, //adc 0x00, regDev1&0x01
  34. /* TA Group */
  35. MUIC_RT8973_CABLE_TYPE_REGULAR_TA, //adc 0x1f (none id, D+ short to D-)
  36. MUIC_RT8973_CABLE_TYPE_ATT_TA, //adc 0x1f (none id, only VBUS)AT&T
  37. MUIC_RT8973_CABLE_TYPE_0x15, //adc 0x15
  38. MUIC_RT8973_CABLE_TYPE_TYPE1_CHARGER, //adc 0x17 (id : 200k)
  39. MUIC_RT8973_CABLE_TYPE_0x1A, //adc 0x1A
  40. /* JIG Group */
  41. MUIC_RT8973_CABLE_TYPE_JIG_USB_OFF, //adc 0x18
  42. MUIC_RT8973_CABLE_TYPE_JIG_USB_ON, //adc 0x19
  43. MUIC_RT8973_CABLE_TYPE_JIG_UART_OFF, //adc 0x1C
  44. MUIC_RT8973_CABLE_TYPE_JIG_UART_ON, //adc 0x1D
  45. // JIG type with VBUS
  46. MUIC_RT8973_CABLE_TYPE_JIG_UART_OFF_WITH_VBUS, //adc 0x1C
  47. MUIC_RT8973_CABLE_TYPE_JIG_UART_ON_WITH_VBUS, //adc 0x1D
  48. MUIC_RT8973_CABLE_TYPE_CDP, // USB Charging downstream port, usually treated as SDP
  49. MUIC_RT8973_CABLE_TYPE_L200K_SPEC_USB, // 200K special USB cable
  50. MUIC_RT8973_CABLE_TYPE_UNKNOWN,
  51. MUIC_RT8973_CABLE_TYPE_INVALID, /* Means un-initialized*/
  52. };
  53. /*enum cable_type_t {
  54. CABLE_TYPE_NONE = 0,
  55. CABLE_TYPE_USB =MUIC_RT8973_CABLE_TYPE_USB,
  56. CABLE_TYPE_AC,
  57. CABLE_TYPE_MISC,
  58. CABLE_TYPE_CARDOCK,
  59. CABLE_TYPE_UARTOFF,
  60. CABLE_TYPE_JIG,
  61. CABLE_TYPE_UNKNOWN =MUIC_RT8973_CABLE_TYPE_UNKNOWN,
  62. CABLE_TYPE_CDP = MUIC_RT8973_CABLE_TYPE_CDP,
  63. CABLE_TYPE_SMART_DOCK,
  64. CABLE_TYPE_OTG = MUIC_RT8973_CABLE_TYPE_OTG,
  65. CABLE_TYPE_AUDIO_DOCK,
  66. #ifdef CONFIG_WIRELESS_CHARGING
  67. CABLE_TYPE_WPC,
  68. #endif
  69. CABLE_TYPE_INCOMPATIBLE,
  70. CABLE_TYPE_DESK_DOCK,
  71. };*/
  72. typedef enum {
  73. JIG_USB_BOOT_OFF,
  74. JIG_USB_BOOT_ON,
  75. JIG_UART_BOOT_OFF,
  76. JIG_UART_BOOT_ON,
  77. } jig_type_t;
  78. struct rt8973_platform_data {
  79. int irq_gpio;
  80. void (*cable_chg_callback)(int32_t cable_type);
  81. void (*ocp_callback)(void);
  82. void (*otp_callback)(void);
  83. void (*ovp_callback)(void);
  84. void (*usb_callback)(uint8_t attached);
  85. void (*uart_callback)(uint8_t attached);
  86. void (*otg_callback)(uint8_t attached);
  87. void (*jig_callback)(jig_type_t type, uint8_t attached);
  88. int (*dock_init) (void);
  89. int gpio_int;
  90. u32 irq_gpio_flags;
  91. // int gpio_sda;
  92. // u32 sda_gpio_flags;
  93. // int gpio_scl;
  94. // u32 scl_gpio_flags;
  95. };
  96. extern struct rt8973_platform_data rt8973_pdata;
  97. extern int rt_check_jig_state(void);
  98. extern struct class *sec_class;
  99. #endif // LINUX_MFD_RT8973_H