Merge tag 'for-v3.9' of git://git.infradead.org/battery-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 20 Feb 2013 18:19:07 +0000 (10:19 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 20 Feb 2013 18:19:07 +0000 (10:19 -0800)
Pull battery updates from Anton Vorontsov:
 "Four new drivers:

   - goldfish_battery:

     This is Android Emulator battery driver.  Originally from Google,
     but Intel folks reshaped it for mainline

   - pm2301_charger:

     A new driver for ST-Ericsson 2301 Power Management chip, uses
     AB8500 battery management core

   - qnap-poweroff:

     The driver adds poweroff functionality for QNAP NAS boxes

   - restart-poweroff:

     A generic driver that implements 'power off by restarting'.  The
     actual poweroff functionality is implemented through a bootloader,
     so Linux' task is just to restart the box.  The driver is useful on
     Buffalo Linkstation LS-XHL and LS-CHLv2 boards.  Andrew Lunn worked
     on submitting the driver (as well as qnap-poweroff above).

  Additionally:

   - A lot of fixes for ab8500 drivers.  This is a part of efforts of
     syncing internal ST-Ericsson development tree with the mainline.
     Lee Jones @ Linaro worked on compilation and reshaping these
     series.

   - New health properties for the power supplies: "Watchdog timer
     expire" and "Safety timer expire"

   - As usual, a bunch of fixes/cleanups here and there"

* tag 'for-v3.9' of git://git.infradead.org/battery-2.6: (81 commits)
  bq2415x_charger: Add support for offline and 100mA mode
  generic-adc-battery: Fix forever loop in gab_remove()
  goldfish_battery: Add missing GENERIC_HARDIRQS dependency
  da9030_battery: Include notifier.h
  bq27x00_battery: Fix reporting battery temperature
  power/reset: Remove newly introduced __dev* annotations
  lp8727_charger: Small cleanup in naming
  ab8500_btemp: Demote initcall sequence
  ds2782_battery: Add power_supply_changed() calls for proper uevent support
  power: Add battery driver for goldfish emulator
  u8500-charger: Delay for USB enumeration
  ab8500-bm: Remove individual [charger|btemp|fg|chargalg] pdata structures
  ab8500-charger: Do not touch VBUSOVV bits
  ab8500-fg: Use correct battery charge full design
  pm2301: LPN mode control support
  pm2301: Enable vbat low monitoring
  ab8500-bm: Flush all work queues before suspending
  ab8500-fg: Go to INIT_RECOVERY when charger removed
  ab8500-charger: Add support for autopower on AB8505 and AB9540
  abx500-chargalg: Add new sysfs interface to get current charge status
  ...

Fix up fairly straightforward conflicts in the ab8500 driver.  But since
it seems to be ARM-specific, I can't even compile-test the result..

1  2 
MAINTAINERS
drivers/mfd/ab8500-core.c
drivers/power/ab8500_bmdata.c
include/linux/mfd/abx500.h
include/linux/mfd/abx500/ab8500-bm.h

