Merge "qcom-charger: WA for legacy bit set on hard reboot"
This commit is contained in:
commit
43c797f34c
3 changed files with 47 additions and 0 deletions
|
@ -1280,6 +1280,13 @@ static int smb2_init_hw(struct smb2 *chip)
|
|||
return rc;
|
||||
}
|
||||
|
||||
rc = smblib_validate_initial_typec_legacy_status(chg);
|
||||
if (rc < 0) {
|
||||
dev_err(chg->dev, "Couldn't validate typec legacy status rc=%d\n",
|
||||
rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <linux/iio/consumer.h>
|
||||
#include <linux/power_supply.h>
|
||||
#include <linux/regulator/driver.h>
|
||||
#include <linux/qpnp/power-on.h>
|
||||
#include <linux/irq.h>
|
||||
#include "smb-lib.h"
|
||||
#include "smb-reg.h"
|
||||
|
@ -3356,3 +3357,40 @@ int smblib_deinit(struct smb_charger *chg)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int smblib_validate_initial_typec_legacy_status(struct smb_charger *chg)
|
||||
{
|
||||
int rc;
|
||||
u8 stat;
|
||||
|
||||
|
||||
if (qpnp_pon_is_warm_reset())
|
||||
return 0;
|
||||
|
||||
rc = smblib_read(chg, TYPE_C_STATUS_5_REG, &stat);
|
||||
if (rc < 0) {
|
||||
smblib_err(chg, "Couldn't read TYPE_C_STATUS_5 rc=%d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if ((stat & TYPEC_LEGACY_CABLE_STATUS_BIT) == 0)
|
||||
return 0;
|
||||
|
||||
rc = smblib_masked_write(chg, TYPE_C_INTRPT_ENB_SOFTWARE_CTRL_REG,
|
||||
TYPEC_DISABLE_CMD_BIT, TYPEC_DISABLE_CMD_BIT);
|
||||
if (rc < 0) {
|
||||
smblib_err(chg, "Couldn't disable typec rc=%d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
usleep_range(150000, 151000);
|
||||
|
||||
rc = smblib_masked_write(chg, TYPE_C_INTRPT_ENB_SOFTWARE_CTRL_REG,
|
||||
TYPEC_DISABLE_CMD_BIT, 0);
|
||||
if (rc < 0) {
|
||||
smblib_err(chg, "Couldn't enable typec rc=%d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -354,6 +354,8 @@ int smblib_set_prop_pd_in_hard_reset(struct smb_charger *chg,
|
|||
int smblib_get_prop_slave_current_now(struct smb_charger *chg,
|
||||
union power_supply_propval *val);
|
||||
|
||||
int smblib_validate_initial_typec_legacy_status(struct smb_charger *chg);
|
||||
|
||||
int smblib_init(struct smb_charger *chg);
|
||||
int smblib_deinit(struct smb_charger *chg);
|
||||
#endif /* __SMB2_CHARGER_H */
|
||||
|
|
Loading…
Add table
Reference in a new issue