14 Jan, 2016

1 commit

  • Currently in bq27541 driver, the average power register address is
    incorrectly set to 0x76, which would result in an error:
    bq27xxx-battery 2-0055: error reading average power register 10: -11
    According to the bq27541 datasheet, fix this problem by setting
    the average power register address to 0x24.

    Fixes: d74534c27775 ("power: bq27xxx_battery: Add support for additional bq27xxx family devices")
    Signed-off-by: Liu Xiang
    Acked-by: Andrew F. Davis
    Signed-off-by: Sebastian Reichel

    Liu Xiang
     

08 Jan, 2016

1 commit


07 Jan, 2016

4 commits


08 Dec, 2015

1 commit

  • Currently the reset/power off handlers (POWER_RESET) and Adaptive Voltage
    Scaling class (POWER_AVS) are not built when POWER_SUPPLY is disabled.
    The POWER_RESET is also not visible in drivers main section of config.

    However they do not really depend on power supply so they can be built
    always. The objects for power supply drivers already depend on
    particular Kconfig symbols so there is no need for any changes in
    drivers/power/Makefile.

    This allows selecting POWER_RESET from main drivers config section and
    fixes following build warning (encountered on ARM exynos defconfig when
    POWER_SUPPLY is disabled manually):

    warning: (ARCH_HISI && ARCH_INTEGRATOR && ARCH_EXYNOS && ARCH_VEXPRESS && REALVIEW_DT) selects POWER_RESET which has unmet direct dependencies (POWER_SUPPLY)
    warning: (ARCH_EXYNOS) selects POWER_RESET_SYSCON which has unmet direct dependencies (POWER_SUPPLY && POWER_RESET && OF)
    warning: (ARCH_EXYNOS) selects POWER_RESET_SYSCON_POWEROFF which has unmet direct dependencies (POWER_SUPPLY && POWER_RESET && OF)

    Reported-by: Pavel Fedin
    Signed-off-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Krzysztof Kozlowski
     

05 Dec, 2015

6 commits


07 Nov, 2015

1 commit

  • Pull MFD updates from Lee Jones:
    "New Device Support:
    - Add support for 88pm860; 88pm80x
    - Add support for 24c08 EEPROM; at24
    - Add support for Broxton Whiskey Cove; intel*
    - Add support for RTS522A; rts5227
    - Add support for I2C devices; intel_quark_i2c_gpio

    New Functionality:
    - Add microphone support; arizona
    - Add general purpose switch support; arizona
    - Add fuel-gauge support; da9150-core
    - Add shutdown support; sec-core
    - Add charger support; tps65217
    - Add flexible serial communication unit support; atmel-flexcom
    - Add power button support; axp20x
    - Add led-flash support; rt5033

    Core Frameworks:
    - Supply a generic macro for defining Regmap IRQs
    - Rework ACPI child device matching

    Fix-ups:
    - Use Regmap to access registers; tps6105x
    - Use DEFINE_RES_IRQ_NAMED() macro; da9150
    - Re-arrange device registration order; intel_quark_i2c_gpio
    - Allow OF matching; cros_ec_i2c, atmel-hlcdc, hi6421-pmic, max8997, sm501
    - Handle deferred probe; twl6040
    - Improve accuracy of headphone detect; arizona
    - Unnecessary MODULE_ALIAS() removal; bcm590xx, rt5033
    - Remove unused code; htc-i2cpld, arizona, pcf50633-irq, sec-core
    - Simplify code; kempld, rts5209, da903x, lm3533, da9052, arizona
    - Remove #iffery; arizona
    - DT binding adaptions; many

    Bug Fixes:
    - Fix possible NULL pointer dereference; wm831x, tps6105x
    - Fix 64bit bug; intel_soc_pmic_bxtwc
    - Fix signedness issue; arizona"

    * tag 'mfd-for-linus-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (73 commits)
    bindings: mfd: s2mps11: Add documentation for s2mps15 PMIC
    mfd: sec-core: Remove unused s2mpu02-rtc and s2mpu02-clk children
    extcon: arizona: Add extcon specific device tree binding document
    MAINTAINERS: Add binding docs for Cirrus Logic/Wolfson Arizona devices
    mfd: arizona: Remove bindings covered in new subsystem specific docs
    mfd: rt5033: Add RT5033 Flash led sub device
    mfd: lpss: Add Intel Broxton PCI IDs
    mfd: lpss: Add Broxton ACPI IDs
    mfd: arizona: Signedness bug in arizona_runtime_suspend()
    mfd: axp20x: Add a cell for the power button part of the, axp288 PMICs
    mfd: dt-bindings: Document pulled down WRSTBI pin on S2MPS1X
    mfd: sec-core: Disable buck voltage reset on watchdog falling edge
    mfd: sec-core: Dump PMIC revision to find out the HW
    mfd: arizona: Use correct type ID for device tree config
    mfd: arizona: Remove use of codec build config #ifdefs
    mfd: arizona: Simplify adding subdevices
    mfd: arizona: Downgrade type mismatch messages to dev_warn
    mfd: arizona: Factor out checking of jack detection state
    mfd: arizona: Factor out DCVDD isolation control
    mfd: Make TPS6105X select REGMAP_I2C
    ...

    Linus Torvalds
     

