mc13783.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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_ackirq(struct mc13783 *mc13783, int irq);
  25. int mc13783_mask(struct mc13783 *mc13783, int irq);
  26. int mc13783_unmask(struct mc13783 *mc13783, int irq);
  27. #define MC13783_ADC0 43
  28. #define MC13783_ADC0_ADREFEN (1 << 10)
  29. #define MC13783_ADC0_ADREFMODE (1 << 11)
  30. #define MC13783_ADC0_TSMOD0 (1 << 12)
  31. #define MC13783_ADC0_TSMOD1 (1 << 13)
  32. #define MC13783_ADC0_TSMOD2 (1 << 14)
  33. #define MC13783_ADC0_ADINC1 (1 << 16)
  34. #define MC13783_ADC0_ADINC2 (1 << 17)
  35. #define MC13783_ADC0_TSMOD_MASK (MC13783_ADC0_TSMOD0 | \
  36. MC13783_ADC0_TSMOD1 | \
  37. MC13783_ADC0_TSMOD2)
  38. /* to be cleaned up */
  39. struct regulator_init_data;
  40. struct mc13783_regulator_init_data {
  41. int id;
  42. struct regulator_init_data *init_data;
  43. };
  44. struct mc13783_regulator_platform_data {
  45. int num_regulators;
  46. struct mc13783_regulator_init_data *regulators;
  47. };
  48. struct mc13783_platform_data {
  49. int num_regulators;
  50. struct mc13783_regulator_init_data *regulators;
  51. #define MC13783_USE_TOUCHSCREEN (1 << 0)
  52. #define MC13783_USE_CODEC (1 << 1)
  53. #define MC13783_USE_ADC (1 << 2)
  54. #define MC13783_USE_RTC (1 << 3)
  55. #define MC13783_USE_REGULATOR (1 << 4)
  56. unsigned int flags;
  57. };
  58. #define MC13783_ADC_MODE_TS 1
  59. #define MC13783_ADC_MODE_SINGLE_CHAN 2
  60. #define MC13783_ADC_MODE_MULT_CHAN 3
  61. int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode,
  62. unsigned int channel, unsigned int *sample);
  63. #define MC13783_SW_SW1A 0
  64. #define MC13783_SW_SW1B 1
  65. #define MC13783_SW_SW2A 2
  66. #define MC13783_SW_SW2B 3
  67. #define MC13783_SW_SW3 4
  68. #define MC13783_SW_PLL 5
  69. #define MC13783_REGU_VAUDIO 6
  70. #define MC13783_REGU_VIOHI 7
  71. #define MC13783_REGU_VIOLO 8
  72. #define MC13783_REGU_VDIG 9
  73. #define MC13783_REGU_VGEN 10
  74. #define MC13783_REGU_VRFDIG 11
  75. #define MC13783_REGU_VRFREF 12
  76. #define MC13783_REGU_VRFCP 13
  77. #define MC13783_REGU_VSIM 14
  78. #define MC13783_REGU_VESIM 15
  79. #define MC13783_REGU_VCAM 16
  80. #define MC13783_REGU_VRFBG 17
  81. #define MC13783_REGU_VVIB 18
  82. #define MC13783_REGU_VRF1 19
  83. #define MC13783_REGU_VRF2 20
  84. #define MC13783_REGU_VMMC1 21
  85. #define MC13783_REGU_VMMC2 22
  86. #define MC13783_REGU_GPO1 23
  87. #define MC13783_REGU_GPO2 24
  88. #define MC13783_REGU_GPO3 25
  89. #define MC13783_REGU_GPO4 26
  90. #define MC13783_REGU_V1 27
  91. #define MC13783_REGU_V2 28
  92. #define MC13783_REGU_V3 29
  93. #define MC13783_REGU_V4 30
  94. #define MC13783_IRQ_ADCDONE 0
  95. #define MC13783_IRQ_ADCBISDONE 1
  96. #define MC13783_IRQ_TS 2
  97. #define MC13783_IRQ_WHIGH 3
  98. #define MC13783_IRQ_WLOW 4
  99. #define MC13783_IRQ_CHGDET 6
  100. #define MC13783_IRQ_CHGOV 7
  101. #define MC13783_IRQ_CHGREV 8
  102. #define MC13783_IRQ_CHGSHORT 9
  103. #define MC13783_IRQ_CCCV 10
  104. #define MC13783_IRQ_CHGCURR 11
  105. #define MC13783_IRQ_BPON 12
  106. #define MC13783_IRQ_LOBATL 13
  107. #define MC13783_IRQ_LOBATH 14
  108. #define MC13783_IRQ_UDP 15
  109. #define MC13783_IRQ_USB 16
  110. #define MC13783_IRQ_ID 19
  111. #define MC13783_IRQ_SE1 21
  112. #define MC13783_IRQ_CKDET 22
  113. #define MC13783_IRQ_UDM 23
  114. #define MC13783_IRQ_1HZ 24
  115. #define MC13783_IRQ_TODA 25
  116. #define MC13783_IRQ_ONOFD1 27
  117. #define MC13783_IRQ_ONOFD2 28
  118. #define MC13783_IRQ_ONOFD3 29
  119. #define MC13783_IRQ_SYSRST 30
  120. #define MC13783_IRQ_RTCRST 31
  121. #define MC13783_IRQ_PC 32
  122. #define MC13783_IRQ_WARM 33
  123. #define MC13783_IRQ_MEMHLD 34
  124. #define MC13783_IRQ_PWRRDY 35
  125. #define MC13783_IRQ_THWARNL 36
  126. #define MC13783_IRQ_THWARNH 37
  127. #define MC13783_IRQ_CLK 38
  128. #define MC13783_IRQ_SEMAF 39
  129. #define MC13783_IRQ_MC2B 41
  130. #define MC13783_IRQ_HSDET 42
  131. #define MC13783_IRQ_HSL 43
  132. #define MC13783_IRQ_ALSPTH 44
  133. #define MC13783_IRQ_AHSSHORT 45
  134. #define MC13783_NUM_IRQ 46
  135. #endif /* __LINUX_MFD_MC13783_H */