power: pm8921-charger: report DC online for some platforms.

Some hardware platforms can supply VPH_PWR without battery
or charger being present.

To avoid shutting down due to no connected power sources
from the perspective of software set a flag that forces
the DC supply to be online for this type of platform.

Signed-off-by: David Keitel <dkeitel@codeaurora.org>
(cherry picked from commit a3cf943ef8c91435e2cb94b8e8bcc482dc65cb27)

Conflicts:

	drivers/power/pm8921-charger.c

Change-Id: I565edb1ab797384481ce5e37aee73ee0a8e80428
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
This commit is contained in:
David Keitel 2012-08-24 15:11:23 -07:00 committed by Stephen Boyd
parent 5ff75f17d8
commit e7fa36ee06
2 changed files with 14 additions and 2 deletions

View file

@ -282,6 +282,7 @@ struct pm8921_chg_chip {
int rconn_mohm;
enum pm8921_chg_led_src_config led_src_config;
bool host_mode;
bool has_dc_supply;
u8 active_path;
int recent_reported_soc;
unsigned int ext_warm_i_limit;
@ -1216,6 +1217,12 @@ static int pm_power_get_property_mains(struct power_supply *psy,
case POWER_SUPPLY_PROP_PRESENT:
case POWER_SUPPLY_PROP_ONLINE:
val->intval = 0;
if (the_chip->has_dc_supply) {
val->intval = 1;
return 0;
}
if (charging_disabled)
return 0;
@ -1737,9 +1744,11 @@ void pm8921_charger_vbus_draw(unsigned int mA)
*/
if (!get_prop_batt_present(the_chip)
&& !is_dc_chg_plugged_in(the_chip)) {
if (!the_chip->has_dc_supply) {
pr_err("rejected: no other power source connected\n");
return;
}
}
if (usb_max_current && mA > usb_max_current) {
pr_warn("restricting usb current to %d instead of %d\n",
@ -4511,6 +4520,7 @@ static int __devinit pm8921_charger_probe(struct platform_device *pdev)
chip->hot_thr = pdata->hot_thr;
chip->rconn_mohm = pdata->rconn_mohm;
chip->led_src_config = pdata->led_src_config;
chip->has_dc_supply = pdata->has_dc_supply;
chip->ext_batt_temp_monitor = pdata->ext_batt_temp_monitor;
chip->eoc_check_soc = pdata->eoc_check_soc;
if (chip->ext_batt_temp_monitor)

View file

@ -94,6 +94,7 @@ enum pm8921_chg_led_src_config {
* however, this should only be enabled for devices which
* control the DC OVP FETs otherwise this option should
* remain disabled
* @has_dc_supply: report DC online if this bit is set in board file
* @trkl_voltage: the trkl voltage in (mV) below which hw controlled
* trkl charging happens with linear charger
* @weak_voltage: the weak voltage (mV) below which hw controlled
@ -145,6 +146,7 @@ struct pm8921_charger_platform_data {
int64_t batt_id_max;
bool keep_btm_on_suspend;
bool dc_unplug_check;
bool has_dc_supply;
int trkl_voltage;
int weak_voltage;
int trkl_current;