mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-08 08:31:52 +00:00
charge_manager: Support no-battery / no-host boards
Boards without batteries and/or without host command support may wish to use charge_manager. BUG=chromium:769895 BRANCH=None TEST=`make buildall -j` Change-Id: I2455528de3300a0651791752a05409c888b5f2a3 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/713943 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
ebcbc5d5f2
commit
33ec4ae3bc
@@ -124,6 +124,7 @@ static int is_connected(int port)
|
||||
* @return 1 when we need to override the a non-dedicated charger
|
||||
* to be a dedicated one, 0 otherwise.
|
||||
*/
|
||||
#ifdef CONFIG_BATTERY
|
||||
static int charge_manager_spoof_dualrole_capability(void)
|
||||
{
|
||||
int spoof_dualrole = (system_get_image_copy() == SYSTEM_IMAGE_RO &&
|
||||
@@ -135,6 +136,13 @@ static int charge_manager_spoof_dualrole_capability(void)
|
||||
#endif
|
||||
return spoof_dualrole;
|
||||
}
|
||||
#else /* CONFIG_BATTERY */
|
||||
/* No battery, so always charge from input port. */
|
||||
static inline int charge_manager_spoof_dualrole_capability(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif /* CONFIG_BATTERY */
|
||||
|
||||
/**
|
||||
* Initialize available charge. Run before board init, so board init can
|
||||
|
||||
@@ -1271,7 +1271,11 @@ extern const int pd_snk_pdo_cnt;
|
||||
*
|
||||
* @param mask host event mask.
|
||||
*/
|
||||
#if defined(HAS_TASK_HOSTCMD) && !defined(TEST_BUILD)
|
||||
void pd_send_host_event(int mask);
|
||||
#else
|
||||
static inline void pd_send_host_event(int mask) { }
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Determine if in alternate mode or not.
|
||||
|
||||
@@ -181,19 +181,22 @@ int ncp15wb_calculate_temp(uint16_t adc);
|
||||
#endif
|
||||
#endif /* TEST_USB_PD || TEST_USB_PD_GIVEBACK */
|
||||
|
||||
#ifdef TEST_CHARGE_MANAGER
|
||||
#if defined(TEST_CHARGE_MANAGER) || defined(TEST_CHARGE_MANAGER_DRP_CHARGING)
|
||||
#define CONFIG_CHARGE_MANAGER
|
||||
#undef CONFIG_CHARGE_MANAGER_DRP_CHARGING
|
||||
#define CONFIG_USB_PD_DUAL_ROLE
|
||||
#define CONFIG_USB_PD_PORT_COUNT 2
|
||||
#endif
|
||||
#define CONFIG_BATTERY
|
||||
#define CONFIG_BATTERY_SMART
|
||||
#define CONFIG_I2C
|
||||
#define CONFIG_I2C_MASTER
|
||||
#define I2C_PORT_BATTERY 0
|
||||
#endif /* TEST_CHARGE_MANAGER_* */
|
||||
|
||||
#ifdef TEST_CHARGE_MANAGER_DRP_CHARGING
|
||||
#define CONFIG_CHARGE_MANAGER
|
||||
#define CONFIG_CHARGE_MANAGER_DRP_CHARGING
|
||||
#define CONFIG_USB_PD_DUAL_ROLE
|
||||
#define CONFIG_USB_PD_PORT_COUNT 2
|
||||
#endif
|
||||
#else
|
||||
#undef CONFIG_CHARGE_MANAGER_DRP_CHARGING
|
||||
#endif /* TEST_CHARGE_MANAGER_DRP_CHARGING */
|
||||
|
||||
#ifdef TEST_CHARGE_RAMP
|
||||
#define CONFIG_CHARGE_RAMP_SW
|
||||
@@ -275,10 +278,5 @@ enum nvmem_vars {
|
||||
#define CONFIG_CURVE25519
|
||||
#endif /* TEST_X25519 */
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
/* Callback function from charge_manager to send host event */
|
||||
static inline void pd_send_host_event(int mask) { }
|
||||
#endif
|
||||
|
||||
#endif /* TEST_BUILD */
|
||||
#endif /* __TEST_TEST_CONFIG_H */
|
||||
|
||||
Reference in New Issue
Block a user