lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-id: <1310977356-24032-1-git-send-email-dg77.kim@samsung.com>
Date:	Mon, 18 Jul 2011 17:22:36 +0900
From:	Donggeun Kim <dg77.kim@...sung.com>
To:	cbou@...l.ru
Cc:	kyungmin.park@...sung.com, myungjoo.ham@...sung.com,
	dg77.kim@...sung.com, linux-kernel@...r.kernel.org
Subject: [PATCH] power_supply: MAX8997 Charger: Provide status field with more
 information

This patch provides additional three values for STATUS property.

Signed-off-by: Donggeun Kim <dg77.kim@...sung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@...sung.com>
Signed-off-by: KyungMin Park <kyungmin.park@...sung.com>
---
 drivers/power/max8997_charger.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/power/max8997_charger.c b/drivers/power/max8997_charger.c
index 7106b49..790b325 100644
--- a/drivers/power/max8997_charger.c
+++ b/drivers/power/max8997_charger.c
@@ -55,8 +55,17 @@ static int max8997_battery_get_property(struct power_supply *psy,
 		ret = max8997_read_reg(i2c, MAX8997_REG_STATUS4, &reg);
 		if (ret)
 			return ret;
+
 		if ((reg & (1 << 0)) == 0x1)
 			val->intval = POWER_SUPPLY_STATUS_FULL;
+		else if ((reg & (1 << 1)) && !(reg & (1 << 2)) &&
+			 (reg & (1 << 3)) && (reg & (3 << 4)) &&
+			 !(reg & (1 << 6)))
+			val->intval = POWER_SUPPLY_STATUS_CHARGING;
+		else if ((reg & (1 << 1)) && !(reg & (1 << 6)))
+			val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
+		else
+			val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
 
 		break;
 	case POWER_SUPPLY_PROP_PRESENT:
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