mc13783.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. /*
  2. * Copyright 2009 Pengutronix
  3. * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it under
  6. * the terms of the GNU General Public License version 2 as published by the
  7. * Free Software Foundation.
  8. */
  9. #ifndef __LINUX_MFD_MC13783_H
  10. #define __LINUX_MFD_MC13783_H
  11. #include <linux/interrupt.h>
  12. struct mc13783;
  13. void mc13783_lock(struct mc13783 *mc13783);
  14. void mc13783_unlock(struct mc13783 *mc13783);
  15. int mc13783_reg_read(struct mc13783 *mc13783, unsigned int offset, u32 *val);
  16. int mc13783_reg_write(struct mc13783 *mc13783, unsigned int offset, u32 val);
  17. int mc13783_reg_rmw(struct mc13783 *mc13783, unsigned int offset,
  18. u32 mask, u32 val);
  19. int mc13783_irq_request(struct mc13783 *mc13783, int irq,
  20. irq_handler_t handler, const char *name, void *dev);
  21. int mc13783_irq_request_nounmask(struct mc13783 *mc13783, int irq,
  22. irq_handler_t handler, const char *name, void *dev);
  23. int mc13783_irq_free(struct mc13783 *mc13783, int irq, void *dev);
  24. int mc13783_irq_mask(struct mc13783 *mc13783, int irq);
  25. int mc13783_irq_unmask(struct mc13783 *mc13783, int irq);
  26. int mc13783_irq_status(struct mc13783 *mc13783, int irq,
  27. int *enabled, int *pending);
  28. int mc13783_irq_ack(struct mc13783 *mc13783, int irq);
  29. static inline int mc13783_mask(struct mc13783 *mc13783, int irq) __deprecated;
  30. static inline int mc13783_mask(struct mc13783 *mc13783, int irq)
  31. {
  32. return mc13783_irq_mask(mc13783, irq);
  33. }
  34. static inline int mc13783_unmask(struct mc13783 *mc13783, int irq) __deprecated;
  35. static inline int mc13783_unmask(struct mc13783 *mc13783, int irq)
  36. {
  37. return mc13783_irq_unmask(mc13783, irq);
  38. }
  39. static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq) __deprecated;
  40. static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq)
  41. {
  42. return mc13783_irq_ack(mc13783, irq);
  43. }
  44. #define MC13783_ADC0 43
  45. #define MC13783_ADC0_ADREFEN (1 << 10)
  46. #define MC13783_ADC0_ADREFMODE (1 << 11)
  47. #define MC13783_ADC0_TSMOD0 (1 << 12)
  48. #define MC13783_ADC0_TSMOD1 (1 << 13)
  49. #define MC13783_ADC0_TSMOD2 (1 << 14)
  50. #define MC13783_ADC0_ADINC1 (1 << 16)
  51. #define MC13783_ADC0_ADINC2 (1 << 17)
  52. #define MC13783_ADC0_TSMOD_MASK (MC13783_ADC0_TSMOD0 | \
  53. MC13783_ADC0_TSMOD1 | \
  54. MC13783_ADC0_TSMOD2)
  55. struct mc13783_led_platform_data {
  56. #define MC13783_LED_MD 0
  57. #define MC13783_LED_AD 1
  58. #define MC13783_LED_KP 2
  59. #define MC13783_LED_R1 3
  60. #define MC13783_LED_G1 4
  61. #define MC13783_LED_B1 5
  62. #define MC13783_LED_R2 6
  63. #define MC13783_LED_G2 7
  64. #define MC13783_LED_B2 8
  65. #define MC13783_LED_R3 9
  66. #define MC13783_LED_G3 10
  67. #define MC13783_LED_B3 11
  68. #define MC13783_LED_MAX MC13783_LED_B3
  69. int id;
  70. const char *name;
  71. const char *default_trigger;
  72. /* Three or two bits current selection depending on the led */
  73. char max_current;
  74. };
  75. struct mc13783_leds_platform_data {
  76. int num_leds;
  77. struct mc13783_led_platform_data *led;
  78. #define MC13783_LED_TRIODE_MD (1 << 0)
  79. #define MC13783_LED_TRIODE_AD (1 << 1)
  80. #define MC13783_LED_TRIODE_KP (1 << 2)
  81. #define MC13783_LED_BOOST_EN (1 << 3)
  82. #define MC13783_LED_TC1HALF (1 << 4)
  83. #define MC13783_LED_SLEWLIMTC (1 << 5)
  84. #define MC13783_LED_SLEWLIMBL (1 << 6)
  85. #define MC13783_LED_TRIODE_TC1 (1 << 7)
  86. #define MC13783_LED_TRIODE_TC2 (1 << 8)
  87. #define MC13783_LED_TRIODE_TC3 (1 << 9)
  88. int flags;
  89. #define MC13783_LED_AB_DISABLED 0
  90. #define MC13783_LED_AB_MD1 1
  91. #define MC13783_LED_AB_MD12 2
  92. #define MC13783_LED_AB_MD123 3
  93. #define MC13783_LED_AB_MD1234 4
  94. #define MC13783_LED_AB_MD1234_AD1 5
  95. #define MC13783_LED_AB_MD1234_AD12 6
  96. #define MC13783_LED_AB_MD1_AD 7
  97. char abmode;
  98. #define MC13783_LED_ABREF_200MV 0
  99. #define MC13783_LED_ABREF_400MV 1
  100. #define MC13783_LED_ABREF_600MV 2
  101. #define MC13783_LED_ABREF_800MV 3
  102. char abref;
  103. #define MC13783_LED_PERIOD_10MS 0
  104. #define MC13783_LED_PERIOD_100MS 1
  105. #define MC13783_LED_PERIOD_500MS 2
  106. #define MC13783_LED_PERIOD_2S 3
  107. char bl_period;
  108. char tc1_period;
  109. char tc2_period;
  110. char tc3_period;
  111. };
  112. /* to be cleaned up */
  113. struct regulator_init_data;
  114. struct mc13783_regulator_init_data {
  115. int id;
  116. struct regulator_init_data *init_data;
  117. };
  118. struct mc13783_regulator_platform_data {
  119. int num_regulators;
  120. struct mc13783_regulator_init_data *regulators;
  121. };
  122. struct mc13783_platform_data {
  123. int num_regulators;
  124. struct mc13783_regulator_init_data *regulators;
  125. struct mc13783_leds_platform_data *leds;
  126. #define MC13783_USE_TOUCHSCREEN (1 << 0)
  127. #define MC13783_USE_CODEC (1 << 1)
  128. #define MC13783_USE_ADC (1 << 2)
  129. #define MC13783_USE_RTC (1 << 3)
  130. #define MC13783_USE_REGULATOR (1 << 4)
  131. #define MC13783_USE_LED (1 << 5)
  132. unsigned int flags;
  133. };
  134. #define MC13783_ADC_MODE_TS 1
  135. #define MC13783_ADC_MODE_SINGLE_CHAN 2
  136. #define MC13783_ADC_MODE_MULT_CHAN 3
  137. int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode,
  138. unsigned int channel, unsigned int *sample);
  139. #define MC13783_SW_SW1A 0
  140. #define MC13783_SW_SW1B 1
  141. #define MC13783_SW_SW2A 2
  142. #define MC13783_SW_SW2B 3
  143. #define MC13783_SW_SW3 4
  144. #define MC13783_SW_PLL 5
  145. #define MC13783_REGU_VAUDIO 6
  146. #define MC13783_REGU_VIOHI 7
  147. #define MC13783_REGU_VIOLO 8
  148. #define MC13783_REGU_VDIG 9
  149. #define MC13783_REGU_VGEN 10
  150. #define MC13783_REGU_VRFDIG 11
  151. #define MC13783_REGU_VRFREF 12
  152. #define MC13783_REGU_VRFCP 13
  153. #define MC13783_REGU_VSIM 14
  154. #define MC13783_REGU_VESIM 15
  155. #define MC13783_REGU_VCAM 16
  156. #define MC13783_REGU_VRFBG 17
  157. #define MC13783_REGU_VVIB 18
  158. #define MC13783_REGU_VRF1 19
  159. #define MC13783_REGU_VRF2 20
  160. #define MC13783_REGU_VMMC1 21
  161. #define MC13783_REGU_VMMC2 22
  162. #define MC13783_REGU_GPO1 23
  163. #define MC13783_REGU_GPO2 24
  164. #define MC13783_REGU_GPO3 25
  165. #define MC13783_REGU_GPO4 26
  166. #define MC13783_REGU_V1 27
  167. #define MC13783_REGU_V2 28
  168. #define MC13783_REGU_V3 29
  169. #define MC13783_REGU_V4 30
  170. #define MC13783_REGU_PWGT1SPI 31
  171. #define MC13783_REGU_PWGT2SPI 32
  172. #define MC13783_IRQ_ADCDONE 0
  173. #define MC13783_IRQ_ADCBISDONE 1
  174. #define MC13783_IRQ_TS 2
  175. #define MC13783_IRQ_WHIGH 3
  176. #define MC13783_IRQ_WLOW 4
  177. #define MC13783_IRQ_CHGDET 6
  178. #define MC13783_IRQ_CHGOV 7
  179. #define MC13783_IRQ_CHGREV 8
  180. #define MC13783_IRQ_CHGSHORT 9
  181. #define MC13783_IRQ_CCCV 10
  182. #define MC13783_IRQ_CHGCURR 11
  183. #define MC13783_IRQ_BPON 12
  184. #define MC13783_IRQ_LOBATL 13
  185. #define MC13783_IRQ_LOBATH 14
  186. #define MC13783_IRQ_UDP 15
  187. #define MC13783_IRQ_USB 16
  188. #define MC13783_IRQ_ID 19
  189. #define MC13783_IRQ_SE1 21
  190. #define MC13783_IRQ_CKDET 22
  191. #define MC13783_IRQ_UDM 23
  192. #define MC13783_IRQ_1HZ 24
  193. #define MC13783_IRQ_TODA 25
  194. #define MC13783_IRQ_ONOFD1 27
  195. #define MC13783_IRQ_ONOFD2 28
  196. #define MC13783_IRQ_ONOFD3 29
  197. #define MC13783_IRQ_SYSRST 30
  198. #define MC13783_IRQ_RTCRST 31
  199. #define MC13783_IRQ_PC 32
  200. #define MC13783_IRQ_WARM 33
  201. #define MC13783_IRQ_MEMHLD 34
  202. #define MC13783_IRQ_PWRRDY 35
  203. #define MC13783_IRQ_THWARNL 36
  204. #define MC13783_IRQ_THWARNH 37
  205. #define MC13783_IRQ_CLK 38
  206. #define MC13783_IRQ_SEMAF 39
  207. #define MC13783_IRQ_MC2B 41
  208. #define MC13783_IRQ_HSDET 42
  209. #define MC13783_IRQ_HSL 43
  210. #define MC13783_IRQ_ALSPTH 44
  211. #define MC13783_IRQ_AHSSHORT 45
  212. #define MC13783_NUM_IRQ 46
  213. #endif /* __LINUX_MFD_MC13783_H */