[PATCH] GTA01: Add "present" property to power_supply

Nelson Castillo arhuaco at freaks-unidos.net
Wed Apr 29 01:58:05 CEST 2009


Small patch to add /sys/class/power_supply/battery/present.
You must not run a GTA01 without battery thus it is always 1.

Signed-off-by: Nelson Castillo <arhuaco at freaks-unidos.net>
---

 drivers/power/gta01_battery.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/power/gta01_battery.c b/drivers/power/gta01_battery.c
index 909f7fe..81a0fe7 100644
--- a/drivers/power/gta01_battery.c
+++ b/drivers/power/gta01_battery.c
@@ -19,6 +19,7 @@ struct gta01_battery {
 };
 
 static enum power_supply_property gta01_bat_props[] = {
+	POWER_SUPPLY_PROP_PRESENT,
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
 	POWER_SUPPLY_PROP_CURRENT_NOW,
@@ -43,6 +44,9 @@ static int gta01_bat_get_property(struct power_supply *psy,
 	case POWER_SUPPLY_PROP_CURRENT_NOW:
 		val->intval = bat->pdata->get_current();
 		break;
+	case POWER_SUPPLY_PROP_PRESENT:
+		val->intval = 1; /* You must never run GTA01 without battery. */
+		break;
 	default:
 		return -EINVAL;
 	}




More information about the openmoko-kernel mailing list