Mayank Rana | 7e57416 | 2013-01-08 15:10:51 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | #include <linux/interrupt.h> |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 15 | #include <linux/mfd/pm8xxx/pm8038.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 16 | #include <linux/mfd/pm8xxx/pm8xxx-adc.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 17 | #include <linux/msm_ssbi.h> |
| 18 | #include <asm/mach-types.h> |
| 19 | #include <mach/msm_bus_board.h> |
| 20 | #include <mach/restart.h> |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 21 | #include <mach/socinfo.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 22 | #include "devices.h" |
Stepan Moskovchenko | 5a83dba | 2011-12-05 17:30:17 -0800 | [diff] [blame] | 23 | #include "board-8930.h" |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 24 | |
| 25 | struct pm8xxx_gpio_init { |
| 26 | unsigned gpio; |
| 27 | struct pm_gpio config; |
| 28 | }; |
| 29 | |
| 30 | struct pm8xxx_mpp_init { |
| 31 | unsigned mpp; |
| 32 | struct pm8xxx_mpp_config_data config; |
| 33 | }; |
| 34 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 35 | #define PM8038_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 36 | _func, _inv, _disable) \ |
| 37 | { \ |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 38 | .gpio = PM8038_GPIO_PM_TO_SYS(_gpio), \ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 39 | .config = { \ |
| 40 | .direction = _dir, \ |
| 41 | .output_buffer = _buf, \ |
| 42 | .output_value = _val, \ |
| 43 | .pull = _pull, \ |
| 44 | .vin_sel = _vin, \ |
| 45 | .out_strength = _out_strength, \ |
| 46 | .function = _func, \ |
| 47 | .inv_int_pol = _inv, \ |
| 48 | .disable_pin = _disable, \ |
| 49 | } \ |
| 50 | } |
| 51 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 52 | #define PM8038_MPP_INIT(_mpp, _type, _level, _control) \ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 53 | { \ |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 54 | .mpp = PM8038_MPP_PM_TO_SYS(_mpp), \ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 55 | .config = { \ |
| 56 | .type = PM8XXX_MPP_TYPE_##_type, \ |
| 57 | .level = _level, \ |
| 58 | .control = PM8XXX_MPP_##_control, \ |
| 59 | } \ |
| 60 | } |
| 61 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 62 | #define PM8038_GPIO_DISABLE(_gpio) \ |
| 63 | PM8038_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM8038_GPIO_VIN_L11, \ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 64 | 0, 0, 0, 1) |
| 65 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 66 | #define PM8038_GPIO_OUTPUT(_gpio, _val) \ |
| 67 | PM8038_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \ |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 68 | PM_GPIO_PULL_NO, PM8038_GPIO_VIN_L11, \ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 69 | PM_GPIO_STRENGTH_HIGH, \ |
| 70 | PM_GPIO_FUNC_NORMAL, 0, 0) |
| 71 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 72 | #define PM8038_GPIO_INPUT(_gpio, _pull) \ |
| 73 | PM8038_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \ |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 74 | _pull, PM8038_GPIO_VIN_L11, \ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 75 | PM_GPIO_STRENGTH_NO, \ |
| 76 | PM_GPIO_FUNC_NORMAL, 0, 0) |
| 77 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 78 | #define PM8038_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \ |
| 79 | PM8038_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \ |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 80 | PM_GPIO_PULL_NO, PM8038_GPIO_VIN_L11, \ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 81 | PM_GPIO_STRENGTH_HIGH, \ |
| 82 | _func, 0, 0) |
| 83 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 84 | #define PM8038_GPIO_OUTPUT_VIN(_gpio, _val, _vin) \ |
| 85 | PM8038_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 86 | PM_GPIO_PULL_NO, _vin, \ |
| 87 | PM_GPIO_STRENGTH_HIGH, \ |
| 88 | PM_GPIO_FUNC_NORMAL, 0, 0) |
| 89 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 90 | #define PM8917_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \ |
| 91 | _func, _inv, _disable) \ |
| 92 | { \ |
| 93 | .gpio = PM8917_GPIO_PM_TO_SYS(_gpio), \ |
| 94 | .config = { \ |
| 95 | .direction = _dir, \ |
| 96 | .output_buffer = _buf, \ |
| 97 | .output_value = _val, \ |
| 98 | .pull = _pull, \ |
| 99 | .vin_sel = _vin, \ |
| 100 | .out_strength = _out_strength, \ |
| 101 | .function = _func, \ |
| 102 | .inv_int_pol = _inv, \ |
| 103 | .disable_pin = _disable, \ |
| 104 | } \ |
| 105 | } |
| 106 | |
| 107 | #define PM8917_MPP_INIT(_mpp, _type, _level, _control) \ |
| 108 | { \ |
| 109 | .mpp = PM8917_MPP_PM_TO_SYS(_mpp), \ |
| 110 | .config = { \ |
| 111 | .type = PM8XXX_MPP_TYPE_##_type, \ |
| 112 | .level = _level, \ |
| 113 | .control = PM8XXX_MPP_##_control, \ |
| 114 | } \ |
| 115 | } |
| 116 | |
| 117 | #define PM8917_GPIO_DISABLE(_gpio) \ |
| 118 | PM8917_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \ |
| 119 | 0, 0, 0, 1) |
| 120 | |
| 121 | #define PM8917_GPIO_OUTPUT(_gpio, _val) \ |
| 122 | PM8917_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \ |
| 123 | PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \ |
| 124 | PM_GPIO_STRENGTH_HIGH, \ |
| 125 | PM_GPIO_FUNC_NORMAL, 0, 0) |
| 126 | |
| 127 | #define PM8917_GPIO_INPUT(_gpio, _pull) \ |
| 128 | PM8917_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \ |
| 129 | _pull, PM_GPIO_VIN_S4, \ |
| 130 | PM_GPIO_STRENGTH_NO, \ |
| 131 | PM_GPIO_FUNC_NORMAL, 0, 0) |
| 132 | |
| 133 | #define PM8917_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \ |
| 134 | PM8917_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \ |
| 135 | PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \ |
| 136 | PM_GPIO_STRENGTH_HIGH, \ |
| 137 | _func, 0, 0) |
| 138 | |
| 139 | #define PM8917_GPIO_OUTPUT_VIN(_gpio, _val, _vin) \ |
| 140 | PM8917_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \ |
| 141 | PM_GPIO_PULL_NO, _vin, \ |
| 142 | PM_GPIO_STRENGTH_HIGH, \ |
| 143 | PM_GPIO_FUNC_NORMAL, 0, 0) |
| 144 | |
| 145 | /* GPIO and MPP configurations for MSM8930 + PM8038 targets */ |
| 146 | |
| 147 | /* Initial PM8038 GPIO configurations */ |
Anirudh Ghayal | eb3af97 | 2011-12-13 17:29:06 +0530 | [diff] [blame] | 148 | static struct pm8xxx_gpio_init pm8038_gpios[] __initdata = { |
| 149 | /* keys GPIOs */ |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 150 | PM8038_GPIO_INPUT(3, PM_GPIO_PULL_UP_30), |
| 151 | PM8038_GPIO_INPUT(8, PM_GPIO_PULL_UP_30), |
| 152 | PM8038_GPIO_INPUT(10, PM_GPIO_PULL_UP_30), |
| 153 | PM8038_GPIO_INPUT(11, PM_GPIO_PULL_UP_30), |
Amy Maloche | e8de95d | 2012-02-23 10:40:25 -0800 | [diff] [blame] | 154 | /* haptics gpio */ |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 155 | PM8038_GPIO_OUTPUT_FUNC(7, 0, PM_GPIO_FUNC_1), |
Manoj Rao | c6d904c | 2012-06-22 00:32:14 -0700 | [diff] [blame] | 156 | /* MHL PWR EN */ |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 157 | PM8038_GPIO_OUTPUT_VIN(5, 1, PM8038_GPIO_VIN_VPH), |
Anirudh Ghayal | eb3af97 | 2011-12-13 17:29:06 +0530 | [diff] [blame] | 158 | }; |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 159 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 160 | /* Initial PM8038 MPP configurations */ |
| 161 | static struct pm8xxx_mpp_init pm8038_mpps[] __initdata = { |
| 162 | }; |
| 163 | |
| 164 | /* GPIO and MPP configurations for MSM8930 + PM8917 targets */ |
| 165 | |
| 166 | /* Initial PM8917 GPIO configurations */ |
| 167 | static struct pm8xxx_gpio_init pm8917_gpios[] __initdata = { |
David Collins | 9898ac3 | 2012-08-10 17:24:38 -0700 | [diff] [blame] | 168 | /* Backlight enable control */ |
| 169 | PM8917_GPIO_OUTPUT(24, 1), |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 170 | /* keys GPIOs */ |
| 171 | PM8917_GPIO_INPUT(27, PM_GPIO_PULL_UP_30), |
| 172 | PM8917_GPIO_INPUT(28, PM_GPIO_PULL_UP_30), |
| 173 | PM8917_GPIO_INPUT(36, PM_GPIO_PULL_UP_30), |
| 174 | PM8917_GPIO_INPUT(37, PM_GPIO_PULL_UP_30), |
| 175 | /* haptics gpio */ |
| 176 | PM8917_GPIO_OUTPUT_FUNC(38, 0, PM_GPIO_FUNC_2), |
| 177 | /* MHL PWR EN */ |
| 178 | PM8917_GPIO_OUTPUT_VIN(25, 1, PM_GPIO_VIN_VPH), |
| 179 | }; |
| 180 | |
| 181 | /* Initial PM8917 MPP configurations */ |
| 182 | static struct pm8xxx_mpp_init pm8917_mpps[] __initdata = { |
Siddartha Mohanadoss | 0cf0826 | 2012-09-12 22:41:05 -0700 | [diff] [blame] | 183 | PM8917_MPP_INIT(PM8XXX_AMUX_MPP_3, A_INPUT, |
| 184 | PM8XXX_MPP_AIN_AMUX_CH8, DIN_TO_INT), |
Mayank Rana | 7e57416 | 2013-01-08 15:10:51 +0530 | [diff] [blame] | 185 | /* Configure MPP01 for USB ID detection */ |
| 186 | PM8917_MPP_INIT(1, D_INPUT, PM8921_MPP_DIG_LEVEL_S4, DIN_TO_INT), |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 187 | }; |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 188 | |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 189 | void __init msm8930_pm8038_gpio_mpp_init(void) |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 190 | { |
| 191 | int i, rc; |
| 192 | |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 193 | for (i = 0; i < ARRAY_SIZE(pm8038_gpios); i++) { |
| 194 | rc = pm8xxx_gpio_config(pm8038_gpios[i].gpio, |
| 195 | &pm8038_gpios[i].config); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 196 | if (rc) { |
| 197 | pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc); |
| 198 | break; |
| 199 | } |
| 200 | } |
| 201 | |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 202 | /* Initial MPP configuration. */ |
| 203 | for (i = 0; i < ARRAY_SIZE(pm8038_mpps); i++) { |
| 204 | rc = pm8xxx_mpp_config(pm8038_mpps[i].mpp, |
| 205 | &pm8038_mpps[i].config); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 206 | if (rc) { |
| 207 | pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc); |
| 208 | break; |
| 209 | } |
| 210 | } |
| 211 | } |
| 212 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 213 | void __init msm8930_pm8917_gpio_mpp_init(void) |
| 214 | { |
| 215 | int i, rc; |
| 216 | |
| 217 | for (i = 0; i < ARRAY_SIZE(pm8917_gpios); i++) { |
| 218 | rc = pm8xxx_gpio_config(pm8917_gpios[i].gpio, |
| 219 | &pm8917_gpios[i].config); |
| 220 | if (rc) { |
| 221 | pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc); |
| 222 | break; |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | /* Initial MPP configuration. */ |
| 227 | for (i = 0; i < ARRAY_SIZE(pm8917_mpps); i++) { |
| 228 | rc = pm8xxx_mpp_config(pm8917_mpps[i].mpp, |
| 229 | &pm8917_mpps[i].config); |
| 230 | if (rc) { |
| 231 | pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc); |
| 232 | break; |
| 233 | } |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | static struct pm8xxx_adc_amux pm8038_adc_channels_data[] = { |
Siddartha Mohanadoss | 3da01a1 | 2011-12-21 19:31:24 -0800 | [diff] [blame] | 238 | {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 239 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 240 | {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 241 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 242 | {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1, |
| 243 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 244 | {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 245 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 246 | {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 247 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 248 | {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 249 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 250 | {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2, |
| 251 | ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM}, |
| 252 | {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV2, |
| 253 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 254 | {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1, |
| 255 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 256 | {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 257 | ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM}, |
| 258 | {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 259 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 260 | {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 261 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 262 | {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 263 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 264 | {"pa_therm1", ADC_MPP_1_AMUX4, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 265 | ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM}, |
| 266 | {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0, |
| 267 | ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM}, |
| 268 | {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 269 | ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM}, |
| 270 | }; |
| 271 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 272 | static struct pm8xxx_adc_properties pm8038_adc_data = { |
Siddartha Mohanadoss | 3da01a1 | 2011-12-21 19:31:24 -0800 | [diff] [blame] | 273 | .adc_vdd_reference = 1800, /* milli-voltage for this adc */ |
| 274 | .bitresolution = 15, |
| 275 | .bipolar = 0, |
| 276 | }; |
| 277 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 278 | static struct pm8xxx_adc_platform_data pm8038_adc_pdata = { |
| 279 | .adc_channel = pm8038_adc_channels_data, |
| 280 | .adc_num_board_channel = ARRAY_SIZE(pm8038_adc_channels_data), |
| 281 | .adc_prop = &pm8038_adc_data, |
Siddartha Mohanadoss | 3da01a1 | 2011-12-21 19:31:24 -0800 | [diff] [blame] | 282 | .adc_mpp_base = PM8038_MPP_PM_TO_SYS(1), |
| 283 | }; |
| 284 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 285 | static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = { |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 286 | .irq_base = PM8038_IRQ_BASE, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 287 | .devirq = MSM_GPIO_TO_INT(104), |
| 288 | .irq_trigger_flag = IRQF_TRIGGER_LOW, |
| 289 | }; |
| 290 | |
| 291 | static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = { |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 292 | .gpio_base = PM8038_GPIO_PM_TO_SYS(1), |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 293 | }; |
| 294 | |
| 295 | static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = { |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 296 | .mpp_base = PM8038_MPP_PM_TO_SYS(1), |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 297 | }; |
| 298 | |
| 299 | static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = { |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 300 | .rtc_write_enable = false, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 301 | .rtc_alarm_powerup = false, |
| 302 | }; |
| 303 | |
| 304 | static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = { |
| 305 | .pull_up = 1, |
Amy Maloche | 6218d68 | 2012-01-10 17:25:03 -0800 | [diff] [blame] | 306 | .kpd_trigger_delay_us = 15625, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 307 | .wakeup = 1, |
| 308 | }; |
| 309 | |
David Keitel | c72d819 | 2012-01-09 11:33:55 -0800 | [diff] [blame] | 310 | static int pm8921_therm_mitigation[] = { |
| 311 | 1100, |
| 312 | 700, |
| 313 | 600, |
| 314 | 325, |
| 315 | }; |
| 316 | |
| 317 | #define MAX_VOLTAGE_MV 4200 |
Abhijeet Dharmapurikar | d6d66c7 | 2012-08-06 14:02:51 -0700 | [diff] [blame] | 318 | #define CHG_TERM_MA 100 |
David Keitel | c72d819 | 2012-01-09 11:33:55 -0800 | [diff] [blame] | 319 | static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = { |
David Keitel | c72d819 | 2012-01-09 11:33:55 -0800 | [diff] [blame] | 320 | .update_time = 60000, |
| 321 | .max_voltage = MAX_VOLTAGE_MV, |
| 322 | .min_voltage = 3200, |
David Keitel | 0789fc6 | 2012-06-07 17:43:27 -0700 | [diff] [blame] | 323 | .uvd_thresh_voltage = 4050, |
David Keitel | 8b079fb | 2012-06-28 19:14:30 -0700 | [diff] [blame] | 324 | .alarm_low_mv = 3400, |
| 325 | .alarm_high_mv = 4000, |
Xiaozhe Shi | 14e8fa1 | 2012-10-11 15:49:58 -0700 | [diff] [blame] | 326 | .resume_voltage_delta = 60, |
| 327 | .resume_charge_percent = 99, |
Abhijeet Dharmapurikar | d6d66c7 | 2012-08-06 14:02:51 -0700 | [diff] [blame] | 328 | .term_current = CHG_TERM_MA, |
David Keitel | c72d819 | 2012-01-09 11:33:55 -0800 | [diff] [blame] | 329 | .cool_temp = 10, |
Abhijeet Dharmapurikar | 807d60f | 2012-11-05 13:37:13 -0800 | [diff] [blame] | 330 | .warm_temp = 45, |
David Keitel | c72d819 | 2012-01-09 11:33:55 -0800 | [diff] [blame] | 331 | .temp_check_period = 1, |
| 332 | .max_bat_chg_current = 1100, |
| 333 | .cool_bat_chg_current = 350, |
| 334 | .warm_bat_chg_current = 350, |
| 335 | .cool_bat_voltage = 4100, |
| 336 | .warm_bat_voltage = 4100, |
| 337 | .thermal_mitigation = pm8921_therm_mitigation, |
| 338 | .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation), |
Jay Chokshi | 74730c7 | 2012-03-15 14:11:28 -0700 | [diff] [blame] | 339 | .led_src_config = LED_SRC_VPH_PWR, |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 340 | .rconn_mohm = 18, |
David Keitel | c72d819 | 2012-01-09 11:33:55 -0800 | [diff] [blame] | 341 | }; |
| 342 | |
Amy Maloche | 8a21931 | 2012-01-19 17:39:56 -0800 | [diff] [blame] | 343 | #define PM8038_WLED_MAX_CURRENT 25 |
Amy Maloche | a0352b5 | 2012-02-27 18:35:23 -0800 | [diff] [blame] | 344 | #define PM8XXX_LED_PWM_PERIOD 1000 |
| 345 | #define PM8XXX_LED_PWM_DUTY_MS 20 |
| 346 | #define PM8038_RGB_LED_MAX_CURRENT 12 |
Amy Maloche | 8a21931 | 2012-01-19 17:39:56 -0800 | [diff] [blame] | 347 | |
| 348 | static struct led_info pm8038_led_info[] = { |
| 349 | [0] = { |
| 350 | .name = "wled", |
Chandan Uddaraju | 194a4b5 | 2012-03-21 10:11:18 -0700 | [diff] [blame] | 351 | .default_trigger = "bkl_trigger", |
Amy Maloche | 8a21931 | 2012-01-19 17:39:56 -0800 | [diff] [blame] | 352 | }, |
Amy Maloche | a0352b5 | 2012-02-27 18:35:23 -0800 | [diff] [blame] | 353 | [1] = { |
| 354 | .name = "led:rgb_red", |
| 355 | .default_trigger = "battery-charging", |
| 356 | }, |
| 357 | [2] = { |
| 358 | .name = "led:rgb_green", |
| 359 | }, |
| 360 | [3] = { |
| 361 | .name = "led:rgb_blue", |
| 362 | }, |
Amy Maloche | 8a21931 | 2012-01-19 17:39:56 -0800 | [diff] [blame] | 363 | }; |
| 364 | |
| 365 | static struct led_platform_data pm8038_led_core_pdata = { |
| 366 | .num_leds = ARRAY_SIZE(pm8038_led_info), |
| 367 | .leds = pm8038_led_info, |
| 368 | }; |
| 369 | |
| 370 | static struct wled_config_data wled_cfg = { |
| 371 | .dig_mod_gen_en = true, |
| 372 | .cs_out_en = true, |
| 373 | .ctrl_delay_us = 0, |
| 374 | .op_fdbck = true, |
| 375 | .ovp_val = WLED_OVP_32V, |
| 376 | .boost_curr_lim = WLED_CURR_LIMIT_525mA, |
Amy Maloche | e7d7ef3 | 2013-01-30 16:16:35 -0800 | [diff] [blame] | 377 | .strings = WLED_SECOND_STRING, |
Amy Maloche | 8a21931 | 2012-01-19 17:39:56 -0800 | [diff] [blame] | 378 | }; |
| 379 | |
Amy Maloche | a0352b5 | 2012-02-27 18:35:23 -0800 | [diff] [blame] | 380 | static int pm8038_led0_pwm_duty_pcts[56] = { |
| 381 | 1, 4, 8, 12, 16, 20, 24, 28, 32, 36, |
| 382 | 40, 44, 46, 52, 56, 60, 64, 68, 72, 76, |
| 383 | 80, 84, 88, 92, 96, 100, 100, 100, 98, 95, |
| 384 | 92, 88, 84, 82, 78, 74, 70, 66, 62, 58, |
| 385 | 58, 54, 50, 48, 42, 38, 34, 30, 26, 22, |
| 386 | 14, 10, 6, 4, 1 |
| 387 | }; |
| 388 | |
Jay Chokshi | be51723 | 2012-06-15 18:20:56 -0700 | [diff] [blame] | 389 | /* |
| 390 | * Note: There is a bug in LPG module that results in incorrect |
| 391 | * behavior of pattern when LUT index 0 is used. So effectively |
| 392 | * there are 63 usable LUT entries. |
| 393 | */ |
Amy Maloche | a0352b5 | 2012-02-27 18:35:23 -0800 | [diff] [blame] | 394 | static struct pm8xxx_pwm_duty_cycles pm8038_led0_pwm_duty_cycles = { |
| 395 | .duty_pcts = (int *)&pm8038_led0_pwm_duty_pcts, |
| 396 | .num_duty_pcts = ARRAY_SIZE(pm8038_led0_pwm_duty_pcts), |
| 397 | .duty_ms = PM8XXX_LED_PWM_DUTY_MS, |
Jay Chokshi | be51723 | 2012-06-15 18:20:56 -0700 | [diff] [blame] | 398 | .start_idx = 1, |
Amy Maloche | a0352b5 | 2012-02-27 18:35:23 -0800 | [diff] [blame] | 399 | }; |
| 400 | |
Amy Maloche | 8a21931 | 2012-01-19 17:39:56 -0800 | [diff] [blame] | 401 | static struct pm8xxx_led_config pm8038_led_configs[] = { |
| 402 | [0] = { |
| 403 | .id = PM8XXX_ID_WLED, |
| 404 | .mode = PM8XXX_LED_MODE_MANUAL, |
| 405 | .max_current = PM8038_WLED_MAX_CURRENT, |
Chandan Uddaraju | 194a4b5 | 2012-03-21 10:11:18 -0700 | [diff] [blame] | 406 | .default_state = 0, |
Amy Maloche | 8a21931 | 2012-01-19 17:39:56 -0800 | [diff] [blame] | 407 | .wled_cfg = &wled_cfg, |
| 408 | }, |
Amy Maloche | a0352b5 | 2012-02-27 18:35:23 -0800 | [diff] [blame] | 409 | [1] = { |
| 410 | .id = PM8XXX_ID_RGB_LED_RED, |
| 411 | .mode = PM8XXX_LED_MODE_PWM1, |
| 412 | .max_current = PM8038_RGB_LED_MAX_CURRENT, |
| 413 | .pwm_channel = 5, |
| 414 | .pwm_period_us = PM8XXX_LED_PWM_PERIOD, |
| 415 | .pwm_duty_cycles = &pm8038_led0_pwm_duty_cycles, |
| 416 | }, |
| 417 | [2] = { |
| 418 | .id = PM8XXX_ID_RGB_LED_GREEN, |
| 419 | .mode = PM8XXX_LED_MODE_PWM1, |
| 420 | .max_current = PM8038_RGB_LED_MAX_CURRENT, |
| 421 | .pwm_channel = 4, |
| 422 | .pwm_period_us = PM8XXX_LED_PWM_PERIOD, |
| 423 | .pwm_duty_cycles = &pm8038_led0_pwm_duty_cycles, |
| 424 | }, |
| 425 | [3] = { |
| 426 | .id = PM8XXX_ID_RGB_LED_BLUE, |
| 427 | .mode = PM8XXX_LED_MODE_PWM1, |
| 428 | .max_current = PM8038_RGB_LED_MAX_CURRENT, |
| 429 | .pwm_channel = 3, |
| 430 | .pwm_period_us = PM8XXX_LED_PWM_PERIOD, |
| 431 | .pwm_duty_cycles = &pm8038_led0_pwm_duty_cycles, |
| 432 | }, |
Amy Maloche | 8a21931 | 2012-01-19 17:39:56 -0800 | [diff] [blame] | 433 | }; |
| 434 | |
| 435 | static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = { |
| 436 | .led_core = &pm8038_led_core_pdata, |
| 437 | .configs = pm8038_led_configs, |
| 438 | .num_configs = ARRAY_SIZE(pm8038_led_configs), |
| 439 | }; |
| 440 | |
David Keitel | c72d819 | 2012-01-09 11:33:55 -0800 | [diff] [blame] | 441 | static struct pm8xxx_ccadc_platform_data pm8xxx_ccadc_pdata = { |
Xiaozhe Shi | d69c91e | 2012-11-06 10:00:38 -0800 | [diff] [blame] | 442 | .r_sense_uohm = 10000, |
David Keitel | 3c37882 | 2012-06-07 13:43:22 -0700 | [diff] [blame] | 443 | .calib_delay_ms = 600000, |
David Keitel | c72d819 | 2012-01-09 11:33:55 -0800 | [diff] [blame] | 444 | }; |
| 445 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 446 | static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = { |
| 447 | .priority = 0, |
| 448 | }; |
| 449 | |
Asish Bhattacharya | 59442e2 | 2012-09-07 17:22:57 +0530 | [diff] [blame] | 450 | /* |
| 451 | * 0x254=0xC8 (Threshold=110, preamp bias=01) |
| 452 | * 0x255=0xC1 (Hold=110, max attn=0000, mute=1) |
| 453 | * 0x256=0xB0 (decay=101, attack=10, delay=0) |
| 454 | */ |
| 455 | |
Asish Bhattacharya | 218f80b | 2012-03-19 02:47:34 -0700 | [diff] [blame] | 456 | static struct pm8xxx_spk_platform_data pm8xxx_spk_pdata = { |
| 457 | .spk_add_enable = false, |
Asish Bhattacharya | 53c87b0 | 2012-12-12 00:19:30 +0530 | [diff] [blame] | 458 | .cd_ng_threshold = 0x0, |
Asish Bhattacharya | 59442e2 | 2012-09-07 17:22:57 +0530 | [diff] [blame] | 459 | .cd_nf_preamp_bias = 0x1, |
| 460 | .cd_ng_hold = 0x6, |
| 461 | .cd_ng_max_atten = 0x0, |
| 462 | .noise_mute = 1, |
| 463 | .cd_ng_decay_rate = 0x5, |
| 464 | .cd_ng_attack_rate = 0x2, |
| 465 | .cd_delay = 0x0, |
Asish Bhattacharya | 218f80b | 2012-03-19 02:47:34 -0700 | [diff] [blame] | 466 | }; |
| 467 | |
David Keitel | c72d819 | 2012-01-09 11:33:55 -0800 | [diff] [blame] | 468 | static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = { |
Abhijeet Dharmapurikar | d6d66c7 | 2012-08-06 14:02:51 -0700 | [diff] [blame] | 469 | .battery_type = BATT_UNKNOWN, |
Xiaozhe Shi | d69c91e | 2012-11-06 10:00:38 -0800 | [diff] [blame] | 470 | .r_sense_uohm = 10000, |
Abhijeet Dharmapurikar | d6d66c7 | 2012-08-06 14:02:51 -0700 | [diff] [blame] | 471 | .v_cutoff = 3400, |
| 472 | .max_voltage_uv = MAX_VOLTAGE_MV * 1000, |
| 473 | .shutdown_soc_valid_limit = 20, |
| 474 | .adjust_soc_low_threshold = 25, |
| 475 | .chg_term_ua = CHG_TERM_MA * 1000, |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 476 | .rconn_mohm = 18, |
Abhijeet Dharmapurikar | 683472d | 2012-10-30 16:21:58 -0700 | [diff] [blame] | 477 | .normal_voltage_calc_ms = 20000, |
| 478 | .low_voltage_calc_ms = 1000, |
Anirudh Ghayal | 6fe4ffa | 2013-02-01 11:44:33 +0530 | [diff] [blame] | 479 | .alarm_low_mv = 3400, |
| 480 | .alarm_high_mv = 4000, |
David Keitel | c72d819 | 2012-01-09 11:33:55 -0800 | [diff] [blame] | 481 | }; |
| 482 | |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 483 | static struct pm8038_platform_data pm8038_platform_data __devinitdata = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 484 | .irq_pdata = &pm8xxx_irq_pdata, |
| 485 | .gpio_pdata = &pm8xxx_gpio_pdata, |
| 486 | .mpp_pdata = &pm8xxx_mpp_pdata, |
| 487 | .rtc_pdata = &pm8xxx_rtc_pdata, |
| 488 | .pwrkey_pdata = &pm8xxx_pwrkey_pdata, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 489 | .misc_pdata = &pm8xxx_misc_pdata, |
David Collins | 1d4061b | 2011-12-06 15:36:40 -0800 | [diff] [blame] | 490 | .regulator_pdatas = msm8930_pm8038_regulator_pdata, |
David Keitel | c72d819 | 2012-01-09 11:33:55 -0800 | [diff] [blame] | 491 | .charger_pdata = &pm8921_chg_pdata, |
| 492 | .bms_pdata = &pm8921_bms_pdata, |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 493 | .adc_pdata = &pm8038_adc_pdata, |
Amy Maloche | 8a21931 | 2012-01-19 17:39:56 -0800 | [diff] [blame] | 494 | .leds_pdata = &pm8xxx_leds_pdata, |
David Keitel | c72d819 | 2012-01-09 11:33:55 -0800 | [diff] [blame] | 495 | .ccadc_pdata = &pm8xxx_ccadc_pdata, |
Asish Bhattacharya | 218f80b | 2012-03-19 02:47:34 -0700 | [diff] [blame] | 496 | .spk_pdata = &pm8xxx_spk_pdata, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 497 | }; |
| 498 | |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 499 | static struct msm_ssbi_platform_data msm8930_ssbi_pm8038_pdata __devinitdata = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 500 | .controller_type = MSM_SBI_CTRL_PMIC_ARBITER, |
| 501 | .slave = { |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 502 | .name = "pm8038-core", |
| 503 | .platform_data = &pm8038_platform_data, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 504 | }, |
| 505 | }; |
| 506 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 507 | /* PM8917 platform data */ |
| 508 | |
| 509 | static struct pm8xxx_adc_amux pm8917_adc_channels_data[] = { |
| 510 | {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 511 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 512 | {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 513 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 514 | {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1, |
| 515 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 516 | {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 517 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 518 | {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 519 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 520 | {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 521 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 522 | {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2, |
| 523 | ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM}, |
| 524 | {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV2, |
| 525 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 526 | {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1, |
| 527 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 528 | {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 529 | ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM}, |
| 530 | {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 531 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 532 | {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 533 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 534 | {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 535 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 536 | {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0, |
| 537 | ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM}, |
| 538 | {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 539 | ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM}, |
Siddartha Mohanadoss | 0cf0826 | 2012-09-12 22:41:05 -0700 | [diff] [blame] | 540 | {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 541 | ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM}, |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 542 | }; |
| 543 | |
| 544 | static struct pm8xxx_adc_properties pm8917_adc_data = { |
| 545 | .adc_vdd_reference = 1800, /* milli-voltage for this adc */ |
| 546 | .bitresolution = 15, |
| 547 | .bipolar = 0, |
| 548 | }; |
| 549 | |
| 550 | static struct pm8xxx_adc_platform_data pm8917_adc_pdata = { |
| 551 | .adc_channel = pm8917_adc_channels_data, |
| 552 | .adc_num_board_channel = ARRAY_SIZE(pm8917_adc_channels_data), |
| 553 | .adc_prop = &pm8917_adc_data, |
| 554 | .adc_mpp_base = PM8917_MPP_PM_TO_SYS(1), |
| 555 | }; |
| 556 | |
| 557 | static struct pm8921_platform_data pm8917_platform_data __devinitdata = { |
| 558 | .irq_pdata = &pm8xxx_irq_pdata, |
| 559 | .gpio_pdata = &pm8xxx_gpio_pdata, |
| 560 | .mpp_pdata = &pm8xxx_mpp_pdata, |
| 561 | .rtc_pdata = &pm8xxx_rtc_pdata, |
| 562 | .pwrkey_pdata = &pm8xxx_pwrkey_pdata, |
| 563 | .misc_pdata = &pm8xxx_misc_pdata, |
David Collins | 4614cb9 | 2012-08-20 12:17:09 -0700 | [diff] [blame] | 564 | .regulator_pdatas = msm8930_pm8917_regulator_pdata, |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 565 | .charger_pdata = &pm8921_chg_pdata, |
| 566 | .bms_pdata = &pm8921_bms_pdata, |
| 567 | .adc_pdata = &pm8917_adc_pdata, |
| 568 | .ccadc_pdata = &pm8xxx_ccadc_pdata, |
| 569 | }; |
| 570 | |
| 571 | static struct msm_ssbi_platform_data msm8930_ssbi_pm8917_pdata __devinitdata = { |
| 572 | .controller_type = MSM_SBI_CTRL_PMIC_ARBITER, |
| 573 | .slave = { |
| 574 | .name = "pm8921-core", |
| 575 | .platform_data = &pm8917_platform_data, |
| 576 | }, |
| 577 | }; |
| 578 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 579 | void __init msm8930_init_pmic(void) |
| 580 | { |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 581 | if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917) { |
| 582 | /* PM8038 configuration */ |
| 583 | pmic_reset_irq = PM8038_IRQ_BASE + PM8038_RESOUT_IRQ; |
| 584 | msm8960_device_ssbi_pmic.dev.platform_data = |
| 585 | &msm8930_ssbi_pm8038_pdata; |
| 586 | pm8038_platform_data.num_regulators |
| 587 | = msm8930_pm8038_regulator_pdata_len; |
David Keitel | b7bf2c9 | 2012-08-24 17:54:00 -0700 | [diff] [blame] | 588 | if (machine_is_msm8930_mtp()) |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 589 | pm8921_bms_pdata.battery_type = BATT_PALLADIUM; |
David Keitel | b7bf2c9 | 2012-08-24 17:54:00 -0700 | [diff] [blame] | 590 | else if (machine_is_msm8930_cdp()) |
| 591 | pm8921_chg_pdata.has_dc_supply = true; |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 592 | } else { |
| 593 | /* PM8917 configuration */ |
| 594 | pmic_reset_irq = PM8917_IRQ_BASE + PM8921_RESOUT_IRQ; |
| 595 | msm8960_device_ssbi_pmic.dev.platform_data = |
| 596 | &msm8930_ssbi_pm8917_pdata; |
David Collins | 4614cb9 | 2012-08-20 12:17:09 -0700 | [diff] [blame] | 597 | pm8917_platform_data.num_regulators |
| 598 | = msm8930_pm8917_regulator_pdata_len; |
David Keitel | b7bf2c9 | 2012-08-24 17:54:00 -0700 | [diff] [blame] | 599 | if (machine_is_msm8930_mtp()) |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 600 | pm8921_bms_pdata.battery_type = BATT_PALLADIUM; |
David Keitel | b7bf2c9 | 2012-08-24 17:54:00 -0700 | [diff] [blame] | 601 | else if (machine_is_msm8930_cdp()) |
| 602 | pm8921_chg_pdata.has_dc_supply = true; |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 603 | } |
Abhijeet Dharmapurikar | bbaef59 | 2012-10-10 10:07:51 -0700 | [diff] [blame] | 604 | |
| 605 | if (!machine_is_msm8930_mtp()) |
| 606 | pm8921_chg_pdata.battery_less_hardware = 1; |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 607 | } |