]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
power: supply: adp5061: show unknown capacity_level as text
authorWei Yongjun <weiyongjun1@huawei.com>
Sat, 27 Aug 2022 07:32:24 +0000 (07:32 +0000)
committerSebastian Reichel <sre@kernel.org>
Sun, 11 Sep 2022 10:19:28 +0000 (12:19 +0200)
adp5061_get_battery_status() only defined show chg_status <= 4, others will
be show as '-1731902199' from /sys/class/power_supply/xx/capacity_level.
switch to show them as 'Unknown'.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/adp5061.c

index daee1161c3059cf2bfb9c30639d5b64dd119b09c..fcf8ff0bc974b86c289580ed17a6d3230d042a98 100644 (file)
@@ -493,6 +493,9 @@ static int adp5061_get_battery_status(struct adp5061_state *st,
        case 0x4: /* VBAT_SNS > VWEAK */
                val->intval = POWER_SUPPLY_CAPACITY_LEVEL_NORMAL;
                break;
+       default:
+               val->intval = POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN;
+               break;
        }
 
        return ret;