diff --git a/arch/arm/configs/lineage_milletltetmo_defconfig b/arch/arm/configs/lineage_milletltetmo_defconfig index 7bffbeed4a6..f0e7a9309ae 100644 --- a/arch/arm/configs/lineage_milletltetmo_defconfig +++ b/arch/arm/configs/lineage_milletltetmo_defconfig @@ -2304,9 +2304,9 @@ CONFIG_POWER_SUPPLY=y # CONFIG_QPNP_CHARGER is not set # CONFIG_QPNP_SEC_CHARGER is not set # CONFIG_LTC4088_CHARGER is not set -CONFIG_BATTERY_BCL=y +# CONFIG_BATTERY_BCL is not set # CONFIG_CHARGER_SMB347 is not set -CONFIG_QPNP_BMS=y +# CONFIG_QPNP_BMS is not set CONFIG_HWMON=y # CONFIG_HWMON_VID is not set # CONFIG_HWMON_DEBUG_CHIP is not set @@ -3800,7 +3800,8 @@ CONFIG_BATTERY_SAMSUNG_DATA_FILE="" # CONFIG_FUELGAUGE_DUMMY is not set # CONFIG_FUELGAUGE_MAX17042 is not set # CONFIG_FUELGAUGE_MAX17048 is not set -# CONFIG_FUELGAUGE_MAX17050 is not set +CONFIG_FUELGAUGE_MAX17050=y +CONFIG_FUELGAUGE_MAX17050_COULOMB_COUNTING=y # CONFIG_FUELGAUGE_MAX77823 is not set # CONFIG_CHARGER_DUMMY is not set # CONFIG_CHARGER_SMB328 is not set diff --git a/drivers/battery/max17050_fuelgauge.c b/drivers/battery/max17050_fuelgauge.c index 58fd2e2aff4..ab0d2b22569 100644 --- a/drivers/battery/max17050_fuelgauge.c +++ b/drivers/battery/max17050_fuelgauge.c @@ -2072,8 +2072,13 @@ static int get_fuelgauge_soc(struct i2c_client *client) goto return_soc; } +#if defined(ANDROID_ALARM_ACTIVATED) current_time = alarm_get_elapsed_realtime(); ts = ktime_to_timespec(current_time); +#else + current_time = ktime_get_boottime(); + ts = ktime_to_timespec(current_time); +#endif /* check fullcap range */ fullcap_check_interval = @@ -2218,8 +2223,13 @@ bool sec_hal_fg_init(struct i2c_client *client) ktime_t current_time; struct timespec ts; +#if defined(ANDROID_ALARM_ACTIVATED) current_time = alarm_get_elapsed_realtime(); ts = ktime_to_timespec(current_time); +#else + current_time = ktime_get_boottime(); + ts = ktime_to_timespec(current_time); +#endif board_fuelgauge_init(fuelgauge); diff --git a/include/linux/battery/fuelgauge/max17050_fuelgauge.h b/include/linux/battery/fuelgauge/max17050_fuelgauge.h index 364039e3b88..1b116ea956b 100644 --- a/include/linux/battery/fuelgauge/max17050_fuelgauge.h +++ b/include/linux/battery/fuelgauge/max17050_fuelgauge.h @@ -18,7 +18,9 @@ #ifndef __MAX17050_FUELGAUGE_H #define __MAX17050_FUELGAUGE_H __FILE__ +#if defined(ANDROID_ALARM_ACTIVATED) #include +#endif #if defined(CONFIG_MACH_LT03SKT) || defined(CONFIG_MACH_LT03KTT) || \ defined(CONFIG_MACH_LT03LGT) || defined(CONFIG_MACH_MONDRIAN)