diff --cc MAINTAINERS
Simple merge
Simple merge
index f034ae43e045ac03127adeca8f1db0f4cbe59b79,20c157b4fe995cc97027e5d67350cd49a4f9f75d..7a96c0650fbbc1daf8c3fdf1dbc699a66b7d7a32
@@@ -424,96 -424,84 +424,84 @@@ static const struct abx500_bm_charger_p
  };
  
  struct abx500_bm_data ab8500_bm_data = {
-       .temp_under             = 3,
-       .temp_low               = 8,
-       .temp_high              = 43,
-       .temp_over              = 48,
-       .main_safety_tmr_h      = 4,
-       .temp_interval_chg      = 20,
-       .temp_interval_nochg    = 120,
-       .usb_safety_tmr_h       = 4,
-       .bkup_bat_v             = BUP_VCH_SEL_2P6V,
-       .bkup_bat_i             = BUP_ICH_SEL_150UA,
-       .no_maintenance         = false,
-       .adc_therm              = ABx500_ADC_THERM_BATCTRL,
-       .chg_unknown_bat        = false,
-       .enable_overshoot       = false,
-       .fg_res                 = 100,
-       .cap_levels             = &cap_levels,
-       .bat_type               = bat_type_thermistor,
-       .n_btypes               = 3,
-       .batt_id                = 0,
-       .interval_charging      = 5,
-       .interval_not_charging  = 120,
-       .temp_hysteresis        = 3,
-       .gnd_lift_resistance    = 34,
-       .maxi                   = &maxi_params,
-       .chg_params             = &chg,
-       .fg_params              = &fg,
+       .temp_under             = 3,
+       .temp_low               = 8,
+       .temp_high              = 43,
+       .temp_over              = 48,
+       .main_safety_tmr_h      = 4,
+       .temp_interval_chg      = 20,
+       .temp_interval_nochg    = 120,
+       .usb_safety_tmr_h       = 4,
+       .bkup_bat_v             = BUP_VCH_SEL_2P6V,
+       .bkup_bat_i             = BUP_ICH_SEL_150UA,
+       .no_maintenance         = false,
+       .capacity_scaling       = false,
+       .adc_therm              = ABx500_ADC_THERM_BATCTRL,
+       .chg_unknown_bat        = false,
+       .enable_overshoot       = false,
+       .fg_res                 = 100,
+       .cap_levels             = &cap_levels,
+       .bat_type               = bat_type_thermistor,
+       .n_btypes               = 3,
+       .batt_id                = 0,
+       .interval_charging      = 5,
+       .interval_not_charging  = 120,
+       .temp_hysteresis        = 3,
+       .gnd_lift_resistance    = 34,
+       .maxi                   = &maxi_params,
+       .chg_params             = &chg,
+       .fg_params              = &fg,
  };
  
- int bmdevs_of_probe(struct device *dev, struct device_node *np,
-                   struct abx500_bm_data **battery)
 -int __devinit ab8500_bm_of_probe(struct device *dev,
 -                               struct device_node *np,
 -                               struct abx500_bm_data *bm)
