GTA01: Add "present" property to power_supply
authorNelson Castillo <arhuaco@freaks-unidos.net>
Tue, 28 Apr 2009 23:58:05 +0000 (18:58 -0500)
committerNelson Castillo <arhuaco@freaks-unidos.net>
Tue, 28 Apr 2009 23:59:24 +0000 (18:59 -0500)
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@freaks-unidos.net>

drivers/power/gta01_battery.c

index 909f7fe..81a0fe7 100644 (file)
@@ -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;
        }