]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branch 'battery/master'
authorStephen Rothwell <sfr@canb.auug.org.au>
Wed, 25 Jul 2012 01:20:18 +0000 (11:20 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 25 Jul 2012 01:20:20 +0000 (11:20 +1000)
1  2 
drivers/mfd/twl-core.c
drivers/power/Kconfig
drivers/power/power_supply_core.c
include/linux/i2c/twl.h

Simple merge
Simple merge
index 6ad612726785f48cdd8dbcc2785de8e211aae873,ff990d26a0c03c4c13bdab9c003247705847082c..85689fb9e81274b1eed946ce6d94b87dafbbef79
@@@ -169,6 -170,63 +170,63 @@@ static void power_supply_dev_release(st
        kfree(dev);
  }
  
 -                                      psy, &psy_tzd_ops, 0, 0, 0, 0);
+ #ifdef CONFIG_THERMAL
+ static int power_supply_read_temp(struct thermal_zone_device *tzd,
+               unsigned long *temp)
+ {
+       struct power_supply *psy;
+       union power_supply_propval val;
+       int ret;
+       WARN_ON(tzd == NULL);
+       psy = tzd->devdata;
+       ret = psy->get_property(psy, POWER_SUPPLY_PROP_TEMP, &val);
+       /* Convert tenths of degree Celsius to milli degree Celsius. */
+       if (!ret)
+               *temp = val.intval * 100;
+       return ret;
+ }
+ static struct thermal_zone_device_ops psy_tzd_ops = {
+       .get_temp = power_supply_read_temp,
+ };
+ static int psy_register_thermal(struct power_supply *psy)
+ {
+       int i;
+       /* Register battery zone device psy reports temperature */
+       for (i = 0; i < psy->num_properties; i++) {
+               if (psy->properties[i] == POWER_SUPPLY_PROP_TEMP) {
+                       psy->tzd = thermal_zone_device_register(psy->name, 0,
++                                      0, psy, &psy_tzd_ops, 0, 0, 0, 0);
+                       if (IS_ERR(psy->tzd))
+                               return PTR_ERR(psy->tzd);
+                       break;
+               }
+       }
+       return 0;
+ }
+ static void psy_unregister_thermal(struct power_supply *psy)
+ {
+       if (IS_ERR_OR_NULL(psy->tzd))
+               return;
+       thermal_zone_device_unregister(psy->tzd);
+ }
+ #else
+ static int psy_register_thermal(struct power_supply *psy)
+ {
+       return 0;
+ }
+ static void psy_unregister_thermal(struct power_supply *psy)
+ {
+ }
+ #endif
  int power_supply_register(struct device *parent, struct power_supply *psy)
  {
        struct device *dev;
Simple merge