blob: 1a0a287096634b1c46ac250440ba37ea3fb64d61 [file] [log] [blame]
Jay Chokshie8741282012-01-25 15:22:55 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08002 *
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/init.h>
15#include <linux/ioport.h>
16#include <linux/platform_device.h>
17#include <linux/bootmem.h>
Jay Chokshie8741282012-01-25 15:22:55 -080018#include <linux/mfd/pm8xxx/pm8921.h>
19#include <linux/leds.h>
20#include <linux/leds-pm8xxx.h>
Jay Chokshif3a9ea82012-01-12 16:34:43 -080021#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -080022#include <asm/mach-types.h>
23#include <asm/mach/mmc.h>
24#include <mach/msm_bus_board.h>
25#include <mach/board.h>
26#include <mach/gpio.h>
27#include <mach/gpiomux.h>
Jay Chokshie8741282012-01-25 15:22:55 -080028#include <mach/restart.h>
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -080029#include "devices.h"
30#include "board-8064.h"
31
Jay Chokshie8741282012-01-25 15:22:55 -080032struct pm8xxx_gpio_init {
33 unsigned gpio;
34 struct pm_gpio config;
35};
36
37struct pm8xxx_mpp_init {
38 unsigned mpp;
39 struct pm8xxx_mpp_config_data config;
40};
41
42#define PM8921_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
43 _func, _inv, _disable) \
44{ \
45 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
46 .config = { \
47 .direction = _dir, \
48 .output_buffer = _buf, \
49 .output_value = _val, \
50 .pull = _pull, \
51 .vin_sel = _vin, \
52 .out_strength = _out_strength, \
53 .function = _func, \
54 .inv_int_pol = _inv, \
55 .disable_pin = _disable, \
56 } \
57}
58
59#define PM8921_MPP_INIT(_mpp, _type, _level, _control) \
60{ \
61 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
62 .config = { \
63 .type = PM8XXX_MPP_TYPE_##_type, \
64 .level = _level, \
65 .control = PM8XXX_MPP_##_control, \
66 } \
67}
68
69#define PM8821_MPP_INIT(_mpp, _type, _level, _control) \
70{ \
71 .mpp = PM8821_MPP_PM_TO_SYS(_mpp), \
72 .config = { \
73 .type = PM8XXX_MPP_TYPE_##_type, \
74 .level = _level, \
75 .control = PM8XXX_MPP_##_control, \
76 } \
77}
78
79#define PM8921_GPIO_DISABLE(_gpio) \
80 PM8921_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
81 0, 0, 0, 1)
82
83#define PM8921_GPIO_OUTPUT(_gpio, _val, _strength) \
84 PM8921_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
85 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
86 PM_GPIO_STRENGTH_##_strength, \
87 PM_GPIO_FUNC_NORMAL, 0, 0)
88
Jay Chokshi1de4f9d2012-02-07 16:11:31 -080089#define PM8921_GPIO_OUTPUT_BUFCONF(_gpio, _val, _strength, _bufconf) \
90 PM8921_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT,\
91 PM_GPIO_OUT_BUF_##_bufconf, _val, \
92 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
93 PM_GPIO_STRENGTH_##_strength, \
94 PM_GPIO_FUNC_NORMAL, 0, 0)
95
Jay Chokshie8741282012-01-25 15:22:55 -080096#define PM8921_GPIO_INPUT(_gpio, _pull) \
97 PM8921_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
98 _pull, PM_GPIO_VIN_S4, \
99 PM_GPIO_STRENGTH_NO, \
100 PM_GPIO_FUNC_NORMAL, 0, 0)
101
102#define PM8921_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
103 PM8921_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
104 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
105 PM_GPIO_STRENGTH_HIGH, \
106 _func, 0, 0)
107
108#define PM8921_GPIO_OUTPUT_VIN(_gpio, _val, _vin) \
109 PM8921_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
110 PM_GPIO_PULL_NO, _vin, \
111 PM_GPIO_STRENGTH_HIGH, \
112 PM_GPIO_FUNC_NORMAL, 0, 0)
113
114/* Initial PM8921 GPIO configurations */
115static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -0800116 PM8921_GPIO_OUTPUT(14, 1, HIGH), /* HDMI Mux Selector */
David Collins390fc332012-02-07 14:38:16 -0800117 PM8921_GPIO_OUTPUT(23, 0, HIGH), /* touchscreen power FET */
Jay Chokshi1de4f9d2012-02-07 16:11:31 -0800118 PM8921_GPIO_OUTPUT_BUFCONF(25, 0, LOW, CMOS), /* DISP_RESET_N */
119 PM8921_GPIO_OUTPUT_FUNC(26, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
David Keitel2f613d92012-02-15 11:29:16 -0800120 PM8921_GPIO_OUTPUT_VIN(30, 1, PM_GPIO_VIN_VPH), /* SMB349 susp line */
Jay Chokshi1de4f9d2012-02-07 16:11:31 -0800121 PM8921_GPIO_OUTPUT_BUFCONF(36, 1, LOW, OPEN_DRAIN),
Amy Maloche70090f992012-02-16 16:35:26 -0800122 PM8921_GPIO_OUTPUT_FUNC(44, 0, PM_GPIO_FUNC_2),
123 PM8921_GPIO_OUTPUT(33, 0, HIGH),
124 PM8921_GPIO_OUTPUT(20, 0, HIGH),
Anirudh Ghayal71478012012-03-08 17:54:23 -0800125 PM8921_GPIO_INPUT(35, PM_GPIO_PULL_UP_30),
126 PM8921_GPIO_INPUT(38, PM_GPIO_PULL_UP_30),
Shiv Maliyappanahalli7e0beff2012-02-06 15:56:39 -0800127 /* TABLA CODEC RESET */
128 PM8921_GPIO_OUTPUT(34, 1, MED),
Oluwafemi Adeyemi0d469ce2012-05-10 18:04:25 -0700129 PM8921_GPIO_INPUT(31, PM_GPIO_PULL_NO),
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -0600130 PM8921_GPIO_OUTPUT(13, 0, HIGH), /* PCIE_CLK_PWR_EN */
Mohan Pallaka474b94b2012-01-25 12:59:58 +0530131};
132
133static struct pm8xxx_gpio_init pm8921_mtp_kp_gpios[] __initdata = {
Anirudh Ghayal71478012012-03-08 17:54:23 -0800134 PM8921_GPIO_INPUT(3, PM_GPIO_PULL_UP_30),
135 PM8921_GPIO_INPUT(4, PM_GPIO_PULL_UP_30),
Mohan Pallaka474b94b2012-01-25 12:59:58 +0530136};
137
138static struct pm8xxx_gpio_init pm8921_cdp_kp_gpios[] __initdata = {
Anirudh Ghayal71478012012-03-08 17:54:23 -0800139 PM8921_GPIO_INPUT(27, PM_GPIO_PULL_UP_30),
140 PM8921_GPIO_INPUT(42, PM_GPIO_PULL_UP_30),
Oluwafemi Adeyemi48fc3262012-03-19 13:26:52 -0700141 PM8921_GPIO_INPUT(17, PM_GPIO_PULL_UP_1P5), /* SD_WP */
Jay Chokshie8741282012-01-25 15:22:55 -0800142};
143
144/* Initial PM8XXX MPP configurations */
145static struct pm8xxx_mpp_init pm8xxx_mpps[] __initdata = {
Jay Chokshi1de4f9d2012-02-07 16:11:31 -0800146 PM8921_MPP_INIT(3, D_OUTPUT, PM8921_MPP_DIG_LEVEL_VPH, DOUT_CTRL_LOW),
Jay Chokshi1de4f9d2012-02-07 16:11:31 -0800147 PM8921_MPP_INIT(8, D_OUTPUT, PM8921_MPP_DIG_LEVEL_S4, DOUT_CTRL_LOW),
Hemant Kumar56925352012-02-13 16:59:52 -0800148 /*MPP9 is used to detect docking station connection/removal on Liquid*/
149 PM8921_MPP_INIT(9, D_INPUT, PM8921_MPP_DIG_LEVEL_S4, DIN_TO_INT),
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -0600150 /* PCIE_RESET_N */
151 PM8921_MPP_INIT(1, D_OUTPUT, PM8921_MPP_DIG_LEVEL_VPH, DOUT_CTRL_HIGH),
Jay Chokshie8741282012-01-25 15:22:55 -0800152};
153
154void __init apq8064_pm8xxx_gpio_mpp_init(void)
155{
156 int i, rc;
157
158 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
159 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
160 &pm8921_gpios[i].config);
161 if (rc) {
162 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
163 break;
164 }
165 }
166
Mohan Pallaka474b94b2012-01-25 12:59:58 +0530167 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
168 for (i = 0; i < ARRAY_SIZE(pm8921_cdp_kp_gpios); i++) {
169 rc = pm8xxx_gpio_config(pm8921_cdp_kp_gpios[i].gpio,
170 &pm8921_cdp_kp_gpios[i].config);
171 if (rc) {
172 pr_err("%s: pm8xxx_gpio_config: rc=%d\n",
173 __func__, rc);
174 break;
175 }
176 }
177
178 if (machine_is_apq8064_mtp())
179 for (i = 0; i < ARRAY_SIZE(pm8921_mtp_kp_gpios); i++) {
180 rc = pm8xxx_gpio_config(pm8921_mtp_kp_gpios[i].gpio,
181 &pm8921_mtp_kp_gpios[i].config);
182 if (rc) {
183 pr_err("%s: pm8xxx_gpio_config: rc=%d\n",
184 __func__, rc);
185 break;
186 }
187 }
188
Jay Chokshie8741282012-01-25 15:22:55 -0800189 for (i = 0; i < ARRAY_SIZE(pm8xxx_mpps); i++) {
190 rc = pm8xxx_mpp_config(pm8xxx_mpps[i].mpp,
191 &pm8xxx_mpps[i].config);
192 if (rc) {
193 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
194 break;
195 }
196 }
197}
198
199static struct pm8xxx_pwrkey_platform_data apq8064_pm8921_pwrkey_pdata = {
200 .pull_up = 1,
201 .kpd_trigger_delay_us = 15625,
202 .wakeup = 1,
203};
204
205static struct pm8xxx_misc_platform_data apq8064_pm8921_misc_pdata = {
206 .priority = 0,
207};
208
209#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
210#define PM8921_LC_LED_LOW_CURRENT 1 /* I = 1mA */
211#define PM8XXX_LED_PWM_PERIOD 1000
212#define PM8XXX_LED_PWM_DUTY_MS 20
213/**
214 * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be
215 * driven using PWM feature.
216 */
217#define PM8XXX_PWM_CHANNEL_NONE -1
218
219static struct led_info pm8921_led_info[] = {
220 [0] = {
221 .name = "led:red",
222 .default_trigger = "ac-online",
223 },
224};
225
226static struct led_platform_data pm8921_led_core_pdata = {
227 .num_leds = ARRAY_SIZE(pm8921_led_info),
228 .leds = pm8921_led_info,
229};
230
231static int pm8921_led0_pwm_duty_pcts[56] = {
232 1, 4, 8, 12, 16, 20, 24, 28, 32, 36,
233 40, 44, 46, 52, 56, 60, 64, 68, 72, 76,
234 80, 84, 88, 92, 96, 100, 100, 100, 98, 95,
235 92, 88, 84, 82, 78, 74, 70, 66, 62, 58,
236 58, 54, 50, 48, 42, 38, 34, 30, 26, 22,
237 14, 10, 6, 4, 1
238};
239
240static struct pm8xxx_pwm_duty_cycles pm8921_led0_pwm_duty_cycles = {
241 .duty_pcts = (int *)&pm8921_led0_pwm_duty_pcts,
242 .num_duty_pcts = ARRAY_SIZE(pm8921_led0_pwm_duty_pcts),
243 .duty_ms = PM8XXX_LED_PWM_DUTY_MS,
244 .start_idx = 0,
245};
246
247static struct pm8xxx_led_config pm8921_led_configs[] = {
248 [0] = {
249 .id = PM8XXX_ID_LED_0,
250 .mode = PM8XXX_LED_MODE_PWM2,
251 .max_current = PM8921_LC_LED_MAX_CURRENT,
252 .pwm_channel = 5,
253 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
254 .pwm_duty_cycles = &pm8921_led0_pwm_duty_cycles,
255 },
256};
257
258static struct pm8xxx_led_platform_data apq8064_pm8921_leds_pdata = {
259 .led_core = &pm8921_led_core_pdata,
260 .configs = pm8921_led_configs,
261 .num_configs = ARRAY_SIZE(pm8921_led_configs),
262};
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -0800263
Jay Chokshif3a9ea82012-01-12 16:34:43 -0800264static struct pm8xxx_adc_amux apq8064_pm8921_adc_channels_data[] = {
265 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
266 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
267 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
268 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
269 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
270 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
271 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
272 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
273 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
274 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
275 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
276 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
277 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
278 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
279 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
280 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
281 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
282 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
283 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
284 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
285 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
286 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
287 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
288 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
289 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
290 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
291 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
292 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
293};
294
295static struct pm8xxx_adc_properties apq8064_pm8921_adc_data = {
296 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
297 .bitresolution = 15,
298 .bipolar = 0,
299};
300
301static struct pm8xxx_adc_platform_data apq8064_pm8921_adc_pdata = {
302 .adc_channel = apq8064_pm8921_adc_channels_data,
303 .adc_num_board_channel = ARRAY_SIZE(apq8064_pm8921_adc_channels_data),
304 .adc_prop = &apq8064_pm8921_adc_data,
305 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
306};
307
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -0800308static struct pm8xxx_mpp_platform_data
309apq8064_pm8921_mpp_pdata __devinitdata = {
310 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
311};
312
313static struct pm8xxx_gpio_platform_data
314apq8064_pm8921_gpio_pdata __devinitdata = {
315 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
316};
317
318static struct pm8xxx_irq_platform_data
319apq8064_pm8921_irq_pdata __devinitdata = {
320 .irq_base = PM8921_IRQ_BASE,
Jeffrey Chuanga92c7ab2012-03-01 23:56:00 -0800321 .devirq = MSM_GPIO_TO_INT(74),
322 .irq_trigger_flag = IRQF_TRIGGER_LOW,
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -0800323 .dev_id = 0,
324};
325
Ashay Jaiswal0b023dc2012-01-25 10:18:36 +0530326static struct pm8xxx_rtc_platform_data
327apq8064_pm8921_rtc_pdata = {
328 .rtc_write_enable = false,
329 .rtc_alarm_powerup = false,
330};
331
Jay Chokshi42fe9f02012-02-01 20:52:08 -0800332static int apq8064_pm8921_therm_mitigation[] = {
333 1100,
334 700,
335 600,
336 325,
337};
338
339#define MAX_VOLTAGE_MV 4200
340static struct pm8921_charger_platform_data
341apq8064_pm8921_chg_pdata __devinitdata = {
342 .safety_time = 180,
343 .update_time = 60000,
344 .max_voltage = MAX_VOLTAGE_MV,
345 .min_voltage = 3200,
346 .resume_voltage_delta = 100,
347 .term_current = 100,
348 .cool_temp = 10,
349 .warm_temp = 40,
350 .temp_check_period = 1,
351 .max_bat_chg_current = 1100,
352 .cool_bat_chg_current = 350,
353 .warm_bat_chg_current = 350,
354 .cool_bat_voltage = 4100,
355 .warm_bat_voltage = 4100,
356 .thermal_mitigation = apq8064_pm8921_therm_mitigation,
357 .thermal_levels = ARRAY_SIZE(apq8064_pm8921_therm_mitigation),
358};
359
360static struct pm8xxx_ccadc_platform_data
361apq8064_pm8xxx_ccadc_pdata = {
362 .r_sense = 10,
363};
364
365static struct pm8921_bms_platform_data
366apq8064_pm8921_bms_pdata __devinitdata = {
David Keitel35e11872012-02-17 17:40:42 -0800367 .battery_type = BATT_UNKNOWN,
Jay Chokshi42fe9f02012-02-01 20:52:08 -0800368 .r_sense = 10,
369 .i_test = 2500,
370 .v_failure = 3000,
371 .calib_delay_ms = 600000,
372 .max_voltage_uv = MAX_VOLTAGE_MV * 1000,
373};
374
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -0800375static struct pm8921_platform_data
376apq8064_pm8921_platform_data __devinitdata = {
377 .regulator_pdatas = msm8064_pm8921_regulator_pdata,
378 .irq_pdata = &apq8064_pm8921_irq_pdata,
379 .gpio_pdata = &apq8064_pm8921_gpio_pdata,
380 .mpp_pdata = &apq8064_pm8921_mpp_pdata,
Ashay Jaiswal0b023dc2012-01-25 10:18:36 +0530381 .rtc_pdata = &apq8064_pm8921_rtc_pdata,
Jay Chokshie8741282012-01-25 15:22:55 -0800382 .pwrkey_pdata = &apq8064_pm8921_pwrkey_pdata,
383 .misc_pdata = &apq8064_pm8921_misc_pdata,
384 .leds_pdata = &apq8064_pm8921_leds_pdata,
Jay Chokshif3a9ea82012-01-12 16:34:43 -0800385 .adc_pdata = &apq8064_pm8921_adc_pdata,
Jay Chokshi42fe9f02012-02-01 20:52:08 -0800386 .charger_pdata = &apq8064_pm8921_chg_pdata,
387 .bms_pdata = &apq8064_pm8921_bms_pdata,
388 .ccadc_pdata = &apq8064_pm8xxx_ccadc_pdata,
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -0800389};
390
391static struct pm8xxx_irq_platform_data
392apq8064_pm8821_irq_pdata __devinitdata = {
393 .irq_base = PM8821_IRQ_BASE,
Jay Chokshie8741282012-01-25 15:22:55 -0800394 .devirq = PM8821_SEC_IRQ_N,
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -0800395 .irq_trigger_flag = IRQF_TRIGGER_HIGH,
396 .dev_id = 1,
397};
398
399static struct pm8xxx_mpp_platform_data
400apq8064_pm8821_mpp_pdata __devinitdata = {
401 .mpp_base = PM8821_MPP_PM_TO_SYS(1),
402};
403
404static struct pm8821_platform_data
405apq8064_pm8821_platform_data __devinitdata = {
406 .irq_pdata = &apq8064_pm8821_irq_pdata,
407 .mpp_pdata = &apq8064_pm8821_mpp_pdata,
408};
409
410static struct msm_ssbi_platform_data apq8064_ssbi_pm8921_pdata __devinitdata = {
411 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
412 .slave = {
413 .name = "pm8921-core",
414 .platform_data = &apq8064_pm8921_platform_data,
415 },
416};
417
418static struct msm_ssbi_platform_data apq8064_ssbi_pm8821_pdata __devinitdata = {
419 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
420 .slave = {
421 .name = "pm8821-core",
422 .platform_data = &apq8064_pm8821_platform_data,
423 },
424};
425
426void __init apq8064_init_pmic(void)
427{
Jay Chokshie8741282012-01-25 15:22:55 -0800428 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
429
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -0800430 apq8064_device_ssbi_pmic1.dev.platform_data =
431 &apq8064_ssbi_pm8921_pdata;
432 apq8064_device_ssbi_pmic2.dev.platform_data =
433 &apq8064_ssbi_pm8821_pdata;
434 apq8064_pm8921_platform_data.num_regulators =
435 msm8064_pm8921_regulator_pdata_len;
436
437 if (machine_is_apq8064_rumi3()) {
438 apq8064_pm8921_irq_pdata.devirq = 0;
439 apq8064_pm8821_irq_pdata.devirq = 0;
David Keitel35e11872012-02-17 17:40:42 -0800440 } else if (machine_is_apq8064_mtp()) {
441 apq8064_pm8921_bms_pdata.battery_type = BATT_PALLADIUM;
442 } else if (machine_is_apq8064_liquid()) {
443 apq8064_pm8921_bms_pdata.battery_type = BATT_DESAY;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -0800444 }
445}