pm8921.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 and
  6. * only version 2 as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. /*
  14. * Qualcomm PMIC 8921 driver header file
  15. *
  16. */
  17. #ifndef __MFD_PM8921_H
  18. #define __MFD_PM8921_H
  19. #include <linux/mfd/pm8xxx/irq.h>
  20. #include <linux/mfd/pm8xxx/gpio.h>
  21. #include <linux/mfd/pm8xxx/mpp.h>
  22. #include <linux/mfd/pm8xxx/rtc.h>
  23. #include <linux/mfd/pm8xxx/pwm.h>
  24. #include <linux/mfd/pm8xxx/misc.h>
  25. #include <linux/mfd/pm8xxx/tm.h>
  26. #include <linux/mfd/pm8xxx/batt-alarm.h>
  27. #include <linux/input/pmic8xxx-pwrkey.h>
  28. #include <linux/input/pmic8xxx-keypad.h>
  29. #include <linux/regulator/pm8xxx-regulator.h>
  30. #include <linux/mfd/pm8xxx/pm8921-charger.h>
  31. #include <linux/mfd/pm8xxx/pm8xxx-adc.h>
  32. #include <linux/mfd/pm8xxx/pm8921-bms.h>
  33. #include <linux/leds-pm8xxx.h>
  34. #include <linux/mfd/pm8xxx/vibrator.h>
  35. #include <linux/mfd/pm8xxx/ccadc.h>
  36. #define PM8921_NR_IRQS 256
  37. #define PM8921_NR_GPIOS 44
  38. #define PM8917_NR_GPIOS 38
  39. #define PM8921_NR_MPPS 12
  40. #define PM8917_NR_MPPS 10
  41. #define PM8921_GPIO_BLOCK_START 24
  42. #define PM8921_MPP_BLOCK_START 16
  43. #define PM8921_IRQ_BLOCK_BIT(block, bit) ((block) * 8 + (bit))
  44. /* GPIOs and MPPs [1,N] */
  45. #define PM8921_GPIO_IRQ(base, gpio) ((base) + \
  46. PM8921_IRQ_BLOCK_BIT(PM8921_GPIO_BLOCK_START, (gpio)-1))
  47. #define PM8921_MPP_IRQ(base, mpp) ((base) + \
  48. PM8921_IRQ_BLOCK_BIT(PM8921_MPP_BLOCK_START, (mpp)-1))
  49. /* PMIC Interrupts */
  50. #define PM8921_RTC_ALARM_IRQ PM8921_IRQ_BLOCK_BIT(4, 7)
  51. #define PM8921_BATT_ALARM_IRQ PM8921_IRQ_BLOCK_BIT(5, 6)
  52. #define PM8921_PWRKEY_REL_IRQ PM8921_IRQ_BLOCK_BIT(6, 2)
  53. #define PM8921_PWRKEY_PRESS_IRQ PM8921_IRQ_BLOCK_BIT(6, 3)
  54. #define PM8921_KEYPAD_IRQ PM8921_IRQ_BLOCK_BIT(9, 2)
  55. #define PM8921_KEYSTUCK_IRQ PM8921_IRQ_BLOCK_BIT(9, 3)
  56. #define PM8921_ADC_EOC_USR_IRQ PM8921_IRQ_BLOCK_BIT(9, 6)
  57. #define PM8921_ADC_BATT_TEMP_WARM_IRQ PM8921_IRQ_BLOCK_BIT(9, 1)
  58. #define PM8921_ADC_BATT_TEMP_COLD_IRQ PM8921_IRQ_BLOCK_BIT(9, 0)
  59. #define PM8921_USB_ID_IN_IRQ(base) (base + PM8921_IRQ_BLOCK_BIT(6, 1))
  60. #define PM8921_USBIN_VALID_IRQ PM8921_IRQ_BLOCK_BIT(1, 7)
  61. #define PM8921_USBIN_OV_IRQ PM8921_IRQ_BLOCK_BIT(1, 6)
  62. #define PM8921_BATT_INSERTED_IRQ PM8921_IRQ_BLOCK_BIT(1, 5)
  63. #define PM8921_VBATDET_LOW_IRQ PM8921_IRQ_BLOCK_BIT(1, 4)
  64. #define PM8921_USBIN_UV_IRQ PM8921_IRQ_BLOCK_BIT(1, 3)
  65. #define PM8921_VBAT_OV_IRQ PM8921_IRQ_BLOCK_BIT(1, 2)
  66. #define PM8921_CHGWDOG_IRQ PM8921_IRQ_BLOCK_BIT(1, 1)
  67. #define PM8921_VCP_IRQ PM8921_IRQ_BLOCK_BIT(1, 0)
  68. #define PM8921_ATCDONE_IRQ PM8921_IRQ_BLOCK_BIT(2, 7)
  69. #define PM8921_ATCFAIL_IRQ PM8921_IRQ_BLOCK_BIT(2, 6)
  70. #define PM8921_CHGDONE_IRQ PM8921_IRQ_BLOCK_BIT(2, 5)
  71. #define PM8921_CHGFAIL_IRQ PM8921_IRQ_BLOCK_BIT(2, 4)
  72. #define PM8921_CHGSTATE_IRQ PM8921_IRQ_BLOCK_BIT(2, 3)
  73. #define PM8921_LOOP_CHANGE_IRQ PM8921_IRQ_BLOCK_BIT(2, 2)
  74. #define PM8921_FASTCHG_IRQ PM8921_IRQ_BLOCK_BIT(2, 1)
  75. #define PM8921_TRKLCHG_IRQ PM8921_IRQ_BLOCK_BIT(2, 0)
  76. #define PM8921_BATT_REMOVED_IRQ PM8921_IRQ_BLOCK_BIT(3, 7)
  77. #define PM8921_BATTTEMP_HOT_IRQ PM8921_IRQ_BLOCK_BIT(3, 6)
  78. #define PM8921_CHGHOT_IRQ PM8921_IRQ_BLOCK_BIT(3, 5)
  79. #define PM8921_BATTTEMP_COLD_IRQ PM8921_IRQ_BLOCK_BIT(3, 4)
  80. #define PM8921_CHG_GONE_IRQ PM8921_IRQ_BLOCK_BIT(3, 3)
  81. #define PM8921_BAT_TEMP_OK_IRQ PM8921_IRQ_BLOCK_BIT(3, 2)
  82. #define PM8921_COARSE_DET_LOW_IRQ PM8921_IRQ_BLOCK_BIT(3, 1)
  83. #define PM8921_VDD_LOOP_IRQ PM8921_IRQ_BLOCK_BIT(3, 0)
  84. #define PM8921_VREG_OV_IRQ PM8921_IRQ_BLOCK_BIT(5, 7)
  85. #define PM8921_VBATDET_IRQ PM8921_IRQ_BLOCK_BIT(5, 5)
  86. #define PM8921_BATFET_IRQ PM8921_IRQ_BLOCK_BIT(5, 4)
  87. #define PM8921_PSI_IRQ PM8921_IRQ_BLOCK_BIT(5, 3)
  88. #define PM8921_DCIN_VALID_IRQ PM8921_IRQ_BLOCK_BIT(5, 2)
  89. #define PM8921_DCIN_OV_IRQ PM8921_IRQ_BLOCK_BIT(5, 1)
  90. #define PM8921_DCIN_UV_IRQ PM8921_IRQ_BLOCK_BIT(5, 0)
  91. #define PM8921_BMS_SBI_WRITE_OK PM8921_IRQ_BLOCK_BIT(15, 7)
  92. #define PM8921_BMS_CC_THR PM8921_IRQ_BLOCK_BIT(15, 6)
  93. #define PM8921_BMS_VSENSE_THR PM8921_IRQ_BLOCK_BIT(15, 5)
  94. #define PM8921_BMS_VSENSE_FOR_R PM8921_IRQ_BLOCK_BIT(15, 4)
  95. #define PM8921_BMS_OCV_FOR_R PM8921_IRQ_BLOCK_BIT(15, 3)
  96. #define PM8921_BMS_GOOD_OCV PM8921_IRQ_BLOCK_BIT(15, 2)
  97. #define PM8921_BMS_VSENSE_AVG PM8921_IRQ_BLOCK_BIT(15, 1)
  98. #define PM8921_BMS_CCADC_EOC PM8921_IRQ_BLOCK_BIT(15, 0)
  99. #define PM8921_OVERTEMP_IRQ PM8921_IRQ_BLOCK_BIT(4, 2)
  100. #define PM8921_TEMPSTAT_IRQ PM8921_IRQ_BLOCK_BIT(6, 7)
  101. #define PM8921_RESOUT_IRQ PM8921_IRQ_BLOCK_BIT(6, 4)
  102. #define PM8921_USB_OTG_OCP_IRQ PM8921_IRQ_BLOCK_BIT(6, 0)
  103. #define PM8921_LVS7_OCP_IRQ PM8921_IRQ_BLOCK_BIT(13, 7)
  104. #define PM8921_LVS6_OCP_IRQ PM8921_IRQ_BLOCK_BIT(13, 6)
  105. #define PM8921_LVS5_OCP_IRQ PM8921_IRQ_BLOCK_BIT(13, 5)
  106. #define PM8921_LVS4_OCP_IRQ PM8921_IRQ_BLOCK_BIT(13, 4)
  107. #define PM8921_LVS3_OCP_IRQ PM8921_IRQ_BLOCK_BIT(13, 3)
  108. #define PM8921_LVS2_OCP_IRQ PM8921_IRQ_BLOCK_BIT(13, 2)
  109. #define PM8921_LVS1_OCP_IRQ PM8921_IRQ_BLOCK_BIT(13, 1)
  110. #define PM8921_HDMI_MVS_OCP_IRQ PM8921_IRQ_BLOCK_BIT(13, 0)
  111. /* PMIC I/O Resources */
  112. #define PM8921_RTC_BASE 0x11D
  113. struct pm8921_platform_data {
  114. int irq_base;
  115. struct pm8xxx_irq_platform_data *irq_pdata;
  116. struct pm8xxx_gpio_platform_data *gpio_pdata;
  117. struct pm8xxx_mpp_platform_data *mpp_pdata;
  118. struct pm8xxx_rtc_platform_data *rtc_pdata;
  119. struct pm8xxx_pwrkey_platform_data *pwrkey_pdata;
  120. struct pm8xxx_keypad_platform_data *keypad_pdata;
  121. struct pm8921_charger_platform_data *charger_pdata;
  122. struct pm8921_bms_platform_data *bms_pdata;
  123. struct pm8xxx_misc_platform_data *misc_pdata;
  124. struct pm8xxx_regulator_platform_data *regulator_pdatas;
  125. int num_regulators;
  126. struct pm8xxx_adc_platform_data *adc_pdata;
  127. struct pm8xxx_led_platform_data *leds_pdata;
  128. struct pm8xxx_vibrator_platform_data *vibrator_pdata;
  129. struct pm8xxx_ccadc_platform_data *ccadc_pdata;
  130. struct pm8xxx_pwm_platform_data *pwm_pdata;
  131. };
  132. #endif