Travis Geiselbrecht | 1d0df69 | 2008-09-01 02:26:09 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2008 Travis Geiselbrecht |
| 3 | * |
Mayank Grover | 7ba3baa | 2019-04-25 11:56:13 +0530 | [diff] [blame] | 4 | * Copyright (c) 2013-2017,2019 The Linux Foundation. All rights reserved. |
Channagoud Kadabi | c3ecbf4 | 2013-05-08 12:54:05 -0700 | [diff] [blame] | 5 | * |
Travis Geiselbrecht | 1d0df69 | 2008-09-01 02:26:09 -0700 | [diff] [blame] | 6 | * 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 Kadabi | fdfee23 | 2015-10-07 11:55:47 -0700 | [diff] [blame] | 27 | #include <qmp_phy.h> |
Travis Geiselbrecht | 1d0df69 | 2008-09-01 02:26:09 -0700 | [diff] [blame] | 28 | |
Channagoud Kadabi | 85c7ec3 | 2016-01-28 23:09:21 -0800 | [diff] [blame] | 29 | #define TARGET_MAX_CMDLNBUF 64 |
Mayank Grover | 204776b | 2017-09-06 10:59:21 +0530 | [diff] [blame] | 30 | |
Saranya Chidura | 1600c2d | 2018-08-30 19:11:05 +0530 | [diff] [blame] | 31 | /* Serial Number Length. */ |
| 32 | #define SERIAL_NUMBER_LEN 13 |
| 33 | |
Mayank Grover | 204776b | 2017-09-06 10:59:21 +0530 | [diff] [blame] | 34 | /* Enum for target VB version detection */ |
| 35 | enum |
| 36 | { |
Mayank Grover | 6edf5e1 | 2017-10-26 12:07:01 +0530 | [diff] [blame] | 37 | VB_L = 1, |
| 38 | VB_M = 2, |
Monika Singh | aec24f0 | 2018-03-14 09:05:46 +0530 | [diff] [blame] | 39 | VB_AVB2 = 4, |
Mayank Grover | 204776b | 2017-09-06 10:59:21 +0530 | [diff] [blame] | 40 | }; |
| 41 | |
Channagoud Kadabi | 77b5227 | 2014-02-04 17:01:16 -0800 | [diff] [blame] | 42 | /* Target helper functions exposed to USB driver */ |
| 43 | typedef 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 Geiselbrecht | 1d0df69 | 2008-09-01 02:26:09 -0700 | [diff] [blame] | 51 | /* super early platform initialization, before almost everything */ |
| 52 | void target_early_init(void); |
| 53 | |
| 54 | /* later init, after the kernel has come up */ |
| 55 | void target_init(void); |
| 56 | |
David Ng | 3679bc5 | 2010-02-09 15:43:43 -0800 | [diff] [blame] | 57 | /* get memory address for fastboot image loading */ |
| 58 | void *target_get_scratch_address(void); |
| 59 | |
Vivek Mehta | 5f1c9d4 | 2011-04-01 20:11:59 -0700 | [diff] [blame] | 60 | /* get the max allowed flash size */ |
| 61 | unsigned target_get_max_flash_size(void); |
| 62 | |
David Ng | 183a742 | 2009-12-07 14:55:21 -0800 | [diff] [blame] | 63 | /* if target is using eMMC bootup */ |
| 64 | int target_is_emmc_boot(void); |
| 65 | |
Greg Grisco | d625055 | 2011-06-29 14:40:23 -0700 | [diff] [blame] | 66 | unsigned* target_atag_mem(unsigned* ptr); |
Greg Grisco | d625055 | 2011-06-29 14:40:23 -0700 | [diff] [blame] | 67 | void target_battery_charging_enable(unsigned enable, unsigned disconnect); |
| 68 | unsigned target_pause_for_battery_charge(void); |
| 69 | unsigned target_baseband(void); |
| 70 | void target_serialno(unsigned char *buf); |
| 71 | void target_fastboot_init(void); |
Stanimir Varbanov | 677001e | 2013-07-18 18:16:39 +0300 | [diff] [blame] | 72 | void target_load_ssd_keystore(void); |
Stanimir Varbanov | 8bc68c7 | 2013-07-08 18:22:04 +0300 | [diff] [blame] | 73 | bool target_is_ssd_enabled(void); |
Channagoud Kadabi | 9fbdcdf | 2013-09-19 16:24:16 -0700 | [diff] [blame] | 74 | void *target_mmc_device(); |
Matthew Qin | defd556 | 2014-07-11 18:02:40 +0800 | [diff] [blame] | 75 | uint32_t is_user_force_reset(void); |
Greg Grisco | d625055 | 2011-06-29 14:40:23 -0700 | [diff] [blame] | 76 | |
Padmanabhan Komanduru | bccbcdc | 2015-06-30 16:19:24 +0530 | [diff] [blame] | 77 | bool target_display_panel_node(char *pbuf, uint16_t buf_size); |
Aravind Venkateswaran | 6385f7e | 2014-02-25 16:45:11 -0800 | [diff] [blame] | 78 | void target_display_init(const char *panel_name); |
Aravind Venkateswaran | dd50c1a | 2014-02-25 14:42:43 -0800 | [diff] [blame] | 79 | void target_display_shutdown(void); |
| 80 | |
Sundarajan Srinivasan | 289ff3f | 2013-09-30 16:46:29 -0700 | [diff] [blame] | 81 | uint32_t target_get_boot_device(); |
| 82 | |
Amol Jadi | 9ff7bb5 | 2013-10-11 14:11:45 -0700 | [diff] [blame] | 83 | const char * target_usb_controller(); |
| 84 | void target_usb_phy_reset(void); |
Tanya Finkel | 77318e0 | 2016-05-17 14:20:59 +0300 | [diff] [blame] | 85 | void target_usb_phy_sec_reset(void); |
Amol Jadi | 9ff7bb5 | 2013-10-11 14:11:45 -0700 | [diff] [blame] | 86 | void target_usb_phy_mux_configure(void); |
Channagoud Kadabi | 77b5227 | 2014-02-04 17:01:16 -0800 | [diff] [blame] | 87 | target_usb_iface_t * target_usb30_init(); |
Sundarajan Srinivasan | 8031f6c | 2014-03-12 15:45:28 -0700 | [diff] [blame] | 88 | bool target_is_cdp_qvga(); |
Channagoud Kadabi | 62ac4cb | 2014-05-13 11:55:38 -0700 | [diff] [blame] | 89 | uint32_t target_hw_interposer(); |
Channagoud Kadabi | d6ded11 | 2014-05-12 18:07:24 -0700 | [diff] [blame] | 90 | uint32_t target_override_pll(); |
Channagoud Kadabi | 41c81a6 | 2014-10-08 19:55:30 -0700 | [diff] [blame] | 91 | uint32_t target_ddr_cfg_val(); |
Unnati Gandhi | 7c53673 | 2014-07-17 14:37:49 +0530 | [diff] [blame] | 92 | void target_usb_init(void); |
| 93 | void target_usb_stop(void); |
| 94 | uint32_t target_get_hlos_subtype(void); |
| 95 | void shutdown_device(); |
Parth Dixit | 300a3b9 | 2015-06-19 16:38:12 +0530 | [diff] [blame] | 96 | uint32_t target_is_pwrkey_pon_reason(void); |
Unnati Gandhi | 7c53673 | 2014-07-17 14:37:49 +0530 | [diff] [blame] | 97 | bool target_warm_boot(void); |
| 98 | bool target_use_signed_kernel(void); |
| 99 | int _emmc_recovery_init(void); |
| 100 | void ulpi_write(unsigned val, unsigned reg); |
Veera Sundaram Sankaran | b0f9e11 | 2014-12-18 14:37:48 -0800 | [diff] [blame] | 101 | void target_crypto_init_params(void); |
Sridhar Parasuram | 1136446 | 2015-01-05 12:22:50 -0800 | [diff] [blame] | 102 | int target_cont_splash_screen(void); |
Channagoud Kadabi | 2021cef | 2015-02-25 12:08:32 -0800 | [diff] [blame] | 103 | bool target_build_variant_user(); |
Channagoud Kadabi | 65b518d | 2015-08-05 16:17:14 -0700 | [diff] [blame] | 104 | void pmic_reset_configure(uint8_t reset_type); |
Krishna Manikandan | 92affec | 2017-12-05 17:47:37 +0530 | [diff] [blame] | 105 | bool is_display_disabled(void); |
Mayank Grover | e8a534f | 2018-05-09 12:06:17 +0530 | [diff] [blame] | 106 | bool target_uses_system_as_root(void); |
Mayank Grover | 7ba3baa | 2019-04-25 11:56:13 +0530 | [diff] [blame] | 107 | bool target_dynamic_partition_supported(void); |
Channagoud Kadabi | fdfee23 | 2015-10-07 11:55:47 -0700 | [diff] [blame] | 108 | struct qmp_reg *target_get_qmp_settings(); |
| 109 | int target_get_qmp_regsize(); |
Parth Dixit | ff1928a | 2016-11-16 19:57:21 +0530 | [diff] [blame] | 110 | uint32_t target_ddr_cfg_reg(); |
Channagoud Kadabi | fdfee23 | 2015-10-07 11:55:47 -0700 | [diff] [blame] | 111 | |
Jiten Patel | 4f6c74b | 2018-08-29 16:34:56 +0530 | [diff] [blame] | 112 | bool is_target_support_dtbo(void); |
Parth Dixit | 550ddf3 | 2016-11-28 17:00:29 +0530 | [diff] [blame] | 113 | bool target_is_pmi_enabled(void); |
Wufeng Jiang | 71246c2 | 2015-08-06 19:07:09 +0800 | [diff] [blame] | 114 | #if PON_VIB_SUPPORT |
Parth Dixit | 7f68371 | 2015-12-23 15:59:16 +0530 | [diff] [blame] | 115 | void get_vibration_type(); |
Wufeng Jiang | 71246c2 | 2015-08-06 19:07:09 +0800 | [diff] [blame] | 116 | #endif |
| 117 | |
lijuang | 102dfa9 | 2015-10-09 18:31:03 +0800 | [diff] [blame] | 118 | #if CHECK_BAT_VOLTAGE |
| 119 | void update_battery_status(void); |
| 120 | #endif |
| 121 | |
lijuang | 3606df8 | 2015-09-02 21:14:43 +0800 | [diff] [blame] | 122 | uint32_t target_get_battery_voltage(); |
| 123 | bool target_battery_soc_ok(); |
| 124 | bool target_battery_is_present(); |
| 125 | uint32_t target_get_pmic(); |
Channagoud Kadabi | 85c7ec3 | 2016-01-28 23:09:21 -0800 | [diff] [blame] | 126 | int target_update_cmdline(char *cmdline); |
Mayank Grover | 204776b | 2017-09-06 10:59:21 +0530 | [diff] [blame] | 127 | int target_get_vb_version(); |
Travis Geiselbrecht | 1d0df69 | 2008-09-01 02:26:09 -0700 | [diff] [blame] | 128 | #endif |