blob: 67e0e6f44f3db9dc9d949009f47b8a5d6ba20140 [file] [log] [blame]
Kevin Chan412e9f92012-01-24 10:45:23 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Jay Chokshiea67c622011-07-29 17:12:26 -07002 *
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#ifndef __ARCH_ARM_MACH_MSM_BOARD_APQ8064_H
14#define __ARCH_ARM_MACH_MSM_BOARD_APQ8064_H
15
David Collinsf0d00732012-01-25 15:46:50 -080016#include <linux/regulator/gpio-regulator.h>
Jay Chokshiea67c622011-07-29 17:12:26 -070017#include <linux/mfd/pm8xxx/pm8921.h>
Jay Chokshi44873f72011-08-30 17:24:26 -070018#include <linux/mfd/pm8xxx/pm8821.h>
Huaibin Yang4a084e32011-12-15 15:25:52 -080019#include <mach/msm_memtypes.h>
David Collinsf0d00732012-01-25 15:46:50 -080020#include <mach/irqs.h>
David Collins2782b5c2012-02-06 10:02:42 -080021#include <mach/rpm-regulator.h>
Laura Abbott532b2df2012-04-12 10:53:48 -070022#include <mach/msm_rtb.h>
David Collinsf0d00732012-01-25 15:46:50 -080023
Jay Chokshibc3d98d2011-08-10 17:14:23 -070024/* Macros assume PMIC GPIOs and MPPs start at 1 */
25#define PM8921_GPIO_BASE NR_GPIO_IRQS
26#define PM8921_GPIO_PM_TO_SYS(pm_gpio) (pm_gpio - 1 + PM8921_GPIO_BASE)
27#define PM8921_MPP_BASE (PM8921_GPIO_BASE + PM8921_NR_GPIOS)
28#define PM8921_MPP_PM_TO_SYS(pm_mpp) (pm_mpp - 1 + PM8921_MPP_BASE)
29#define PM8921_IRQ_BASE (NR_MSM_IRQS + NR_GPIO_IRQS)
30
Jay Chokshi44873f72011-08-30 17:24:26 -070031#define PM8821_MPP_BASE (PM8921_MPP_BASE + PM8921_NR_MPPS)
32#define PM8821_MPP_PM_TO_SYS(pm_mpp) (pm_mpp - 1 + PM8821_MPP_BASE)
33#define PM8821_IRQ_BASE (PM8921_IRQ_BASE + PM8921_NR_IRQS)
34
Swaminathan Sathappan1707d4a2012-04-02 14:42:28 -070035#define TABLA_INTERRUPT_BASE (PM8821_IRQ_BASE + PM8821_NR_IRQS)
36
David Collins75016742011-12-02 15:04:25 -080037extern struct pm8xxx_regulator_platform_data
Jay Chokshiea67c622011-07-29 17:12:26 -070038 msm8064_pm8921_regulator_pdata[] __devinitdata;
39
40extern int msm8064_pm8921_regulator_pdata_len __devinitdata;
Sahitya Tummala3586ed92011-08-03 09:13:23 +053041
David Collinsf0d00732012-01-25 15:46:50 -080042#define GPIO_VREG_ID_EXT_5V 0
43#define GPIO_VREG_ID_EXT_3P3V 1
David Collins390fc332012-02-07 14:38:16 -080044#define GPIO_VREG_ID_EXT_TS_SW 2
Jay Chokshi1de4f9d2012-02-07 16:11:31 -080045#define GPIO_VREG_ID_EXT_MPP8 3
David Collinsf0d00732012-01-25 15:46:50 -080046
Jay Chokshi1b7eaa92012-04-04 14:53:14 -070047#define GPIO_VREG_ID_FRC_5V 0
48#define GPIO_VREG_ID_AVC_1P2V 1
49#define GPIO_VREG_ID_AVC_1P8V 2
50#define GPIO_VREG_ID_AVC_2P2V 3
51#define GPIO_VREG_ID_AVC_5V 4
52#define GPIO_VREG_ID_AVC_3P3V 5
53
David Collinsf0d00732012-01-25 15:46:50 -080054#define APQ8064_EXT_3P3V_REG_EN_GPIO 77
55
56extern struct gpio_regulator_platform_data
57 apq8064_gpio_regulator_pdata[] __devinitdata;
58
Jay Chokshi1b7eaa92012-04-04 14:53:14 -070059extern struct gpio_regulator_platform_data
60 mpq8064_gpio_regulator_pdata[] __devinitdata;
61
David Collins2782b5c2012-02-06 10:02:42 -080062extern struct rpm_regulator_platform_data
63 apq8064_rpm_regulator_pdata __devinitdata;
64
Jay Chokshi7805b5a2011-11-07 15:55:30 -080065extern struct regulator_init_data msm8064_saw_regulator_pdata_8921_s5;
66extern struct regulator_init_data msm8064_saw_regulator_pdata_8921_s6;
67extern struct regulator_init_data msm8064_saw_regulator_pdata_8821_s0;
68extern struct regulator_init_data msm8064_saw_regulator_pdata_8821_s1;
69
Sahitya Tummala3586ed92011-08-03 09:13:23 +053070struct mmc_platform_data;
71int __init apq8064_add_sdcc(unsigned int controller,
72 struct mmc_platform_data *plat);
73
Stepan Moskovchenkoe438b632011-12-06 13:44:03 -080074void apq8064_init_mmc(void);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -080075void apq8064_init_gpiomux(void);
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -080076void apq8064_init_pmic(void);
Jordan Crouseb3115fe2012-02-01 22:11:12 -070077
Kevin Chan412e9f92012-01-24 10:45:23 -080078extern struct msm_camera_board_info apq8064_camera_board_info;
79void apq8064_init_cam(void);
David Keitel3c40fc52012-02-09 17:53:52 -080080
81#define APQ_8064_GSBI1_QUP_I2C_BUS_ID 0
Jing Lin04601f92012-02-05 15:36:07 -080082#define APQ_8064_GSBI3_QUP_I2C_BUS_ID 3
Kevin Chan412e9f92012-01-24 10:45:23 -080083#define APQ_8064_GSBI4_QUP_I2C_BUS_ID 4
Santosh Mardieff9a742012-04-09 23:23:39 +053084#define APQ_8064_GSBI5_QUP_I2C_BUS_ID 5
Huaibin Yang4a084e32011-12-15 15:25:52 -080085
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -070086unsigned char apq8064_hdmi_as_primary_selected(void);
Huaibin Yang4a084e32011-12-15 15:25:52 -080087void apq8064_init_fb(void);
88void apq8064_allocate_fb_region(void);
89void apq8064_mdp_writeback(struct memtype_reserve *reserve_table);
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -070090void __init apq8064_set_display_params(char *prim_panel, char *ext_panel);
Jordan Crouseb3115fe2012-02-01 22:11:12 -070091
92void apq8064_init_gpu(void);
Jay Chokshie8741282012-01-25 15:22:55 -080093void apq8064_pm8xxx_gpio_mpp_init(void);
Jordan Crouseb3115fe2012-02-01 22:11:12 -070094
Jay Chokshie7d8d4f2012-04-04 14:47:57 -070095#define PLATFORM_IS_MPQ8064() \
96 (machine_is_mpq8064_hrd() || \
97 machine_is_mpq8064_dtv() || \
98 machine_is_mpq8064_cdp() \
99 )
100
101
102#define GPIO_EXPANDER_IRQ_BASE (TABLA_INTERRUPT_BASE + \
103 NR_TABLA_IRQS)
104#define GPIO_EXPANDER_GPIO_BASE (PM8821_MPP_BASE + PM8821_NR_MPPS)
105
106#define GPIO_EPM_EXPANDER_BASE GPIO_EXPANDER_GPIO_BASE
107#define SX150X_EPM_NR_GPIOS 16
108#define SX150X_EPM_NR_IRQS 8
109
110#define SX150X_EXP1_GPIO_BASE (GPIO_EPM_EXPANDER_BASE + \
111 SX150X_EPM_NR_GPIOS)
112#define SX150X_EXP1_IRQ_BASE (GPIO_EXPANDER_IRQ_BASE + \
113 SX150X_EPM_NR_IRQS)
114#define SX150X_EXP1_NR_IRQS 16
115#define SX150X_EXP1_NR_GPIOS 16
116
117#define SX150X_EXP2_GPIO_BASE (SX150X_EXP1_GPIO_BASE + \
118 SX150X_EXP1_NR_GPIOS)
119#define SX150X_EXP2_IRQ_BASE (SX150X_EXP1_IRQ_BASE + SX150X_EXP1_NR_IRQS)
120#define SX150X_EXP2_NR_IRQS 8
121#define SX150X_EXP2_NR_GPIOS 8
122
123#define SX150X_EXP3_GPIO_BASE (SX150X_EXP2_GPIO_BASE + \
124 SX150X_EXP2_NR_GPIOS)
125#define SX150X_EXP3_IRQ_BASE (SX150X_EXP2_IRQ_BASE + SX150X_EXP2_NR_IRQS)
126#define SX150X_EXP3_NR_IRQS 8
127#define SX150X_EXP3_NR_GPIOS 8
128
129#define SX150X_EXP4_GPIO_BASE (SX150X_EXP3_GPIO_BASE + \
130 SX150X_EXP3_NR_GPIOS)
131#define SX150X_EXP4_IRQ_BASE (SX150X_EXP3_IRQ_BASE + SX150X_EXP3_NR_IRQS)
132#define SX150X_EXP4_NR_IRQS 16
133#define SX150X_EXP4_NR_GPIOS 16
134
135#define SX150X_GPIO(_expander, _pin) (SX150X_EXP##_expander##_GPIO_BASE + _pin)
136
137enum {
138 SX150X_EPM,
139 SX150X_EXP1,
140 SX150X_EXP2,
141 SX150X_EXP3,
142 SX150X_EXP4,
143};
144
Laura Abbott532b2df2012-04-12 10:53:48 -0700145extern struct msm_rtb_platform_data apq8064_rtb_pdata;
Jay Chokshiea67c622011-07-29 17:12:26 -0700146#endif