mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-07-19 12:07:00 +08:00
44 lines
1.5 KiB
Diff
44 lines
1.5 KiB
Diff
From 69645c0ba065a4414d633f62fb100e9ae2471fbb Mon Sep 17 00:00:00 2001
|
|
From: Hector Martin <marcan@marcan.st>
|
|
Date: Tue, 8 Feb 2022 02:51:35 +0900
|
|
Subject: [PATCH 141/171] power: supply: macsmc_power: Add cycle count and
|
|
health props
|
|
|
|
Signed-off-by: Hector Martin <marcan@marcan.st>
|
|
---
|
|
drivers/power/supply/macsmc_power.c | 11 +++++++++++
|
|
1 file changed, 11 insertions(+)
|
|
|
|
diff --git a/drivers/power/supply/macsmc_power.c b/drivers/power/supply/macsmc_power.c
|
|
index 140526a963b6..6c939371912a 100644
|
|
--- a/drivers/power/supply/macsmc_power.c
|
|
+++ b/drivers/power/supply/macsmc_power.c
|
|
@@ -138,6 +138,15 @@ static int macsmc_battery_get_property(struct power_supply *psy,
|
|
ret = apple_smc_read_s64(power->smc, SMC_KEY(BAAC), &vs64);
|
|
val->intval = vs64;
|
|
break;
|
|
+ case POWER_SUPPLY_PROP_CYCLE_COUNT:
|
|
+ ret = apple_smc_read_u16(power->smc, SMC_KEY(B0CT), &vu16);
|
|
+ val->intval = vu16;
|
|
+ break;
|
|
+ case POWER_SUPPLY_PROP_HEALTH:
|
|
+ ret = apple_smc_read_flag(power->smc, SMC_KEY(BBAD));
|
|
+ val->intval = ret == 1 ? POWER_SUPPLY_HEALTH_DEAD : POWER_SUPPLY_HEALTH_GOOD;
|
|
+ ret = ret < 0 ? ret : 0;
|
|
+ break;
|
|
case POWER_SUPPLY_PROP_MODEL_NAME:
|
|
val->strval = power->model_name;
|
|
break;
|
|
@@ -169,6 +178,8 @@ static enum power_supply_property macsmc_battery_props[] = {
|
|
POWER_SUPPLY_PROP_CHARGE_NOW,
|
|
POWER_SUPPLY_PROP_TEMP,
|
|
POWER_SUPPLY_PROP_CHARGE_COUNTER,
|
|
+ POWER_SUPPLY_PROP_CYCLE_COUNT,
|
|
+ POWER_SUPPLY_PROP_HEALTH,
|
|
POWER_SUPPLY_PROP_MODEL_NAME,
|
|
POWER_SUPPLY_PROP_SERIAL_NUMBER,
|
|
};
|
|
--
|
|
2.34.1
|
|
|