Message ID | 20220827073224.713803-3-weiyongjun1@huawei.com (mailing list archive) |
---|---|
State | Handled Elsewhere, archived |
Headers | show |
Series | power: supply: adp5061: some fixes from device mockup test | expand |
> -----Original Message----- > From: Wei Yongjun <weiyongjun1@huawei.com> > Sent: Samstag, 27. August 2022 09:32 > To: Hennerich, Michael <Michael.Hennerich@analog.com>; Sebastian > Reichel <sre@kernel.org> > Cc: Wei Yongjun <weiyongjun1@huawei.com>; linux-pm@vger.kernel.org; > linux-kernel@vger.kernel.org > Subject: [PATCH -next 2/2] power: supply: adp5061: show unknown > capacity_level as text > > > 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> > --- > drivers/power/supply/adp5061.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/power/supply/adp5061.c > b/drivers/power/supply/adp5061.c index daee1161c305..fcf8ff0bc974 > 100644 > --- a/drivers/power/supply/adp5061.c > +++ b/drivers/power/supply/adp5061.c > @@ -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; > -- > 2.34.1
diff --git a/drivers/power/supply/adp5061.c b/drivers/power/supply/adp5061.c index daee1161c305..fcf8ff0bc974 100644 --- a/drivers/power/supply/adp5061.c +++ b/drivers/power/supply/adp5061.c @@ -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;
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> --- drivers/power/supply/adp5061.c | 3 +++ 1 file changed, 3 insertions(+)