14 Jul, 2017

1 commit


05 Jul, 2017

2 commits

  • Pull power supply and reset updates from Sebastian Reichel:
    "New drivers:
    - Linear ltc3651 charger driver
    - Motorola CPCAP battery fuel-gauge driver

    New chip/feature support:
    - bq27xxx: prepare for chip data setup
    - axp20x_battery: support max charge current setup

    New core features:
    - add Apple Brick ID type
    - support "supplied-from" device property for generic ACPI/pdata support
    - support strings for sysfs properties representing enums
    - introduce battery-info (backend is DT only for now)
    - provide reboot-mode header globally

    .. and misc fixes"

    * tag 'for-v4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (39 commits)
    power: supply: sbs-battery: Don't needlessly set CAPACITY_MODE
    power: supply: sbs-battery: Prevent CAPACITY_MODE races
    power: supply: bq24735: remove incorrect le16_to_cpu calls
    power: supply: sbs-battery: remove incorrect le16_to_cpu calls
    power: supply: cpcap-charger: Add missing power_supply_config
    power: supply: twl4030-charger: move allocation of iio channel to the beginning
    power: supply: twl4030-charger: allocate iio by devm_iio_channel_get() and fix error path
    power: supply: core: constify psy_tcd_ops.
    dt-bindings: power: supply: cpcap-battery: Add power-supplies property
    dt-bindings: power: supply: move max8903-charger.txt to proper location
    dt-bindings: power: supply: move maxim,max14656.txt to proper location
    power: supply: twl4030_charger: Use sysfs_match_string() helper
    power: reset: reboot-mode: Make include file global
    power: supply: axp20x_battery: add DT support for battery max constant charge current
    power: supply: axp20x_battery: add support for DT battery
    power: supply: bq27xxx: Add power_supply_battery_info support
    power: supply: bq27xxx: Add chip data memory read/write support
    power: supply: bq27xxx: Add bulk transfer bus methods
    dt-bindings: power: supply: bq27xxx: Add monitored-battery documentation
    power: supply: core: Add power_supply_prop_precharge
    ...

    Linus Torvalds
     
  • Pull power management updates from Rafael Wysocki:
    "The big ticket items here are the rework of suspend-to-idle in order
    to add proper support for power button wakeup from it on recent Dell
    laptops and the rework of interfaces exporting the current CPU
    frequency on x86.

    In addition to that, support for a few new pieces of hardware is
    added, the PCI/ACPI device wakeup infrastructure is simplified
    significantly and the wakeup IRQ framework is fixed to unbreak the IRQ
    bus locking infrastructure.

    Also, there are some functional improvements for intel_pstate, tools
    updates and small fixes and cleanups all over.

    Specifics:

    - Rework suspend-to-idle to allow it to take wakeup events signaled
    by the EC into account on ACPI-based platforms in order to properly
    support power button wakeup from suspend-to-idle on recent Dell
    laptops (Rafael Wysocki).

    That includes the core suspend-to-idle code rework, support for the
    Low Power S0 _DSM interface, and support for the ACPI INT0002
    Virtual GPIO device from Hans de Goede (required for USB keyboard
    wakeup from suspend-to-idle to work on some machines).

    - Stop trying to export the current CPU frequency via /proc/cpuinfo
    on x86 as that is inaccurate and confusing (Len Brown).

    - Rework the way in which the current CPU frequency is exported by
    the kernel (over the cpufreq sysfs interface) on x86 systems with
    the APERF and MPERF registers by always using values read from
    these registers, when available, to compute the current frequency
    regardless of which cpufreq driver is in use (Len Brown).

    - Rework the PCI/ACPI device wakeup infrastructure to remove the
    questionable and artificial distinction between "devices that can
    wake up the system from sleep states" and "devices that can
    generate wakeup signals in the working state" from it, which allows
    the code to be simplified quite a bit (Rafael Wysocki).

    - Fix the wakeup IRQ framework by making it use SRCU instead of RCU
    which doesn't allow sleeping in the read-side critical sections,
    but which in turn is expected to be allowed by the IRQ bus locking
    infrastructure (Thomas Gleixner).

    - Modify some computations in the intel_pstate driver to avoid
    rounding errors resulting from them (Srinivas Pandruvada).

    - Reduce the overhead of the intel_pstate driver in the HWP
    (hardware-managed P-states) mode and when the "performance" P-state
    selection algorithm is in use by making it avoid registering
    scheduler callbacks in those cases (Len Brown).

    - Rework the energy_performance_preference sysfs knob in intel_pstate
    by changing the values that correspond to different symbolic hint
    names used by it (Len Brown).

    - Make it possible to use more than one cpuidle driver at the same
    time on ARM (Daniel Lezcano).

    - Make it possible to prevent the cpuidle menu governor from using
    the 0 state by disabling it via sysfs (Nicholas Piggin).

    - Add support for FFH (Fixed Functional Hardware) MWAIT in ACPI C1 on
    AMD systems (Yazen Ghannam).

    - Make the CPPC cpufreq driver take the lowest nonlinear performance
    information into account (Prashanth Prakash).

    - Add support for hi3660 to the cpufreq-dt driver, fix the imx6q
    driver and clean up the sfi, exynos5440 and intel_pstate drivers
    (Colin Ian King, Krzysztof Kozlowski, Octavian Purdila, Rafael
    Wysocki, Tao Wang).

    - Fix a few minor issues in the generic power domains (genpd)
    framework and clean it up somewhat (Krzysztof Kozlowski, Mikko
    Perttunen, Viresh Kumar).

    - Fix a couple of minor issues in the operating performance points
    (OPP) framework and clean it up somewhat (Viresh Kumar).

    - Fix a CONFIG dependency in the hibernation core and clean it up
    slightly (Balbir Singh, Arvind Yadav, BaoJun Luo).

    - Add rk3228 support to the rockchip-io adaptive voltage scaling
    (AVS) driver (David Wu).

    - Fix an incorrect bit shift operation in the RAPL power capping
    driver (Adam Lessnau).

    - Add support for the EPP field in the HWP (hardware managed
    P-states) control register, HWP.EPP, to the x86_energy_perf_policy
    tool and update msr-index.h with HWP.EPP values (Len Brown).

    - Fix some minor issues in the turbostat tool (Len Brown).

    - Add support for AMD family 0x17 CPUs to the cpupower tool and fix a
    minor issue in it (Sherry Hurwitz).

    - Assorted cleanups, mostly related to the constification of some
    data structures (Arvind Yadav, Joe Perches, Kees Cook, Krzysztof
    Kozlowski)"

    * tag 'pm-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (69 commits)
    cpufreq: Update scaling_cur_freq documentation
    cpufreq: intel_pstate: Clean up after performance governor changes
    PM: hibernate: constify attribute_group structures.
    cpuidle: menu: allow state 0 to be disabled
    intel_idle: Use more common logging style
    PM / Domains: Fix missing default_power_down_ok comment
    PM / Domains: Fix unsafe iteration over modified list of domains
    PM / Domains: Fix unsafe iteration over modified list of domain providers
    PM / Domains: Fix unsafe iteration over modified list of device links
    PM / Domains: Handle safely genpd_syscore_switch() call on non-genpd device
    PM / Domains: Call driver's noirq callbacks
    PM / core: Drop run_wake flag from struct dev_pm_info
    PCI / PM: Simplify device wakeup settings code
    PCI / PM: Drop pme_interrupt flag from struct pci_dev
    ACPI / PM: Consolidate device wakeup settings code
    ACPI / PM: Drop run_wake from struct acpi_device_wakeup_flags
    PM / QoS: constify *_attribute_group.
    PM / AVS: rockchip-io: add io selectors and supplies for rk3228
    powercap/RAPL: prevent overridding bits outside of the mask
    PM / sysfs: Constify attribute groups
    ...

    Linus Torvalds
     

