summaryrefslogtreecommitdiff
path: root/drivers/power/smb347-charger.c
AgeCommit message (Collapse)AuthorFilesLines
2012-09-21smb347-charger: Fix battery status reporting logic for charger faultsRamakrishna Pallala1-15/+82
This patch checks for charger status register for determining the battery charging status and reports Discharing/Charging/Not Charging/Full accordingly. This patch also adds the interrupt support for Safety Timer Expiration. This interrupt is helpful in debugging the cause for charger fault. Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-06-20smb347-charger: Add constant charge and current propertiesRamakrishna Pallala1-6/+117
This patch makes use of the two new properties in smb347 charger driver. Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-05-19smb347-charger: Include missing <linux/err.h>Mika Westerberg1-0/+1
Without the include we get build errors like: drivers/power/smb347-charger.c: In function 'smb347_probe': drivers/power/smb347-charger.c:1039:2: error: implicit declaration of function 'IS_ERR' [-Werror=implicit-function-declaration] drivers/power/smb347-charger.c:1040:3: error: implicit declaration of function 'PTR_ERR' [-Werror=implicit-function-declaration] Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-05-06smb347-charger: Clean up battery attributesRamakrishna Pallala1-49/+0
CURRENT_NOW and VOLTAGE_NOW should be instantaneous readings from power supply(ex: battery). smb347 charger driver reports charge voltage for VOLTAGE_NOW and charge current for CURRENT_NOW attributes which are not instantaneous readings. This patch removes the battery VOLTAGE_NOW and CURRENT_NOW properties from the driver and also removes hw_to_current() which is not required anymore. Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-05-05smb347-charger: Convert to regmap APIMika Westerberg1-327/+231
The smb347-charger driver does a lot of read-modify-write to the device registers. Instead of open-coding everything we can take advantage of regmap API which provides nice functions to do this kind of things. In addition there is no need for custom debugfs file for dumping registers as this is already provided by the regmap API. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-05-05smb347-charger: Move IRQ enabling to the end of probeMika Westerberg1-4/+2
There is a potential problem if we call smb347_irq_enable() from smb347_irq_init() because smb347_irq_enable() makes the device registers read-only once it returns and smb347_irq_init() expects them to still be read-write. Currently no harm happens because it is the last call we make in smb347_irq_init(). Anyway a better place for enabling IRQs is at the end of probe function and this is also symmetric to call smb347_irq_disable() which is done at the beginning of remove function. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-05-05smb347-charger: Rename few functions to match better what they are doingMika Westerberg1-21/+21
The naming used in the driver for some functions is not very clear what the functions are really doing. To make this a bit easier to understand we rename few functions which were badly named. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-05-05smb347-charger: Convert to use module_i2c_driver()Mika Westerberg1-11/+1
This reduces the amount of boilerplate code in the driver and makes it a bit simpler. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-05-05smb347_charger: Cleanup power supply registration code in probeRamakrishna Pallala1-30/+40
This patch checks if the usb or mains charging is enabled by the platform before registering with the power supply class. Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-03-26Add I2C driver for Summit Microelectronics SMB347 Battery Charger.Bruce E. Robertson1-0/+1294
Driver support for the Summit I²C battery charger. This is used in some Intel devices. Signed-off-by: Bruce E. Robertson <bruce.e.robertson@intel.com> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>