mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
Support discharge on BQ24715 for Rambi and Squawks
BUG=chrome-os-partner:25031
BRANCH=rambi
TEST=Manually
make BOARD=peppy
make BOARD=falco
make BOARD=rambi
make BOARD=squawks
On rambi and squawks, connect charger
ectool chargecontrol discharge
ectool i2cread 16 0 0x16 0x0a
It should return 16-bit negative integer.
Change-Id: I8a8dfa90d2ad82595ac7a420c3c8ffc13b12cde6
Signed-off-by: Justin Chuang <jchuang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/182586
Reviewed-by: Dave Parker <dparker@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
e73a228985
commit
fc91a7f7fd
@@ -8,8 +8,8 @@
|
||||
#include "adc_chip.h"
|
||||
#include "backlight.h"
|
||||
#include "board.h"
|
||||
#include "charger.h"
|
||||
#include "common.h"
|
||||
#include "driver/charger/bq24738.h"
|
||||
#include "driver/temp_sensor/g781.h"
|
||||
#include "extpower.h"
|
||||
#include "fan.h"
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "adc.h"
|
||||
#include "adc_chip.h"
|
||||
#include "backlight.h"
|
||||
#include "charger.h"
|
||||
#include "common.h"
|
||||
#include "driver/temp_sensor/tmp432.h"
|
||||
#include "extpower.h"
|
||||
@@ -197,3 +198,11 @@ struct ec_thermal_config thermal_params[] = {
|
||||
{{0, 0, 0}, 0, 0},
|
||||
};
|
||||
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
|
||||
|
||||
/**
|
||||
* Discharge battery when on AC power for factory test.
|
||||
*/
|
||||
int board_discharge_on_ac(int enable)
|
||||
{
|
||||
return charger_discharge_on_ac(enable);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#define CONFIG_BOARD_VERSION
|
||||
#define CONFIG_CHARGER
|
||||
#define CONFIG_CHARGER_BQ24715
|
||||
#define CONFIG_CHARGER_DISCHARGE_ON_AC
|
||||
#define CONFIG_CHARGER_INPUT_CURRENT 1700 /* 33 W adapter, 19 V, 1.75 A */
|
||||
#define CONFIG_CHARGER_SENSE_RESISTOR 10 /* Charge sense resistor, mOhm */
|
||||
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 /* Input senso resistor, mOhm */
|
||||
@@ -177,6 +178,9 @@ enum temp_sensor_id {
|
||||
TEMP_SENSOR_COUNT
|
||||
};
|
||||
|
||||
/* Discharge battery when on AC power for factory test. */
|
||||
int board_discharge_on_ac(int enable);
|
||||
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
|
||||
#endif /* __BOARD_H */
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "adc.h"
|
||||
#include "adc_chip.h"
|
||||
#include "backlight.h"
|
||||
#include "charger.h"
|
||||
#include "common.h"
|
||||
#include "driver/temp_sensor/tmp432.h"
|
||||
#include "extpower.h"
|
||||
@@ -199,3 +200,11 @@ struct ec_thermal_config thermal_params[] = {
|
||||
{{0, 0, 0}, 0, 0},
|
||||
};
|
||||
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
|
||||
|
||||
/**
|
||||
* Discharge battery when on AC power for factory test.
|
||||
*/
|
||||
int board_discharge_on_ac(int enable)
|
||||
{
|
||||
return charger_discharge_on_ac(enable);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#define CONFIG_BOARD_VERSION
|
||||
#define CONFIG_CHARGER
|
||||
#define CONFIG_CHARGER_BQ24715
|
||||
#define CONFIG_CHARGER_DISCHARGE_ON_AC
|
||||
#define CONFIG_CHARGER_INPUT_CURRENT 1700 /* 33 W adapter, 19 V, 1.75 A */
|
||||
#define CONFIG_CHARGER_SENSE_RESISTOR 10 /* Charge sense resistor, mOhm */
|
||||
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 /* Input senso resistor, mOhm */
|
||||
@@ -178,6 +179,9 @@ enum temp_sensor_id {
|
||||
TEMP_SENSOR_COUNT
|
||||
};
|
||||
|
||||
/* Discharge battery when on AC power for factory test. */
|
||||
int board_discharge_on_ac(int enable);
|
||||
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
|
||||
#endif /* __BOARD_H */
|
||||
|
||||
@@ -190,3 +190,22 @@ int charger_post_init(void)
|
||||
rv = charger_set_input_current(CONFIG_CHARGER_INPUT_CURRENT);
|
||||
return rv;
|
||||
}
|
||||
|
||||
int charger_discharge_on_ac(int enable)
|
||||
{
|
||||
int rv;
|
||||
int option;
|
||||
|
||||
rv = charger_get_option(&option);
|
||||
if (rv)
|
||||
return rv;
|
||||
|
||||
option &= ~OPT_LEARN_MASK;
|
||||
if (enable)
|
||||
option |= OPT_LEARN_ENABLE;
|
||||
else
|
||||
option |= OPT_LEARN_DISABLE;
|
||||
rv = charger_set_option(option);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,4 @@
|
||||
#define ACPRES_DEGLITCH_150MS (0 << 15)
|
||||
#define ACPRES_DEGLITCH_1300MS_DEFAULT (1 << 15)
|
||||
|
||||
/* Discharge battery when on AC power. */
|
||||
int charger_discharge_on_ac(int enable);
|
||||
|
||||
#endif /* __CROS_EC_CHARGER_BQ24738_H */
|
||||
|
||||
@@ -76,6 +76,9 @@ int charger_set_current(int current);
|
||||
int charger_get_voltage(int *voltage);
|
||||
int charger_set_voltage(int voltage);
|
||||
|
||||
/* Discharge battery when on AC power. */
|
||||
int charger_discharge_on_ac(int enable);
|
||||
|
||||
/* Other parameters that may be charger-specific, but are common so far. */
|
||||
int charger_set_input_current(int input_current);
|
||||
int charger_get_input_current(int *input_current);
|
||||
|
||||
Reference in New Issue
Block a user