1. 04 Mar, 2022 1 commit
  2. 28 Feb, 2022 5 commits
    • Linus Walleij's avatar
      power: supply: ab8500_fg: Use VBAT-to-Ri if possible · bc5d4a24
      Linus Walleij authored
      Augment the AB8500 fuel gauge to use the VBAT-to-Ri method of
      estimating the internal resistance if possible. Else fall back
      to using the temperature-to-Ri or just the default Ri.
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
      bc5d4a24
    • Linus Walleij's avatar
      power: supply: Support VBAT-to-Ri lookup tables · e9e7d165
      Linus Walleij authored
      In Samsung devices, the method used to compensate for temperature,
      age, load etc is by way of VBAT to Ri tables, which correlates the
      battery voltage under load (VBAT) to an internal resistance (Ri).
      
      Using this Ri and a measurement of the current out of the battery
      (IBAT) the open circuit voltage (OCV) can be calculated as:
      
        OCV = VBAT - (Ri * IBAT)
      
      The details are described in comments to struct
      power_supply_battery_info in the commit.
      
      Since not all batteries supply this VBAT-to-Ri data, the fallback
      method to use the temperature-to-Ri lookup table can also be used
      as a fallback.
      
      Add two helper functions to check if we have the tables needed for
      using power_supply_vbat2ri() or power_supply_temp2resist_simple()
      respectively, so capacity estimation code can choose which one
      to employ.
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
      e9e7d165
    • Linus Walleij's avatar
      power: supply: ab8500: Standardize BTI resistance · 1f918e0f
      Linus Walleij authored
      The Battery Type Indicator (BTI) resistor is a resistor mounted
      between a special terminal on the battery and ground. By sending
      a fixed current (such as 7mA) through this resistor and measuring
      the voltage over it, the resistance can be determined, and this
      verifies the battery type.
      
      Typical side view of the battery:
      
        o     o     o
       GND   BTI   +3.8V
      
      Typical example of the electrical layout:
      
        +3.8 V   BTI
          |       |
          | +     |
       _______   [ ] 7kOhm
         ___      |
          |       |
          |       |
         GND     GND
      
      By verifying this resistance before attempting to charge the
      battery we add an additional level of security.
      
      In some systems this is used for plug-and-play of batteries with
      different capacity. In other cases, this is merely used to verify
      that the right type of battery is connected, if several batteries
      have the same physical shape and can be plugged into the same
      slot. Sometimes this is just a surplus security mechanism.
      
      Nokia and Samsung among many other vendors are known to use these
      BTI resistors.
      
      Add the BTI properties to struct power_supply_battery_info and
      switch the AB8500 charger code over to using it.
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
      1f918e0f
    • Linus Walleij's avatar
      power: supply: ab8500: Standardize alert mode charging · 0e8b903b
      Linus Walleij authored
      The AB8500 code is using a special current and voltage setting
      when the battery is in "alert mode", i.e. when it is starting
      to go outside normal operating conditions so it is too
      cold or too hot. This makes sense as a way for the charging
      algorithm to deal with hostile environments.
      
      Add the needed members to the struct power_supply_battery_info,
      and switch the AB8500 charging code over to using this.
      Reviewed-by: default avatarMatti Vaittineen <matti.vaittinen@fi.rohmeurope.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
      0e8b903b
    • Linus Walleij's avatar
      power: supply: ab8500: Standardize maintenance charging · d72ce7d3
      Linus Walleij authored
      Maintenance charging is the phase of keeping up the charge
      after the battery has charged fully using CC/CV charging.
      
      This can be done in many successive phases and is usually
      done with a slightly lower constant voltage than CV, and
      a slightly lower allowed current.
      
      Add an array of maintenance charging points each with a
      current, voltage and safety timer, and add helper functions
      to use these. Migrate the AB8500 code over.
      
      This is used in several Samsung products using the AB8500
      and these batteries and their complete parameters will
      be added later as full examples, but the default battery
      in the AB8500 code serves as a reasonable example so far.
      Reviewed-by: default avatarMatti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
      d72ce7d3
  3. 25 Feb, 2022 4 commits
  4. 24 Feb, 2022 9 commits
  5. 13 Feb, 2022 7 commits
  6. 11 Feb, 2022 14 commits