From 08a2151766ca7fa0c07a7e1694596d687a8eacc3 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Thu, 10 Nov 2022 20:05:35 +0100
Subject: [PATCH 399/487] power: supply: ip5xxx: Add support for
 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN

Report total battery capacity.

Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
 drivers/power/supply/ip5xxx_power.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/power/supply/ip5xxx_power.c b/drivers/power/supply/ip5xxx_power.c
index ff2f4eeea875..b24f1122333b 100644
--- a/drivers/power/supply/ip5xxx_power.c
+++ b/drivers/power/supply/ip5xxx_power.c
@@ -195,6 +195,8 @@ static const enum power_supply_property ip5xxx_battery_properties[] = {
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
+	POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
+	POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN,
 };
 
 static int ip5xxx_battery_get_status(struct ip5xxx *ip5xxx, int *val)
@@ -401,6 +403,14 @@ static int ip5xxx_battery_get_property(struct power_supply *psy,
 		val->intval = DIV_ROUND_CLOSEST(raw * 149197, 200);
 		return 0;
 
+	case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
+		val->intval = ip5xxx->bat->energy_full_design_uwh;
+		return 0;
+
+	case POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN:
+		val->intval = 0;
+		return 0;
+
 	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
 		ret = ip5xxx_read(ip5xxx, IP5XXX_CHG_CTL4A, &rval);
 		if (ret)
-- 
2.48.1

