power: android-battery: remove ac and usb supplies
authorTodd Poynor <toddpoynor@google.com>
Wed, 9 Jan 2013 02:46:41 +0000 (18:46 -0800)
committerArve Hjønnevåg <arve@android.com>
Mon, 1 Jul 2013 21:16:20 +0000 (14:16 -0700)
Should no longer need to fix up AC/USB online state via these.

Change-Id: I48d2ef0fbefee58cb47eafc11d9a44759920df7a
Signed-off-by: Todd Poynor <toddpoynor@google.com>
drivers/power/android_battery.c

index dbba090a51e1e6ea42c7fb5e5cf06d0e85ea5e36..6e8b4054c8d72ba380d157c4d19d26a23b89919b 100644 (file)
@@ -47,8 +47,6 @@ struct android_bat_data {
        struct device           *dev;
 
        struct power_supply     psy_bat;
-       struct power_supply     psy_usb;
-       struct power_supply     psy_ac;
 
        struct wake_lock        monitor_wake_lock;
        struct wake_lock        charger_wake_lock;
@@ -74,10 +72,6 @@ struct android_bat_data {
        struct dentry           *debugfs_entry;
 };
 
-static char *supply_list[] = {
-       "android-battery",
-};
-
 static enum power_supply_property android_battery_props[] = {
        POWER_SUPPLY_PROP_STATUS,
        POWER_SUPPLY_PROP_HEALTH,
@@ -90,10 +84,6 @@ static enum power_supply_property android_battery_props[] = {
        POWER_SUPPLY_PROP_CURRENT_NOW,
 };
 
-static enum power_supply_property android_power_props[] = {
-       POWER_SUPPLY_PROP_ONLINE,
-};
-
 static DEFINE_MUTEX(android_bat_state_lock);
 
 static void android_bat_update_data(struct android_bat_data *battery);
@@ -163,36 +153,6 @@ static int android_bat_get_property(struct power_supply *ps,
        return 0;
 }
 
-static int android_usb_get_property(struct power_supply *ps,
-               enum power_supply_property psp,
-               union power_supply_propval *val)
-{
-       struct android_bat_data *battery = container_of(ps,
-                               struct android_bat_data, psy_usb);
-
-       if (psp != POWER_SUPPLY_PROP_ONLINE)
-               return -EINVAL;
-
-       val->intval = (battery->charge_source == CHARGE_SOURCE_USB);
-
-       return 0;
-}
-
-static int android_ac_get_property(struct power_supply *ps,
-               enum power_supply_property psp,
-               union power_supply_propval *val)
-{
-       struct android_bat_data *battery = container_of(ps,
-                               struct android_bat_data, psy_ac);
-
-       if (psp != POWER_SUPPLY_PROP_ONLINE)
-               return -EINVAL;
-
-       val->intval = (battery->charge_source == CHARGE_SOURCE_AC);
-
-       return 0;
-}
-
 static void android_bat_get_temp(struct android_bat_data *battery)
 {
        int batt_temp = 42; /* 4.2C */
@@ -439,8 +399,6 @@ static void android_bat_charger_work(struct work_struct *work)
 
        mutex_unlock(&android_bat_state_lock);
        wake_lock_timeout(&battery->charger_wake_lock, HZ * 2);
-       power_supply_changed(&battery->psy_ac);
-       power_supply_changed(&battery->psy_usb);
 }
 
 
@@ -601,22 +559,6 @@ static int android_bat_probe(struct platform_device *pdev)
        battery->psy_bat.num_properties = ARRAY_SIZE(android_battery_props),
        battery->psy_bat.get_property = android_bat_get_property,
 
-       battery->psy_usb.name = "android-usb",
-       battery->psy_usb.type = POWER_SUPPLY_TYPE_USB,
-       battery->psy_usb.supplied_to = supply_list,
-       battery->psy_usb.num_supplicants = ARRAY_SIZE(supply_list),
-       battery->psy_usb.properties = android_power_props,
-       battery->psy_usb.num_properties = ARRAY_SIZE(android_power_props),
-       battery->psy_usb.get_property = android_usb_get_property,
-
-       battery->psy_ac.name = "android-ac",
-       battery->psy_ac.type = POWER_SUPPLY_TYPE_MAINS,
-       battery->psy_ac.supplied_to = supply_list,
-       battery->psy_ac.num_supplicants = ARRAY_SIZE(supply_list),
-       battery->psy_ac.properties = android_power_props,
-       battery->psy_ac.num_properties = ARRAY_SIZE(android_power_props),
-       battery->psy_ac.get_property = android_ac_get_property;
-
        battery->batt_vcell = -1;
        battery->batt_soc = -1;
 
@@ -632,20 +574,6 @@ static int android_bat_probe(struct platform_device *pdev)
                goto err_psy_bat_reg;
        }
 
-       ret = power_supply_register(&pdev->dev, &battery->psy_usb);
-       if (ret) {
-               dev_err(battery->dev, "%s: failed to register psy_usb\n",
-                               __func__);
-               goto err_psy_usb_reg;
-       }
-
-       ret = power_supply_register(&pdev->dev, &battery->psy_ac);
-       if (ret) {
-               dev_err(battery->dev, "%s: failed to register psy_ac\n",
-                               __func__);
-               goto err_psy_ac_reg;
-       }
-
        battery->monitor_wqueue =
                alloc_workqueue(dev_name(&pdev->dev), WQ_FREEZABLE, 1);
        if (!battery->monitor_wqueue) {
@@ -686,10 +614,6 @@ static int android_bat_probe(struct platform_device *pdev)
        return 0;
 
 err_wq:
-       power_supply_unregister(&battery->psy_ac);
-err_psy_ac_reg:
-       power_supply_unregister(&battery->psy_usb);
-err_psy_usb_reg:
        power_supply_unregister(&battery->psy_bat);
 err_psy_bat_reg:
        wake_lock_destroy(&battery->monitor_wake_lock);