blob: 90557b97fa762b23e09713ee36ef2e7a53eff19e [file] [log] [blame]
Jay Chokshi9d36a3d2011-10-26 15:57:51 -07001/*
David Keitel310eb682012-01-09 10:59:10 -08002 * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Jay Chokshi9d36a3d2011-10-26 15:57:51 -07003 *
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 8038 driver header file
15 *
16 */
17
18#ifndef __MFD_PM8038_H
19#define __MFD_PM8038_H
20
21#include <linux/device.h>
22#include <linux/mfd/pm8xxx/irq.h>
23#include <linux/mfd/pm8xxx/gpio.h>
24#include <linux/mfd/pm8xxx/mpp.h>
25#include <linux/mfd/pm8xxx/pwm.h>
26#include <linux/mfd/pm8xxx/rtc.h>
27#include <linux/input/pmic8xxx-pwrkey.h>
28#include <linux/mfd/pm8xxx/misc.h>
David Collins045a76e2011-12-06 11:35:28 -080029#include <linux/regulator/pm8xxx-regulator.h>
Siddartha Mohanadossef102132011-12-19 11:30:32 -080030#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
David Keitel310eb682012-01-09 10:59:10 -080031#include <linux/mfd/pm8xxx/pm8921-charger.h>
32#include <linux/mfd/pm8xxx/pm8921-bms.h>
Amy Maloche89501012012-01-27 14:11:29 -080033#include <linux/leds-pm8xxx.h>
David Keitel310eb682012-01-09 10:59:10 -080034#include <linux/mfd/pm8xxx/ccadc.h>
Asish Bhattacharyadfe0f572012-03-19 02:45:03 -070035#include <linux/mfd/pm8xxx/spk.h>
Jay Chokshi9d36a3d2011-10-26 15:57:51 -070036
37#define PM8038_CORE_DEV_NAME "pm8038-core"
38
39#define PM8038_NR_IRQS 256
40#define PM8038_NR_GPIOS 12
41#define PM8038_NR_MPPS 6
42
43#define PM8038_GPIO_BLOCK_START 24
44#define PM8038_MPP_BLOCK_START 16
45
46#define PM8038_IRQ_BLOCK_BIT(block, bit) ((block) * 8 + (bit))
47
48/* GPIO and MPPs [1,N] */
49#define PM8038_GPIO_IRQ(base, gpio) ((base) + \
50 PM8038_IRQ_BLOCK_BIT(PM8038_GPIO_BLOCK_START, (gpio)-1))
51#define PM8038_MPP_IRQ(base, mpp) ((base) + \
52 PM8038_IRQ_BLOCK_BIT(PM8038_MPP_BLOCK_START, (mpp)-1))
53
54/* PMIC Interrupts */
55#define PM8038_RTC_ALARM_IRQ PM8038_IRQ_BLOCK_BIT(4, 7)
56#define PM8038_PWRKEY_REL_IRQ PM8038_IRQ_BLOCK_BIT(6, 2)
57#define PM8038_PWRKEY_PRESS_IRQ PM8038_IRQ_BLOCK_BIT(6, 3)
58#define PM8038_KEYPAD_IRQ PM8038_IRQ_BLOCK_BIT(9, 2)
59#define PM8038_KEYSTUCK_IRQ PM8038_IRQ_BLOCK_BIT(9, 3)
Siddartha Mohanadossef102132011-12-19 11:30:32 -080060#define PM8038_ADC_EOC_USR_IRQ PM8038_IRQ_BLOCK_BIT(9, 6)
61#define PM8038_ADC_BATT_TEMP_WARM_IRQ PM8038_IRQ_BLOCK_BIT(9, 1)
62#define PM8038_ADC_BATT_TEMP_COLD_IRQ PM8038_IRQ_BLOCK_BIT(9, 0)
Jay Chokshi9d36a3d2011-10-26 15:57:51 -070063#define PM8038_USB_ID_IN_IRQ(base) (base + PM8921_IRQ_BLOCK_BIT(6, 1))
64
65#define PM8038_RESOUT_IRQ PM8038_IRQ_BLOCK_BIT(6, 4)
66
67struct pm8038_platform_data {
68 int irq_base;
69 struct pm8xxx_gpio_platform_data *gpio_pdata;
70 struct pm8xxx_irq_platform_data *irq_pdata;
71 struct pm8xxx_mpp_platform_data *mpp_pdata;
72 struct pm8xxx_rtc_platform_data *rtc_pdata;
73 struct pm8xxx_pwrkey_platform_data *pwrkey_pdata;
74 struct pm8xxx_misc_platform_data *misc_pdata;
David Collins045a76e2011-12-06 11:35:28 -080075 struct pm8xxx_regulator_platform_data *regulator_pdatas;
76 int num_regulators;
David Keitel310eb682012-01-09 10:59:10 -080077 struct pm8921_charger_platform_data *charger_pdata;
78 struct pm8921_bms_platform_data *bms_pdata;
Siddartha Mohanadossef102132011-12-19 11:30:32 -080079 struct pm8xxx_adc_platform_data *adc_pdata;
Amy Maloche89501012012-01-27 14:11:29 -080080 struct pm8xxx_led_platform_data *leds_pdata;
David Keitel310eb682012-01-09 10:59:10 -080081 struct pm8xxx_ccadc_platform_data *ccadc_pdata;
Asish Bhattacharyadfe0f572012-03-19 02:45:03 -070082 struct pm8xxx_spk_platform_data *spk_pdata;
Jay Chokshi9d36a3d2011-10-26 15:57:51 -070083};
84
85#endif