summaryrefslogtreecommitdiffstats
path: root/drivers/power
Commit message (Collapse)AuthorAgeFilesLines
...
| * | power: supply: ltc2941-battery-gauge: Add LTC2942 supportLadislav Michl2017-07-251-13/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LTC2942 is pin compatible with LTC2941 providing additional informations about battery voltage and temperature. It can be runtime detected using bit A7 in the Status register. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Acked-by: Rob Herring <robh@kernel.org> Acked-by: Dragos Bogdan <dragos.bogdan@analog.com> Tested-by: Dragos Bogdan <dragos.bogdan@analog.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * | power: supply: ltc2941-battery-gauge: Prepare for LTC2942 and LTC2944Ladislav Michl2017-07-251-32/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to support LTC2942 which has temperature registers at different offsets than LTC2943 use following register naming scheme (prefixes): - LTC294X_ common registers - LTC2942_ chips specific registers - LTC2943_ specific registers LTC2944 is compatible with LTC2943 but uses different constants to compute voltage and current, so replace num_regs misused for device indentification with real device id to discriminate between those two. There are no functional changes. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Acked-by: Dragos Bogdan <dragos.bogdan@analog.com> Tested-by: Dragos Bogdan <dragos.bogdan@analog.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * | power: supply: sbs-battery: Add delay when changing capacity mode bitPhil Reid2017-07-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At least with the Inspired Energy compatible batteries a delay is required after setting the capacity mode bit from amp to watts or the reverse. Setting the bit and then immediately pooling the status register results in an unknown error being returned in the register. Add the delay results in and ok status being return. This was also seen when reading the charge and energy registers where the wrong value was returned for the requested mode. Signed-off-by: Phil Reid <preid@electromag.com.au> Tested-by: Michael Heinemann <committed@heine.so> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * | power: supply: sbs-battery: sort includesPhil Reid2017-07-251-8/+7
| | | | | | | | | | | | | | | | | | | | | Sort the header includes prior to adding to the list. Signed-off-by: Phil Reid <preid@electromag.com.au> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * | power: supply: sbs-battery: Remove FSF mailing address from commentsPhil Reid2017-07-251-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | checkpatch issued an error in having the FSF address in the comment. As address may change and Linux already includes a copy. Signed-off-by: Phil Reid <preid@electromag.com.au> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * | Merge branch 'fixes' into for-nextSebastian Reichel2017-07-243-4/+5
| |\ \ | | | | | | | | | | | | Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| | * | power: supply: act8945a_charger: fix of_irq_get() error checkSergei Shtylyov2017-07-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of_irq_get() may return any negative error number as well as 0 on failure, while the driver only checks for -EPROBE_DEFER, blithely continuing with the call to devm_request_irq() -- that function expects *unsigned int*, so would probably fail anyway when a large IRQ number resulting from a conversion of a negative error number is passed to it... This, however, is incorrect behavior -- error number is not IRQ number. Check for 'irq <= 0' instead and return -ENXIO from probe if of_irq_get() returned 0. Fixes: a09209acd6a8 ("power: supply: act8945a_charger: Add status change update support") Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| | * | power: supply: cpcap-charger: add OMAP_USB2 dependencyArnd Bergmann2017-07-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When CONFIG_OMAP_USB2 is set to 'm' and the charger driver is built-in, we get this link failure: drivers/power/supply/cpcap-charger.o: In function `cpcap_charger_probe': cpcap-charger.c:(.text+0x48c): undefined reference to `omap_usb2_set_comparator' drivers/power/supply/cpcap-charger.o: In function `cpcap_charger_remove': cpcap-charger.c:(.text+0x774): undefined reference to `omap_usb2_set_comparator' This adds a dependency to prevent that problem, while still allowing compile-testing with the OMAP_USB2 driver completely disabled. Fixes: 0c9888e3c192 ("power: supply: cpcap-charger: Add minimal CPCAP PMIC battery charger") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| | * | power: supply: sbs-battery: correct capacity mode selection bitsMichael Heinemann2017-07-241-2/+2
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The capacity mode bit is bit 15. Currently it is written as default initialized enum and never shifted. This leads to a behaviour where the BATTERY_MODE is not correctly recognized and set again. This commit initializes the enum accordingly. Signed-off-by: Michael Heinemann <committed@heine.so> Tested-by: Phil Reid <preid@electromag.com.au> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * | power: supply: Add support for MAX1721x standalone fuel gaugeAlex A. Mihaylov2017-07-243-0/+462
| | | | | | | | | | | | | | | | | | | | | | | | | | | The MAX17211 monitor a single cell pack. The MAX17215 monitor and balance a 2S or 3S pack or monitor a multiple-series cell pack. Both device use 1-Wire interfce. Signed-off-by: Alex A. Mihaylov <minimumlaw@rambler.ru> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * | power: supply: constify attribute_group structures.Arvind Yadav2017-07-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | attribute_groups are not supposed to change at runtime. All functions working with attribute_groups provided by <linux/sysfs.h> work with const attribute_group. So mark the non-const structs as const. File size before: text data bss dec hex filename 2673 400 0 3073 c01 power/supply/pcf50633-charger.o File size After adding 'const': text data bss dec hex filename 2737 336 0 3073 bed power/supply/pcf50633-charger.o Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * | power: reset: Convert to using %pOF instead of full_nameRob Herring2017-07-241-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | Now that we have a custom printf format specifier, convert users of full_name to use %pOF instead. This is preparation to remove storing of the full path string for each node. Signed-off-by: Rob Herring <robh@kernel.org> Cc: Nicolas Ferre <nicolas.ferre@microchip.com> Cc: Sebastian Reichel <sre@kernel.org> Cc: linux-pm@vger.kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
* | Merge tag 'mfd-next-4.14' of ↵Linus Torvalds2017-09-071-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd Pull MFD updates from Lee Jones: "New Drivers - RK805 Power Management IC (PMIC) - ROHM BD9571MWV-M MFD Power Management IC (PMIC) - Texas Instruments TPS68470 Power Management IC (PMIC) & LEDs New Device Support: - Add support for HiSilicon Hi6421v530 to hi6421-pmic-core - Add support for X-Powers AXP806 to axp20x - Add support for X-Powers AXP813 to axp20x - Add support for Intel Sunrise Point LPSS to intel-lpss-pci New Functionality: - Amend API to provide register layout; atmel-smc Fix-ups: - DT re-work; omap, nokia - Header file location change {I2C => MFD}; dm355evm_msp, tps65010 - Fix chip ID formatting issue(s); rk808 - Optionally register touchscreen devices; da9052-core - Documentation improvements; twl-core - Constification; rtsx_pcr, ab8500-core, da9055-i2c, da9052-spi - Drop unnecessary static declaration; max8925-i2c - Kconfig changes (missing deps and remove module support) - Slim down oversized licence statement; hi6421-pmic-core - Use managed resources (devm_*); lp87565 - Supply proper error checking/handling; t7l66xb Bug Fixes: - Fix counter duplication issue; da9052-core - Fix potential NULL deference issue; max8998 - Leave SPI-NOR write-protection bit alone; lpc_ich - Ensure device is put into reset during suspend; intel-lpss - Correct register offset variable size; omap-usb-tll" * tag 'mfd-next-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (61 commits) mfd: intel_soc_pmic: Differentiate between Bay and Cherry Trail CRC variants mfd: intel_soc_pmic: Export separate mfd-cell configs for BYT and CHT dt-bindings: mfd: Add bindings for ZII RAVE devices mfd: omap-usb-tll: Fix register offsets mfd: da9052: Constify spi_device_id mfd: intel-lpss: Put I2C and SPI controllers into reset state on suspend mfd: da9055: Constify i2c_device_id mfd: intel-lpss: Add missing PCI ID for Intel Sunrise Point LPSS devices mfd: t7l66xb: Handle return value of clk_prepare_enable mfd: Add ROHM BD9571MWV-M PMIC DT bindings mfd: intel_soc_pmic_chtwc: Turn Kconfig option into a bool mfd: lp87565: Convert to use devm_mfd_add_devices() mfd: Add support for TPS68470 device mfd: lpc_ich: Do not touch SPI-NOR write protection bit on Haswell/Broadwell mfd: syscon: atmel-smc: Add helper to retrieve register layout mfd: axp20x: Use correct platform device ID for many PEK dt-bindings: mfd: axp20x: Introduce bindings for AXP813 mfd: axp20x: Add support for AXP813 PMIC dt-bindings: mfd: axp20x: Add AXP806 to supported list of chips mfd: Add ROHM BD9571MWV-M MFD PMIC driver ...
| * | mfd: twl: Move header file out of I2C realmWolfram Sang2017-09-041-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | include/linux/i2c is not for client devices. Move the header file to a more appropriate location. Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Mark Brown <broonie@kernel.org> Acked-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Acked-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Kishon Vijay Abraham I <kishon@ti.com> Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Thierry Reding <thierry.reding@gmail.com> Acked-by: Tony Lindgren <tony@atomide.com> Acked-by: Daniel Thompson <daniel.thompson@linaro.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Lee Jones <lee.jones@linaro.org>
* | Merge tag 'pm-4.14-rc1' of ↵Linus Torvalds2017-09-051-0/+38
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull power management updates from Rafael Wysocki: "This time (again) cpufreq gets the majority of changes which mostly are driver updates (including a major consolidation of intel_pstate), some schedutil governor modifications and core cleanups. There also are some changes in the system suspend area, mostly related to diagnostics and debug messages plus some renames of things related to suspend-to-idle. One major change here is that suspend-to-idle is now going to be preferred over S3 on systems where the ACPI tables indicate to do so and provide requsite support (the Low Power Idle S0 _DSM in particular). The system sleep documentation and the tools related to it are updated too. The rest is a few cpuidle changes (nothing major), devfreq updates, generic power domains (genpd) framework updates and a few assorted modifications elsewhere. Specifics: - Drop the P-state selection algorithm based on a PID controller from intel_pstate and make it use the same P-state selection method (based on the CPU load) for all types of systems in the active mode (Rafael Wysocki, Srinivas Pandruvada). - Rework the cpufreq core and governors to make it possible to take cross-CPU utilization updates into account and modify the schedutil governor to actually do so (Viresh Kumar). - Clean up the handling of transition latency information in the cpufreq core and untangle it from the information on which drivers cannot do dynamic frequency switching (Viresh Kumar). - Add support for new SoCs (MT2701/MT7623 and MT7622) to the mediatek cpufreq driver and update its DT bindings (Sean Wang). - Modify the cpufreq dt-platdev driver to autimatically create cpufreq devices for the new (v2) Operating Performance Points (OPP) DT bindings and update its whitelist of supported systems (Viresh Kumar, Shubhrajyoti Datta, Marc Gonzalez, Khiem Nguyen, Finley Xiao). - Add support for Ux500 to the cpufreq-dt driver and drop the obsolete dbx500 cpufreq driver (Linus Walleij, Arnd Bergmann). - Add new SoC (R8A7795) support to the cpufreq rcar driver (Khiem Nguyen). - Fix and clean up assorted issues in the cpufreq drivers and core (Arvind Yadav, Christophe Jaillet, Colin Ian King, Gustavo Silva, Julia Lawall, Leonard Crestez, Rob Herring, Sudeep Holla). - Update the IO-wait boost handling in the schedutil governor to make it less aggressive (Joel Fernandes). - Rework system suspend diagnostics to make it print fewer messages to the kernel log by default, add a sysfs knob to allow more suspend-related messages to be printed and add Low Power S0 Idle constraints checks to the ACPI suspend-to-idle code (Rafael Wysocki, Srinivas Pandruvada). - Prefer suspend-to-idle over S3 on ACPI-based systems with the ACPI_FADT_LOW_POWER_S0 flag set and the Low Power Idle S0 _DSM interface present in the ACPI tables (Rafael Wysocki). - Update documentation related to system sleep and rename a number of items in the code to make it cleare that they are related to suspend-to-idle (Rafael Wysocki). - Export a variable allowing device drivers to check the target system sleep state from the core system suspend code (Florian Fainelli). - Clean up the cpuidle subsystem to handle the polling state on x86 in a more straightforward way and to use %pOF instead of full_name (Rafael Wysocki, Rob Herring). - Update the devfreq framework to fix and clean up a few minor issues (Chanwoo Choi, Rob Herring). - Extend diagnostics in the generic power domains (genpd) framework and clean it up slightly (Thara Gopinath, Rob Herring). - Fix and clean up a couple of issues in the operating performance points (OPP) framework (Viresh Kumar, Waldemar Rymarkiewicz). - Add support for RV1108 to the rockchip-io Adaptive Voltage Scaling (AVS) driver (David Wu). - Fix the usage of notifiers in CPU power management on some platforms (Alex Shi). - Update the pm-graph system suspend/hibernation and boot profiling utility (Todd Brandt). - Make it possible to run the cpupower utility without CPU0 (Prarit Bhargava)" * tag 'pm-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (87 commits) cpuidle: Make drivers initialize polling state cpuidle: Move polling state initialization code to separate file cpuidle: Eliminate the CPUIDLE_DRIVER_STATE_START symbol cpufreq: imx6q: Fix imx6sx low frequency support cpufreq: speedstep-lib: make several arrays static, makes code smaller PM: docs: Delete the obsolete states.txt document PM: docs: Describe high-level PM strategies and sleep states PM / devfreq: Fix memory leak when fail to register device PM / devfreq: Add dependency on PM_OPP PM / devfreq: Move private devfreq_update_stats() into devfreq PM / devfreq: Convert to using %pOF instead of full_name PM / AVS: rockchip-io: add io selectors and supplies for RV1108 cpufreq: ti: Fix 'of_node_put' being called twice in error handling path cpufreq: dt-platdev: Drop few entries from whitelist cpufreq: dt-platdev: Automatically create cpufreq device with OPP v2 ARM: ux500: don't select CPUFREQ_DT cpuidle: Convert to using %pOF instead of full_name cpufreq: Convert to using %pOF instead of full_name PM / Domains: Convert to using %pOF instead of full_name cpufreq: Cap the default transition delay value to 10 ms ...
| * | PM / AVS: rockchip-io: add io selectors and supplies for RV1108David Wu2017-08-251-0/+38
| |/ | | | | | | | | | | | | | | This adds the necessary data for handling io voltage domains on the RV1108. Signed-off-by: David Wu <david.wu@rock-chips.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* | power: wm831x_power: Support USB charger current limit managementBaolin Wang2017-08-151-0/+72
|/ | | | | | | | | | | | | | Integrate with the newly added USB charger interface to limit the current we draw from the USB input based on the input device configuration identified by the USB stack, allowing us to charge more quickly from high current inputs without drawing more current than specified from others. Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Acked-by: Lee Jones <lee.jones@linaro.org> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Acked-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* Merge tag 'for-v4.13-2' of ↵Linus Torvalds2017-07-131-15/+28
|\ | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply Pull power supply fixes from Reichel: "I have two more fixes for the power-supply subsystem: - two fixes for twl4030-charger" * tag 'for-v4.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: power: supply: twl4030-charger: add deferred probing for phy and iio power: supply: twl4030-charger: move irq allocation to just before irqs are enabled
| * power: supply: twl4030-charger: add deferred probing for phy and iioH. Nikolaus Schaller2017-07-031-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes an issue if both this twl4030_charger driver and phy-twl4030-usb are compiled as modules and loaded in random order. It has been observed on GTA04 and OpenPandora devices that in worst case the boot process hangs and in best case the AC detection fails with a warning. Therefore we add deferred probing checks for the usb_phy and the iio channel for AC detection. Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * power: supply: twl4030-charger: move irq allocation to just before irqs are ↵H. Nikolaus Schaller2017-07-031-14/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | enabled And initialize workers and notifiers as soon as possible. This avoids a potential race if irqs are enabled and triggered too early before the worker is properly set up. Suggested-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
* | Merge tag 'for-v4.13' of ↵Linus Torvalds2017-07-0420-213/+2000
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply 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 ...
| * power: supply: sbs-battery: Don't needlessly set CAPACITY_MODEShawn Nematbakhsh2017-06-151-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | According to the smart battery spec (1), the CAPACITY_MODE bit does not influence the value read from RelativeStateOfCharge(), so don't bother changing CAPACITY_MODE when doing such a read. (1) - Smart Battery Data Specification, Rev 1.1, Dec. 11, 1998 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * power: supply: sbs-battery: Prevent CAPACITY_MODE racesShawn Nematbakhsh2017-06-151-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | A subset of smart battery commands return charge or energy depending on the CAPACITY_MODE bit setting of BatteryMode(). In order to unambiguously read a charge or energy value, it is necessary to ensure that CAPACITY_MODE is set as desired, and not changed for the duration of the attribute read. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * power: supply: bq24735: remove incorrect le16_to_cpu callsPhil Reid2017-06-151-4/+2
| | | | | | | | | | | | | | | | | | i2c_smbus commands handle the correct byte order for smbus transactions internally. This will currently result in incorrect operation on big endian systems. Signed-off-by: Phil Reid <preid@electromag.com.au> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * power: supply: sbs-battery: remove incorrect le16_to_cpu callsPhil Reid2017-06-151-4/+3
| | | | | | | | | | | | | | | | | | i2c_smbus commands handle the correct byte order for smbus transactions internally. This will currently result in incorrect operation on big endian systems. Signed-off-by: Phil Reid <preid@electromag.com.au> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * power: supply: cpcap-charger: Add missing power_supply_configTony Lindgren2017-06-151-1/+5
| | | | | | | | | | | | | | | | | | | | | | Otherwise cpcap-battery won't probe properly with the power-supplies property configured but will fail with "Not all required supplies found, defer probe". Cc: Marcel Partap <mpartap@gmx.net> Cc: Michael Scott <michael.scott@linaro.org> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * power: supply: twl4030-charger: move allocation of iio channel to the beginningH. Nikolaus Schaller2017-06-141-6/+6
| | | | | | | | | | | | | | | | | | This is in prepraration for EPROBE_DEFER handling because it is quite likely that geting the (madc) iio channel is deferred more often than later steps. Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * power: supply: twl4030-charger: allocate iio by devm_iio_channel_get() and ↵H. Nikolaus Schaller2017-06-141-8/+2
| | | | | | | | | | | | | | | | fix error path Suggested-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * power: supply: core: constify psy_tcd_ops.Arvind Yadav2017-06-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | File size before: text data bss dec hex filename 4240 200 80 4520 11a8 drivers/power/supply/power_supply_core.o File size After adding 'const': text data bss dec hex filename 4296 136 80 4512 11a0 drivers/power/supply/power_supply_core.o Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * power: supply: twl4030_charger: Use sysfs_match_string() helperAndy Shevchenko2017-06-121-9/+5
| | | | | | | | | | | | | | | | Use sysfs_match_string() helper instead of open coded variant. Cc: Sebastian Reichel <sre@kernel.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * Merge branch 'psy-reboot-mode-immutable' into psy-nextSebastian Reichel2017-06-083-20/+2
| |\
| | * power: reset: reboot-mode: Make include file globalBjorn Andersson2017-06-083-20/+2
| | | | | | | | | | | | | | | | | | | | | | | | Move the reboot-mode.h include file into include/linux to allow drivers outside drivers/power/reset to implement reboot-mode. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * | power: supply: axp20x_battery: add DT support for battery max constant ↵Quentin Schulz2017-06-081-8/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | charge current 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 <quentin.schulz@free-electrons.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * | power: supply: axp20x_battery: add support for DT batteryQuentin Schulz2017-06-081-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <quentin.schulz@free-electrons.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * | power: supply: bq27xxx: Add power_supply_battery_info supportLiam Breck2017-06-082-1/+214
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <matt@ranostay.consulting> Signed-off-by: Liam Breck <kernel@networkimprov.net> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * | power: supply: bq27xxx: Add chip data memory read/write supportLiam Breck2017-06-081-0/+265
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <matt@ranostay.consulting> Signed-off-by: Liam Breck <kernel@networkimprov.net> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * | power: supply: bq27xxx: Add bulk transfer bus methodsMatt Ranostay2017-06-082-3/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <matt@ranostay.consulting> Signed-off-by: Liam Breck <kernel@networkimprov.net> Acked-by: "Andrew F. Davis" <afd@ti.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * | power: supply: core: Add power_supply_prop_prechargeLiam Breck2017-06-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Battery chargers use POWER_SUPPLY_PROP_PRECHARGE_CURRENT Clarify related item POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT Signed-off-by: Liam Breck <kernel@networkimprov.net> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * | power: supply: core: Add power_supply_battery_info and APILiam Breck2017-06-081-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <matt@ranostay.consulting> Signed-off-by: Liam Breck <kernel@networkimprov.net> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * | power: supply: cpcap-battery: Add a battery driverTony Lindgren2017-06-083-0/+817
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <mpartap@gmx.net> Cc: Michael Scott <michael.scott@linaro.org> Cc: Rob Herring <robh@kernel.org> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * | power: reset: Default POWER_RESET_BRCMSTB to BMIPS_GENERICFlorian Fainelli2017-06-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <f.fainelli@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * | power: reset: Allow selecting POWER_RESET_BRCMSTB on ARM64Florian Fainelli2017-06-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <f.fainelli@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * | power: reset: at91-sama5d2_shdwc: fix clobber listAlexandre Belloni2017-06-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Assembly in at91_lpddr_poweroff has r0 in the clobber list but uses r6. Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * | power: reset: at91-poweroff: fix clobber listAlexandre Belloni2017-06-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Assembly in at91_lpddr_poweroff has r0 in the clobber list but uses r6. Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * | power: supply: twl4030-charger: remove nonstandard max_current sysfs attributeH. Nikolaus Schaller2017-06-081-63/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <hns@goldelico.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * | power: supply: ltc3651-charger: fix some error codes in probeDan Carpenter2017-06-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <dan.carpenter@oracle.com> [Wei Yongjun found the same issue independently] Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Acked-by: Mike Looijmans <mike.looijmans@topic.nl> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * | power: supply: sysfs: parse string as enum when writing propertyDavid Lechner2017-06-081-39/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <david@lechnology.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * | power: supply: Add Apple Brick ID power supply typeBenson Leung2017-06-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <bleung@chromium.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * | power: supply: core: Add support for supplied-from device-propertyHans de Goede2017-05-151-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| * | power: supply: axp20x_usb_power: Drop unnecessary staticJulia Lawall2017-05-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/) // <smpl> @bad exists@ position p; identifier x; type T; @@ static T x@p; ... x = <+...x...+> @@ identifier x; expression e; type T; position p != bad.p; @@ -static T x@p; ... when != x when strict ?x = e; // </smpl> 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 <Julia.Lawall@lip6.fr> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
OpenPOWER on IntegriCloud