summaryrefslogtreecommitdiff
path: root/drivers/power
AgeCommit message (Collapse)Author
2016-03-03power_supply: 88pm860x_charger: do not pass NULL to power_supply_putColin Ian King
In the case where power_supply_get_by_name returns NULL the current error return path calls power_supply_put with a NULL psy which will cause a null pointer dereference. Avoid this with an immediate return. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-03-03jz4740-battery: Correct voltage change checkMaarten ter Huurne
The check is supposed to avoid redundant update notifications, so it should check for the difference between old and new voltage exceeding a threshold. Also make sure the result of a failed read is never stored. Signed-off-by: Maarten ter Huurne <maarten@treewalker.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-03-03power_supply: lp8788-charger: initialize boolean 'found'Colin Ian King
The boolean 'found' is not initialized and hence garbage. It should be initialized as false. Found with static analysis using CoverityScan Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Milo Kim <milo.kim@ti.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-03-03goldfish: Enable ACPI-based enumeration for goldfish batteryYu Ning
Add the ACPI bindings to the goldfish battery driver. Signed-off-by: Yu Ning <yu.ning@intel.com> Signed-off-by: Jin Qian <jinqian@android.com> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-03-03power: goldfish_battery: add devicetree bindingsGreg Hackmann
Add device tree bindings to the Goldfish virtual platform battery drivers. Signed-off-by: Greg Hackmann <ghackmann@google.com> Signed-off-by: Jin Qian <jinqian@android.com> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-24power: act8945a: add charger driver for ACT8945AWenyou Yang
This patch adds new driver for Active-semi ACT8945A ActivePath charger (part of ACT8945A MFD driver) providing power supply class information to userspace. The driver can be configured through DT (such as, total timer, precondition timer and input over-voltage threshold). Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> [ add "|| COMPILE_TEST" to MFD_ACT8945A dependency ] Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-21power: bq27xxx_battery: Restore device nameIvaylo Dimitrov
Patch <703df6c09795> ("power: bq27xxx_battery: Reorganize I2C into a module") has removed the device name numbering from bq27xxx_battery_i2c_probe. Fix that by restoring the code. Fixes: 703df6c097956d17a818e63961c82e8e9eef9fef Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Tested-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-21power_supply: bq27xxx_battery: Add of modalias and match table when ↵Pali Rohár
CONFIG_OF is enabled Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-21power_supply: bq2415x_charger: Add of modalias and match table when ↵Pali Rohár
CONFIG_OF is enabled Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-21power_supply: bq2415x_charger: Do not add acpi modalias when CONFIG_ACPI is ↵Pali Rohár
not enabled Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-21power_supply: isp1704_charger: Add compatible of match for nxp,isp1707Pali Rohár
Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-21power_supply: isp1704_charger: Error messages when probe failPali Rohár
This patch adds more detailed error messages when probe function fails. It is useful for debbuging why the driver refuses to register the charger device. Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-15power_supply: Add types for USB Type C and PD chargersBenson Leung
This adds power supply types for USB chargers defined in the USB Type-C Specification 1.1 and in the USB Power Delivery Specification Revision 2.0 V1.1. The following are added : POWER_SUPPLY_TYPE_USB_TYPE_C, /* Type C Port */ POWER_SUPPLY_TYPE_USB_PD, /* Power Delivery Port */ POWER_SUPPLY_TYPE_USB_PD_DRP, /* PD Dual Role Port */ Signed-off-by: Benson Leung <bleung@chromium.org> [tomeu: remove the mention to Type C from the comments] Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-15power: bq24735-charger: add 'ti,external-control' optionJonathan Tinkham
Implement an 'ti,external-control' option for when the charger shouldn't be configured by the host. Signed-off-by: Jonathan Tinkham <sctincman@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-15power: bq24735-charger: fix failed i2c with ac-detectJonathan Tinkham
When an ac-detect pin exists, but the charger is not plugged in, the chip will not respond to i2c messages, causing the module to fail when inserted. Signed-off-by: Jonathan Tinkham <sctincman@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-15power: reset: Fix dependencies for !HAS_IOMEM archsRichard Weinberger
Not every arch has io memory. So, unbreak the build by fixing the dependencies. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-15power: collie_battery: hide unused variableArnd Bergmann
The 'wakeup_enabled' variable in this driver is only accessed by the optional power management functions and we get a warning when they are disabled: drivers/power/collie_battery.c:29:12: error: 'wakeup_enabled' defined but not used [-Werror=unused-variable] This moves the definition next to the users inside the same #ifdef, which avoids the warning. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-15power/reset: versatile: support the actual versatileLinus Walleij
While this driver is named after the Versatile family of boards (ARM reference designs) the machine actually called Versatile was not supported. This patch makes the driver handle also that machine. We augment the register names for the reset to *VERSATILE* as well since it is the same register offsets for Versatile and RealView. Cc: Rob Herring <robh@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-15bq24735_charger: add status property to view/enable/disable chargingPeter Rosin
Add possibility to disable/re-enable charging via sysfs. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-01-14power: bq27xxx_battery: Fix bq27541 AveragePower register addressLiu Xiang
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 <liu.xiang6@zte.com.cn> Acked-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-01-07power: test_power: correctly handle empty writesSasha Levin
Writing 0 length data into test_power makes it access an invalid array location and kill the system. Fixes: f17ef9b2d ("power: Make test_power driver more dynamic.") Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-01-07power: generic-adc-battery: use to_delayed_workGeliang Tang
Use to_delayed_work() instead of open-coding it. Signed-off-by: Geliang Tang <geliangtang@163.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-01-07power: isp1704_charger: Fix isp1704_write() definitionIvaylo Dimitrov
All calls to isp1704_write() are using parameter sequence of isp1704_write(isp, reg, val) but the function is defined as isp1704_write(isp, val, reg). Fix isp1704_write function definition so that the driver to be functional. Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-01-07power: bq27xxx: fix register numbers of bq27500H. Nikolaus Schaller
bug: according to data sheet some register numbers are wrong. tested: no Fixes: d74534c27775 ("power: bq27xxx_battery: Add support for additional bq27xxx family devices") Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Acked-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-01-07power: bq27xxx: fix reading for bq27000 and bq27010H. Nikolaus Schaller
bug: the driver reports funny capacity values: root@letux:/sys/class/power_supply/bq27000-battery# cat uevent POWER_SUPPLY_NAME=bq27000-battery POWER_SUPPLY_STATUS=Charging POWER_SUPPLY_PRESENT=1 POWER_SUPPLY_VOLTAGE_NOW=3702000 POWER_SUPPLY_CURRENT_NOW=-464635 POWER_SUPPLY_CAPACITY=1536 <- over 100% is magic POWER_SUPPLY_CAPACITY_LEVEL=Normal POWER_SUPPLY_TEMP=311 POWER_SUPPLY_TIME_TO_FULL_NOW=10440 POWER_SUPPLY_TECHNOLOGY=Li-ion POWER_SUPPLY_CHARGE_FULL=805450 POWER_SUPPLY_CHARGE_NOW=1068 POWER_SUPPLY_CHARGE_FULL_DESIGN=8844998 <- battery has just 1200 mAh POWER_SUPPLY_CYCLE_COUNT=21 POWER_SUPPLY_ENERGY_NOW=0 POWER_SUPPLY_POWER_AVG=0 POWER_SUPPLY_HEALTH=Good POWER_SUPPLY_MANUFACTURER=Texas Instruments reason: the state of charge and the design capacity register are single byte only. The design capacity returns the higer order byte. tested: GTA04 with Openmoko/FIC HF08x battery (using hdq) Fixes: d74534c27775 ("power: bq27xxx_battery: Add support for additional bq27xxx family devices") Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Acked-by: Andrew F. Davis <afd@ti.com> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-12-08power: Fix unmet dependency on POWER_SUPPLY by POWER_RESET by uncoupling themKrzysztof Kozlowski
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 <p.fedin@samsung.com> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-12-05power: bq27xxx_battery: Reorganize I2C into a moduleAndrew F. Davis
Separate out I2C functionality into a module. This fixes several small issues and simplifies the driver initialization. Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-12-05power: bq27xxx: don't fill system log by missing batteryNeilBrown
Print message that battery is not calibrated only once to avoid spamming the log. Suggested-By: H. Nikolaus Schaller <hns@goldelico.com> Suggested-By: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-12-05power: max8903_charger: set IRQF_ONESHOT if no primary handler is specifiedSaurabh Sengar
If no primary handler is specified for threaded_irq then a default one is assigned which always returns IRQ_WAKE_THREAD. This handler requires the IRQF_ONESHOT, because the source of interrupt is not disabled. Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-12-05power/reset: at91-reset: add missing of_node_putJulia Lawall
for_each_matching_node performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. A simplified version of the semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // <smpl> @@ expression e,e1; local idexpression np; @@ for_each_matching_node(np, e1) { ... when != of_node_put(np) when != e = np ( return np; | + of_node_put(np); ? return ...; ) ... } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-12-05power: ds2782_battery: constify ds278x_battery_ops structureJulia Lawall
The ds278x_battery_ops structure is never modified, so declare it as const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-12-05power: bq2415x_charger: Delete unnecessary checks before the function call ↵Markus Elfring
"of_node_put" The of_node_put() function tests whether its argument is NULL and then returns immediately. Thus the test around the calls is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Acked-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.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>