charger: add gpio request protection for WLS control

For WLS gpio control, if GPIO is requested failed. We should block
the driver. Or if the driver use the gpio that is requested failed, there
will be some unexpected problems.

Change-Id: I8460d64032d673e5fcd32acd135e1f7b65f677d3
Reviewed-on: https://gerrit.mot.com/2239374
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Tested-by: Jira Key
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
weiweij 2022-04-12 11:29:45 +08:00 • committed by Wei Wei
commit 208033c97d
2 changed files with 10 additions and 6 deletions

View file

@ -1416,10 +1416,12 @@ static int bq2589x_parse_dt(struct device *dev, struct bq2589x *bq)
if (gpio_is_valid(bq->wls_en_gpio))
{
ret = gpio_request(bq->wls_en_gpio, "mmi wls en pin");
if (ret)
if (ret) {
dev_err(bq->dev, "%s: %d gpio(wls en) request failed\n", __func__, bq->wls_en_gpio);
else
gpio_direction_output(bq->wls_en_gpio, 0);//default enable wls charge
return ret;
}
gpio_direction_output(bq->wls_en_gpio, 0);//default enable wls charge
}
ret = of_property_read_u32(np, "ti,bq2589x,vbus-volt-high-level", &pe.high_volt_level);

View file

@ -2495,10 +2495,12 @@ static int sgm4154x_parse_dt(struct sgm4154x_device *sgm)
if (gpio_is_valid(sgm->wls_en_gpio))
{
ret = gpio_request(sgm->wls_en_gpio, "mmi wls en pin");
if (ret)
if (ret) {
dev_err(sgm->dev, "%s: %d gpio(wls en) request failed\n", __func__, sgm->wls_en_gpio);
else
gpio_direction_output(sgm->wls_en_gpio, 0);//default enable wls charge
return ret;
}
gpio_direction_output(sgm->wls_en_gpio, 0);//default enable wls charge
}
/* sw jeita */