aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRask Ingemann Lambertsen <rask@sygehus.dk>2009-02-08 16:49:18 +0000
committerAndy Green <agreen@octopus.localdomain>2009-02-08 16:49:18 +0000
commit498d0953423a504cd24d11a0307e0ec01b81b68d (patch)
treeb25cfa206e2ed96ff46e74ad3ed08dfab06cb74a /drivers
parent9dbeaa31ed639d1481cb6a3f2080420eb267e0cd (diff)
power: pcf50633 wall charger current limit fix
Hi. The recent patch to fix a USB current limit violation when turning the device off triggered a bug in setting the battery charge current limit. We now get a charge current limit of 0 mA on the GTA02 when plugging in the wall charger (just as when setting 1000 mA in /sys/class/[...]/chg_curlim). This patch fixes it (and a comment typo). Tested on a GTA02 with a wall charger. Signed-off-by: Rask Ingemann Lambertsen <rask@sygehus.dk>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/power/pcf50633-charger.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/power/pcf50633-charger.c b/drivers/power/pcf50633-charger.c
index d20a7178329..92cbd25033c 100644
--- a/drivers/power/pcf50633-charger.c
+++ b/drivers/power/pcf50633-charger.c
@@ -48,7 +48,7 @@ int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma)
u8 bits;
int charging_start = 1;
u8 mbcs2, chgmod;
- u8 mbcc5;
+ unsigned int mbcc5;
if (ma >= 1000) {
bits = PCF50633_MBCC7_USB_1000mA;
@@ -76,7 +76,7 @@ int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma)
* We limit the charging current to be the USB current limit.
* The reason is that on pcf50633, when it enters PMU Standby mode,
* which it does when the device goes "off", the USB current limit
- * reverts to the variant default. It at least one common case, that
+ * reverts to the variant default. In at least one common case, that
* default is 500mA. By setting the charging current to be the same
* as the USB limit we set here before PMU standby, we enforce it only
* using the correct amount of current even when the USB current limit
@@ -84,6 +84,8 @@ int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma)
*/
mbcc5 = (ma << 8) / mbc->pcf->pdata->chg_ref_current_ma;
+ if (mbcc5 > 255)
+ mbcc5 = 255;
pcf50633_reg_write(mbc->pcf, PCF50633_REG_MBCC5, mbcc5);
mbcs2 = pcf50633_reg_read(pcf, PCF50633_REG_MBCS2);
@@ -192,7 +194,7 @@ static ssize_t set_chglim(struct device *dev,
{
struct pcf50633_mbc *mbc = dev_get_drvdata(dev);
unsigned long ma;
- u8 mbcc5;
+ unsigned int mbcc5;
int ret;
ret = strict_strtoul(buf, 10, &ma);
@@ -200,6 +202,8 @@ static ssize_t set_chglim(struct device *dev,
return -EINVAL;
mbcc5 = (ma << 8) / mbc->pcf->pdata->chg_ref_current_ma;
+ if (mbcc5 > 255)
+ mbcc5 = 255;
pcf50633_reg_write(mbc->pcf, PCF50633_REG_MBCC5, mbcc5);
return count;