++int ab8500_bm_of_probe(struct device *dev,
++                     struct device_node *np,
++                     struct abx500_bm_data *bm)
  {
-       struct  abx500_battery_type *btype;
-       struct  device_node *np_bat_supply;
-       struct  abx500_bm_data *bat;
+       struct batres_vs_temp *tmp_batres_tbl;
+       struct device_node *battery_node;
        const char *btech;
-       char bat_tech[8];
-       int i, thermistor;
-       *battery = &ab8500_bm_data;
+       int i;
  
        /* get phandle to 'battery-info' node */
-       np_bat_supply = of_parse_phandle(np, "battery", 0);
-       if (!np_bat_supply) {
-               dev_err(dev, "missing property battery\n");
+       battery_node = of_parse_phandle(np, "battery", 0);
+       if (!battery_node) {
+               dev_err(dev, "battery node or reference missing\n");
                return -EINVAL;
        }
-       if (of_property_read_bool(np_bat_supply,
-                       "thermistor-on-batctrl"))
-               thermistor = NTC_INTERNAL;
-       else
-               thermistor = NTC_EXTERNAL;
  
-       bat = *battery;
-       if (thermistor == NTC_EXTERNAL) {
-               bat->n_btypes  = 4;
-               bat->bat_type  = bat_type_ext_thermistor;
-               bat->adc_therm = ABx500_ADC_THERM_BATTEMP;
-       }
-       btech = of_get_property(np_bat_supply,
-               "stericsson,battery-type", NULL);
+       btech = of_get_property(battery_node, "stericsson,battery-type", NULL);
        if (!btech) {
                dev_warn(dev, "missing property battery-name/type\n");
-               strcpy(bat_tech, "UNKNOWN");
-       } else {
-               strcpy(bat_tech, btech);
+               return -EINVAL;
        }
  
-       if (strncmp(bat_tech, "LION", 4) == 0) {
-               bat->no_maintenance  = true;
-               bat->chg_unknown_bat = true;
-               bat->bat_type[BATTERY_UNKNOWN].charge_full_design = 2600;
-               bat->bat_type[BATTERY_UNKNOWN].termination_vol    = 4150;
-               bat->bat_type[BATTERY_UNKNOWN].recharge_vol       = 4130;
-               bat->bat_type[BATTERY_UNKNOWN].normal_cur_lvl     = 520;
-               bat->bat_type[BATTERY_UNKNOWN].normal_vol_lvl     = 4200;
+       if (strncmp(btech, "LION", 4) == 0) {
+               bm->no_maintenance  = true;
+               bm->chg_unknown_bat = true;
+               bm->bat_type[BATTERY_UNKNOWN].charge_full_design = 2600;
+               bm->bat_type[BATTERY_UNKNOWN].termination_vol    = 4150;
+               bm->bat_type[BATTERY_UNKNOWN].recharge_cap       = 95;
+               bm->bat_type[BATTERY_UNKNOWN].normal_cur_lvl     = 520;
+               bm->bat_type[BATTERY_UNKNOWN].normal_vol_lvl     = 4200;
        }
-       /* select the battery resolution table */
-       for (i = 0; i < bat->n_btypes; ++i) {
-               btype = (bat->bat_type + i);
-               if (thermistor == NTC_EXTERNAL) {
-                       btype->batres_tbl =
-                               temp_to_batres_tbl_ext_thermistor;
-               } else if (strncmp(bat_tech, "LION", 4) == 0) {
-                       btype->batres_tbl =
-                               temp_to_batres_tbl_9100;
-               } else {
-                       btype->batres_tbl =
-                               temp_to_batres_tbl_thermistor;
-               }
+       if (of_property_read_bool(battery_node, "thermistor-on-batctrl")) {
+               if (strncmp(btech, "LION", 4) == 0)
+                       tmp_batres_tbl = temp_to_batres_tbl_9100;
+               else
+                       tmp_batres_tbl = temp_to_batres_tbl_thermistor;
+       } else {
+               bm->n_btypes   = 4;
+               bm->bat_type   = bat_type_ext_thermistor;
+               bm->adc_therm  = ABx500_ADC_THERM_BATTEMP;
+               tmp_batres_tbl = temp_to_batres_tbl_ext_thermistor;
        }
-       of_node_put(np_bat_supply);
+       /* select the battery resolution table */
+       for (i = 0; i < bm->n_btypes; ++i)
+               bm->bat_type[i].batres_tbl = tmp_batres_tbl;
+       of_node_put(battery_node);
        return 0;
  }
Simple merge
index 9bd037df97d95a673d80f771cb9b1eaf56bce1c1,345bc159f978097ce94a90c039c64a799ca5f76e..8d35bfe164c87f46f7c84e01ede1034322fa2870
@@@ -437,17 -420,47 +423,6 @@@ int ab8500_fg_inst_curr_started(struct 
  int ab8500_fg_inst_curr_done(struct ab8500_fg *di);
  
  #else
 -int ab8500_fg_inst_curr_started(struct ab8500_fg *di)
 -{
 -      return 0;
 -}
 -
 -int ab8500_fg_inst_curr_done(struct ab8500_fg *di)
 -{
 -      return 0;
 -}
 -static void ab8500_fg_reinit(void)
 -{
 -}
 -static void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA)
 -{
 -}
 -static struct ab8500_btemp *ab8500_btemp_get(void)
 -{
 -      return NULL;
 -}
 -static int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp)
 -{
 -      return 0;
 -}
 -struct ab8500_fg *ab8500_fg_get(void)
 -{
 -      return NULL;
 -}
 -static int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev)
 -{
 -      return -ENODEV;
 -}
 -
 -static inline int ab8500_fg_inst_curr_start(struct ab8500_fg *di)
 -{
 -      return -ENODEV;
 -}
 -
 -static inline int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res)
 -{
 -      return -ENODEV;
 -}
 -
 +static struct abx500_bm_data ab8500_bm_data;
- static inline int ab8500_fg_inst_curr_start(struct ab8500_fg *di)
- {
-       return -ENODEV;
- }
- static inline int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res)
- {
-       return -ENODEV;
- }
  #endif
  #endif /* _AB8500_BM_H */