Merge branch 'for-linus-3.6' of git://dev.laptop.org/users/dilinger/linux-olpc
Linus Torvalds [Thu, 2 Aug 2012 18:52:39 +0000 (11:52 -0700)]
Pull OLPC platform updates from Andres Salomon:
 "These move the OLPC Embedded Controller driver out of
  arch/x86/platform and into drivers/platform/olpc.

  OLPC machines are now ARM-based (which means lots of x86 and ARM
  changes), but are typically pretty self-contained..  so it makes more
  sense to go through a separate OLPC tree after getting the appropriate
  review/ACKs."

* 'for-linus-3.6' of git://dev.laptop.org/users/dilinger/linux-olpc:
  x86: OLPC: move s/r-related EC cmds to EC driver
  Platform: OLPC: move global variables into priv struct
  Platform: OLPC: move debugfs support from x86 EC driver
  x86: OLPC: switch over to using new EC driver on x86
  Platform: OLPC: add a suspended flag to the EC driver
  Platform: OLPC: turn EC driver into a platform_driver
  Platform: OLPC: allow EC cmd to be overridden, and create a workqueue to call it
  drivers: OLPC: update various drivers to include olpc-ec.h
  Platform: OLPC: add a stub to drivers/platform/ for the OLPC EC driver

1  2 
drivers/power/olpc_battery.c

@@@ -17,6 -17,7 +17,7 @@@
  #include <linux/power_supply.h>
  #include <linux/jiffies.h>
  #include <linux/sched.h>
+ #include <linux/olpc-ec.h>
  #include <asm/olpc.h>
  
  
@@@ -231,9 -232,11 +232,9 @@@ static int olpc_bat_get_charge_full_des
  
        case POWER_SUPPLY_TECHNOLOGY_LiFe:
                switch (mfr) {
 -              case 1: /* Gold Peak */
 -                      val->intval = 2800000;
 -                      break;
 +              case 1: /* Gold Peak, fall through */
                case 2: /* BYD */
 -                      val->intval = 3100000;
 +                      val->intval = 2800000;
                        break;
                default:
                        return -EIO;
@@@ -265,55 -268,6 +266,55 @@@ static int olpc_bat_get_charge_now(unio
        return 0;
  }
  
 +static int olpc_bat_get_voltage_max_design(union power_supply_propval *val)
 +{
 +      uint8_t ec_byte;
 +      union power_supply_propval tech;
 +      int mfr;
 +      int ret;
 +
 +      ret = olpc_bat_get_tech(&tech);
 +      if (ret)
 +              return ret;
 +
 +      ec_byte = BAT_ADDR_MFR_TYPE;
 +      ret = olpc_ec_cmd(EC_BAT_EEPROM, &ec_byte, 1, &ec_byte, 1);
 +      if (ret)
 +              return ret;
 +
 +      mfr = ec_byte >> 4;
 +
 +      switch (tech.intval) {
 +      case POWER_SUPPLY_TECHNOLOGY_NiMH:
 +              switch (mfr) {
 +              case 1: /* Gold Peak */
 +                      val->intval = 6000000;
 +                      break;
 +              default:
 +                      return -EIO;
 +              }
 +              break;
 +
 +      case POWER_SUPPLY_TECHNOLOGY_LiFe:
 +              switch (mfr) {
 +              case 1: /* Gold Peak */
 +                      val->intval = 6400000;
 +                      break;
 +              case 2: /* BYD */
 +                      val->intval = 6500000;
 +                      break;
 +              default:
 +                      return -EIO;
 +              }
 +              break;
 +
 +      default:
 +              return -EIO;
 +      }
 +
 +      return ret;
 +}
 +
  /*********************************************************************
   *            Battery properties
   *********************************************************************/
@@@ -448,11 -402,6 +449,11 @@@ static int olpc_bat_get_property(struc
                sprintf(bat_serial, "%016llx", (long long)be64_to_cpu(ser_buf));
                val->strval = bat_serial;
                break;
 +      case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
 +              ret = olpc_bat_get_voltage_max_design(val);
 +              if (ret)
 +                      return ret;
 +              break;
        default:
                ret = -EINVAL;
                break;
@@@ -480,7 -429,6 +481,7 @@@ static enum power_supply_property olpc_
        POWER_SUPPLY_PROP_MANUFACTURER,
        POWER_SUPPLY_PROP_SERIAL_NUMBER,
        POWER_SUPPLY_PROP_CHARGE_COUNTER,
 +      POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
  };
  
  /* XO-1.5 does not have ambient temperature property */
@@@ -502,7 -450,6 +503,7 @@@ static enum power_supply_property olpc_
        POWER_SUPPLY_PROP_MANUFACTURER,
        POWER_SUPPLY_PROP_SERIAL_NUMBER,
        POWER_SUPPLY_PROP_CHARGE_COUNTER,
 +      POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
  };
  
  /* EEPROM reading goes completely around the power_supply API, sadly */