blob: d4b2416fe2689728e37dfec225fe67e21963d6ed [file] [log] [blame]
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -07001/*
2 * Copyright (c) 2008 Travis Geiselbrecht
3 *
Mayank Grover7ba3baa2019-04-25 11:56:13 +05304 * Copyright (c) 2013-2017,2019 The Linux Foundation. All rights reserved.
Channagoud Kadabic3ecbf42013-05-08 12:54:05 -07005 *
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#ifndef __TARGET_H
26#define __TARGET_H
Channagoud Kadabifdfee232015-10-07 11:55:47 -070027#include <qmp_phy.h>
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -070028
Channagoud Kadabi85c7ec32016-01-28 23:09:21 -080029#define TARGET_MAX_CMDLNBUF 64
Mayank Grover204776b2017-09-06 10:59:21 +053030
Saranya Chidura1600c2d2018-08-30 19:11:05 +053031/* Serial Number Length. */
32#define SERIAL_NUMBER_LEN 13
33
Mayank Grover204776b2017-09-06 10:59:21 +053034/* Enum for target VB version detection */
35enum
36{
Mayank Grover6edf5e12017-10-26 12:07:01 +053037 VB_L = 1,
38 VB_M = 2,
Monika Singhaec24f02018-03-14 09:05:46 +053039 VB_AVB2 = 4,
Mayank Grover204776b2017-09-06 10:59:21 +053040};
41
Channagoud Kadabi77b52272014-02-04 17:01:16 -080042/* Target helper functions exposed to USB driver */
43typedef struct {
44 void (*mux_config) ();
45 void (*phy_reset) ();
46 void (*phy_init) ();
47 void (*clock_init) ();
48 uint8_t vbus_override;
49} target_usb_iface_t;
50
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -070051/* super early platform initialization, before almost everything */
52void target_early_init(void);
53
54/* later init, after the kernel has come up */
55void target_init(void);
56
David Ng3679bc52010-02-09 15:43:43 -080057/* get memory address for fastboot image loading */
58void *target_get_scratch_address(void);
59
Vivek Mehta5f1c9d42011-04-01 20:11:59 -070060/* get the max allowed flash size */
61unsigned target_get_max_flash_size(void);
62
David Ng183a7422009-12-07 14:55:21 -080063/* if target is using eMMC bootup */
64int target_is_emmc_boot(void);
65
Greg Griscod6250552011-06-29 14:40:23 -070066unsigned* target_atag_mem(unsigned* ptr);
Greg Griscod6250552011-06-29 14:40:23 -070067void target_battery_charging_enable(unsigned enable, unsigned disconnect);
68unsigned target_pause_for_battery_charge(void);
69unsigned target_baseband(void);
70void target_serialno(unsigned char *buf);
71void target_fastboot_init(void);
Stanimir Varbanov677001e2013-07-18 18:16:39 +030072void target_load_ssd_keystore(void);
Stanimir Varbanov8bc68c72013-07-08 18:22:04 +030073bool target_is_ssd_enabled(void);
Channagoud Kadabi9fbdcdf2013-09-19 16:24:16 -070074void *target_mmc_device();
Matthew Qindefd5562014-07-11 18:02:40 +080075uint32_t is_user_force_reset(void);
Greg Griscod6250552011-06-29 14:40:23 -070076
Padmanabhan Komandurubccbcdc2015-06-30 16:19:24 +053077bool target_display_panel_node(char *pbuf, uint16_t buf_size);
Aravind Venkateswaran6385f7e2014-02-25 16:45:11 -080078void target_display_init(const char *panel_name);
Aravind Venkateswarandd50c1a2014-02-25 14:42:43 -080079void target_display_shutdown(void);
80
Sundarajan Srinivasan289ff3f2013-09-30 16:46:29 -070081uint32_t target_get_boot_device();
82
Amol Jadi9ff7bb52013-10-11 14:11:45 -070083const char * target_usb_controller();
84void target_usb_phy_reset(void);
Tanya Finkel77318e02016-05-17 14:20:59 +030085void target_usb_phy_sec_reset(void);
Amol Jadi9ff7bb52013-10-11 14:11:45 -070086void target_usb_phy_mux_configure(void);
Channagoud Kadabi77b52272014-02-04 17:01:16 -080087target_usb_iface_t * target_usb30_init();
Sundarajan Srinivasan8031f6c2014-03-12 15:45:28 -070088bool target_is_cdp_qvga();
Channagoud Kadabi62ac4cb2014-05-13 11:55:38 -070089uint32_t target_hw_interposer();
Channagoud Kadabid6ded112014-05-12 18:07:24 -070090uint32_t target_override_pll();
Channagoud Kadabi41c81a62014-10-08 19:55:30 -070091uint32_t target_ddr_cfg_val();
Unnati Gandhi7c536732014-07-17 14:37:49 +053092void target_usb_init(void);
93void target_usb_stop(void);
94uint32_t target_get_hlos_subtype(void);
95void shutdown_device();
Parth Dixit300a3b92015-06-19 16:38:12 +053096uint32_t target_is_pwrkey_pon_reason(void);
Unnati Gandhi7c536732014-07-17 14:37:49 +053097bool target_warm_boot(void);
98bool target_use_signed_kernel(void);
99int _emmc_recovery_init(void);
100void ulpi_write(unsigned val, unsigned reg);
Veera Sundaram Sankaranb0f9e112014-12-18 14:37:48 -0800101void target_crypto_init_params(void);
Sridhar Parasuram11364462015-01-05 12:22:50 -0800102int target_cont_splash_screen(void);
Channagoud Kadabi2021cef2015-02-25 12:08:32 -0800103bool target_build_variant_user();
Channagoud Kadabi65b518d2015-08-05 16:17:14 -0700104void pmic_reset_configure(uint8_t reset_type);
Krishna Manikandan92affec2017-12-05 17:47:37 +0530105bool is_display_disabled(void);
Mayank Grovere8a534f2018-05-09 12:06:17 +0530106bool target_uses_system_as_root(void);
Mayank Grover7ba3baa2019-04-25 11:56:13 +0530107bool target_dynamic_partition_supported(void);
Channagoud Kadabifdfee232015-10-07 11:55:47 -0700108struct qmp_reg *target_get_qmp_settings();
109int target_get_qmp_regsize();
Parth Dixitff1928a2016-11-16 19:57:21 +0530110uint32_t target_ddr_cfg_reg();
Channagoud Kadabifdfee232015-10-07 11:55:47 -0700111
Jiten Patel4f6c74b2018-08-29 16:34:56 +0530112bool is_target_support_dtbo(void);
Parth Dixit550ddf32016-11-28 17:00:29 +0530113bool target_is_pmi_enabled(void);
Wufeng Jiang71246c22015-08-06 19:07:09 +0800114#if PON_VIB_SUPPORT
Parth Dixit7f683712015-12-23 15:59:16 +0530115void get_vibration_type();
Wufeng Jiang71246c22015-08-06 19:07:09 +0800116#endif
117
lijuang102dfa92015-10-09 18:31:03 +0800118#if CHECK_BAT_VOLTAGE
119void update_battery_status(void);
120#endif
121
lijuang3606df82015-09-02 21:14:43 +0800122uint32_t target_get_battery_voltage();
123bool target_battery_soc_ok();
124bool target_battery_is_present();
125uint32_t target_get_pmic();
Channagoud Kadabi85c7ec32016-01-28 23:09:21 -0800126int target_update_cmdline(char *cmdline);
Mayank Grover204776b2017-09-06 10:59:21 +0530127int target_get_vb_version();
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -0700128#endif