06 Nov, 2015

1 commit

  • Pull power supply and reset updates from Sebastian Reichel:
    - new AXP20X USB Power driver
    - new Qualcomm SMBB driver
    - new TPS65217 Charger driver
    - BQ24257: add BQ24250/BQ24251 support
    - overhaul bq27x00 battery driver, rename to bq27xxx
    - misc fixes and cleanups

    * tag 'for-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (54 commits)
    power: bq27xxx_battery: Remove unneeded dependency in Kconfig
    power: bq27xxx_battery: move irq handler to i2c section
    power: bq27xxx_battery: fix platform probe
    twl4030_charger: add missing iio dependency
    power_supply: charger-manager: add missing of_node_put
    Documentation: power: bq24257: Document exported sysfs entries
    power: bq24257: Add various device-specific sysfs properties
    power: bq24257: Allow input current limit sysfs access
    power: bq24257: Add input DPM voltage threshold setting support
    power: bq24257: Add over voltage protection setting support
    power: bq24257: Add SW-based approach for Power Good determination
    power: bq24257: Allow manual setting of input current limit
    power: bq24257: Add bit definition for temp sense enable
    power: bq24257: Add basic support for bq24250/bq24251
    dt: power: bq24257-charger: Cover additional devices
    power: bq24257: Simplify bq24257_power_supply_init()
    power: bq24257: Use managed power supply register
    power: bq24257: Streamline input current limit setup
    power: bq24257: Remove IRQ config through stat-gpios
    power: bq27xxx_battery: fix signedness bug in bq27xxx_battery_read_health()
    ...

    Linus Torvalds
     

19 Oct, 2015

3 commits


16 Oct, 2015

1 commit


15 Oct, 2015

