blob: d11c13f91c61d90296f3cbb2f2ebc7d6637f3c1e [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 Chan8b0d2322011-09-10 21:06:31 -0700175struct msm8960_privacy_light_cfg {
176 unsigned mpp;
177};
178
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700179struct msm_camera_sensor_platform_info {
180 int mount_angle;
Nishant Pandit24153d82011-08-27 16:05:13 +0530181 int sensor_reset_enable;
182 int sensor_reset;
183 int sensor_pwd;
184 int vcm_pwd;
185 int vcm_enable;
Kevin Chan8b0d2322011-09-10 21:06:31 -0700186 int privacy_light;
187 void *privacy_light_info;
Nishant Pandit24153d82011-08-27 16:05:13 +0530188};
189
190struct msm_camera_gpio_conf {
191 void *cam_gpiomux_conf_tbl;
192 uint8_t cam_gpiomux_conf_tbl_size;
193 uint16_t *cam_gpio_tbl;
194 uint8_t cam_gpio_tbl_size;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700195};
196
Sreesudhan Ramakrish Ramkumara4b5f302011-09-12 16:23:22 -0700197struct msm_actuator_info {
198 struct i2c_board_info const *board_info;
199 int bus_id;
200 int vcm_pwd;
201 int vcm_enable;
202};
203
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700204struct msm_camera_sensor_info {
205 const char *sensor_name;
206 int sensor_reset_enable;
207 int sensor_reset;
208 int sensor_pwd;
209 int vcm_pwd;
210 int vcm_enable;
211 int mclk;
212 int flash_type;
213 struct msm_camera_sensor_platform_info *sensor_platform_info;
214 struct msm_camera_device_platform_data *pdata;
215 struct resource *resource;
216 uint8_t num_resources;
217 struct msm_camera_sensor_flash_data *flash_data;
218 int csi_if;
219 struct msm_camera_csi_params csi_params;
220 struct msm_camera_sensor_strobe_flash_data *strobe_flash_data;
221 char *eeprom_data;
Nishant Pandit24153d82011-08-27 16:05:13 +0530222 struct msm_camera_gpio_conf *gpio_conf;
223 enum msm_camera_type camera_type;
Sreesudhan Ramakrish Ramkumara4b5f302011-09-12 16:23:22 -0700224 struct msm_actuator_info *actuator_info;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700225};
226
Kevin Chan09f4e662011-12-16 08:17:02 -0800227struct msm_camera_board_info {
228 struct i2c_board_info *board_info;
229 uint8_t num_i2c_board_info;
230};
231
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700232int msm_get_cam_resources(struct msm_camera_sensor_info *);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700233
Stephen Boydbd323442011-02-23 09:37:42 -0800234struct clk_lookup;
Daniel Walker5e96da52010-05-12 13:43:28 -0700235
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700236struct snd_endpoint {
237 int id;
238 const char *name;
239};
Steve Mucklea55df6e2010-01-07 12:43:24 -0800240
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700241struct msm_snd_endpoints {
242 struct snd_endpoint *endpoints;
243 unsigned num;
244};
245
246#define MSM_MAX_DEC_CNT 14
247/* 7k target ADSP information */
248/* Bit 23:0, for codec identification like mp3, wav etc *
249 * Bit 27:24, for mode identification like tunnel, non tunnel*
250 * bit 31:28, for operation support like DM, DMA */
251enum msm_adspdec_concurrency {
252 MSM_ADSP_CODEC_WAV = 0,
253 MSM_ADSP_CODEC_ADPCM = 1,
254 MSM_ADSP_CODEC_MP3 = 2,
255 MSM_ADSP_CODEC_REALAUDIO = 3,
256 MSM_ADSP_CODEC_WMA = 4,
257 MSM_ADSP_CODEC_AAC = 5,
258 MSM_ADSP_CODEC_RESERVED = 6,
259 MSM_ADSP_CODEC_MIDI = 7,
260 MSM_ADSP_CODEC_YADPCM = 8,
261 MSM_ADSP_CODEC_QCELP = 9,
262 MSM_ADSP_CODEC_AMRNB = 10,
263 MSM_ADSP_CODEC_AMRWB = 11,
264 MSM_ADSP_CODEC_EVRC = 12,
265 MSM_ADSP_CODEC_WMAPRO = 13,
266 MSM_ADSP_MODE_TUNNEL = 24,
267 MSM_ADSP_MODE_NONTUNNEL = 25,
268 MSM_ADSP_MODE_LP = 26,
269 MSM_ADSP_OP_DMA = 28,
270 MSM_ADSP_OP_DM = 29,
271};
272
273struct msm_adspdec_info {
274 const char *module_name;
275 unsigned module_queueid;
276 int module_decid; /* objid */
277 unsigned nr_codec_support;
278};
279
280/* Carries information about number codec
281 * supported if same codec or different codecs
282 */
283struct dec_instance_table {
284 uint8_t max_instances_same_dec;
285 uint8_t max_instances_diff_dec;
286};
287
288struct msm_adspdec_database {
289 unsigned num_dec;
290 unsigned num_concurrency_support;
291 unsigned int *dec_concurrency_table; /* Bit masked entry to *
292 * represents codec, mode etc */
293 struct msm_adspdec_info *dec_info_list;
294 struct dec_instance_table *dec_instance_list;
295};
296
297enum msm_mdp_hw_revision {
298 MDP_REV_20 = 1,
299 MDP_REV_22,
300 MDP_REV_30,
301 MDP_REV_303,
302 MDP_REV_31,
303 MDP_REV_40,
304 MDP_REV_41,
305 MDP_REV_42,
Huaibin Yang4a084e32011-12-15 15:25:52 -0800306 MDP_REV_43,
307 MDP_REV_44,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700308};
309
310struct msm_panel_common_pdata {
311 uintptr_t hw_revision_addr;
312 int gpio;
313 int (*backlight_level)(int level, int max, int min);
314 int (*pmic_backlight)(int level);
315 int (*panel_num)(void);
316 void (*panel_config_gpio)(int);
317 int (*vga_switch)(int select_vga);
318 int *gpio_num;
319 int mdp_core_clk_rate;
320 unsigned num_mdp_clk;
321 int *mdp_core_clk_table;
322#ifdef CONFIG_MSM_BUS_SCALING
323 struct msm_bus_scale_pdata *mdp_bus_scale_table;
324#endif
325 int mdp_rev;
Nagamalleswararao Ganji937a1192011-12-07 19:00:52 -0800326 u32 ov0_wb_size; /* overlay0 writeback size */
327 u32 ov1_wb_size; /* overlay1 writeback size */
328 u32 mem_hid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700329};
330
Huaibin Yanga5419422011-12-08 23:52:10 -0800331
332
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700333struct lcdc_platform_data {
334 int (*lcdc_gpio_config)(int on);
335 int (*lcdc_power_save)(int);
336 unsigned int (*lcdc_get_clk)(void);
337#ifdef CONFIG_MSM_BUS_SCALING
338 struct msm_bus_scale_pdata *bus_scale_table;
339#endif
340};
341
342struct tvenc_platform_data {
343 int poll;
344 int (*pm_vid_en)(int on);
345#ifdef CONFIG_MSM_BUS_SCALING
346 struct msm_bus_scale_pdata *bus_scale_table;
347#endif
348};
349
350struct mddi_platform_data {
351 int (*mddi_power_save)(int on);
352 int (*mddi_sel_clk)(u32 *clk_rate);
353 int (*mddi_client_power)(u32 client_id);
354};
355
356struct mipi_dsi_platform_data {
357 int vsync_gpio;
358 int (*dsi_power_save)(int on);
359 int (*dsi_client_reset)(void);
360 int (*get_lane_config)(void);
361 int target_type;
362};
363
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -0700364enum mipi_dsi_3d_ctrl {
365 FPGA_EBI2_INTF,
366 FPGA_SPI_INTF,
367};
368
369/* DSI PHY configuration */
370struct mipi_dsi_phy_ctrl {
371 uint32_t regulator[5];
372 uint32_t timing[12];
373 uint32_t ctrl[4];
374 uint32_t strength[4];
375 uint32_t pll[21];
376};
377
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700378struct mipi_dsi_panel_platform_data {
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -0700379 int fpga_ctrl_mode;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700380 int fpga_3d_config_addr;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700381 int *gpio;
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -0700382 struct mipi_dsi_phy_ctrl *phy_ctrl_settings;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700383};
384
385struct msm_fb_platform_data {
386 int (*detect_client)(const char *name);
387 int mddi_prescan;
388 int (*allow_set_offset)(void);
389};
390
391struct msm_hdmi_platform_data {
392 int irq;
393 int (*cable_detect)(int insert);
394 int (*comm_power)(int on, int show);
395 int (*enable_5v)(int on);
396 int (*core_power)(int on, int show);
397 int (*cec_power)(int on);
398 int (*init_irq)(void);
399 bool (*check_hdcp_hw_support)(void);
400};
401
402struct msm_i2c_platform_data {
403 int clk_freq;
404 uint32_t rmutex;
405 const char *rsl_id;
406 uint32_t pm_lat;
407 int pri_clk;
408 int pri_dat;
409 int aux_clk;
410 int aux_dat;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700411 int src_clk_rate;
412 int use_gsbi_shared_mode;
413 void (*msm_i2c_config_gpio)(int iface, int config_type);
414};
415
416struct msm_i2c_ssbi_platform_data {
417 const char *rsl_id;
418 enum msm_ssbi_controller_type controller_type;
419};
420
421struct msm_vidc_platform_data {
422 int memtype;
Deepak Koturcb4f6722011-10-31 14:06:57 -0700423 u32 enable_ion;
Deepika Pepakayalabebc7622011-12-01 15:13:43 -0800424 int disable_dmx;
Rajeshwar Kurapatyc155c352011-12-17 06:35:32 +0530425 int disable_fullhd;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700426#ifdef CONFIG_MSM_BUS_SCALING
427 struct msm_bus_scale_pdata *vidc_bus_client_pdata;
428#endif
429};
430
431#if defined(CONFIG_USB_PEHCI_HCD) || defined(CONFIG_USB_PEHCI_HCD_MODULE)
432struct isp1763_platform_data {
433 unsigned reset_gpio;
434 int (*setup_gpio)(int enable);
435};
436#endif
Russell Kinga09e64f2008-08-05 16:14:15 +0100437/* common init routines for use by arch/arm/mach-msm/board-*.c */
438
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700439#ifdef CONFIG_OF_DEVICE
440void msm_copper_init(struct of_dev_auxdata **);
441#endif
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700442void msm_add_devices(void);
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700443void msm_copper_add_devices(void);
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700444void msm_map_common_io(void);
445void msm_map_qsd8x50_io(void);
446void msm_map_msm8x60_io(void);
447void msm_map_msm8960_io(void);
448void msm_map_msm8930_io(void);
449void msm_map_apq8064_io(void);
450void msm_map_msm7x30_io(void);
451void msm_map_fsm9xxx_io(void);
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700452void msm_map_copper_io(void);
Taniya Das43bcdd62011-12-02 17:33:27 +0530453void msm_map_msm8625_io(void);
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700454void msm_init_irq(void);
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700455void msm_copper_init_irq(void);
Taniya Das86e0e132011-10-19 11:32:00 +0530456void vic_handle_irq(struct pt_regs *regs);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700457
458struct mmc_platform_data;
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700459int msm_add_sdcc(unsigned int controller,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700460 struct mmc_platform_data *plat);
461
462struct msm_usb_host_platform_data;
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700463int msm_add_host(unsigned int host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700464 struct msm_usb_host_platform_data *plat);
465#if defined(CONFIG_USB_FUNCTION_MSM_HSUSB) \
466 || defined(CONFIG_USB_MSM_72K) || defined(CONFIG_USB_MSM_72K_MODULE)
467void msm_hsusb_set_vbus_state(int online);
468#else
469static inline void msm_hsusb_set_vbus_state(int online) {}
470#endif
471
Stepan Moskovchenkob3e63862011-10-20 18:36:55 -0700472void msm_snddev_init(void);
473void msm_snddev_init_timpani(void);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700474void msm_snddev_poweramp_on(void);
475void msm_snddev_poweramp_off(void);
476void msm_snddev_hsed_voltage_on(void);
477void msm_snddev_hsed_voltage_off(void);
478void msm_snddev_tx_route_config(void);
479void msm_snddev_tx_route_deconfig(void);
480
481extern unsigned int msm_shared_ram_phys; /* defined in arch/arm/mach-msm/io.c */
482
Russell Kinga09e64f2008-08-05 16:14:15 +0100483
484#endif