ab5500.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * Copyright (C) ST-Ericsson 2011
  3. *
  4. * License Terms: GNU General Public License v2
  5. */
  6. #ifndef MFD_AB5500_H
  7. #define MFD_AB5500_H
  8. struct device;
  9. enum ab5500_devid {
  10. AB5500_DEVID_ADC,
  11. AB5500_DEVID_LEDS,
  12. AB5500_DEVID_POWER,
  13. AB5500_DEVID_REGULATORS,
  14. AB5500_DEVID_SIM,
  15. AB5500_DEVID_RTC,
  16. AB5500_DEVID_CHARGER,
  17. AB5500_DEVID_FUELGAUGE,
  18. AB5500_DEVID_VIBRATOR,
  19. AB5500_DEVID_CODEC,
  20. AB5500_DEVID_USB,
  21. AB5500_DEVID_OTP,
  22. AB5500_DEVID_VIDEO,
  23. AB5500_DEVID_DBIECI,
  24. AB5500_DEVID_ONSWA,
  25. AB5500_NUM_DEVICES,
  26. };
  27. enum ab5500_banks {
  28. AB5500_BANK_VIT_IO_I2C_CLK_TST_OTP = 0,
  29. AB5500_BANK_VDDDIG_IO_I2C_CLK_TST = 1,
  30. AB5500_BANK_VDENC = 2,
  31. AB5500_BANK_SIM_USBSIM = 3,
  32. AB5500_BANK_LED = 4,
  33. AB5500_BANK_ADC = 5,
  34. AB5500_BANK_RTC = 6,
  35. AB5500_BANK_STARTUP = 7,
  36. AB5500_BANK_DBI_ECI = 8,
  37. AB5500_BANK_CHG = 9,
  38. AB5500_BANK_FG_BATTCOM_ACC = 10,
  39. AB5500_BANK_USB = 11,
  40. AB5500_BANK_IT = 12,
  41. AB5500_BANK_VIBRA = 13,
  42. AB5500_BANK_AUDIO_HEADSETUSB = 14,
  43. AB5500_NUM_BANKS = 15,
  44. };
  45. enum ab5500_banks_addr {
  46. AB5500_ADDR_VIT_IO_I2C_CLK_TST_OTP = 0x4A,
  47. AB5500_ADDR_VDDDIG_IO_I2C_CLK_TST = 0x4B,
  48. AB5500_ADDR_VDENC = 0x06,
  49. AB5500_ADDR_SIM_USBSIM = 0x04,
  50. AB5500_ADDR_LED = 0x10,
  51. AB5500_ADDR_ADC = 0x0A,
  52. AB5500_ADDR_RTC = 0x0F,
  53. AB5500_ADDR_STARTUP = 0x03,
  54. AB5500_ADDR_DBI_ECI = 0x07,
  55. AB5500_ADDR_CHG = 0x0B,
  56. AB5500_ADDR_FG_BATTCOM_ACC = 0x0C,
  57. AB5500_ADDR_USB = 0x05,
  58. AB5500_ADDR_IT = 0x0E,
  59. AB5500_ADDR_VIBRA = 0x02,
  60. AB5500_ADDR_AUDIO_HEADSETUSB = 0x0D,
  61. };
  62. /*
  63. * Interrupt register offsets
  64. * Bank : 0x0E
  65. */
  66. #define AB5500_IT_SOURCE0_REG 0x20
  67. #define AB5500_IT_SOURCE1_REG 0x21
  68. #define AB5500_IT_SOURCE2_REG 0x22
  69. #define AB5500_IT_SOURCE3_REG 0x23
  70. #define AB5500_IT_SOURCE4_REG 0x24
  71. #define AB5500_IT_SOURCE5_REG 0x25
  72. #define AB5500_IT_SOURCE6_REG 0x26
  73. #define AB5500_IT_SOURCE7_REG 0x27
  74. #define AB5500_IT_SOURCE8_REG 0x28
  75. #define AB5500_IT_SOURCE9_REG 0x29
  76. #define AB5500_IT_SOURCE10_REG 0x2A
  77. #define AB5500_IT_SOURCE11_REG 0x2B
  78. #define AB5500_IT_SOURCE12_REG 0x2C
  79. #define AB5500_IT_SOURCE13_REG 0x2D
  80. #define AB5500_IT_SOURCE14_REG 0x2E
  81. #define AB5500_IT_SOURCE15_REG 0x2F
  82. #define AB5500_IT_SOURCE16_REG 0x30
  83. #define AB5500_IT_SOURCE17_REG 0x31
  84. #define AB5500_IT_SOURCE18_REG 0x32
  85. #define AB5500_IT_SOURCE19_REG 0x33
  86. #define AB5500_IT_SOURCE20_REG 0x34
  87. #define AB5500_IT_SOURCE21_REG 0x35
  88. #define AB5500_IT_SOURCE22_REG 0x36
  89. #define AB5500_IT_SOURCE23_REG 0x37
  90. #define AB5500_NUM_IRQ_REGS 23
  91. /**
  92. * struct ab5500
  93. * @access_mutex: lock out concurrent accesses to the AB registers
  94. * @dev: a pointer to the device struct for this chip driver
  95. * @ab5500_irq: the analog baseband irq
  96. * @irq_base: the platform configuration irq base for subdevices
  97. * @chip_name: name of this chip variant
  98. * @chip_id: 8 bit chip ID for this chip variant
  99. * @irq_lock: a lock to protect the mask
  100. * @abb_events: a local bit mask of the prcmu wakeup events
  101. * @event_mask: a local copy of the mask event registers
  102. * @last_event_mask: a copy of the last event_mask written to hardware
  103. * @startup_events: a copy of the first reading of the event registers
  104. * @startup_events_read: whether the first events have been read
  105. */
  106. struct ab5500 {
  107. struct mutex access_mutex;
  108. struct device *dev;
  109. unsigned int ab5500_irq;
  110. unsigned int irq_base;
  111. char chip_name[32];
  112. u8 chip_id;
  113. struct mutex irq_lock;
  114. u32 abb_events;
  115. u8 mask[AB5500_NUM_IRQ_REGS];
  116. u8 oldmask[AB5500_NUM_IRQ_REGS];
  117. u8 startup_events[AB5500_NUM_IRQ_REGS];
  118. bool startup_events_read;
  119. #ifdef CONFIG_DEBUG_FS
  120. unsigned int debug_bank;
  121. unsigned int debug_address;
  122. #endif
  123. };
  124. struct ab5500_platform_data {
  125. struct {unsigned int base; unsigned int count; } irq;
  126. void *dev_data[AB5500_NUM_DEVICES];
  127. struct abx500_init_settings *init_settings;
  128. unsigned int init_settings_sz;
  129. bool pm_power_off;
  130. };
  131. #endif /* MFD_AB5500_H */