blob: c7ef2719c220b585b851914dd6db37009cde7469 [file] [log] [blame]
Russell Kinga09e64f2008-08-05 16:14:15 +01001/* arch/arm/mach-msm/include/mach/board.h
2 *
3 * Copyright (C) 2007 Google, Inc.
Nagamalleswararao Ganji70fac1e2011-12-29 19:06:37 -08004 * Copyright (c) 2008-2012, Code Aurora Forum. All rights reserved.
Russell Kinga09e64f2008-08-05 16:14:15 +01005 * Author: Brian Swetland <swetland@google.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef __ASM_ARCH_MSM_BOARD_H
19#define __ASM_ARCH_MSM_BOARD_H
20
21#include <linux/types.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070022#include <linux/input.h>
23#include <linux/usb.h>
24#include <linux/leds-pmic8058.h>
25#include <linux/clkdev.h>
Sathish Ambleyc58afc22011-10-09 21:55:39 -070026#include <linux/of_platform.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070027#include <linux/msm_ssbi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070028#include <mach/msm_bus.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010029
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030struct msm_camera_io_ext {
31 uint32_t mdcphy;
32 uint32_t mdcsz;
33 uint32_t appphy;
34 uint32_t appsz;
35 uint32_t camifpadphy;
36 uint32_t camifpadsz;
37 uint32_t csiphy;
38 uint32_t csisz;
39 uint32_t csiirq;
40 uint32_t csiphyphy;
41 uint32_t csiphysz;
42 uint32_t csiphyirq;
43 uint32_t ispifphy;
44 uint32_t ispifsz;
45 uint32_t ispifirq;
46};
47
48struct msm_camera_io_clk {
49 uint32_t mclk_clk_rate;
50 uint32_t vfe_clk_rate;
51};
52
Nishant Pandit474f2252011-07-23 23:17:56 +053053struct msm_cam_expander_info {
54 struct i2c_board_info const *board_info;
55 int bus_id;
56};
57
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070058struct msm_camera_device_platform_data {
59 int (*camera_gpio_on) (void);
60 void (*camera_gpio_off)(void);
61 struct msm_camera_io_ext ioext;
62 struct msm_camera_io_clk ioclk;
63 uint8_t csid_core;
Suresh Vankadara8df2c752012-01-18 00:18:03 +053064 uint8_t is_csiphy;
65 uint8_t is_csic;
66 uint8_t is_csid;
67 uint8_t is_ispif;
68 uint8_t is_vpe;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070069 struct msm_bus_scale_pdata *cam_bus_scale_table;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070070};
71enum msm_camera_csi_data_format {
72 CSI_8BIT,
73 CSI_10BIT,
74 CSI_12BIT,
75};
76struct msm_camera_csi_params {
77 enum msm_camera_csi_data_format data_format;
78 uint8_t lane_cnt;
79 uint8_t lane_assign;
80 uint8_t settle_cnt;
81 uint8_t dpcm_scheme;
82};
83
84#ifdef CONFIG_SENSORS_MT9T013
85struct msm_camera_legacy_device_platform_data {
86 int sensor_reset;
87 int sensor_pwd;
88 int vcm_pwd;
89 void (*config_gpio_on) (void);
90 void (*config_gpio_off)(void);
91};
92#endif
93
94#define MSM_CAMERA_FLASH_NONE 0
95#define MSM_CAMERA_FLASH_LED 1
96
97#define MSM_CAMERA_FLASH_SRC_PMIC (0x00000001<<0)
98#define MSM_CAMERA_FLASH_SRC_PWM (0x00000001<<1)
99#define MSM_CAMERA_FLASH_SRC_CURRENT_DRIVER (0x00000001<<2)
Nishant Pandit474f2252011-07-23 23:17:56 +0530100#define MSM_CAMERA_FLASH_SRC_EXT (0x00000001<<3)
Taniya Das7a22cdd2011-09-08 14:57:00 +0530101#define MSM_CAMERA_FLASH_SRC_LED (0x00000001<<3)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700102
103struct msm_camera_sensor_flash_pmic {
104 uint8_t num_of_src;
105 uint32_t low_current;
106 uint32_t high_current;
107 enum pmic8058_leds led_src_1;
108 enum pmic8058_leds led_src_2;
109 int (*pmic_set_current)(enum pmic8058_leds id, unsigned mA);
110};
111
112struct msm_camera_sensor_flash_pwm {
113 uint32_t freq;
114 uint32_t max_load;
115 uint32_t low_load;
116 uint32_t high_load;
117 uint32_t channel;
118};
119
120struct pmic8058_leds_platform_data;
121struct msm_camera_sensor_flash_current_driver {
122 uint32_t low_current;
123 uint32_t high_current;
124 const struct pmic8058_leds_platform_data *driver_channel;
Nishant Pandit474f2252011-07-23 23:17:56 +0530125};
126
127struct msm_camera_sensor_flash_external {
128 uint32_t led_en;
129 uint32_t led_flash_en;
130 struct msm_cam_expander_info *expander_info;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700131};
132
Taniya Das7a22cdd2011-09-08 14:57:00 +0530133struct msm_camera_sensor_flash_led {
134 const char *led_name;
135 const int led_name_len;
136};
137
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700138struct msm_camera_sensor_flash_src {
139 int flash_sr_type;
140
141 union {
142 struct msm_camera_sensor_flash_pmic pmic_src;
143 struct msm_camera_sensor_flash_pwm pwm_src;
144 struct msm_camera_sensor_flash_current_driver
145 current_driver_src;
Nishant Pandit474f2252011-07-23 23:17:56 +0530146 struct msm_camera_sensor_flash_external
147 ext_driver_src;
Taniya Das7a22cdd2011-09-08 14:57:00 +0530148 struct msm_camera_sensor_flash_led led_src;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700149 } _fsrc;
150};
151
152struct msm_camera_sensor_flash_data {
153 int flash_type;
154 struct msm_camera_sensor_flash_src *flash_src;
155};
156
157struct msm_camera_sensor_strobe_flash_data {
158 uint8_t flash_trigger;
159 uint8_t flash_charge; /* pin for charge */
160 uint8_t flash_charge_done;
161 uint32_t flash_recharge_duration;
162 uint32_t irq;
163 spinlock_t spin_lock;
164 spinlock_t timer_lock;
165 int state;
166};
167
Nishant Pandit24153d82011-08-27 16:05:13 +0530168enum msm_camera_type {
169 BACK_CAMERA_2D,
170 FRONT_CAMERA_2D,
171 BACK_CAMERA_3D,
172 BACK_CAMERA_INT_3D,
173};
174
Kevin Chaneb6b6072012-01-17 11:54:54 -0800175enum camera_vreg_type {
176 REG_LDO,
177 REG_VS,
Kevin Chan8b0d2322011-09-10 21:06:31 -0700178};
179
Kevin Chaneb6b6072012-01-17 11:54:54 -0800180struct camera_vreg_t {
181 char *reg_name;
182 enum camera_vreg_type type;
183 int min_voltage;
184 int max_voltage;
185 int op_mode;
186};
187
188struct msm_gpio_set_tbl {
189 unsigned gpio;
190 unsigned long flags;
191 uint32_t delay;
Nishant Pandit24153d82011-08-27 16:05:13 +0530192};
193
194struct msm_camera_gpio_conf {
195 void *cam_gpiomux_conf_tbl;
196 uint8_t cam_gpiomux_conf_tbl_size;
Kevin Chaneb6b6072012-01-17 11:54:54 -0800197 struct gpio *cam_gpio_common_tbl;
198 uint8_t cam_gpio_common_tbl_size;
199 struct gpio *cam_gpio_req_tbl;
200 uint8_t cam_gpio_req_tbl_size;
201 struct msm_gpio_set_tbl *cam_gpio_set_tbl;
202 uint8_t cam_gpio_set_tbl_size;
203};
204
205struct msm_camera_sensor_platform_info {
206 int mount_angle;
207 int sensor_reset;
208 struct camera_vreg_t *cam_vreg;
209 int num_vreg;
210 int32_t (*ext_power_ctrl) (int enable);
211 struct msm_camera_gpio_conf *gpio_conf;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700212};
213
Sreesudhan Ramakrish Ramkumara4b5f302011-09-12 16:23:22 -0700214struct msm_actuator_info {
215 struct i2c_board_info const *board_info;
216 int bus_id;
217 int vcm_pwd;
218 int vcm_enable;
219};
220
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700221struct msm_camera_sensor_info {
222 const char *sensor_name;
223 int sensor_reset_enable;
224 int sensor_reset;
225 int sensor_pwd;
226 int vcm_pwd;
227 int vcm_enable;
228 int mclk;
229 int flash_type;
230 struct msm_camera_sensor_platform_info *sensor_platform_info;
231 struct msm_camera_device_platform_data *pdata;
232 struct resource *resource;
233 uint8_t num_resources;
234 struct msm_camera_sensor_flash_data *flash_data;
235 int csi_if;
236 struct msm_camera_csi_params csi_params;
237 struct msm_camera_sensor_strobe_flash_data *strobe_flash_data;
238 char *eeprom_data;
Nishant Pandit24153d82011-08-27 16:05:13 +0530239 enum msm_camera_type camera_type;
Sreesudhan Ramakrish Ramkumara4b5f302011-09-12 16:23:22 -0700240 struct msm_actuator_info *actuator_info;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700241};
242
Kevin Chan09f4e662011-12-16 08:17:02 -0800243struct msm_camera_board_info {
244 struct i2c_board_info *board_info;
245 uint8_t num_i2c_board_info;
246};
247
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700248int msm_get_cam_resources(struct msm_camera_sensor_info *);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700249
Stephen Boydbd323442011-02-23 09:37:42 -0800250struct clk_lookup;
Daniel Walker5e96da52010-05-12 13:43:28 -0700251
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700252struct snd_endpoint {
253 int id;
254 const char *name;
255};
Steve Mucklea55df6e2010-01-07 12:43:24 -0800256
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700257struct msm_snd_endpoints {
258 struct snd_endpoint *endpoints;
259 unsigned num;
260};
261
262#define MSM_MAX_DEC_CNT 14
263/* 7k target ADSP information */
264/* Bit 23:0, for codec identification like mp3, wav etc *
265 * Bit 27:24, for mode identification like tunnel, non tunnel*
266 * bit 31:28, for operation support like DM, DMA */
267enum msm_adspdec_concurrency {
268 MSM_ADSP_CODEC_WAV = 0,
269 MSM_ADSP_CODEC_ADPCM = 1,
270 MSM_ADSP_CODEC_MP3 = 2,
271 MSM_ADSP_CODEC_REALAUDIO = 3,
272 MSM_ADSP_CODEC_WMA = 4,
273 MSM_ADSP_CODEC_AAC = 5,
274 MSM_ADSP_CODEC_RESERVED = 6,
275 MSM_ADSP_CODEC_MIDI = 7,
276 MSM_ADSP_CODEC_YADPCM = 8,
277 MSM_ADSP_CODEC_QCELP = 9,
278 MSM_ADSP_CODEC_AMRNB = 10,
279 MSM_ADSP_CODEC_AMRWB = 11,
280 MSM_ADSP_CODEC_EVRC = 12,
281 MSM_ADSP_CODEC_WMAPRO = 13,
282 MSM_ADSP_MODE_TUNNEL = 24,
283 MSM_ADSP_MODE_NONTUNNEL = 25,
284 MSM_ADSP_MODE_LP = 26,
285 MSM_ADSP_OP_DMA = 28,
286 MSM_ADSP_OP_DM = 29,
287};
288
289struct msm_adspdec_info {
290 const char *module_name;
291 unsigned module_queueid;
292 int module_decid; /* objid */
293 unsigned nr_codec_support;
294};
295
296/* Carries information about number codec
297 * supported if same codec or different codecs
298 */
299struct dec_instance_table {
300 uint8_t max_instances_same_dec;
301 uint8_t max_instances_diff_dec;
302};
303
304struct msm_adspdec_database {
305 unsigned num_dec;
306 unsigned num_concurrency_support;
307 unsigned int *dec_concurrency_table; /* Bit masked entry to *
308 * represents codec, mode etc */
309 struct msm_adspdec_info *dec_info_list;
310 struct dec_instance_table *dec_instance_list;
311};
312
313enum msm_mdp_hw_revision {
314 MDP_REV_20 = 1,
315 MDP_REV_22,
316 MDP_REV_30,
317 MDP_REV_303,
318 MDP_REV_31,
319 MDP_REV_40,
320 MDP_REV_41,
321 MDP_REV_42,
Huaibin Yang4a084e32011-12-15 15:25:52 -0800322 MDP_REV_43,
323 MDP_REV_44,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700324};
325
326struct msm_panel_common_pdata {
327 uintptr_t hw_revision_addr;
328 int gpio;
329 int (*backlight_level)(int level, int max, int min);
330 int (*pmic_backlight)(int level);
331 int (*panel_num)(void);
332 void (*panel_config_gpio)(int);
333 int (*vga_switch)(int select_vga);
334 int *gpio_num;
335 int mdp_core_clk_rate;
336 unsigned num_mdp_clk;
337 int *mdp_core_clk_table;
338#ifdef CONFIG_MSM_BUS_SCALING
339 struct msm_bus_scale_pdata *mdp_bus_scale_table;
340#endif
341 int mdp_rev;
Nagamalleswararao Ganji937a1192011-12-07 19:00:52 -0800342 u32 ov0_wb_size; /* overlay0 writeback size */
343 u32 ov1_wb_size; /* overlay1 writeback size */
344 u32 mem_hid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700345};
346
Huaibin Yanga5419422011-12-08 23:52:10 -0800347
348
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700349struct lcdc_platform_data {
350 int (*lcdc_gpio_config)(int on);
351 int (*lcdc_power_save)(int);
352 unsigned int (*lcdc_get_clk)(void);
353#ifdef CONFIG_MSM_BUS_SCALING
354 struct msm_bus_scale_pdata *bus_scale_table;
355#endif
356};
357
358struct tvenc_platform_data {
359 int poll;
360 int (*pm_vid_en)(int on);
361#ifdef CONFIG_MSM_BUS_SCALING
362 struct msm_bus_scale_pdata *bus_scale_table;
363#endif
364};
365
366struct mddi_platform_data {
367 int (*mddi_power_save)(int on);
368 int (*mddi_sel_clk)(u32 *clk_rate);
369 int (*mddi_client_power)(u32 client_id);
370};
371
372struct mipi_dsi_platform_data {
373 int vsync_gpio;
374 int (*dsi_power_save)(int on);
375 int (*dsi_client_reset)(void);
376 int (*get_lane_config)(void);
377 int target_type;
378};
379
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -0700380enum mipi_dsi_3d_ctrl {
381 FPGA_EBI2_INTF,
382 FPGA_SPI_INTF,
383};
384
385/* DSI PHY configuration */
386struct mipi_dsi_phy_ctrl {
387 uint32_t regulator[5];
388 uint32_t timing[12];
389 uint32_t ctrl[4];
390 uint32_t strength[4];
391 uint32_t pll[21];
392};
393
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700394struct mipi_dsi_panel_platform_data {
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -0700395 int fpga_ctrl_mode;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700396 int fpga_3d_config_addr;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700397 int *gpio;
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -0700398 struct mipi_dsi_phy_ctrl *phy_ctrl_settings;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700399};
400
401struct msm_fb_platform_data {
402 int (*detect_client)(const char *name);
403 int mddi_prescan;
404 int (*allow_set_offset)(void);
405};
406
407struct msm_hdmi_platform_data {
408 int irq;
409 int (*cable_detect)(int insert);
410 int (*comm_power)(int on, int show);
411 int (*enable_5v)(int on);
412 int (*core_power)(int on, int show);
413 int (*cec_power)(int on);
414 int (*init_irq)(void);
415 bool (*check_hdcp_hw_support)(void);
416};
417
418struct msm_i2c_platform_data {
419 int clk_freq;
420 uint32_t rmutex;
421 const char *rsl_id;
422 uint32_t pm_lat;
423 int pri_clk;
424 int pri_dat;
425 int aux_clk;
426 int aux_dat;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700427 int src_clk_rate;
428 int use_gsbi_shared_mode;
429 void (*msm_i2c_config_gpio)(int iface, int config_type);
430};
431
432struct msm_i2c_ssbi_platform_data {
433 const char *rsl_id;
434 enum msm_ssbi_controller_type controller_type;
435};
436
437struct msm_vidc_platform_data {
438 int memtype;
Deepak Koturcb4f6722011-10-31 14:06:57 -0700439 u32 enable_ion;
Deepika Pepakayalabebc7622011-12-01 15:13:43 -0800440 int disable_dmx;
Rajeshwar Kurapatyc155c352011-12-17 06:35:32 +0530441 int disable_fullhd;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700442#ifdef CONFIG_MSM_BUS_SCALING
443 struct msm_bus_scale_pdata *vidc_bus_client_pdata;
444#endif
445};
446
447#if defined(CONFIG_USB_PEHCI_HCD) || defined(CONFIG_USB_PEHCI_HCD_MODULE)
448struct isp1763_platform_data {
449 unsigned reset_gpio;
450 int (*setup_gpio)(int enable);
451};
452#endif
Russell Kinga09e64f2008-08-05 16:14:15 +0100453/* common init routines for use by arch/arm/mach-msm/board-*.c */
454
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700455#ifdef CONFIG_OF_DEVICE
456void msm_copper_init(struct of_dev_auxdata **);
457#endif
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700458void msm_add_devices(void);
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700459void msm_copper_add_devices(void);
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700460void msm_map_common_io(void);
461void msm_map_qsd8x50_io(void);
462void msm_map_msm8x60_io(void);
463void msm_map_msm8960_io(void);
464void msm_map_msm8930_io(void);
465void msm_map_apq8064_io(void);
466void msm_map_msm7x30_io(void);
467void msm_map_fsm9xxx_io(void);
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700468void msm_map_copper_io(void);
Taniya Das43bcdd62011-12-02 17:33:27 +0530469void msm_map_msm8625_io(void);
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700470void msm_init_irq(void);
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700471void msm_copper_init_irq(void);
Taniya Das86e0e132011-10-19 11:32:00 +0530472void vic_handle_irq(struct pt_regs *regs);
Olav Hauganb800c8c2012-01-30 08:50:45 -0800473void msm_copper_reserve(void);
474void msm_copper_very_early(void);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700475
476struct mmc_platform_data;
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700477int msm_add_sdcc(unsigned int controller,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700478 struct mmc_platform_data *plat);
479
480struct msm_usb_host_platform_data;
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700481int msm_add_host(unsigned int host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700482 struct msm_usb_host_platform_data *plat);
483#if defined(CONFIG_USB_FUNCTION_MSM_HSUSB) \
484 || defined(CONFIG_USB_MSM_72K) || defined(CONFIG_USB_MSM_72K_MODULE)
485void msm_hsusb_set_vbus_state(int online);
486#else
487static inline void msm_hsusb_set_vbus_state(int online) {}
488#endif
489
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700490void msm_snddev_init(void);
491void msm_snddev_init_timpani(void);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700492void msm_snddev_poweramp_on(void);
493void msm_snddev_poweramp_off(void);
494void msm_snddev_hsed_voltage_on(void);
495void msm_snddev_hsed_voltage_off(void);
496void msm_snddev_tx_route_config(void);
497void msm_snddev_tx_route_deconfig(void);
498
499extern unsigned int msm_shared_ram_phys; /* defined in arch/arm/mach-msm/io.c */
500
Russell Kinga09e64f2008-08-05 16:14:15 +0100501
502#endif