blob: e733842970a45a08798805acfaf0d47bb3257a5c [file] [log] [blame]
Jay Chokshi9d36a3d2011-10-26 15:57:51 -07001/*
2 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
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 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>
Jay Chokshi9d36a3d2011-10-26 15:57:51 -070031
32#define PM8038_CORE_DEV_NAME "pm8038-core"
33
34#define PM8038_NR_IRQS 256
35#define PM8038_NR_GPIOS 12
36#define PM8038_NR_MPPS 6
37
38#define PM8038_GPIO_BLOCK_START 24
39#define PM8038_MPP_BLOCK_START 16
40
41#define PM8038_IRQ_BLOCK_BIT(block, bit) ((block) * 8 + (bit))
42
43/* GPIO and MPPs [1,N] */
44#define PM8038_GPIO_IRQ(base, gpio) ((base) + \
45 PM8038_IRQ_BLOCK_BIT(PM8038_GPIO_BLOCK_START, (gpio)-1))
46#define PM8038_MPP_IRQ(base, mpp) ((base) + \
47 PM8038_IRQ_BLOCK_BIT(PM8038_MPP_BLOCK_START, (mpp)-1))
48
49/* PMIC Interrupts */
50#define PM8038_RTC_ALARM_IRQ PM8038_IRQ_BLOCK_BIT(4, 7)
51#define PM8038_PWRKEY_REL_IRQ PM8038_IRQ_BLOCK_BIT(6, 2)
52#define PM8038_PWRKEY_PRESS_IRQ PM8038_IRQ_BLOCK_BIT(6, 3)
53#define PM8038_KEYPAD_IRQ PM8038_IRQ_BLOCK_BIT(9, 2)
54#define PM8038_KEYSTUCK_IRQ PM8038_IRQ_BLOCK_BIT(9, 3)
Siddartha Mohanadossef102132011-12-19 11:30:32 -080055#define PM8038_ADC_EOC_USR_IRQ PM8038_IRQ_BLOCK_BIT(9, 6)
56#define PM8038_ADC_BATT_TEMP_WARM_IRQ PM8038_IRQ_BLOCK_BIT(9, 1)
57#define PM8038_ADC_BATT_TEMP_COLD_IRQ PM8038_IRQ_BLOCK_BIT(9, 0)
Jay Chokshi9d36a3d2011-10-26 15:57:51 -070058#define PM8038_USB_ID_IN_IRQ(base) (base + PM8921_IRQ_BLOCK_BIT(6, 1))
59
60#define PM8038_RESOUT_IRQ PM8038_IRQ_BLOCK_BIT(6, 4)
61
62struct pm8038_platform_data {
63 int irq_base;
64 struct pm8xxx_gpio_platform_data *gpio_pdata;
65 struct pm8xxx_irq_platform_data *irq_pdata;
66 struct pm8xxx_mpp_platform_data *mpp_pdata;
67 struct pm8xxx_rtc_platform_data *rtc_pdata;
68 struct pm8xxx_pwrkey_platform_data *pwrkey_pdata;
69 struct pm8xxx_misc_platform_data *misc_pdata;
David Collins045a76e2011-12-06 11:35:28 -080070 struct pm8xxx_regulator_platform_data *regulator_pdatas;
71 int num_regulators;
Siddartha Mohanadossef102132011-12-19 11:30:32 -080072 struct pm8xxx_adc_platform_data *adc_pdata;
Jay Chokshi9d36a3d2011-10-26 15:57:51 -070073};
74
75#endif