Merge 1acdc785b7d7f583465a50b8ce30390e282bf9c2 on remote branch
Change-Id: Iae47418fec43252cc4ee5d608d0d42827cca2476
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index a2662c7..a69056b 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -67,7 +67,7 @@
#endif
#if ENABLE_WBC
-#include <pm_app_smbchg.h>
+#include <pm_smbchg_common.h>
#endif
#if DEVICE_TREE
diff --git a/dev/fbcon/fbcon.c b/dev/fbcon/fbcon.c
index 848b967..ed45f48 100644
--- a/dev/fbcon/fbcon.c
+++ b/dev/fbcon/fbcon.c
@@ -37,7 +37,7 @@
#include <string.h>
#include <arch/ops.h>
#if ENABLE_WBC
-#include <pm_app_smbchg.h>
+#include <pm_smbchg_common.h>
#endif
#include "font5x12.h"
diff --git a/dev/pmic/pm8x41/qpnp-smb2.c b/dev/pmic/pm8x41/qpnp-smb2.c
index 07f5265..31406e4 100644
--- a/dev/pmic/pm8x41/qpnp-smb2.c
+++ b/dev/pmic/pm8x41/qpnp-smb2.c
@@ -30,6 +30,7 @@
#include <debug.h>
#include <pm8x41.h>
#include <pm8x41_hw.h>
+#include <pm_smbchg_common.h>
#include <qpnp-smb2.h>
#include <qpnp-fg-gen3.h>
#include <qtimer.h>
@@ -44,6 +45,8 @@
#define BATT_STATUS_MASK 0x07
#define DISABLE_CHARGE 0x07
+char panel_name[256];
+
static bool is_battery_present(void)
{
uint8_t val = 0;
@@ -122,6 +125,12 @@
shutdown_device();
}
+ if (!display_initialized) {
+ charge_in_progress = true;
+ target_display_init(panel_name);
+ display_initialized = true;
+ }
+
current_vbat = fg_gen3_get_battery_voltage();
batt_curr = fg_gen3_get_battery_current();
dprintf(INFO, "Battery Charging: current=%d mA voltage=%d mV\n",
@@ -129,5 +138,6 @@
mdelay(1000);
}
+ charge_in_progress = false;
dprintf(INFO,"Battery Charging is completed Booting to HLOS\n");
-}
+}
\ No newline at end of file
diff --git a/dev/pmic/pmi8994/include/pm_app_smbchg.h b/dev/pmic/pmi8994/include/pm_app_smbchg.h
index 0a55b99..7178b96 100644
--- a/dev/pmic/pmi8994/include/pm_app_smbchg.h
+++ b/dev/pmic/pmi8994/include/pm_app_smbchg.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015, 2019, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -198,10 +198,7 @@
void *pm_target_information_get_specific_info();
void *pm_target_chg_range_data();
-bool pm_appsbl_display_init_done();
-bool pm_appsbl_charging_in_progress();
pm_err_flag_type pm_appsbl_set_dcin_suspend();
-bool pm_app_display_shutdown_in_prgs();
pm_err_flag_type pm_smbchg_get_charger_path(uint32 device_index, pm_smbchg_usb_chgpth_pwr_pth_type* charger_path);
#endif //PM_APP_SMBCHG__H
diff --git a/dev/pmic/pmi8994/include/pm_smbchg_common.h b/dev/pmic/pmi8994/include/pm_smbchg_common.h
new file mode 100644
index 0000000..4847de5
--- /dev/null
+++ b/dev/pmic/pmi8994/include/pm_smbchg_common.h
@@ -0,0 +1,42 @@
+/* Copyright (c) 2015, 2019, The Linux Foundation. All rights reserved.
+
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PM_SMBCHG_H_
+#define _PM_SMBCHG_H_
+
+#include <sys/types.h>
+
+extern bool charge_in_progress;
+extern bool display_initialized;
+extern bool display_shutdown_in_prgs;
+
+bool pm_appsbl_charging_in_progress();
+bool pm_appsbl_display_init_done();
+bool pm_app_display_shutdown_in_prgs();
+
+#endif
diff --git a/dev/pmic/pmi8994/pm_app_smbchg.c b/dev/pmic/pmi8994/pm_app_smbchg.c
index 7ee25d9..473b48a 100644
--- a/dev/pmic/pmi8994/pm_app_smbchg.c
+++ b/dev/pmic/pmi8994/pm_app_smbchg.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015, 2019, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -39,6 +39,7 @@
#include "pm_fg_driver.h"
#include "pm_smbchg_driver.h"
#include "pm_comm.h"
+#include "pm_smbchg_common.h"
#include "pm_smbchg_dc_chgpth.h"
#include <kernel/thread.h>
#include <debug.h>
@@ -72,17 +73,7 @@
#define boot_log_message(...) dprintf(CRITICAL, __VA_ARGS__)
static pm_smbchg_bat_if_low_bat_thresh_type pm_dbc_bootup_volt_threshold;
-/* Need to maintain flags to track
- * 1. charge_in_progress: Charging progress and exit the loop once charging is completed.
- * 2. display_initialized: Track if the display is already initialized to make sure display
- * thread does not reinitialize the display again.
- * 3. display_shutdown_in_prgs: To avoid race condition between regualr display initialization and
- * display shutdown in display thread.
- */
-static bool display_initialized;
-static bool charge_in_progress;
-static bool display_shutdown_in_prgs;
static bool pm_app_read_from_sram;
char panel_name[256];
@@ -594,16 +585,6 @@
}
#endif
-bool pm_appsbl_charging_in_progress()
-{
- return charge_in_progress;
-}
-
-bool pm_appsbl_display_init_done()
-{
- return display_initialized;
-}
-
pm_err_flag_type pm_appsbl_set_dcin_suspend(uint32_t device_index)
{
pm_err_flag_type err_flag = PM_ERR_FLAG__SUCCESS;
@@ -629,11 +610,6 @@
return false;
}
-bool pm_app_display_shutdown_in_prgs()
-{
- return display_shutdown_in_prgs;
-}
-
static int display_charger_screen()
{
static bool display_init_first_time;
diff --git a/dev/pmic/pmi8994/pm_smbchg_common.c b/dev/pmic/pmi8994/pm_smbchg_common.c
new file mode 100644
index 0000000..992bf39
--- /dev/null
+++ b/dev/pmic/pmi8994/pm_smbchg_common.c
@@ -0,0 +1,56 @@
+/* Copyright (c) 2015, 2019, The Linux Foundation. All rights reserved.
+
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <pm_smbchg_common.h>
+
+/* Need to maintain flags to track
+ * 1. charge_in_progress: Charging progress and exit the loop once charging is completed.
+ * 2. display_initialized: Track if the display is already initialized to make sure display
+ * thread does not reinitialize the display again.
+ * 3. display_shutdown_in_prgs: To avoid race condition between regualr display initialization and
+ * display shutdown in display thread.
+ */
+
+bool charge_in_progress = false;
+bool display_initialized = false;
+bool display_shutdown_in_prgs = false;
+
+bool pm_appsbl_charging_in_progress()
+{
+ return charge_in_progress;
+}
+
+bool pm_appsbl_display_init_done()
+{
+ return display_initialized;
+}
+
+bool pm_app_display_shutdown_in_prgs()
+{
+ return display_shutdown_in_prgs;
+}
\ No newline at end of file
diff --git a/dev/pmic/pmi8994/rules.mk b/dev/pmic/pmi8994/rules.mk
index bbf41d0..7c4ede7 100644
--- a/dev/pmic/pmi8994/rules.mk
+++ b/dev/pmic/pmi8994/rules.mk
@@ -13,4 +13,5 @@
$(LOCAL_DIR)/pm_fg_driver.o \
$(LOCAL_DIR)/pm_smbchg_chgr.o \
$(LOCAL_DIR)/pm_smbchg_driver.o \
- $(LOCAL_DIR)/pm_smbchg_usb_chgpth.o
+ $(LOCAL_DIR)/pm_smbchg_usb_chgpth.o \
+ $(LOCAL_DIR)/pm_smbchg_common.o
diff --git a/platform/init.c b/platform/init.c
index 0488c53..9044bac 100644
--- a/platform/init.c
+++ b/platform/init.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2008 Travis Geiselbrecht
*
- * Copyright (c) 2014-2016,2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2016,2019-2020 The Linux Foundation. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
@@ -180,6 +180,10 @@
return 0;
#endif
}
+__WEAK void *target_mmc_device()
+{
+ return NULL;
+}
/* function to update boot device base, for emmc targets. */
__WEAK void platform_boot_dev_cmdline(char *buf)
@@ -193,6 +197,11 @@
}
dev = (struct mmc_device *)target_mmc_device();
+ if (!dev) {
+ dprintf(CRITICAL,"ERROR: Invalid mmc device");
+ return;
+ }
+
boot_dev_str_sz = ((sizeof(dev->host.base))*2) + 7;
if (boot_dev_str_sz > sizeof(char) * BOOT_DEV_MAX_LEN) {
dprintf(CRITICAL,"ERROR: Invalid buf sz - Failed to populate boot device");
diff --git a/platform/mdm9607/platform.c b/platform/mdm9607/platform.c
index 1be8698..701a3a1 100644
--- a/platform/mdm9607/platform.c
+++ b/platform/mdm9607/platform.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015,2020 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -53,6 +53,8 @@
#define SCRATCH_REGION1_VIRT_START_128 0x88000000
#define SCRATCH_REGION2_VIRT_START_128 (SCRATCH_REGION1_VIRT_START_128 + SCRATCH_REGION1_SIZE_128)
+#define SCRATCH_REGION2_VIRT_START_256 (SCRATCH_REGION_256 + SCRATCH_REGION_SIZE_256)
+
static void ddr_based_mmu_mappings(mmu_section_t *table, uint32_t table_size);
static uint64_t ddr_size;
static void board_ddr_detect();
@@ -80,8 +82,9 @@
};
mmu_section_t mmu_section_table_256[] = {
- {SCRATCH_REGION_256, SCRATCH_REGION_256, SCRATCH_REGION_SIZE_256/ MB, SCRATCH_MEMORY},
- {KERNEL_REGION, KERNEL_REGION, KERNEL_REGION_SIZE/ MB, SCRATCH_MEMORY},
+ {SCRATCH_REGION_256, SCRATCH_REGION_256, SCRATCH_REGION_SIZE_256/ MB, SCRATCH_MEMORY},
+ {SCRATCH_REGION2_256, SCRATCH_REGION2_VIRT_START_256, SCRATCH_REGION2_SIZE_256/ MB, SCRATCH_MEMORY},
+ {KERNEL_REGION, KERNEL_REGION, KERNEL_REGION_SIZE/ MB, SCRATCH_MEMORY},
};
static void board_ddr_detect()
diff --git a/project/msm8952.mk b/project/msm8952.mk
index ac8da71..90cfcdb 100644
--- a/project/msm8952.mk
+++ b/project/msm8952.mk
@@ -103,7 +103,7 @@
ENABLE_WEAK_BATT_CHRG_SUPPORT := 1
ifeq ($(ENABLE_WEAK_BATT_CHRG_SUPPORT),1)
-DEFINES += WEAK_BATT_CHRG_SUPPORT=1
+DEFINES += ENABLE_WBC=1
DEFINES += LK_BATT_VOLT_THRESHOLD=3400000
endif
diff --git a/target/mdm9607/meminfo.c b/target/mdm9607/meminfo.c
index 31eea83..3196cfc 100644
--- a/target/mdm9607/meminfo.c
+++ b/target/mdm9607/meminfo.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015,2020 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -103,5 +103,5 @@
return (SCRATCH_REGION1_SIZE_128 + SCRATCH_REGION2_SIZE_128);
else
/*256MB DDR scratch size*/
- return (SCRATCH_REGION_SIZE_256);
+ return (SCRATCH_REGION_SIZE_256 + SCRATCH_REGION2_SIZE_256);
}
diff --git a/target/mdm9607/rules.mk b/target/mdm9607/rules.mk
index 555cf51..422b906 100644
--- a/target/mdm9607/rules.mk
+++ b/target/mdm9607/rules.mk
@@ -12,14 +12,16 @@
SCRATCH_REGION1_128 := 0x86000000
SCRATCH_REGION1_SIZE_128 := 0x01a00000 # 26MB
SCRATCH_REGION2_128 := 0x80000000
-SCRATCH_REGION2_SIZE_128 := 0x02900000 # 41M
+SCRATCH_REGION2_SIZE_128 := 0x02900000 # 41M
KERNEL_REGION := 0x80000000
-KERNEL_REGION_SIZE := 0x2000000 # 20MB
+KERNEL_REGION_SIZE := 0x02000000 # 32MB
SCRATCH_ADDR_256 := 0x88000000
SCRATCH_REGION_256 := 0x88000000
+SCRATCH_REGION2_256 := 0x82A00000
SCRATCH_REGION_SIZE_256 := 0x08000000 # 128MB
+SCRATCH_REGION2_SIZE_256 := 0x05000000 # 80MB
BASE_ADDR := 0x80000000
@@ -39,11 +41,13 @@
SCRATCH_ADDR_128=$(SCRATCH_ADDR_128) \
SCRATCH_ADDR_256=$(SCRATCH_ADDR_256) \
SCRATCH_REGION_256=$(SCRATCH_REGION_256) \
+ SCRATCH_REGION2_256=$(SCRATCH_REGION2_256) \
SCRATCH_REGION1_128=$(SCRATCH_REGION1_128) \
SCRATCH_REGION2_128=$(SCRATCH_REGION2_128) \
SCRATCH_REGION1_SIZE_128=$(SCRATCH_REGION1_SIZE_128) \
SCRATCH_REGION2_SIZE_128=$(SCRATCH_REGION2_SIZE_128) \
SCRATCH_REGION_SIZE_256=$(SCRATCH_REGION_SIZE_256) \
+ SCRATCH_REGION2_SIZE_256=$(SCRATCH_REGION2_SIZE_256) \
KERNEL_REGION=$(KERNEL_REGION) \
KERNEL_REGION_SIZE=$(KERNEL_REGION_SIZE)
diff --git a/target/msm8952/init.c b/target/msm8952/init.c
index c95899f..9700941 100644
--- a/target/msm8952/init.c
+++ b/target/msm8952/init.c
@@ -69,7 +69,7 @@
#include <vibrator.h>
#endif
-#if WEAK_BATT_CHRG_SUPPORT
+#if ENABLE_WBC
#include <qpnp-smb2.h>
#endif
@@ -349,12 +349,6 @@
vib_timed_turn_on(VIBRATE_TIME);
#endif
-#if WEAK_BATT_CHRG_SUPPORT
- if(sdm429_pm660_target())
- /* Start Weak Battery Charging */
- weak_battery_charging();
-#endif
-
if (target_use_signed_kernel())
target_crypto_init_params();
@@ -395,6 +389,15 @@
#if SMD_SUPPORT
rpm_smd_init();
#endif
+
+#if ENABLE_WBC
+ if(sdm429_pm660_target())
+ {
+ /* Start Weak Battery Charging */
+ weak_battery_charging();
+ }
+#endif
+
}
void target_serialno(unsigned char *buf)
@@ -808,4 +811,3 @@
}
}
}
-
diff --git a/target/msm8996/init.c b/target/msm8996/init.c
index 9434738..1b26698 100644
--- a/target/msm8996/init.c
+++ b/target/msm8996/init.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2018, 2020 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -63,6 +63,7 @@
#include <rpm-glink.h>
#if ENABLE_WBC
#include <pm_app_smbchg.h>
+#include <pm_smbchg_common.h>
#endif
#if LONG_PRESS_POWER_ON