drivers: power: Add CONFIG_QG_LEGACY for legacy devices

* Fixes battery detection for legacy devices

Co-authored-by: marcost2 <marcostolcachir@gmail.com>
Change-Id: Ibd13f278a38ca80e593a0d4e0c14389faad580dc
This commit is contained in:
Deivid21 2025-09-01 11:13:20 -04:00 • committed by Michael Bestas
commit 06c7efd80c
4 changed files with 11 additions and 3 deletions

View file

@ -7,3 +7,11 @@ config MMI_SMBCHARGER_IIO
This driver can also be built as a module. If so, the module
will be called mmi-smbcharger-iio.
config QG_LEGACY
bool "Legacy behavior for QG fuel gauge (disable SOH)"
depends on MMI_SMBCHARGER_IIO
default n
help
Says Y if you want to disable QG SOH channel and use legacy
battery detection path.

View file

@ -4815,7 +4815,7 @@ static int qpnp_qg_probe(struct platform_device *pdev)
chip->sys_soc = INT_MIN;
chip->full_soc = QG_SOC_FULL;
chip->chg_iterm_ma = INT_MIN;
#ifdef CONFIG_DENVER_DTB
#ifdef CONFIG_QG_LEGACY
chip->soh = -EINVAL;
#else
chip->soh = 100;

View file

@ -33,7 +33,7 @@ enum qg_chg_iio_channels {
SMB5_QG_CYCLE_COUNT,
SMB5_QG_CHARGE_FULL_DESIGN,
SMB5_QG_TIME_TO_FULL_NOW,
#ifndef CONFIG_DENVER_DTB
#ifndef CONFIG_QG_LEGACY
SMB5_QG_SOH,
#endif
};

View file

@ -915,7 +915,7 @@ static const char * const smblib_qg_ext_iio_chan[] = {
[SMB5_QG_CYCLE_COUNT] = "cycle_count",
[SMB5_QG_CHARGE_FULL_DESIGN] = "charge_full_design",
[SMB5_QG_TIME_TO_FULL_NOW] = "time_to_full_now",
#ifndef CONFIG_DENVER_DTB
#ifndef CONFIG_QG_LEGACY
[SMB5_QG_SOH] = "soh",
#endif
};