dect
/
linux-2.6
Archived
13
0
Fork 0

In part2:

- A small patch for the RX51 OMAP board (Nokia N900 phone), the patch
   creates a battery monitor device instance, so that it can be probed. It
   was acked by the OMAP maintainer;
 
 - A couple of late bug fixes for the charger-manager: corrects corner
   cases for the battery full handling.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iQIcBAABAgAGBQJQ0P/CAAoJEGgI9fZJve1b1FQP/2EmdDqZ/RLtiDskid4JC8sQ
 NZMGaqhtXzdr4Duukrt7mvmZR0i3mJcSiGMDonsJFPoUXK6Zwr4eWpdL71Ehn7Sh
 0X6ul2iipqUi1g78mpFE8BwwTyzKxsL/+Njj25s/VuBrOYfA+xF44AgDG90/YpUf
 xRwNGsLAESpKCxsT4NKoPSCg6T6SfprPlyECdtt4hWCetntVezc6TON14JU/E2OS
 5Bq07TWKAN/F9a4QIiYDaykTf4NrERwqHnmgA6kHG/Bf0q61ON91UCI4o+UVIGMe
 v3Rc52pZPbqsatOd/t5ujPwBiQwy1+70mMeuYmdw9oJHScAG2+KFKns4dw3zaiIE
 9rpyo3T2E1tiu1/Ny71hiBAqOG5Wuh6USQ02PyUXKnMaZ1Owcr47MfOMoY8LZLV1
 knAfduMi/jpHva3UBRvnShbZMelM5AJk2ctLq/lH8JxljYjh4jcsWNGm++1rLmOr
 jvRpqso4IJxhAoe2i23p7lalsAemwnfR2PfiP3PH/77jJISZrhXZs2e4DwR0N/KM
 pBvfS8DEp2xEcg/0OUXU5O90J6DBaVL0N8fntn9HW8VHf1o/6ETr46b562hAt9s8
 Mp/uPK/FMpMz+a8jsactUGsn2HVuYYDTIQqRW3AeUoaT6hXrYJEdd2iPCZCh1OBF
 KmpjWS3ZDeDTBMpfgZRk
 =hppb
 -----END PGP SIGNATURE-----

Merge tag 'for-v3.8-part2' of git://git.infradead.org/battery-2.6

Pull battery update, part 2, from Anton Vorontsov:
 "These are left overs that I didn't have time to review/apply before
  the merge window opened.  I didn't want to "spoil" the first pull
  request with these late patches, so they were not included:

   - A small patch for the RX51 OMAP board (Nokia N900 phone), the patch
     creates a battery monitor device instance, so that it can be
     probed.  It was acked by the OMAP maintainer;

   - A couple of late bug fixes for the charger-manager: corrects corner
     cases for the battery full handling."

* tag 'for-v3.8-part2' of git://git.infradead.org/battery-2.6:
  charger-manager: Fix bug when check dropped voltage after fullbatt event
  charger-manager: Fix bug related to checking fully charged state of battery
  ARM: OMAP: rx51: Register platform device for rx51_battery
This commit is contained in:
Linus Torvalds 2012-12-19 08:14:08 -08:00
commit 5031a2a7c1
2 changed files with 22 additions and 22 deletions

View File

@ -256,6 +256,11 @@ static struct spi_board_info rx51_peripherals_spi_board_info[] __initdata = {
},
};
static struct platform_device rx51_battery_device = {
.name = "rx51-battery",
.id = -1,
};
static void rx51_charger_set_power(bool on)
{
gpio_set_value(RX51_USB_TRANSCEIVER_RST_GPIO, on);
@ -277,6 +282,7 @@ static void __init rx51_charger_init(void)
WARN_ON(gpio_request_one(RX51_USB_TRANSCEIVER_RST_GPIO,
GPIOF_OUT_INIT_HIGH, "isp1704_reset"));
platform_device_register(&rx51_battery_device);
platform_device_register(&rx51_charger_device);
}

View File

@ -239,44 +239,37 @@ static bool is_full_charged(struct charger_manager *cm)
int uV;
/* If there is no battery, it cannot be charged */
if (!is_batt_present(cm)) {
val.intval = 0;
goto out;
}
if (!is_batt_present(cm))
return false;
if (cm->fuel_gauge && desc->fullbatt_full_capacity > 0) {
val.intval = 0;
/* Not full if capacity of fuel gauge isn't full */
ret = cm->fuel_gauge->get_property(cm->fuel_gauge,
POWER_SUPPLY_PROP_CHARGE_FULL, &val);
if (!ret && val.intval > desc->fullbatt_full_capacity) {
val.intval = 1;
goto out;
}
if (!ret && val.intval > desc->fullbatt_full_capacity)
return true;
}
/* Full, if it's over the fullbatt voltage */
if (desc->fullbatt_uV > 0) {
ret = get_batt_uV(cm, &uV);
if (!ret && uV >= desc->fullbatt_uV) {
val.intval = 1;
goto out;
}
if (!ret && uV >= desc->fullbatt_uV)
return true;
}
/* Full, if the capacity is more than fullbatt_soc */
if (cm->fuel_gauge && desc->fullbatt_soc > 0) {
val.intval = 0;
ret = cm->fuel_gauge->get_property(cm->fuel_gauge,
POWER_SUPPLY_PROP_CAPACITY, &val);
if (!ret && val.intval >= desc->fullbatt_soc) {
val.intval = 1;
goto out;
}
if (!ret && val.intval >= desc->fullbatt_soc)
return true;
}
val.intval = 0;
out:
return val.intval ? true : false;
return false;
}
/**
@ -489,8 +482,9 @@ static void fullbatt_vchk(struct work_struct *work)
return;
}
diff = desc->fullbatt_uV;
diff -= batt_uV;
diff = desc->fullbatt_uV - batt_uV;
if (diff < 0)
return;
dev_info(cm->dev, "VBATT dropped %duV after full-batt.\n", diff);