04 Jul, 2017

2 commits


28 Jun, 2017

1 commit


15 Jun, 2017

8 commits


12 Jun, 2017

1 commit


09 Jun, 2017

3 commits


08 Jun, 2017

16 commits

  • This adds the ability to set the maximum constant charge current,
    supported by the battery, delivered by this battery power supply to the
    battery.

    The maximum constant charge current set in DT will also set the default
    constant charge current supplied by this supply.

    The actual user can modify the constant charge current within the range
    of 0 to maximum constant charge current via sysfs.
    The user can also modify the maximum constant charge current to widen
    the range of possible constant charge current. While this seems quite
    risky, a message is printed on the console to warn the user this might
    damage the battery. The reason for letting the user change the maximum
    constant charge current is for letting users change the battery and
    thus, let them adjust the maximum constant charge current according to
    what the battery can support.

    Signed-off-by: Quentin Schulz
    Signed-off-by: Sebastian Reichel

    Quentin Schulz
     
  • This adds support in X-Powers AXP20X and AXP22X battery driver for a
    fixed battery in DT.

    It will take the minimum supported voltage by the battery as defined in
    the battery DT node and set the V_OFF register to this value, telling
    the system to shut down if the supplied power is below this value.

    Signed-off-by: Quentin Schulz
    Signed-off-by: Sebastian Reichel

    Quentin Schulz
     
  • Previously there was no way to configure these chips in the event that the
    defaults didn't match the battery in question.

    For chips with RAM data memory (and also those with flash/NVM data memory
    if CONFIG_BATTERY_BQ27XXX_DT_UPDATES_NVM is defined and the user has not
    set module param dt_monitored_battery_updates_nvm=0) we now call
    power_supply_get_battery_info(), check its values, and write battery
    properties to chip data memory if there is a dm_regs table for the chip.

    Signed-off-by: Matt Ranostay
    Signed-off-by: Liam Breck
    Signed-off-by: Sebastian Reichel

    Liam Breck
     
  • Add these to enable read/write of chip data memory RAM/NVM/flash:
    bq27xxx_battery_seal()
    bq27xxx_battery_unseal()
    bq27xxx_battery_set_cfgupdate()
    bq27xxx_battery_soft_reset()
    bq27xxx_battery_read_dm_block()
    bq27xxx_battery_write_dm_block()
    bq27xxx_battery_checksum_dm_block()

    Signed-off-by: Matt Ranostay
    Signed-off-by: Liam Breck
    Signed-off-by: Sebastian Reichel

    Liam Breck
     
  • Declare bus.write/read_bulk/write_bulk().
    Add I2C write/read_bulk/write_bulk() to implement the above.
    Add bq27xxx_write/read_block/write_block() helpers to call the above.

    Signed-off-by: Matt Ranostay
    Signed-off-by: Liam Breck
    Acked-by: "Andrew F. Davis"
    Signed-off-by: Sebastian Reichel

    Matt Ranostay
     
  • Battery chargers use POWER_SUPPLY_PROP_PRECHARGE_CURRENT
    Clarify related item POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT

    Signed-off-by: Liam Breck
    Signed-off-by: Sebastian Reichel

    Liam Breck
     
  • power_supply_get_battery_info() reads battery data from devicetree.
    struct power_supply_battery_info provides battery data to drivers.
    Its fields correspond to elements in enum power_supply_property.
    Drivers may surface battery data in sysfs via corresponding
    POWER_SUPPLY_PROP_* fields.

    Signed-off-by: Matt Ranostay
    Signed-off-by: Liam Breck
    Signed-off-by: Sebastian Reichel

    Liam Breck
     
  • On the CPCAP PMIC we can use the ADCs for monitoring the battery,
    and there is also a coulomb counter. So let's add basic support for
    the battery driver.

    I did not add any capacity prediction as that should probably be
    done in the user space. Or at least user space should tell the kernel
    some battery statistics and then the kernel driver could display the
    capacity based on that.

    Cc: devicetree@vger.kernel.org
    Cc: Marcel Partap
    Cc: Michael Scott
    Cc: Rob Herring
    Signed-off-by: Tony Lindgren
    Signed-off-by: Sebastian Reichel

    Tony Lindgren
     
  • On Broadcom MIPS STB platforms, BMIPS_GENERIC is the Kconfig symbol that
    is used, make this reboot driver default to that value to make sure we
    can reboot a system properly.

    Signed-off-by: Florian Fainelli
    Signed-off-by: Sebastian Reichel

    Florian Fainelli
     
  • Since commit 37eb56dc79a8 ("arm64: Add Broadcom Set Top Box Kconfig
    entry point") we have ARCH_BRCMSTB also visible on ARM64 platform, yet
    this reboot driver was not selectable, so fix that.

    Signed-off-by: Florian Fainelli
    Signed-off-by: Sebastian Reichel

    Florian Fainelli
     
  • Assembly in at91_lpddr_poweroff has r0 in the clobber list but uses r6.

    Reported-by: Ben Hutchings
    Signed-off-by: Alexandre Belloni
    Acked-by: Nicolas Ferre
    Signed-off-by: Sebastian Reichel

    Alexandre Belloni
     
  • Assembly in at91_lpddr_poweroff has r0 in the clobber list but uses r6.

    Reported-by: Ben Hutchings
    Signed-off-by: Alexandre Belloni
    Acked-by: Nicolas Ferre
    Signed-off-by: Sebastian Reichel

    Alexandre Belloni
     
  • Since we now support the standard 'input_current_limit' property by

    commit 3fb319c2cdcd ("power: supply: twl4030-charger: add writable INPUT_CURRENT_LIMIT property")

    we can now remove the nonstandard 'max_current' sysfs attribute.

    See Documentation/power/power_supply_class.txt line 125

    Both are functionally equivalent. From ABI point of view it is just a rename
    of the property.

    This also removes the entry in Documentation/ABI/testing/sysfs-class-power-twl4030

    Signed-off-by: H. Nikolaus Schaller
    Signed-off-by: Sebastian Reichel

    H. Nikolaus Schaller
     
  • There are several cut and past bugs here. ltc3651_charger->charger is
    NULL at this point, so we return success instead of the intended error
    codes.

    Fixes: c94d4ed017ae ("power: supply: Add ltc3651-charger driver")
    Signed-off-by: Dan Carpenter
    [Wei Yongjun found the same issue independently]
    Signed-off-by: Wei Yongjun
    Acked-by: Mike Looijmans
    Signed-off-by: Sebastian Reichel

    Dan Carpenter
     
  • This fixes the TODO to parse strings and convert them to enum values
    when writing to a power_supply class property sysfs attribute.

    There is at least one driver that has a writable enum property that
    previously could only be written as an integer, so a fallback to writing
    enums as integers instead of strings is provided so we don't break existing
    userspace programs.

    Signed-off-by: David Lechner
    Signed-off-by: Sebastian Reichel

    David Lechner
     
  • Apple currently supports three very common USB chargers:
    https://www.apple.com/power-adapters/

    These chargers implement a proprietary Apple method for advertising
    1A, 2.1A, and 2.4A at 5V called "Brick ID".
    In addition, 3rd parties implement the same charging method in many
    charging accessories that work with iOS devices.

    Devices that have charger detection chips such as the Pericom PI3USB9281,
    eg. Google Chromebook Pixel 2015, are capable of detecting
    these chargers, so let's add a type to facilicate passing that info
    up to userspace.

    This adds a separate power supply type for Apple's proprietary
    "Brick ID" charging method.

    Signed-off-by: Benson Leung
    Signed-off-by: Sebastian Reichel

    Benson Leung
     

15 May, 2017

5 commits

  • On devicetree using platforms the devicetree can provide info on which
    power-supplies supply another power-supply through phandles.

    This commit adds support for providing this info on non devicetree
    platforms through the platform code setting a supplied-from
    device-property on the power-supplies parent device.

    Signed-off-by: Hans de Goede
    Signed-off-by: Sebastian Reichel

    Hans de Goede
     
  • Drop static on a local variable, when the variable is either first
    initialized or never used, on every possible execution path through the
    function. The static has no benefit, and dropping it reduces the code
    size.

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

    //
    @bad exists@
    position p;
    identifier x;
    type T;
    @@

    static T x@p;
    ...
    x =

    @@
    identifier x;
    expression e;
    type T;
    position p != bad.p;
    @@

    -static
    T x@p;
    ... when != x
    when strict
    ?x = e;
    //

    The change in code size is indicates by the following output from the size
    command.

    before:
    text data bss dec hex filename
    2865 252 8 3125 c35 drivers/power/supply/axp20x_usb_power.o

    after:
    text data bss dec hex filename
    2822 252 0 3074 c02 drivers/power/supply/axp20x_usb_power.o

    Signed-off-by: Julia Lawall
    Signed-off-by: Sebastian Reichel

    Julia Lawall
     
  • The LTC3651 reports its status via GPIO lines. This driver translates
    the GPIO levels to battery charger status information via sysfs.
    It relies on devicetree to supply the IO configuration.

    Signed-off-by: Mike Looijmans
    Signed-off-by: Sebastian Reichel

    Mike Looijmans
     
  • With the ADC driver working, we can now fix the voltage table based on
    the values read from the ADC.

    Note that unlike the ICHRG registers, the VCHRG register bits don't
    match the MC13783UG.pdf.

    Cc: Marcel Partap
    Cc: Michael Scott
    Signed-off-by: Tony Lindgren
    Signed-off-by: Sebastian Reichel

    Tony Lindgren
     
  • Turns out a similar battery charger hardware is documented for NXP MC13783
    PMIC in "MC13783 Power Management and Audio Circuit Users's Guide" named
    MC13783UG.pdf. Looks like the CPCAP charge current table matches that, so
    let's start using the nominal values from it.

    While at it, let's also add comments to some of the mystery CPCAP charger
    registers based on the MC13783UG.pdf documentation.

    Note that this patch does not contain any functional changes, the register
    values being used stay the same.

    Cc: Marcel Partap
    Cc: Michael Scott
    Signed-off-by: Tony Lindgren
    Signed-off-by: Sebastian Reichel

    Tony Lindgren
     

13 May, 2017

1 commit

  • Pull more power-supply updates from Sebastian Reichel:
    "The power-supply subsystem has a few more changes for the v4.12 merge
    window:

    - New battery driver for AXP20X and AXP22X PMICs

    - Improve max17042_battery for usage on x86

    - Misc small cleanups & fixes"

    * tag 'for-v4.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (34 commits)
    power: supply: cpcap-charger: Keep trickle charger bits disabled
    power: supply: cpcap-charger: Fix enable for 3.8V charge setting
    power: supply: cpcap-charger: Fix charge voltage configuration
    power: supply: cpcap-charger: Fix charger name
    power: supply: twl4030-charger: make twl4030_bci_property_is_writeable static
    power: supply: sbs-battery: Add alert callback
    mailmap: add Sebastian Reichel
    power: supply: avoid unused twl4030-madc.h
    power: supply: sbs-battery: Correct supply status with current draw
    power: supply: sbs-battery: Don't ignore the first external power change
    power: supply: pda_power: move from timer to delayed_work
    power: supply: max17042_battery: Add support for the SCOPE property
    power: supply: max17042_battery: Add support for the CHARGE_NOW property
    power: supply: max17042_battery: Add support for the CHARGE_FULL_DESIGN property
    power: supply: max17042_battery: mAh readings depend on r_sns value
    power: supply: max17042_battery: Add support for the VOLT_MIN property
    power: supply: max17042_battery: Add support for the TECHNOLOGY attribute
    power: supply: max17042_battery: Add external_power_changed callback
    power: supply: max17042_battery: Add support for the STATUS property
    power: supply: max17042_battery: Add default platform_data fallback data
    ...

    Linus Torvalds