Abhijeet Dharmapurikar | cbdb53e | 2011-04-05 14:40:52 -0700 | [diff] [blame] | 1 | /* |
Willie Ruan | 5106035 | 2012-01-19 16:58:49 -0800 | [diff] [blame] | 2 | * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved. |
Abhijeet Dharmapurikar | cbdb53e | 2011-04-05 14:40:52 -0700 | [diff] [blame] | 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 | |
| 18 | #ifndef __MFD_PM8921_H |
| 19 | #define __MFD_PM8921_H |
| 20 | |
| 21 | #include <linux/device.h> |
Abhijeet Dharmapurikar | c013f0a | 2011-04-05 14:40:53 -0700 | [diff] [blame] | 22 | #include <linux/mfd/pm8xxx/irq.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 23 | #include <linux/mfd/pm8xxx/gpio.h> |
| 24 | #include <linux/mfd/pm8xxx/mpp.h> |
| 25 | #include <linux/mfd/pm8xxx/rtc.h> |
| 26 | #include <linux/mfd/pm8xxx/pwm.h> |
| 27 | #include <linux/mfd/pm8xxx/misc.h> |
| 28 | #include <linux/mfd/pm8xxx/tm.h> |
| 29 | #include <linux/mfd/pm8xxx/batt-alarm.h> |
| 30 | #include <linux/input/pmic8xxx-pwrkey.h> |
| 31 | #include <linux/input/pmic8xxx-keypad.h> |
David Collins | 7501674 | 2011-12-02 15:04:25 -0800 | [diff] [blame] | 32 | #include <linux/regulator/pm8xxx-regulator.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 33 | #include <linux/mfd/pm8xxx/pm8921-charger.h> |
Siddartha Mohanadoss | af91d90 | 2011-10-20 10:23:34 -0700 | [diff] [blame] | 34 | #include <linux/mfd/pm8xxx/pm8xxx-adc.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 35 | #include <linux/mfd/pm8xxx/pm8921-bms.h> |
Jay Chokshi | 8994e39 | 2011-09-14 18:20:39 -0700 | [diff] [blame] | 36 | #include <linux/leds-pm8xxx.h> |
Anirudh Ghayal | 6804c74 | 2011-07-27 11:47:53 +0530 | [diff] [blame] | 37 | #include <linux/mfd/pm8xxx/vibrator.h> |
Abhijeet Dharmapurikar | 82d9398 | 2011-11-09 15:52:25 -0800 | [diff] [blame] | 38 | #include <linux/mfd/pm8xxx/ccadc.h> |
Abhijeet Dharmapurikar | c013f0a | 2011-04-05 14:40:53 -0700 | [diff] [blame] | 39 | |
| 40 | #define PM8921_NR_IRQS 256 |
Abhijeet Dharmapurikar | cbdb53e | 2011-04-05 14:40:52 -0700 | [diff] [blame] | 41 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 42 | #define PM8921_NR_GPIOS 44 |
Willie Ruan | 5106035 | 2012-01-19 16:58:49 -0800 | [diff] [blame] | 43 | #define PM8917_NR_GPIOS 38 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 44 | |
| 45 | #define PM8921_NR_MPPS 12 |
Willie Ruan | 5106035 | 2012-01-19 16:58:49 -0800 | [diff] [blame] | 46 | #define PM8917_NR_MPPS 10 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 47 | |
| 48 | #define PM8921_GPIO_BLOCK_START 24 |
| 49 | #define PM8921_MPP_BLOCK_START 16 |
| 50 | #define PM8921_IRQ_BLOCK_BIT(block, bit) ((block) * 8 + (bit)) |
| 51 | |
| 52 | /* GPIOs and MPPs [1,N] */ |
| 53 | #define PM8921_GPIO_IRQ(base, gpio) ((base) + \ |
| 54 | PM8921_IRQ_BLOCK_BIT(PM8921_GPIO_BLOCK_START, (gpio)-1)) |
| 55 | #define PM8921_MPP_IRQ(base, mpp) ((base) + \ |
| 56 | PM8921_IRQ_BLOCK_BIT(PM8921_MPP_BLOCK_START, (mpp)-1)) |
| 57 | |
| 58 | /* PMIC Interrupts */ |
| 59 | #define PM8921_RTC_ALARM_IRQ PM8921_IRQ_BLOCK_BIT(4, 7) |
| 60 | #define PM8921_BATT_ALARM_IRQ PM8921_IRQ_BLOCK_BIT(5, 6) |
| 61 | #define PM8921_PWRKEY_REL_IRQ PM8921_IRQ_BLOCK_BIT(6, 2) |
| 62 | #define PM8921_PWRKEY_PRESS_IRQ PM8921_IRQ_BLOCK_BIT(6, 3) |
| 63 | #define PM8921_KEYPAD_IRQ PM8921_IRQ_BLOCK_BIT(9, 2) |
| 64 | #define PM8921_KEYSTUCK_IRQ PM8921_IRQ_BLOCK_BIT(9, 3) |
| 65 | #define PM8921_ADC_EOC_USR_IRQ PM8921_IRQ_BLOCK_BIT(9, 6) |
| 66 | #define PM8921_ADC_BATT_TEMP_WARM_IRQ PM8921_IRQ_BLOCK_BIT(9, 1) |
| 67 | #define PM8921_ADC_BATT_TEMP_COLD_IRQ PM8921_IRQ_BLOCK_BIT(9, 0) |
| 68 | #define PM8921_USB_ID_IN_IRQ(base) (base + PM8921_IRQ_BLOCK_BIT(6, 1)) |
| 69 | |
| 70 | #define PM8921_USBIN_VALID_IRQ PM8921_IRQ_BLOCK_BIT(1, 7) |
| 71 | #define PM8921_USBIN_OV_IRQ PM8921_IRQ_BLOCK_BIT(1, 6) |
| 72 | #define PM8921_BATT_INSERTED_IRQ PM8921_IRQ_BLOCK_BIT(1, 5) |
| 73 | #define PM8921_VBATDET_LOW_IRQ PM8921_IRQ_BLOCK_BIT(1, 4) |
| 74 | #define PM8921_USBIN_UV_IRQ PM8921_IRQ_BLOCK_BIT(1, 3) |
| 75 | #define PM8921_VBAT_OV_IRQ PM8921_IRQ_BLOCK_BIT(1, 2) |
| 76 | #define PM8921_CHGWDOG_IRQ PM8921_IRQ_BLOCK_BIT(1, 1) |
| 77 | #define PM8921_VCP_IRQ PM8921_IRQ_BLOCK_BIT(1, 0) |
| 78 | #define PM8921_ATCDONE_IRQ PM8921_IRQ_BLOCK_BIT(2, 7) |
| 79 | #define PM8921_ATCFAIL_IRQ PM8921_IRQ_BLOCK_BIT(2, 6) |
| 80 | #define PM8921_CHGDONE_IRQ PM8921_IRQ_BLOCK_BIT(2, 5) |
| 81 | #define PM8921_CHGFAIL_IRQ PM8921_IRQ_BLOCK_BIT(2, 4) |
| 82 | #define PM8921_CHGSTATE_IRQ PM8921_IRQ_BLOCK_BIT(2, 3) |
| 83 | #define PM8921_LOOP_CHANGE_IRQ PM8921_IRQ_BLOCK_BIT(2, 2) |
| 84 | #define PM8921_FASTCHG_IRQ PM8921_IRQ_BLOCK_BIT(2, 1) |
| 85 | #define PM8921_TRKLCHG_IRQ PM8921_IRQ_BLOCK_BIT(2, 0) |
| 86 | #define PM8921_BATT_REMOVED_IRQ PM8921_IRQ_BLOCK_BIT(3, 7) |
| 87 | #define PM8921_BATTTEMP_HOT_IRQ PM8921_IRQ_BLOCK_BIT(3, 6) |
| 88 | #define PM8921_CHGHOT_IRQ PM8921_IRQ_BLOCK_BIT(3, 5) |
| 89 | #define PM8921_BATTTEMP_COLD_IRQ PM8921_IRQ_BLOCK_BIT(3, 4) |
| 90 | #define PM8921_CHG_GONE_IRQ PM8921_IRQ_BLOCK_BIT(3, 3) |
| 91 | #define PM8921_BAT_TEMP_OK_IRQ PM8921_IRQ_BLOCK_BIT(3, 2) |
| 92 | #define PM8921_COARSE_DET_LOW_IRQ PM8921_IRQ_BLOCK_BIT(3, 1) |
| 93 | #define PM8921_VDD_LOOP_IRQ PM8921_IRQ_BLOCK_BIT(3, 0) |
| 94 | #define PM8921_VREG_OV_IRQ PM8921_IRQ_BLOCK_BIT(5, 7) |
| 95 | #define PM8921_VBATDET_IRQ PM8921_IRQ_BLOCK_BIT(5, 5) |
| 96 | #define PM8921_BATFET_IRQ PM8921_IRQ_BLOCK_BIT(5, 4) |
| 97 | #define PM8921_PSI_IRQ PM8921_IRQ_BLOCK_BIT(5, 3) |
| 98 | #define PM8921_DCIN_VALID_IRQ PM8921_IRQ_BLOCK_BIT(5, 2) |
| 99 | #define PM8921_DCIN_OV_IRQ PM8921_IRQ_BLOCK_BIT(5, 1) |
| 100 | #define PM8921_DCIN_UV_IRQ PM8921_IRQ_BLOCK_BIT(5, 0) |
| 101 | |
| 102 | #define PM8921_BMS_SBI_WRITE_OK PM8921_IRQ_BLOCK_BIT(15, 7) |
| 103 | #define PM8921_BMS_CC_THR PM8921_IRQ_BLOCK_BIT(15, 6) |
| 104 | #define PM8921_BMS_VSENSE_THR PM8921_IRQ_BLOCK_BIT(15, 5) |
| 105 | #define PM8921_BMS_VSENSE_FOR_R PM8921_IRQ_BLOCK_BIT(15, 4) |
| 106 | #define PM8921_BMS_OCV_FOR_R PM8921_IRQ_BLOCK_BIT(15, 3) |
| 107 | #define PM8921_BMS_GOOD_OCV PM8921_IRQ_BLOCK_BIT(15, 2) |
| 108 | #define PM8921_BMS_VSENSE_AVG PM8921_IRQ_BLOCK_BIT(15, 1) |
| 109 | #define PM8921_BMS_CCADC_EOC PM8921_IRQ_BLOCK_BIT(15, 0) |
| 110 | |
| 111 | #define PM8921_OVERTEMP_IRQ PM8921_IRQ_BLOCK_BIT(4, 2) |
| 112 | #define PM8921_TEMPSTAT_IRQ PM8921_IRQ_BLOCK_BIT(6, 7) |
Abhijeet Dharmapurikar | 6d565fd | 2011-09-15 18:49:56 -0700 | [diff] [blame] | 113 | #define PM8921_RESOUT_IRQ PM8921_IRQ_BLOCK_BIT(6, 4) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 114 | |
David Collins | 1b570d2 | 2012-01-30 15:40:55 -0800 | [diff] [blame^] | 115 | #define PM8921_USB_OTG_OCP_IRQ PM8921_IRQ_BLOCK_BIT(6, 0) |
| 116 | #define PM8921_LVS7_OCP_IRQ PM8921_IRQ_BLOCK_BIT(13, 7) |
| 117 | #define PM8921_LVS6_OCP_IRQ PM8921_IRQ_BLOCK_BIT(13, 6) |
| 118 | #define PM8921_LVS5_OCP_IRQ PM8921_IRQ_BLOCK_BIT(13, 5) |
| 119 | #define PM8921_LVS4_OCP_IRQ PM8921_IRQ_BLOCK_BIT(13, 4) |
| 120 | #define PM8921_LVS3_OCP_IRQ PM8921_IRQ_BLOCK_BIT(13, 3) |
| 121 | #define PM8921_LVS2_OCP_IRQ PM8921_IRQ_BLOCK_BIT(13, 2) |
| 122 | #define PM8921_LVS1_OCP_IRQ PM8921_IRQ_BLOCK_BIT(13, 1) |
| 123 | #define PM8921_HDMI_MVS_OCP_IRQ PM8921_IRQ_BLOCK_BIT(13, 0) |
| 124 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 125 | /* PMIC I/O Resources */ |
| 126 | #define PM8921_RTC_BASE 0x11D |
| 127 | |
Abhijeet Dharmapurikar | cbdb53e | 2011-04-05 14:40:52 -0700 | [diff] [blame] | 128 | struct pm8921_platform_data { |
| 129 | int irq_base; |
Abhijeet Dharmapurikar | c013f0a | 2011-04-05 14:40:53 -0700 | [diff] [blame] | 130 | struct pm8xxx_irq_platform_data *irq_pdata; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 131 | struct pm8xxx_gpio_platform_data *gpio_pdata; |
| 132 | struct pm8xxx_mpp_platform_data *mpp_pdata; |
| 133 | struct pm8xxx_rtc_platform_data *rtc_pdata; |
| 134 | struct pm8xxx_pwrkey_platform_data *pwrkey_pdata; |
| 135 | struct pm8xxx_keypad_platform_data *keypad_pdata; |
| 136 | struct pm8921_charger_platform_data *charger_pdata; |
| 137 | struct pm8921_bms_platform_data *bms_pdata; |
| 138 | struct pm8xxx_misc_platform_data *misc_pdata; |
David Collins | 7501674 | 2011-12-02 15:04:25 -0800 | [diff] [blame] | 139 | struct pm8xxx_regulator_platform_data *regulator_pdatas; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 140 | int num_regulators; |
Siddartha Mohanadoss | af91d90 | 2011-10-20 10:23:34 -0700 | [diff] [blame] | 141 | struct pm8xxx_adc_platform_data *adc_pdata; |
Jay Chokshi | 8994e39 | 2011-09-14 18:20:39 -0700 | [diff] [blame] | 142 | struct pm8xxx_led_platform_data *leds_pdata; |
Anirudh Ghayal | 6804c74 | 2011-07-27 11:47:53 +0530 | [diff] [blame] | 143 | struct pm8xxx_vibrator_platform_data *vibrator_pdata; |
Abhijeet Dharmapurikar | 82d9398 | 2011-11-09 15:52:25 -0800 | [diff] [blame] | 144 | struct pm8xxx_ccadc_platform_data *ccadc_pdata; |
Abhijeet Dharmapurikar | cbdb53e | 2011-04-05 14:40:52 -0700 | [diff] [blame] | 145 | }; |
| 146 | |
| 147 | #endif |