power: supply: sc8886: stop probe when battery was no found

SC8886 will shutdown the output off in these cases
when battery was removed:
1. INPUT CRRENT is set to 0. In Battery system, battery
would take over system supply, but in no battery system,
it would restart due to system poweroff.

2. VBat is higher than VSysmin, sc8886 would switch
system supply to VBat, But in no battery system, there
is just a capacitance, the voltage of capacitance would
be pull down quickly when supply switch and it make
system restart.

Signed-off-by: Zain Wang <wzz@rock-chips.com>
Change-Id: I0398d55d511254821744c4e7d4448ef4605af509
This commit is contained in:
Zain Wang 2022-05-16 14:49:47 +08:00 committed by Tao Huang
parent 84d26633c7
commit cd340ba466

View File

@ -2014,6 +2014,20 @@ static int bq25700_probe(struct i2c_client *client,
return -ENODEV;
}
/*
* Make sure battery online, otherwise, writing INPUT_CURRENT and
* CHARGE_CURRENT would make system power off
*/
if (of_parse_phandle(charger->dev->of_node, "ti,battery", 0)) {
if (IS_ERR_OR_NULL(power_supply_get_by_phandle(
charger->dev->of_node,
"ti,battery"))) {
dev_info(charger->dev, "No battery found\n");
return -EPROBE_DEFER;
}
dev_info(charger->dev, "Battery found\n");
}
ret = bq25700_hw_init(charger);
if (ret < 0) {
dev_err(dev, "Cannot initialize the chip.\n");