1 commit

  • for_each_child_of_node performs an of_node_get on each iteration, so
    a break out of the loop requires an of_node_put.

    The semantic patch that fixes this problem is as follows
    (http://coccinelle.lip6.fr):

    //
    @@
    expression root,e;
    local idexpression child;
    @@

    for_each_child_of_node(root, child) {
    ... when != of_node_put(child)
    when != e = child
    (
    return child;
    |
    + of_node_put(child);
    ? return ...;
    )
    ...
    }
    //

    Signed-off-by: Julia Lawall
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Julia Lawall
     

14 Oct, 2015

1 commit


13 Oct, 2015

1 commit


29 Sep, 2015

13 commits

  • This patch adds support for enabling/disabling optional device specific
    features through sysfs properties at runtime.

    * High-impedance mode enable/disable
    * Sysoff enable/disable

    Refer to the respective device datasheets for more information:

    http://www.ti.com/product/bq24250
    http://www.ti.com/product/bq24251
    http://www.ti.com/product/bq24257

    Signed-off-by: Andreas Dannenberg
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Andreas Dannenberg
     
  • This patch allows reading and writing of the input current limit through
    the power supply's input_current_limit sysfs property. This allows
    userspace to see what charger was detected (if the D+/D- USB signal-
    based charger type detection is enabled) and to re-configure the maximum
    current drawn from the external supply at runtime based on system-level
    knowledge or user input. Note that upon charger disconnection and
    re-connection the limit configured through firmware becomes active again
    (or the D+/D- USB signal-based charger detection will be run again).

    Signed-off-by: Andreas Dannenberg
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Andreas Dannenberg
     
  • A new optional device property called "ti,in-dpm-voltage" is introduced
    to allow configuring the input voltage threshold for the devices'
    dynamic power path management (DPM) feature. In short, it can be used to
    prevent the input voltage from dropping below a certain value as current
    is drawn to charge the battery or supply the system.

    Signed-off-by: Andreas Dannenberg
    Reviewed-by: Laurentiu Palcu
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Andreas Dannenberg
     
  • A new optional device property called "ti,ovp-voltage" is introduced to
    allow configuring the input over voltage protection setting.

    This commit also adds the basic sysfs support for custom properties
    which is being used to allow userspace to read the current ovp-voltage
    setting.

    Signed-off-by: Andreas Dannenberg
    Reviewed-by: Laurentiu Palcu
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Andreas Dannenberg
     
  • A software-based approach for determining the charger's input voltage
    "Power Good" state is introduced for devices like the bq24250 which
    don't have a dedicated hardware pin for that purpose. This SW-based
    approach is also used for other devices (with dedicated PG pin) as a
    fall back solution if that pin is not configured to be used through
    "pg-gpios".

    Signed-off-by: Andreas Dannenberg
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Andreas Dannenberg
     
  • A new optional device property called "ti,current-limit" is introduced
    to allow disabling the D+/D- USB signal-based charger type auto-
    detection algorithm used to set the input current limit and instead to
    use a fixed input current limit.

    Signed-off-by: Andreas Dannenberg
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Andreas Dannenberg
     
  • Adding a missing bit definition for the sake of consistency device model
    vs. bit field representation. No change in functionality.

    Signed-off-by: Andreas Dannenberg
    Reviewed-by: Laurentiu Palcu
    Signed-off-by: Sebastian Reichel

    Andreas Dannenberg
     
  • This patch adds basic support for bq24250 and bq24251 which are very
    similar to the bq24257 the driver was originally written for. Basic
    support means the ability to select a device through Kconfig, DT and
    ACPI, an instance variable allowing to check which chip is active, and
    the reporting back of the selected device through the model_name power
    supply sysfs property.

    This patch by itself is not sufficient to actually use those two added
    devices in a real-world setting due to some feature differences which
    are addressed by other patches in this series.

    Signed-off-by: Andreas Dannenberg
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Andreas Dannenberg
     
  • Eliminate a few lines of code by using the PTR_ERR_OR_ZERO() macro.

    Signed-off-by: Andreas Dannenberg
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Andreas Dannenberg
     
  • Use the devm_* managed version of the function to register the power
    supply and remove the associated unregister function. This will simplify
    error handling moving forward as it allows the unregister to happen
    automatically. It also saves a few lines of code.

    As this changes the order of putting the bq24257 into reset vs.
    unregistering the power-supply during driver remove re-tested various
    driver unload scenario to make sure that this doesn't cause any
    unintended side effects such as erroneous interrupts.

    Signed-off-by: Andreas Dannenberg
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Andreas Dannenberg
     
  • The maximum amount of input current the charger should draw is dependent
    on the power supply and should only be (re-)configured when the power
    supply gets connected and disconnected. However the driver was also
    lowering the bq24257's input current limit setting to 500mA when the
    battery was removed and restored the previous setting according to the
    power supply capabilities when the battery was reconnected although
    these events are not impacting the amount of power that can be drawn
    from the supply. Furthermore, a re-configuration of the input current
    limit to 500mA when the battery gets disconnected is actually dangerous
    if the limit was set higher previously and the system draws more than
    500mA in which case the system voltage would be reduced in order to
    maintain 500mA which could result in the system getting too low of a
    supply to maintain operation. Last but not least the mechanism itself
    used for battery re-connection detection did not work in corner cases
    such as when the device's input current loop becomes active and the
    bq24257 device clears its battery fault error resulting in incorrectly
    reporting that the battery got reconnected.

    This patches removes the impact the battery removal/insertion has on the
    input current limit configured for the bq24257 and simplifies the
    associated handler routine.

    Signed-off-by: Andreas Dannenberg
    Signed-off-by: Sebastian Reichel

    Andreas Dannenberg
     
  • At the time the driver was written GpioInt resources in ACPI were not
    passed to the driver in client->irq, as opposed to DT enumeration. To
    accommodate this use case, a "stat-gpios" property was introduced to
    allow configuring the IRQ.

    However this issue with ACPI was fixed in commit "845c877 i2c / ACPI:
    Assign IRQ for devices that have GpioInt automatically" and makes this
    workaround no longer necessary, hence we can remove the support for the
    "stat-gpios" property and the associated code from the bq24257 driver.

    Signed-off-by: Andreas Dannenberg
    Signed-off-by: Sebastian Reichel

    Andreas Dannenberg
     
  • We need flags to be signed for the error handling to work.

    The problem has been detected using proposed semantic patch
    scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].

    [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576

    Fixes: 74aab849f342 ('power: bq27xxx_battery: Cleanup health checking')
    Signed-off-by: Andrzej Hajda
    Signed-off-by: Dan Carpenter
    Acked-By: Pali Rohár
    Acked-by: Andrew F. Davis
    Signed-off-by: Sebastian Reichel

    Andrzej Hajda
     

27 Sep, 2015

2 commits


25 Sep, 2015

2 commits


24 Sep, 2015

1 commit

  • Commit b68c3161430a (bq2415x_charger: Allow to load and use driver even if
    notify device is not registered yet) introduced null pointer dereference in
    case bq is NULL. This patch fixes it.

    Fixes: b68c3161430a ("bq2415x_charger: Allow to load and use driver even if notify device is not registered yet")
    Reported-by: Dan Carpenter
    Signed-off-by: Pali Rohár
    Signed-off-by: Sebastian Reichel

    Pali Rohár