summaryrefslogtreecommitdiffstats
path: root/drivers/power
Commit message (Collapse)AuthorAgeFilesLines
* power_supply: charger-manager: Use power_supply_*() API for accessing ↵Krzysztof Kozlowski2015-03-131-17/+20
| | | | | | | | | | | | | | | | function attrs Replace direct calls to power supply function attributes with wrappers. Wrappers provide safe access in case of unregistering the power supply (e.g. by removing the driver). Replace: - get_property -> power_supply_get_property Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Acked-by: Pavel Machek <pavel@ucw.cz> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power_supply: bq2415x_charger: Use power_supply_*() API for accessing ↵Krzysztof Kozlowski2015-03-131-1/+2
| | | | | | | | | | | | | | | | function attrs Replace direct calls to power supply function attributes with wrappers. Wrappers provide safe access in case of unregistering the power supply (e.g. by removing the driver). Replace: - get_property -> power_supply_get_property Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Acked-by: Pavel Machek <pavel@ucw.cz> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power_supply: apm_power: Use power_supply_*() API for accessing function attrsKrzysztof Kozlowski2015-03-131-2/+2
| | | | | | | | | | | | | | Replace direct calls to power supply function attributes with wrappers. Wrappers provide safe access in case of unregistering the power supply (e.g. by removing the driver). Replace: - get_property -> power_supply_get_property Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Acked-by: Pavel Machek <pavel@ucw.cz> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power_supply: ab8500: Use power_supply_*() API for accessing function attrsKrzysztof Kozlowski2015-03-134-5/+5
| | | | | | | | | | | | | | | Replace direct calls to power supply function attributes with wrappers. Wrappers provide safe access in case of unregistering the power supply (e.g. by removing the driver). Replace: - get_property -> power_supply_get_property Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Acked-by: Pavel Machek <pavel@ucw.cz> Acked-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power_supply: 88pm860x_charger: Use power_supply_*() API for accessing ↵Krzysztof Kozlowski2015-03-131-5/+8
| | | | | | | | | | | | | | | | | function attrs Replace direct calls to power supply function attributes with wrappers. Wrappers provide safe access in case of unregistering the power supply (e.g. by removing the driver). Replace: - get_property -> power_supply_get_property - set_property -> power_supply_set_property Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Acked-by: Pavel Machek <pavel@ucw.cz> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power_supply: sysfs: Use power_supply_*() API for accessing function attrsKrzysztof Kozlowski2015-03-131-3/+3
| | | | | | | | | | | | | | | | Replace direct calls to power supply function attributes with wrappers. Wrappers provide safe access in case of unregistering the power supply (e.g. by removing the driver). Replace: - get_property -> power_supply_get_property - set_property -> power_supply_set_property - property_is_writeable -> power_supply_property_is_writeable Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Acked-by: Pavel Machek <pavel@ucw.cz> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power_supply: Add API for safe access of power supply function attrsKrzysztof Kozlowski2015-03-131-1/+46
| | | | | | | | | | | | | | | | | | | | | | Add simple wrappers for accessing power supply's function attributes: - get_property -> power_supply_get_property - set_property -> power_supply_set_property - property_is_writeable -> power_supply_property_is_writeable - external_power_changed -> power_supply_external_power_changed This API along with atomic usage counter adds a safe way of accessing a power supply from another driver. If power supply is unregistered after obtaining reference to it by some driver, then the API wrappers won't be executed in invalid (freed) context. Next patch changing the ownership of power supply class is still needed to fully fix race conditions in accessing freed power supply. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Sebastian Reichel <sre@kernel.org> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power_supply: Move run-time configuration to separate structureKrzysztof Kozlowski2015-03-1359-150/+190
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add new structure 'power_supply_config' for holding run-time initialization data like of_node, supplies and private driver data. The power_supply_register() function is changed so all power supply drivers need updating. When registering the power supply this new 'power_supply_config' should be used instead of directly initializing 'struct power_supply'. This allows changing the ownership of power_supply structure from driver to the power supply core in next patches. When a driver does not use of_node or supplies then it should use NULL as config. If driver uses of_node or supplies then it should allocate config on stack and initialize it with proper values. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Pavel Machek <pavel@ucw.cz> [for the nvec part] Reviewed-by: Marc Dietrich <marvin24@gmx.de> [for drivers/platform/x86/compal-laptop.c] Reviewed-by: Darren Hart <dvhart@linux.intel.com> [for drivers/hid/*] Reviewed-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power_supply: Add driver private dataKrzysztof Kozlowski2015-03-131-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | Allow drivers to store private data inside power_supply structure for later usage in power supply operations. Usage of driver private data is necessary to access driver's state container object from power supply calls (like get_property()) if struct 'power_supply' is a stored there as a pointer, for example: struct some_driver_info { struct i2c_client *client; struct power_supply *power_supply; ... } In such case one cannot use container_of() and must store pointer to state container as private data. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Sebastian Reichel <sre@kernel.org> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power: generic-adc-battery: Fix power_supply_property returned valueNicolas Saenz Julienne2015-03-091-1/+1
| | | | | | | | The POWER_SUPPLY_PROP_STATUS case in gab_get_property() wasn't providing any value. Signed-off-by: Nicolas Saenz Julienne <nicolassaenzj@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* ab8500_fg.c: only request threaded IRQs when necessaryValentin Rothberg2015-03-071-13/+33
| | | | | | | | | | | | | | | All 5 IRQ handlers of the driver are requested as threaded interrupt handlers. However, only 1 handler can block. The remaining 4 handlers defer the actual handling to a workqueue. Hence, 4 of 5 IRQ handlers have a considerable overhead, since they are executed in a kernel thread to schedule another kernel thread (workqueue). This change splits up the 5 interrupt handlers into top halves (_th) and bottom halves (_bh) and resolves the aforementioned overhead by only requesting threaded interrupts (i.e., bottom halves) when necessary. Signed-off-by: Valentin Rothberg <Valentin.Rothberg@lip6.fr> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* X-Power AXP288 PMIC Fuel Gauge DriverTodd Brandt2015-03-073-0/+1161
| | | | | | | | | | New power_supply driver at driver/power which interfaces with the axp20x mfd driver as a cell. Provides battery info, monitors for changes, and generates alerts on temperature and capacity issues Signed-off-by: Todd Brandt <todd.e.brandt@linux.intel.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* bq2415x_charger: Add support for bq24157sAnda-Maria Nicolae2015-03-071-0/+8
| | | | | | | | | | This patch adds bq24157s charger in the list of supported chargers. bq24157s is similar to bq24158, except for Bit6 from Special Charger Voltage/Enable Pin Status register, but this register is currently not used by bq2415x_charger. Signed-off-by: Anda-Maria Nicolae <anda-maria.nicolae@intel.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* bq2415x_charger: Remove unnecessary else after returnAnda-Maria Nicolae2015-03-071-16/+8
| | | | | | | Fix coding style to comply with checkpatch.pl Signed-off-by: Anda-Maria Nicolae <anda-maria.nicolae@intel.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power/smb347-charger.c: set IRQF_ONESHOT flag to ensure IRQ requestValentin Rothberg2015-03-021-1/+2
| | | | | | | | | | | Since commit 1c6c69525b40eb76de8adf039409722015927dc3 ("genirq: Reject bogus threaded irq requests") threaded IRQs without a primary handler need to be requested with IRQF_ONESHOT, otherwise the request may fail. Generated by: scripts/coccinelle/misc/irqf_oneshot.cocci Signed-off-by: Valentin Rothberg <Valentin.Rothberg@lip6.fr> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power: bq27x00_battery: add bq27510 supportAlexandre Belloni2015-02-281-5/+45
| | | | | | | Add support for bq27510 to the bq27x00 driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power_supply core: support use of devres to register/unregister a power supply.NeilBrown2015-02-261-0/+45
| | | | | | | | Using devm_power_supply_register allows the unregister to happen automatically on error or final put. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* bq2415x_charger, bq27x00_battery.c: comment cleanupsPavel Machek2015-02-252-10/+1
| | | | | | | Cleanup comments for bq2415x_charger, bq27x00_battery.c. Signed-off-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* ab8500_fg: use jiffies_to_msecs for jiffies conversionNicholas Mc Guire2015-02-251-2/+2
| | | | | | | | | | Converting jiffies to milliseconds by "val * 1000 / HZ" is technically OK but jiffies_to_msecs(val) is the cleaner solution and handles all corner cases correctly. This is a minor API consolidation only and should make things more readable. Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* ab8500_fg: match return type of wait_for_completion_timeoutNicholas Mc Guire2015-02-251-2/+2
| | | | | | | | | return type of wait_for_completion_timeout is unsigned long not int. as timeout is used for wait_for_completion_timeout exclusively here its type is simply changed to unsigned long. Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power_supply: ab8500_fg: Simplify creation and removal of sysfs entriesKrzysztof Kozlowski2015-02-251-18/+11
| | | | | | | | | | | | | | | Simplify a little ab8500_fg_sysfs_psy_create_attrs () and ab8500_fg_sysfs_psy_remove_attrs() functions because they received pointer to power supply device which was then converted into power supply instance. Then it was converted into struct ab8500_fg. The path looked like: ab8500_fg->psy.dev -> psy -> ab8500_fg Instead just pass pointer to struct ab8500_fg directly so all conversions won't be necessary. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* Merge branch 'fixes' into nextSebastian Reichel2015-02-253-5/+28
|\
| * power_supply: lp8788-charger: Fix leaked power supply on probe failKrzysztof Kozlowski2015-02-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | Driver forgot to unregister charger power supply if registering of battery supply failed in probe(). In such case the memory associated with power supply leaked. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Fixes: 98a276649358 ("power_supply: Add new lp8788 charger driver") Cc: <stable@vger.kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power_supply: ipaq_micro_battery: Check return values in probeKrzysztof Kozlowski2015-02-251-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The return values of create_singlethread_workqueue() and power_supply_register() calls were not checked and even on error probe() function returned 0. 1. If allocation of workqueue failed (returning NULL) then further accesses could lead to NULL pointer dereference. The queue_delayed_work() expects workqueue to be non-NULL. 2. If registration of power supply failed then during unbind the driver tried to unregister power supply which was not actually registered. This could lead to memory corruption because power_supply_unregister() unconditionally cleans up given power supply. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Fixes: 00a588f9d27f ("power: add driver for battery reading on iPaq h3xxx") Cc: <stable@vger.kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power_supply: ipaq_micro_battery: Fix leaking workqueueKrzysztof Kozlowski2015-02-251-0/+1
| | | | | | | | | | | | | | | | | | | | Driver allocates singlethread workqueue in probe but it is not destroyed during removal. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Fixes: 00a588f9d27f ("power: add driver for battery reading on iPaq h3xxx") Cc: <stable@vger.kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power_supply: twl4030_madc: Check return value of power_supply_registerKrzysztof Kozlowski2015-02-251-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The return value of power_supply_register() call was not checked and even on error probe() function returned 0. If registering failed then during unbind the driver tried to unregister power supply which was not actually registered. This could lead to memory corruption because power_supply_unregister() unconditionally cleans up given power supply. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Fixes: da0a00ebc239 ("power: Add twl4030_madc battery driver.") Cc: <stable@vger.kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power: ltc2941-battery-gauge: Fix typo in conversion formula (58 instead of 85)Mike Looijmans2015-02-251-1/+1
| | | | | | | | | | | | | | | | The driver reported 30% less than actually measured. This turned out to be caused by a simple typo in the formula to calculate the LSB quantity. Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* | power_supply: max17042: Use regmap_update_bits instead read and writeKrzysztof Kozlowski2015-02-251-6/+4
| | | | | | | | | | | | | | | | | | | | | | Consolidate regmap_read() and regmap_write() into one regmap_update_bits() call. This is more readable and safer because regmap's mutex will prevent any concurrent access to modified registers (the concurrent access could happen through max17042_init_chip() in scheduled work). Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* | power_supply: max17040: Use system efficient workqueuesKrzysztof Kozlowski2015-02-251-3/+6
| | | | | | | | | | | | | | | | | | The scheduled work in max17040_battery driver reads device parameters and stores them in memory. Any CPU could do that so use system efficient workqueues to limit unnecessary CPU wake ups. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* | power_supply: max14577: Properly handle error conditionsKrzysztof Kozlowski2015-02-251-36/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Re-work and fix handling of errors when retrieving power supply properties: 1. Return errno values directly from get_property() instead of storing 'unknown' as intval for given property. 2. Handle regmap_read() errors and return errno code. Previously the regmap_read() return code was ignored so an uninitialized value from the stack could be used for calculating the property. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* | power_supply: max14577: Don't store charging and battery states for laterKrzysztof Kozlowski2015-02-251-5/+0
| | | | | | | | | | | | | | | | Remove caching of charging and battery states in driver's state container because the cached value was not used later. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* | power_supply: max77693: Properly handle error conditionsKrzysztof Kozlowski2015-02-251-44/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Re-work and fix handling of errors when retrieving power supply properties: 1. Return errno values directly from get_property() instead of storing 'unknown' as intval for given property. 2. Handle regmap_read() errors when getting 'online' and 'present' proprties and return errno code. Previously the regmap_read() return code was ignored so an uninitialized value from the stack could be used for calculating the property. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* | power: Use subdir-ccflags-* to inherit debug flagGeert Uytterhoeven2015-02-251-1/+1
| | | | | | | | | | | | | | | | Use subdir-ccflags-* instead of ccflags-* to inherit the debug settings from Kconfig when traversing subdirectories. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* | bq27x00_battery: register as non-wakeup power supply.NeilBrown2015-02-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | power_supply status changes for the bq27x00 are only noticed via polling, not via interrupts. So they are never the source of events which should reliably wake the system from suspend. So it is appropriate to register as a no_ws power source, just like the ACPI battery. This removes some debugging messages which occasionally confusingly identify bq27x00 as a wakeup source. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* | power_supply: rt5033: Constify struct regmap_configKrzysztof Kozlowski2015-02-251-1/+1
| | | | | | | | | | | | | | | | The regmap_config struct may be const because it is not modified by the driver and regmap_init() accepts pointer to const. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* | power: Add support for DA9150 ChargerAdam Thomson2015-02-253-0/+701
| | | | | | | | | | | | | | This patch adds support for DA9150 Charger & Fuel-Gauge IC Charger. Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* | power: ltc2941-battery-gauge: Fix typo in conversion formula (58 instead of 85)Mike Looijmans2015-02-251-1/+1
|/ | | | | | | | The driver reported 30% less than actually measured. This turned out to be caused by a simple typo in the formula to calculate the LSB quantity. Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power_supply: 88pm860x: Fix leaked power supply on probe failKrzysztof Kozlowski2015-01-281-0/+1
| | | | | | | | | | | Driver forgot to unregister power supply if request_threaded_irq() failed in probe(). In such case the memory associated with power supply leaked. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Fixes: a830d28b48bf ("power_supply: Enable battery-charger for 88pm860x") Cc: <stable@vger.kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power/reset: restart-poweroff: Remove arm dependenciesGuenter Roeck2015-01-252-2/+0
| | | | | | | | | This driver is now arm specific anymore, so there is no need to include an arm specific include file. Also drop unnecessary depencency on ARM from Kconfig. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power/reset: st-poweroff: Fix misleading Kconfig descriptionGuenter Roeck2015-01-251-2/+2
| | | | | | | | | The st-poweroff driver does not really power off the system but resets it, so Kconfig should not claim that the driver would handle power-off. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power/reset: st-poweroff: Register with kernel restart handlerGuenter Roeck2015-01-251-6/+11
| | | | | | | | | Register with kernel restart handler instead of setting arm_pm_restart directly. Select high priority since the restart handler is instantiated through devicetree, indicating that it should be used if configured. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power/reset: Remove sun6i reboot driverGuenter Roeck2015-01-253-92/+0
| | | | | | | | | sun6i restart is now handled by its watchdog driver directly, so this driver is no longer needed. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power/reset: at91: Register with kernel restart handlerGuenter Roeck2015-01-251-10/+18
| | | | | | | | | Register with kernel restart handler instead of setting arm_pm_restart directly. Register with high priority since the driver unconditionally overwrites other restart handlers if instantiated. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power/reset: arm-versatile: Register with kernel restart handlerGuenter Roeck2015-01-251-3/+14
| | | | | | | | | Register with kernel restart handler instead of setting arm_pm_restart directly. Select high priority since the restart handler is instantiated through devicetree, indicating that it should be used if configured. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power: test_power: Use enum as index for array of suppliesKrzysztof Kozlowski2015-01-231-11/+22
| | | | | | | | | Replace hard-coded numbers for indices of power supply array with enum. This improves a little the readability as one does not have to guess which power supply is associated with number. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* Add LTC2941/LTC2943 Battery Gauge DriverMike Looijmans2015-01-223-0/+556
| | | | | | | | | | | | | | | | | | | | Both the LTC2941 and LTC2943 measure battery capacity. The LTC2943 is compatible with the LTC2941, it adds voltage and temperature monitoring, and uses a slightly different conversion formula for the charge counter. To avoid confusion with e.g. the LTC2945, the driver is called LTC2941 instead of LTC294X. v2: Fix units of measurement: uV, uA and centidegrees. v3: Correctly set configuration register. Allow negative values for the sense resistor. v4: Run checkpatch.pl and fix all errors and warnings. v5: Prefix "lltc," to devicetree properties. Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl> [ removed .owner field ] Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power/reset: brcmstb: Add support for old 65nm chipsKevin Cernekee2015-01-221-0/+6
| | | | | | | | The register bit fields are a little different, so add an entry and a compatible string to accommodate them. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power/reset: brcmstb: Use the DT "compatible" string to indicate bit positionsKevin Cernekee2015-01-221-7/+28
| | | | | | | | | Some of the older chips used different bits to arm and trigger the reset. Add the infrastructure needed to specify this through the "compatible" string. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power/reset: brcmstb: Make the driver buildable on MIPSKevin Cernekee2015-01-221-5/+4
| | | | | | | | Now that the driver doesn't use any ARM-specific headers, it is safe to build on MIPS or with COMPILE_TEST. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power: charger-manager: Use alarmtimer for battery monitoring in suspend.Jonghwa Lee2015-01-212-208/+83
| | | | | | | | | | | | To guerantee proper charing and managing batteries even in suspend, charger-manager has used rtc device with rtc framework interface. However, it is better to use alarmtimer for cleaner and more appropriate operation. This patch makes driver to use alarmtimer for polling work in suspend and removes all deprecated codes related with using rtc interface. Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>