summaryrefslogtreecommitdiff
path: root/drivers/power
AgeCommit message (Collapse)Author
2016-10-31power: bq24257: Fix use of uninitialized pointer bq->chargerGeorges Savoundararadj
commit 0610735928ee47870e083d5901caa371089216f1 upstream. bq->charger is initialized in bq24257_power_supply_init. Therefore, bq24257_power_supply_init should be called before the registration of the IRQ handler bq24257_irq_handler_thread that calls power_supply_changed(bq->charger). Signed-off-by: Georges Savoundararadj <savoundg@gmail.com> Cc: Aurelien Chanot <chanot.a@gmail.com> Cc: Andreas Dannenberg <dannenberg@ti.com> Cc: Sebastian Reichel <sre@kernel.org> Cc: David Woodhouse <dwmw2@infradead.org> Fixes: 2219a935963e ("power_supply: Add TI BQ24257 charger driver") Signed-off-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-30power: supply: max17042_battery: fix model download bug.Sven Van Asbroeck
commit 5381cfb6f0422da24cfa9da35b0433c0415830e0 upstream. The device's model download function returns the model data as an array of u32s, which is later compared to the reference model data. However, since the latter is an array of u16s, the comparison does not happen correctly, and model verification fails. This in turn breaks the POR initialization sequence. Fixes: 39e7213edc4f3 ("max17042_battery: Support regmap to access device's registers") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Sven Van Asbroeck <TheSven73@googlemail.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-30power_supply: tps65217-charger: fix missing platform_set_drvdata()Wei Yongjun
commit 33e7664a0af6e9a516f01014f39737aaa119b6d9 upstream. Add missing platform_set_drvdata() in tps65217_charger_probe(), otherwise calling platform_get_drvdata() in remove returns NULL. This is detected by Coccinelle semantic patch. Fixes: 3636859b280c ("power_supply: Add support for tps65217-charger") Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-30power: reset: hisi-reboot: Unmap region obtained by of_iomapArvind Yadav
commit bae170efd6c42bf116f513a1dd07639d68fa71b9 upstream. Free memory mapping, if probe is not successful. Fixes: 4a9b37371822 ("power: reset: move hisilicon reboot code") Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-10power_supply: power_supply_read_temp only if use_cnt > 0Rhyland Klein
commit 5bc28b93a36e3cb3acc2870fb75cb6ffb182fece upstream. Change power_supply_read_temp() to use power_supply_get_property() so that it will check the use_cnt and ensure it is > 0. The use_cnt will be incremented at the end of __power_supply_register, so this will block to case where get_property can be called before the supply is fully registered. This fixes the issue show in the stack below: [ 1.452598] power_supply_read_temp+0x78/0x80 [ 1.458680] thermal_zone_get_temp+0x5c/0x11c [ 1.464765] thermal_zone_device_update+0x34/0xb4 [ 1.471195] thermal_zone_device_register+0x87c/0x8cc [ 1.477974] __power_supply_register+0x364/0x424 [ 1.484317] power_supply_register_no_ws+0x10/0x18 [ 1.490833] bq27xxx_battery_setup+0x10c/0x164 [ 1.497003] bq27xxx_battery_i2c_probe+0xd0/0x1b0 [ 1.503435] i2c_device_probe+0x174/0x240 [ 1.509172] driver_probe_device+0x1fc/0x29c [ 1.515167] __driver_attach+0xa4/0xa8 [ 1.520643] bus_for_each_dev+0x58/0x98 [ 1.526204] driver_attach+0x20/0x28 [ 1.531505] bus_add_driver+0x1c8/0x22c [ 1.537067] driver_register+0x68/0x108 [ 1.542630] i2c_register_driver+0x38/0x7c [ 1.548457] bq27xxx_battery_i2c_driver_init+0x18/0x20 [ 1.555321] do_one_initcall+0x38/0x12c [ 1.560886] kernel_init_freeable+0x148/0x1ec [ 1.566972] kernel_init+0x10/0xfc [ 1.572101] ret_from_fork+0x10/0x40 Also make the same change to ps_get_max_charge_cntl_limit() and ps_get_cur_chrage_cntl_limit() to be safe. Lastly, change the return value of power_supply_get_property() to -EAGAIN from -ENODEV if use_cnt <= 0. Fixes: 297d716f6260 ("power_supply: Change ownership from driver to core") Signed-off-by: Rhyland Klein <rklein@nvidia.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-06Merge tag 'mfd-for-linus-4.4' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd 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 ...
2015-11-05Merge tag 'for-v4.4' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply 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() ...
2015-10-19power: bq27xxx_battery: Remove unneeded dependency in KconfigAndrew F. Davis
I2C is only required when using the config item BATTERY_BQ27XXX_I2C which already depends on the I2C subsystem, remove the unneeded dependency from BATTERY_BQ27XXX. Signed-off-by: Andrew F. Davis <afd@ti.com> Acked-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-10-19power: bq27xxx_battery: move irq handler to i2c sectionSebastian Reichel
The IRQ handler is not used by the platform based code resulting in a 'defined but not used' warning, if CONFIG_BQ27XXX_I2C is not enabled. Signed-off-by: Sebastian Reichel <sre@kernel.org> Acked-by: Pali Rohár <pali.rohar@gmail.com> Acked-by: Andrew F. Davis <afd@ti.com>
2015-10-19power: bq27xxx_battery: fix platform probeSebastian Reichel
Add missing initialization of register mapping table to platform probe function. Signed-off-by: Sebastian Reichel <sre@kernel.org> Acked-by: Pali Rohár <pali.rohar@gmail.com> Acked-by: Andrew F. Davis <afd@ti.com>
2015-10-16twl4030_charger: add missing iio dependencySebastian Reichel
This driver fails to link without CONFIG_IIO, since there are no stubs for the iio_channels functions. Signed-off-by: Sebastian Reichel <sre@kernel.org> Acked-by: Marek Belisko <marek@goldelico.com> Acked-by: Nikolaus Schaller <hns@goldelico.com>
2015-10-15power_supply: charger-manager: add missing of_node_putJulia Lawall
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): // <smpl> @@ 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 ...; ) ... } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-10-14PM / AVS: rockchip-io: Fix module autoload for OF platform driverLuis de Bethencourt
This platform driver has a OF device ID table but the OF module alias information is not created so module autoloading won't work. Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-10-13power: Add support for DA9150 Fuel-GaugeAdam Thomson
This adds power supply driver support for the Fuel-Gauge part of the DA9150 combined Charger and Fuel-Gauge device. Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Acked-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-09-29power: bq24257: Add various device-specific sysfs propertiesAndreas Dannenberg
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 <dannenberg@ti.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-29power: bq24257: Allow input current limit sysfs accessAndreas 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 <dannenberg@ti.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-29power: bq24257: Add input DPM voltage threshold setting supportAndreas 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 <dannenberg@ti.com> Reviewed-by: Laurentiu Palcu <laurentiu.palcu@intel.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-29power: bq24257: Add over voltage protection setting supportAndreas 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 <dannenberg@ti.com> Reviewed-by: Laurentiu Palcu <laurentiu.palcu@intel.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-29power: bq24257: Add SW-based approach for Power Good determinationAndreas 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 <dannenberg@ti.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-29power: bq24257: Allow manual setting of input current limitAndreas 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 <dannenberg@ti.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-29power: bq24257: Add bit definition for temp sense enableAndreas 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 <dannenberg@ti.com> Reviewed-by: Laurentiu Palcu <laurentiu.palcu@intel.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-29power: bq24257: Add basic support for bq24250/bq24251Andreas 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 <dannenberg@ti.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-29power: bq24257: Simplify bq24257_power_supply_init()Andreas Dannenberg
Eliminate a few lines of code by using the PTR_ERR_OR_ZERO() macro. Signed-off-by: Andreas Dannenberg <dannenberg@ti.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-29power: bq24257: Use managed power supply registerAndreas 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 <dannenberg@ti.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-28power: bq24257: Streamline input current limit setupAndreas 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 <dannenberg@ti.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-28power: bq24257: Remove IRQ config through stat-gpiosAndreas 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 <dannenberg@ti.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-28power: bq27xxx_battery: fix signedness bug in bq27xxx_battery_read_health()Andrzej Hajda
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 <a.hajda@samsung.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-By: Pali Rohár <pali.rohar@gmail.com> Acked-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-26drivers: power: twl4030_charger: fix link problems when building as moduleMarek Belisko
If either twl4030_charger or twl4030_madc is configured as MODULE, we get build (link) errors. To solve, the direct call of twl4030_get_madc_conversion() is replaced by a call to iio_read_channel_processed(). Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Signed-off-by: Marek Belisko <marek@goldelico.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-26wm831x_power: Use IRQF_ONESHOT to request threaded IRQsValentin Rothberg
Since commit 1c6c69525b40 ("genirq: Reject bogus threaded irq requests") threaded IRQs without a primary handler need to be requested with IRQF_ONESHOT, otherwise the request will fail. scripts/coccinelle/misc/irqf_oneshot.cocci detected this issue. Fixes: b5874f33bbaf ("wm831x_power: Use genirq") Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-24power_supply: Add support for tps65217-charger.Enric Balletbo i Serra
This patch adds support for the tps65217 charger driver. This driver is responsible for controlling the charger aspect of the tps65217 mfd. Currently, this mainly consists of turning on and off the charger, but some other features of the charger can be supported through this driver. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-24power: qcom_smbb: test the correct variableDan Carpenter
"state" is a bool so it's never less than zero. The intent was to test "ret" instead. Fixes: 56d7df8716b2 ('power: Add Qualcomm SMBB driver') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-23bq2415x_charger: Fix null pointer dereferencePali Rohár
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 <dan.carpenter@oracle.com> Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-23power: bq27xxx_battery: Add interrupt handling supportAndrew F. Davis
Some devices have a pin that can generate an interrupt when the battery's status changes. Add an interrupt handler to read the new battery status. Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-23power: bq27xxx_battery: Cleanup health checkingAndrew F. Davis
Reorganize the logic checking battery health and add under temperature condition checking. Signed-off-by: Andrew F. Davis <afd@ti.com> Acked-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-23power: bq27xxx_battery: Add support for additional bq27xxx family devicesAndrew F. Davis
Add support for additional devices and register equivalent family devices including the bq27010, bq27210, bq27500, bq27510, bq27520, bq27530, bq27531, bq27541, bq27542, bq27546, bq27545, bq27441, bq27421, and the bq27641. To facilitate this process the register mapings have been moved to tables and other small cleanups have been made. Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-23power: bq27xxx_battery: Fix typos and change naming for state of charge ↵Andrew F. Davis
functions Fix typos and change "relative state of charge" to "state of charge" as not all supported devices use relative state of charge. Signed-off-by: Andrew F. Davis <afd@ti.com> Acked-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-23power: bq27xxx_battery: Platform initialization must declare a deviceAndrew F. Davis
When initialized as a platform device the initializer must now specify a device. An empty device name is no longer valid. Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-23power: bq27x00_battery: Renaming for consistencyAndrew F. Davis
Rename functions that are used by multiple devices. New devices have been added and the function names and driver name are no longer general enough for the functionality they provide. Signed-off-by: Andrew F. Davis <afd@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Acked-by: GUAN Xuetao <gxt@mprc.pku.edu.cn> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22power: bq27x00_battery: Remove unneeded i2c MODULE_ALIASAndrew F. Davis
The MODULE_DEVICE_TABLE macro automatically adds all needed i2c MODULE_ALIASes so remove the extra MODULE_ALIAS. Signed-off-by: Andrew F. Davis <afd@ti.com> Acked-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22power_supply: max8998: Use devm_power_supply_registerVaishali Thakkar
Use managed resource function devm_power_supply_register instead of power_supply_register to simplify the error path by allowing unregister to happen automatically on error. To be compatible with the change, replace various gotos by direct returns and remove unneeded label err. Also, remove max8998_battery_remove as it is now redundant. Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22tps65090-charger: Fix module autoload for OF platform driverLuis de Bethencourt
This platform driver has a OF device ID table but the OF module alias information is not created so module autoloading won't work. Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22max8903_charger: Convert to using managed resourcesVaishali Thakkar
Use managed resource functions devm_request_threaded_irq and devm_power_supply_register to simplify error handling. To be compatible with the change, various gotos are replaced with direct returns and unneeded labels are dropped. Also, remove max8903_remove as it is now redundant. Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22power: max17042_battery: Convert to using managed resourcesVaishali Thakkar
Use managed resource functions devm_request_threaded_irq and devm_power_supply_register to simplify error handling. Also, remove max17042_remove as it is now redundant. Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22power: reset: at91-reset/trivial: driver applies to SAMA5 family as wellNicolas Ferre
This diver doesn't applies only on SAM9 SoC families but on SAMA5 families as well. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22power/reset: at91-poweroff: get and use slow clockAlexandre Belloni
Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system hang") added a workaround for the slow clock as it is not properly handled by its users. Get and use the slow clock as it is necessary for the at91 shutdown controller. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22power/reset: at91-poweroff: allow compiling as a moduleAlexandre Belloni
It was not possible to compile at91-poweroff as a module. Implement .remove() to allow it. Also switch to module_platform_driver_probe() as it is not hotpluggable. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22power/reset: at91-reset: get and use slow clockAlexandre Belloni
Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system hang") added a workaround for the slow clock as it is not properly handled by its users. Get and use the slow clock as it is necessary for the at91 reset controller. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22power/reset: at91-reset: allow compiling as a moduleAlexandre Belloni
It was not possible to compile at91-reset as a module. Implement .remove() to allow it. Also switch to module_platform_driver_probe() as it is not hotpluggable. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22power/reset: at91-reset: remove useless at91_reset_platform_probe()Alexandre Belloni
Since all the at91 platforms are now DT only, at91_reset_platform_probe() is now useless, remove it. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-2288pm860x_battery: Convert to using managed resourcesVaishali Thakkar
Use managed resource functions devm_request_threaded_irq and devm_power_supply_register to simplify error handling. To be compatible with the change, various gotos are replaced with direct returns and unneeded labels are dropped. Also, remove pm860x_battery_remove as it is now redundant. Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>