drivers/power/bq2429x.c: Add BATIO_OPRTN_SYSON for enabling BATFET after SYSOFF

This commit is contained in:
Jussi Kivilinna 2017-11-08 13:08:54 -06:00 committed by Gregory Nutt
parent c8797dbabc
commit 509d729825
2 changed files with 26 additions and 0 deletions

View File

@ -428,6 +428,27 @@ static int bq2429x_sysoff(FAR struct bq2429x_dev_s *priv)
return ret;
}
/****************************************************************************
* Name: bq2429x_syson
*
* Description:
* Turn the internal battery FET on.
*
****************************************************************************/
static int bq2429x_syson(FAR struct bq2429x_dev_s *priv)
{
int ret;
uint8_t value = 0;
ret = bq2429x_getreg8(priv, BQ2429X_REG07, &value, 1);
batdbg("REG7 read value: 0x%08X\n", value);
value &= ~BQ2429XR7_BATFET_DISABLE;
ret |= bq2429x_putreg8(priv, BQ2429X_REG07, value);
return ret;
}
/****************************************************************************
* Name: bq2429x_en_term
*
@ -1153,6 +1174,10 @@ static int bq2429x_operate(FAR struct battery_charger_dev_s *dev,
ret = bq2429x_sysoff(priv);
break;
case BATIO_OPRTN_SYSON:
ret = bq2429x_syson(priv);
break;
case BATIO_OPRTN_RESET:
ret = bq2429x_reset(priv);
break;

View File

@ -85,6 +85,7 @@ enum batio_operate_e
BATIO_OPRTN_EN_TERM,
BATIO_OPRTN_HIZ,
BATIO_OPRTN_SYSOFF,
BATIO_OPRTN_SYSON,
BATIO_OPRTN_RESET,
BATIO_OPRTN_WDOG,
BATIO_OPRTN_END