summaryrefslogtreecommitdiff
path: root/drivers/power/sbs-battery.c
AgeCommit message (Collapse)Author
2014-02-03power: sbs: fix compilation errorLaxman Dewangan
Fix compilation error: /** sbs-battery.c:959:8: warning: initialization from incompatible pointer type [enabled by default] sbs-battery.c:959:8: warning: (near initialization for 'sbs_pm_ops.resume') [enabled by default] sbs-battery.c:959:8: warning: initialization from incompatible pointer type [enabled by default] sbs-battery.c:959:8: warning: (near initialization for 'sbs_pm_ops.thaw') [enabled by default] sbs-battery.c:959:8: warning: initialization from incompatible pointer type [enabled by default] sbs-battery.c:959:8: warning: (near initialization for 'sbs_pm_ops.restore') [enabled by default] */ Change-Id: I1afccaec7337762d4cf376c58bed9c3f4f7e47a4 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/360086 (cherry picked from commit 2ec66177fd788a21da73cc2b98373781eab1fe06) Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Change-Id: I4f9746dc05216fed337cc062060019fe84d45a5b Reviewed-on: http://git-master/r/362840
2014-01-06power: Add early battery capacity and voltage snapshot recordingdarbha sriharsha
If the battery gauge gets incorrect readings for capacity as 0 even for an instant soon after the kernel bootup, the board will incorrectly shut down reporting low battery though there is sufficient juice in the battery. Hence, if there is even a slight delay in correct battery capacity reporting by fuel gauge due to chip problem or coding error, this can lead to the board incorrectly shutting down as for an instant, the android framework will read the capacity as 0. Hence, adding support for recording an early snapshot value of capacity and voltage values and making these early snapshots available through sysfs entries, so that appropriate sanity tests can examine these values and flag an error if early capacity snapshot value is 0. Bug 1291416 Change-Id: I1be86b23bdc247d7c1bfd8230e433345e026cba8 Signed-off-by: darbha sriharsha <dsriharsha@nvidia.com> Reviewed-on: http://git-master/r/349431 GVS: Gerrit_Virtual_Submit Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
2013-11-28power: sbs-battery: Provide API to enable broadcast modeDarbha Sriharsha
Provide API to enable the broadcast of charging current and charging voltage values to the battery charger chipset Bug 1271064 Change-Id: Id89f42d4787ed27ab576da0fe986e9377a153d97 Signed-off-by: Darbha Sriharsha <dsriharsha@nvidia.com> Reviewed-on: http://git-master/r/333381 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
2013-09-14power: battery-charger: pass driver data part of charger/gauge registrationLaxman Dewangan
Pass the driver specific data as part of battery charger and battery gauge driver registration. This will simplify the registration and avoid the call of set_drvdata() explicitly. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/244172 (cherry picked from commit f43d8265b5da40b3b3392c6a883e29061251b492) Change-Id: Ie3936a2c05d411bc8a302d5dd999390d16eb9fdf Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/253366 Reviewed-by: Automatic_Commit_Validation_User
2013-09-14power: sbs-battery: remove exported API for charger status updateLaxman Dewangan
Battery gauge driver, sbs-battery, have the communication with charger driver through battery-charger-gauge communication framework and so no need to export the API for same purpose. Removing the status_update() API. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/240070 (cherry picked from commit 91447f03fe459dfb74938f316fa89feb651de92f) Change-Id: Ib161f7f8189c44beb8bc42deeafe3ae10d222423 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/253349 Reviewed-by: Automatic_Commit_Validation_User
2013-09-14power: sbs-battery: register for battery gauge driverLaxman Dewangan
Register battery gauge driver to provide callback api for getting charging status whether it is charging or discharging. Based on this status, battery gauge driver report the charging status. bug 1231506 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/238553 (Cherrypicked from 050b09065e02ab678e547916a28c3b225ae75b40) Change-Id: If89fe181b94071c887dc0556532cbedadfde1a87 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/248335 Reviewed-by: Automatic_Commit_Validation_User
2013-09-14power: sbs-battery: add shutdown functionalitySyed Rafiuddin
This change is intended to add the shutdown functionality to the sbs compliant fuel gauge driver Bug 1202296 Change-Id: I337e67c67692f455d7752a02bc86844a0848cedd Signed-off-by: Syed Rafiuddin <srafiuddin@nvidia.com> Signed-off-by: Darbha Sriharsha <dsriharsha@nvidia.com> Reviewed-on: http://git-master/r/194071 (cherry picked from commit 2c1750734efc9ba383e8dd1671a7ea612f34ced2) Reviewed-on: http://git-master/r/192964 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Sang-Hun Lee <sanlee@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
2013-09-14fixup! power: bq20z75: copy pdata to the driver contextDan Willemsen
Signed-off-by: Dan Willemsen <dwillemsen@nvidia.com>
2013-09-14drivers: power: sbs-battery: update battery statusSyed Rafiuddin
Update battery characterstics contineously Bug 1054751 Change-Id: Ia7770f7d388599b321e48b40a5723029dff92e6b Signed-off-by: Syed Rafiuddin <srafiuddin@nvidia.com> Reviewed-on: http://git-master/r/165833 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
2013-09-14drivers: power: tps65090: detect battery from fuel-guageSyed Rafiuddin
detect battery in tps65090 charger driver using bq20z45 fuel-gauge driver. Change-Id: Ic19a8f2459b3fecde2c7cf17b3d02b9e4b71c307 Signed-off-by: Syed Rafiuddin <srafiuddin@nvidia.com> Reviewed-on: http://git-master/r/161649 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> Tested-by: Daniel Solomon <daniels@nvidia.com>
2013-09-14power: bq20z75: copy pdata to the driver contextVarun Wadekar
Generally boards define platform data structs as __initdata. Due to this, it is not available in the driver as a pointer. The driver needs to copy the platform data to its context in order to use it after _probe exits. Change-Id: If6a4944f0f3cbb835e56d915cf5eee34d0de374d Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Rebase-Id: Rfed58f516da3df7672d5db1c4e03bbf67659ff31
2013-09-14bq20z75: check for battery status update on resumePritesh Raithatha
Bug 877456 Change-Id: Ie276daa13feb6702791fab36f7fa88c3811ed3bb Signed-off-by: Pritesh Raithatha <praithatha@nvidia.com> Reviewed-on: http://git-master/r/64030 Reviewed-by: Sachin Nikam <snikam@nvidia.com> Reviewed-by: Mayuresh Kulkarni <mkulkarni@nvidia.com> Rebase-Id: R2a2430d7ae7c1a4262682bd4e537b519d055f98a
2013-03-31sbs-battery: Use dev_pm_opsLars-Peter Clausen
Use dev_pm_ops instead of the deprecated legacy suspend/resume callbacks. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Rhyland Klein <rklein@nvidia.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-03-31sbs-battery: Use of_match_ptr() macroSachin Kamat
This eliminates having an #ifdef returning NULL for the case when OF is disabled. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2012-11-28power: remove use of __devexitBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Anton Vorontsov <cbou@mail.ru> Cc: David Woodhouse <dwmw2@infradead.org> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28power: remove use of __devinitBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Anton Vorontsov <cbou@mail.ru> Cc: David Woodhouse <dwmw2@infradead.org> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28power: remove use of __devexit_pBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Anton Vorontsov <cbou@mail.ru> Cc: David Woodhouse <dwmw2@infradead.org> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-20sbs-battery: Probe should try talking to the deviceOlof Johansson
Turns out this driver doesn't actually try talking to the device at probe time, so if it's incorrectly configured in the device tree or platform data (or if the battery has been removed from the system), then probe will succeed and every access will sit there and time out. The end result is a possibly laggy system that thinks it has a battery but can never read status, which isn't very useful. Instead, just read any register (I chose status) at probe, and if that fails, don't register the device. Signed-off-by: Olof Johansson <olof@lixom.net> Acked-by: Rhyland Klein <rklein@nvidia.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-06-19sbs-battery: Don't trigger false supply_changed eventNikolaus Voss
power_supply_changed() events are triggerd based on the return value of a get_property() call. However the property TECHNOLOGY is hard-coded to LION in this driver, thus always succeeds. So, with the battery removed, this triggers a false battery present uevent. This uevent triggers a new query via power_supply_uevent() which again starts to query all known properties and thus leads to an infinite loop of battery present/not-present uevents. This patch skips the battery presence detection for the hard-coded property TECHNOLOGY. Signed-off-by: Nikolaus Voss <n.voss@weinmann.de> Acked-by Rhyland Klein <rklein@nvidia.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-05-05sbs-battery.c: Capacity attr = remaining relative capacityNikolaus Voss
Currently, the capacity exported by this driver refers to reg 0x0e, which is the absolute state of charge which according to SBS refers to the design capacity/ energy of the battery. It can be > 100 % and drops below 100 % for a fully charged battery with the battery aging. This is not what the user exspects of a remaining capacity indication between 0 and 100 % with 100 % referring to a fully charged battery. This is provided by SBS reg 0x0d, which is the relative state of charge referring to the full charge capacity. Signed-off-by: Nikolaus Voss <n.voss@weinmann.de> Acked-by: Rhyland Klein <rklein@nvidia.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-03-26power_supply: Convert i2c drivers to module_i2c_driverAxel Lin
Factor out some boilerplate code for i2c driver registration into module_i2c_driver. Signed-off-by: Axel Lin <axel.lin@gmail.com> Cc: Woogyom Kim <milo.kim@ti.com> Cc: Daniel Jeong <daniel.jeong@ti.com> Cc: Minkyu Kang <mk7.kang@samsung.com> Cc: Peter Edwards <sweetlilmre@gmail.com> Acked-by: Milo(Woogyom) Kim <milo.kim@ti.com> Acked-by: Rhyland Klein <rklein@nvidia.com> Acked-by: Ryan Mallon <rmallon@gmail.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-01-06sbs-battery: Fix devicetree match tableOlof Johansson
It should be an of module table, not i2c. Signed-off-by: Olof Johansson <olof@lixom.net> Acked-by: Rhyland Klein <rklein@nvidia.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-06sbs-battery: Change power supply nameRhyland Klein
The power supply name used to be fixed as "battery". This change allows for multiple batteries by generating the name rather than using a fixed value. Signed-off-by: Rhyland Klein <rklein@nvidia.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-06sbs-battery: Rename internals to new nameRhyland Klein
Now that this driver is named more generally, this change updates the internal variables, defines and functions to use this new name. Signed-off-by: Rhyland Klein <rklein@nvidia.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-06bq20z75: Rename to sbs-batteryRhyland Klein
This driver for the bq20z75 implemented the register spec defined by the SBS standard. As this is not unique to this the TI part this was originally written for, we can generalize this driver to show its support for any SBS compliant battery. Signed-off-by: Rhyland Klein <rklein@nvidia.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>