blob: c3893d37fa26fd3f2b079c12e1786eb0aa0c1428 [file] [log] [blame]
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -07001/*
Casey Pipera277d882013-10-21 10:11:04 -07002 * Copyright (c) 2008 Travis Geiselbrecht
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -07003 *
lijuangc518f5d2015-02-10 10:22:53 +08004 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
5 *
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -07006 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files
8 * (the "Software"), to deal in the Software without restriction,
9 * including without limitation the rights to use, copy, modify, merge,
10 * publish, distribute, sublicense, and/or sell copies of the Software,
11 * and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25#include <err.h>
26#include <debug.h>
27#include <target.h>
28#include <compiler.h>
Pavel Nedeva4c9d3a2013-05-15 14:42:34 +030029#include <dload_util.h>
Channagoud Kadabi41c81a62014-10-08 19:55:30 -070030#include <sdhci_msm.h>
Wufeng Jiang71246c22015-08-06 19:07:09 +080031#if PON_VIB_SUPPORT
32#include <smem.h>
33#include <vibrator.h>
34#include <board.h>
35#endif
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -070036
Subbaraman Narayanamurthyf17b4ae2011-02-16 20:19:56 -080037#define EXPAND(NAME) #NAME
38#define TARGET(NAME) EXPAND(NAME)
Amol Jadi57abe4c2011-05-24 15:47:27 -070039/*
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -070040 * default implementations of these routines, if the target code
41 * chooses not to implement.
42 */
43
44__WEAK void target_early_init(void)
45{
46}
47
48__WEAK void target_init(void)
49{
50}
51
David Ng3679bc52010-02-09 15:43:43 -080052__WEAK void *target_get_scratch_address(void)
53{
54 return (void *)(SCRATCH_ADDR);
55}
56
Vivek Mehta5f1c9d42011-04-01 20:11:59 -070057__WEAK unsigned target_get_max_flash_size(void)
58{
59 return (120 * 1024 * 1024);
60}
61
Tanya Brokhman1c94f1a2015-02-15 09:05:03 +020062__WEAK int flash_ubi_img(void)
63{
64 return 0;
65}
66
Tanya Brokhman84eaaf62015-02-24 21:57:06 +020067__WEAK int update_ubi_vol(void)
68{
69 return 0;
70}
71
David Ng183a7422009-12-07 14:55:21 -080072__WEAK int target_is_emmc_boot(void)
73{
David Ng025c1d92009-12-09 23:46:00 -080074#if _EMMC_BOOT
75 return 1;
76#else
David Ng183a7422009-12-07 14:55:21 -080077 return 0;
David Ng025c1d92009-12-09 23:46:00 -080078#endif
David Ng183a7422009-12-07 14:55:21 -080079}
Chandan Uddarajude85d3f2010-01-05 16:32:33 -080080
81__WEAK unsigned check_reboot_mode(void)
82{
83 return 0;
84}
Chandan Uddaraju94183c02010-01-15 15:13:59 -080085
lijuangc518f5d2015-02-10 10:22:53 +080086__WEAK unsigned check_hard_reboot_mode(void)
87{
88 return 0;
89}
90
Chandan Uddaraju94183c02010-01-15 15:13:59 -080091__WEAK void reboot_device(unsigned reboot_reason)
92{
93}
Chandan Uddaraju7f5b9012010-02-06 16:37:48 -080094
Matthew Qindefd5562014-07-11 18:02:40 +080095__WEAK uint32_t is_user_force_reset(void)
96{
97 return 0;
98}
99
Pavel Nedeva4c9d3a2013-05-15 14:42:34 +0300100__WEAK int set_download_mode(enum dload_mode mode)
Pavel Nedev76a3e212013-05-09 10:37:21 +0300101{
102 return -1;
103}
104
David Ngf773dde2010-07-26 19:55:08 -0700105__WEAK unsigned target_pause_for_battery_charge(void)
106{
107 return 0;
108}
Ajay Dudanid04110c2011-01-17 23:55:07 -0800109
110__WEAK unsigned target_baseband()
111{
112 return 0;
113}
Subbaraman Narayanamurthyf17b4ae2011-02-16 20:19:56 -0800114
115__WEAK void target_serialno(unsigned char *buf)
116{
Ajay Dudanif63d02f2011-10-01 08:29:53 -0700117 snprintf((char *) buf, 13, "%s",TARGET(BOARD));
Subbaraman Narayanamurthyf17b4ae2011-02-16 20:19:56 -0800118}
Amol Jadi57abe4c2011-05-24 15:47:27 -0700119
120__WEAK void target_fastboot_init()
121{
122}
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700123
124__WEAK int emmc_recovery_init(void)
125{
126 return 0;
127}
Shashank Mittalcd98d472011-08-02 14:29:24 -0700128
129__WEAK bool target_use_signed_kernel(void)
130{
131#if _SIGNED_KERNEL
132 return 1;
133#else
134 return 0;
135#endif
136}
Amol Jadi6834f1a2012-06-29 14:42:59 -0700137
Stanimir Varbanov8bc68c72013-07-08 18:22:04 +0300138__WEAK bool target_is_ssd_enabled(void)
139{
140#ifdef SSD_ENABLE
141 return 1;
142#else
143 return 0;
144#endif
145}
146
Stanimir Varbanov677001e2013-07-18 18:16:39 +0300147__WEAK void target_load_ssd_keystore(void)
148{
149}
Amol Jadi6834f1a2012-06-29 14:42:59 -0700150
151/* Default target does not support continuous splash screen feature. */
152__WEAK int target_cont_splash_screen()
153{
154 return 0;
155}
Amol Jadida118b92012-07-06 19:53:18 -0700156
157/* Default target specific initialization before using USB */
158__WEAK void target_usb_init(void)
159{
160}
161
162/* Default target specific usb shutdown */
163__WEAK void target_usb_stop(void)
164{
165}
Channagoud Kadabifa6179e2013-06-18 18:35:14 -0700166
167/* Default target specific target uninit */
168__WEAK void target_uninit(void)
169{
170}
Dhaval Patelcdcb6462013-07-18 14:46:57 -0700171
Padmanabhan Komandurubccbcdc2015-06-30 16:19:24 +0530172__WEAK bool target_display_panel_node(char *pbuf, uint16_t buf_size)
Dhaval Patelcdcb6462013-07-18 14:46:57 -0700173{
174 return false;
175}
Channagoud Kadabi9fbdcdf2013-09-19 16:24:16 -0700176
Aravind Venkateswaran6385f7e2014-02-25 16:45:11 -0800177__WEAK void target_display_init(const char *panel_name)
Aravind Venkateswarandd50c1a2014-02-25 14:42:43 -0800178{
179}
180
181__WEAK void target_display_shutdown(void)
182{
183}
184
Casey Piperf8cebb62013-09-11 15:56:17 -0700185__WEAK uint8_t target_panel_auto_detect_enabled()
186{
187 return 0;
188}
189
Casey Piper48bfc0d2013-11-18 13:24:35 -0800190__WEAK uint8_t target_is_edp()
191{
192 return 0;
193}
194
Amol Jadi417c7f22013-10-07 12:52:21 -0700195/* default usb controller to be used. */
196__WEAK const char * target_usb_controller()
197{
198 return "ci";
199}
Amol Jadi9ff7bb52013-10-11 14:11:45 -0700200
201/* override for target specific usb phy reset. */
202__WEAK void target_usb_phy_reset(void)
203{
204}
Hanumant Singh8e1ac232014-01-29 13:41:51 -0800205
206/* determine if target is in warm boot. */
207__WEAK bool target_warm_boot(void)
208{
209 return false;
210}
Aparna Mallavarapu373d38b2014-05-23 14:47:19 +0530211
212/* Determine the HLOS subtype of the target */
213__WEAK uint32_t target_get_hlos_subtype(void)
214{
215 return 0;
216}
Channagoud Kadabi82cf5c62014-08-24 22:17:34 -0700217
218/* Initialize crypto parameters */
219__WEAK void target_crypto_init_params()
220{
221}
Channagoud Kadabi41c81a62014-10-08 19:55:30 -0700222
223/* Default CFG delay value */
224__WEAK uint32_t target_ddr_cfg_val()
225{
226 return DDR_CONFIG_VAL;
227}
Channagoud Kadabi2021cef2015-02-25 12:08:32 -0800228
Wufeng Jiang71246c22015-08-06 19:07:09 +0800229#if PON_VIB_SUPPORT
230uint32_t get_vibration_type()
231{
232 uint32_t ret = VIB_ERM_TYPE;
233 uint32_t hw_id = board_hardware_id();
234 uint32_t platform = board_platform_id();
235 switch(hw_id){
236 case HW_PLATFORM_MTP:
237 switch(platform){
238 case MSM8952:
239 ret = VIB_ERM_TYPE;
240 break;
241 case MSM8976:
242 ret = VIB_LRA_TYPE;
243 break;
244 }
245 break;
246 case HW_PLATFORM_QRD:
247 ret = VIB_ERM_TYPE;
248 break;
249 }
250 return ret;
251}
252#endif
253
Channagoud Kadabi2021cef2015-02-25 12:08:32 -0800254/* Return Build variant */
255__WEAK bool target_build_variant_user()
256{
257#if USER_BUILD_VARIANT
258 return true;
259#else
260 return false;
261#endif
262}