blob: 574dab672fd5084a5a816e0833f9ab2dff592295 [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>
David Collinseff4bd52012-06-21 15:31:13 -070036#include <linux/mfd/pm8xxx/tm.h>
Jay Chokshi9d36a3d2011-10-26 15:57:51 -070037
38#define PM8038_CORE_DEV_NAME "pm8038-core"
39
40#define PM8038_NR_IRQS 256
41#define PM8038_NR_GPIOS 12
42#define PM8038_NR_MPPS 6
43
44#define PM8038_GPIO_BLOCK_START 24
45#define PM8038_MPP_BLOCK_START 16
46
47#define PM8038_IRQ_BLOCK_BIT(block, bit) ((block) * 8 + (bit))
48
49/* GPIO and MPPs [1,N] */
50#define PM8038_GPIO_IRQ(base, gpio) ((base) + \
51 PM8038_IRQ_BLOCK_BIT(PM8038_GPIO_BLOCK_START, (gpio)-1))
52#define PM8038_MPP_IRQ(base, mpp) ((base) + \
53 PM8038_IRQ_BLOCK_BIT(PM8038_MPP_BLOCK_START, (mpp)-1))
54
55/* PMIC Interrupts */
56#define PM8038_RTC_ALARM_IRQ PM8038_IRQ_BLOCK_BIT(4, 7)
Abhijeet Dharmapurikar6d538142012-09-24 13:04:37 -070057#define PM8038_BATT_ALARM_IRQ PM8921_IRQ_BLOCK_BIT(5, 6)
Jay Chokshi9d36a3d2011-10-26 15:57:51 -070058#define PM8038_PWRKEY_REL_IRQ PM8038_IRQ_BLOCK_BIT(6, 2)
59#define PM8038_PWRKEY_PRESS_IRQ PM8038_IRQ_BLOCK_BIT(6, 3)
60#define PM8038_KEYPAD_IRQ PM8038_IRQ_BLOCK_BIT(9, 2)
61#define PM8038_KEYSTUCK_IRQ PM8038_IRQ_BLOCK_BIT(9, 3)
Siddartha Mohanadossef102132011-12-19 11:30:32 -080062#define PM8038_ADC_EOC_USR_IRQ PM8038_IRQ_BLOCK_BIT(9, 6)
63#define PM8038_ADC_BATT_TEMP_WARM_IRQ PM8038_IRQ_BLOCK_BIT(9, 1)
64#define PM8038_ADC_BATT_TEMP_COLD_IRQ PM8038_IRQ_BLOCK_BIT(9, 0)
Jay Chokshi9d36a3d2011-10-26 15:57:51 -070065#define PM8038_USB_ID_IN_IRQ(base) (base + PM8921_IRQ_BLOCK_BIT(6, 1))
66
67#define PM8038_RESOUT_IRQ PM8038_IRQ_BLOCK_BIT(6, 4)
68
David Collinseff4bd52012-06-21 15:31:13 -070069#define PM8038_OVERTEMP_IRQ PM8038_IRQ_BLOCK_BIT(4, 2)
70#define PM8038_TEMPSTAT_IRQ PM8038_IRQ_BLOCK_BIT(6, 7)
71
Jay Chokshi9d36a3d2011-10-26 15:57:51 -070072struct pm8038_platform_data {
73 int irq_base;
74 struct pm8xxx_gpio_platform_data *gpio_pdata;
75 struct pm8xxx_irq_platform_data *irq_pdata;
76 struct pm8xxx_mpp_platform_data *mpp_pdata;
77 struct pm8xxx_rtc_platform_data *rtc_pdata;
78 struct pm8xxx_pwrkey_platform_data *pwrkey_pdata;
79 struct pm8xxx_misc_platform_data *misc_pdata;
David Collins045a76e2011-12-06 11:35:28 -080080 struct pm8xxx_regulator_platform_data *regulator_pdatas;
81 int num_regulators;
David Keitel310eb682012-01-09 10:59:10 -080082 struct pm8921_charger_platform_data *charger_pdata;
83 struct pm8921_bms_platform_data *bms_pdata;
Siddartha Mohanadossef102132011-12-19 11:30:32 -080084 struct pm8xxx_adc_platform_data *adc_pdata;
Amy Maloche89501012012-01-27 14:11:29 -080085 struct pm8xxx_led_platform_data *leds_pdata;
David Keitel310eb682012-01-09 10:59:10 -080086 struct pm8xxx_ccadc_platform_data *ccadc_pdata;
Asish Bhattacharyadfe0f572012-03-19 02:45:03 -070087 struct pm8xxx_spk_platform_data *spk_pdata;
Jay Chokshi9d36a3d2011-10-26 15:57:51 -070088};
89
90#endif