blob: 5d22d66710a2407b914d4854cfd549e3901b5fdd [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
Kevin Chanbb8ef862012-02-14 13:03:04 -0800205enum msm_camera_i2c_mux_mode {
206 MODE_R,
207 MODE_L,
208 MODE_DUAL
209};
210
211struct msm_camera_i2c_conf {
212 uint8_t use_i2c_mux;
213 struct platform_device *mux_dev;
214 enum msm_camera_i2c_mux_mode i2c_mux_mode;
215};
216
Kevin Chaneb6b6072012-01-17 11:54:54 -0800217struct msm_camera_sensor_platform_info {
218 int mount_angle;
219 int sensor_reset;
220 struct camera_vreg_t *cam_vreg;
221 int num_vreg;
222 int32_t (*ext_power_ctrl) (int enable);
223 struct msm_camera_gpio_conf *gpio_conf;
Kevin Chanbb8ef862012-02-14 13:03:04 -0800224 struct msm_camera_i2c_conf *i2c_conf;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700225};
226
Sreesudhan Ramakrish Ramkumara4b5f302011-09-12 16:23:22 -0700227struct msm_actuator_info {
228 struct i2c_board_info const *board_info;
229 int bus_id;
230 int vcm_pwd;
231 int vcm_enable;
232};
233
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700234struct msm_camera_sensor_info {
235 const char *sensor_name;
236 int sensor_reset_enable;
237 int sensor_reset;
238 int sensor_pwd;
239 int vcm_pwd;
240 int vcm_enable;
241 int mclk;
242 int flash_type;
243 struct msm_camera_sensor_platform_info *sensor_platform_info;
244 struct msm_camera_device_platform_data *pdata;
245 struct resource *resource;
246 uint8_t num_resources;
247 struct msm_camera_sensor_flash_data *flash_data;
248 int csi_if;
249 struct msm_camera_csi_params csi_params;
250 struct msm_camera_sensor_strobe_flash_data *strobe_flash_data;
251 char *eeprom_data;
Nishant Pandit24153d82011-08-27 16:05:13 +0530252 enum msm_camera_type camera_type;
Sreesudhan Ramakrish Ramkumara4b5f302011-09-12 16:23:22 -0700253 struct msm_actuator_info *actuator_info;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700254};
255
Kevin Chan09f4e662011-12-16 08:17:02 -0800256struct msm_camera_board_info {
257 struct i2c_board_info *board_info;
258 uint8_t num_i2c_board_info;
259};
260
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700261int msm_get_cam_resources(struct msm_camera_sensor_info *);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700262
Stephen Boydbd323442011-02-23 09:37:42 -0800263struct clk_lookup;
Daniel Walker5e96da52010-05-12 13:43:28 -0700264
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700265struct snd_endpoint {
266 int id;
267 const char *name;
268};
Steve Mucklea55df6e2010-01-07 12:43:24 -0800269
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700270struct msm_snd_endpoints {
271 struct snd_endpoint *endpoints;
272 unsigned num;
273};
274
275#define MSM_MAX_DEC_CNT 14
276/* 7k target ADSP information */
277/* Bit 23:0, for codec identification like mp3, wav etc *
278 * Bit 27:24, for mode identification like tunnel, non tunnel*
279 * bit 31:28, for operation support like DM, DMA */
280enum msm_adspdec_concurrency {
281 MSM_ADSP_CODEC_WAV = 0,
282 MSM_ADSP_CODEC_ADPCM = 1,
283 MSM_ADSP_CODEC_MP3 = 2,
284 MSM_ADSP_CODEC_REALAUDIO = 3,
285 MSM_ADSP_CODEC_WMA = 4,
286 MSM_ADSP_CODEC_AAC = 5,
287 MSM_ADSP_CODEC_RESERVED = 6,
288 MSM_ADSP_CODEC_MIDI = 7,
289 MSM_ADSP_CODEC_YADPCM = 8,
290 MSM_ADSP_CODEC_QCELP = 9,
291 MSM_ADSP_CODEC_AMRNB = 10,
292 MSM_ADSP_CODEC_AMRWB = 11,
293 MSM_ADSP_CODEC_EVRC = 12,
294 MSM_ADSP_CODEC_WMAPRO = 13,
295 MSM_ADSP_MODE_TUNNEL = 24,
296 MSM_ADSP_MODE_NONTUNNEL = 25,
297 MSM_ADSP_MODE_LP = 26,
298 MSM_ADSP_OP_DMA = 28,
299 MSM_ADSP_OP_DM = 29,
300};
301
302struct msm_adspdec_info {
303 const char *module_name;
304 unsigned module_queueid;
305 int module_decid; /* objid */
306 unsigned nr_codec_support;
307};
308
309/* Carries information about number codec
310 * supported if same codec or different codecs
311 */
312struct dec_instance_table {
313 uint8_t max_instances_same_dec;
314 uint8_t max_instances_diff_dec;
315};
316
317struct msm_adspdec_database {
318 unsigned num_dec;
319 unsigned num_concurrency_support;
320 unsigned int *dec_concurrency_table; /* Bit masked entry to *
321 * represents codec, mode etc */
322 struct msm_adspdec_info *dec_info_list;
323 struct dec_instance_table *dec_instance_list;
324};
325
326enum msm_mdp_hw_revision {
327 MDP_REV_20 = 1,
328 MDP_REV_22,
329 MDP_REV_30,
330 MDP_REV_303,
331 MDP_REV_31,
332 MDP_REV_40,
333 MDP_REV_41,
334 MDP_REV_42,
Huaibin Yang4a084e32011-12-15 15:25:52 -0800335 MDP_REV_43,
336 MDP_REV_44,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700337};
338
339struct msm_panel_common_pdata {
340 uintptr_t hw_revision_addr;
341 int gpio;
342 int (*backlight_level)(int level, int max, int min);
343 int (*pmic_backlight)(int level);
344 int (*panel_num)(void);
345 void (*panel_config_gpio)(int);
346 int (*vga_switch)(int select_vga);
347 int *gpio_num;
348 int mdp_core_clk_rate;
349 unsigned num_mdp_clk;
350 int *mdp_core_clk_table;
351#ifdef CONFIG_MSM_BUS_SCALING
352 struct msm_bus_scale_pdata *mdp_bus_scale_table;
353#endif
354 int mdp_rev;
Nagamalleswararao Ganji937a1192011-12-07 19:00:52 -0800355 u32 ov0_wb_size; /* overlay0 writeback size */
356 u32 ov1_wb_size; /* overlay1 writeback size */
357 u32 mem_hid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700358};
359
Huaibin Yanga5419422011-12-08 23:52:10 -0800360
361
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700362struct lcdc_platform_data {
363 int (*lcdc_gpio_config)(int on);
364 int (*lcdc_power_save)(int);
365 unsigned int (*lcdc_get_clk)(void);
366#ifdef CONFIG_MSM_BUS_SCALING
367 struct msm_bus_scale_pdata *bus_scale_table;
368#endif
369};
370
371struct tvenc_platform_data {
372 int poll;
373 int (*pm_vid_en)(int on);
374#ifdef CONFIG_MSM_BUS_SCALING
375 struct msm_bus_scale_pdata *bus_scale_table;
376#endif
377};
378
379struct mddi_platform_data {
380 int (*mddi_power_save)(int on);
381 int (*mddi_sel_clk)(u32 *clk_rate);
382 int (*mddi_client_power)(u32 client_id);
383};
384
385struct mipi_dsi_platform_data {
386 int vsync_gpio;
387 int (*dsi_power_save)(int on);
388 int (*dsi_client_reset)(void);
389 int (*get_lane_config)(void);
390 int target_type;
391};
392
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -0700393enum mipi_dsi_3d_ctrl {
394 FPGA_EBI2_INTF,
395 FPGA_SPI_INTF,
396};
397
398/* DSI PHY configuration */
399struct mipi_dsi_phy_ctrl {
400 uint32_t regulator[5];
401 uint32_t timing[12];
402 uint32_t ctrl[4];
403 uint32_t strength[4];
404 uint32_t pll[21];
405};
406
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700407struct mipi_dsi_panel_platform_data {
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -0700408 int fpga_ctrl_mode;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700409 int fpga_3d_config_addr;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700410 int *gpio;
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -0700411 struct mipi_dsi_phy_ctrl *phy_ctrl_settings;
Ravishangar Kalyanam903f65c2012-01-28 21:36:22 -0800412 char dlane_swap;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700413};
414
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -0800415struct lvds_panel_platform_data {
416 int *gpio;
417};
418
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700419struct msm_fb_platform_data {
420 int (*detect_client)(const char *name);
421 int mddi_prescan;
422 int (*allow_set_offset)(void);
423};
424
425struct msm_hdmi_platform_data {
426 int irq;
427 int (*cable_detect)(int insert);
428 int (*comm_power)(int on, int show);
429 int (*enable_5v)(int on);
430 int (*core_power)(int on, int show);
431 int (*cec_power)(int on);
432 int (*init_irq)(void);
433 bool (*check_hdcp_hw_support)(void);
434};
435
436struct msm_i2c_platform_data {
437 int clk_freq;
438 uint32_t rmutex;
439 const char *rsl_id;
440 uint32_t pm_lat;
441 int pri_clk;
442 int pri_dat;
443 int aux_clk;
444 int aux_dat;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700445 int src_clk_rate;
446 int use_gsbi_shared_mode;
447 void (*msm_i2c_config_gpio)(int iface, int config_type);
448};
449
450struct msm_i2c_ssbi_platform_data {
451 const char *rsl_id;
452 enum msm_ssbi_controller_type controller_type;
453};
454
455struct msm_vidc_platform_data {
456 int memtype;
Deepak Koturcb4f6722011-10-31 14:06:57 -0700457 u32 enable_ion;
Deepika Pepakayalabebc7622011-12-01 15:13:43 -0800458 int disable_dmx;
Rajeshwar Kurapatyc155c352011-12-17 06:35:32 +0530459 int disable_fullhd;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700460#ifdef CONFIG_MSM_BUS_SCALING
461 struct msm_bus_scale_pdata *vidc_bus_client_pdata;
462#endif
463};
464
465#if defined(CONFIG_USB_PEHCI_HCD) || defined(CONFIG_USB_PEHCI_HCD_MODULE)
466struct isp1763_platform_data {
467 unsigned reset_gpio;
468 int (*setup_gpio)(int enable);
469};
470#endif
Russell Kinga09e64f2008-08-05 16:14:15 +0100471/* common init routines for use by arch/arm/mach-msm/board-*.c */
472
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700473#ifdef CONFIG_OF_DEVICE
474void msm_copper_init(struct of_dev_auxdata **);
475#endif
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700476void msm_add_devices(void);
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700477void msm_copper_add_devices(void);
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700478void msm_map_common_io(void);
479void msm_map_qsd8x50_io(void);
480void msm_map_msm8x60_io(void);
481void msm_map_msm8960_io(void);
482void msm_map_msm8930_io(void);
483void msm_map_apq8064_io(void);
484void msm_map_msm7x30_io(void);
485void msm_map_fsm9xxx_io(void);
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700486void msm_map_copper_io(void);
Taniya Das43bcdd62011-12-02 17:33:27 +0530487void msm_map_msm8625_io(void);
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700488void msm_init_irq(void);
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700489void msm_copper_init_irq(void);
Taniya Das86e0e132011-10-19 11:32:00 +0530490void vic_handle_irq(struct pt_regs *regs);
Olav Hauganb800c8c2012-01-30 08:50:45 -0800491void msm_copper_reserve(void);
492void msm_copper_very_early(void);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700493
494struct mmc_platform_data;
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700495int msm_add_sdcc(unsigned int controller,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700496 struct mmc_platform_data *plat);
497
498struct msm_usb_host_platform_data;
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700499int msm_add_host(unsigned int host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700500 struct msm_usb_host_platform_data *plat);
501#if defined(CONFIG_USB_FUNCTION_MSM_HSUSB) \
502 || defined(CONFIG_USB_MSM_72K) || defined(CONFIG_USB_MSM_72K_MODULE)
503void msm_hsusb_set_vbus_state(int online);
504#else
505static inline void msm_hsusb_set_vbus_state(int online) {}
506#endif
507
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700508void msm_snddev_init(void);
509void msm_snddev_init_timpani(void);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700510void msm_snddev_poweramp_on(void);
511void msm_snddev_poweramp_off(void);
512void msm_snddev_hsed_voltage_on(void);
513void msm_snddev_hsed_voltage_off(void);
514void msm_snddev_tx_route_config(void);
515void msm_snddev_tx_route_deconfig(void);
516
517extern unsigned int msm_shared_ram_phys; /* defined in arch/arm/mach-msm/io.c */
518
Russell Kinga09e64f2008-08-05 16:14:15 +0100519
520#endif