/* I2C safe register check */ staticinlinebool i2c_safe_reg(unsignedchar reg)
{ switch (reg) { case DA9052_STATUS_A_REG: case DA9052_STATUS_B_REG: case DA9052_STATUS_C_REG: case DA9052_STATUS_D_REG: case DA9052_ADC_RES_L_REG: case DA9052_ADC_RES_H_REG: case DA9052_VDD_RES_REG: case DA9052_ICHG_AV_REG: case DA9052_TBAT_RES_REG: case DA9052_ADCIN4_RES_REG: case DA9052_ADCIN5_RES_REG: case DA9052_ADCIN6_RES_REG: case DA9052_TJUNC_RES_REG: case DA9052_TSI_X_MSB_REG: case DA9052_TSI_Y_MSB_REG: case DA9052_TSI_LSB_REG: case DA9052_TSI_Z_MSB_REG: returntrue; default: returnfalse;
}
}
/* * There is an issue with DA9052 and DA9053_AA/BA/BB PMIC where the PMIC * gets lockup up or fails to respond following a system reset. * This fix is to follow any read or write with a dummy read to a safe * register.
*/ staticint da9052_i2c_fix(struct da9052 *da9052, unsignedchar reg)
{ int val;
switch (da9052->chip_id) { case DA9052: case DA9053_AA: case DA9053_BA: case DA9053_BB: /* A dummy read to a safe register address. */ if (!i2c_safe_reg(reg)) return regmap_read(da9052->regmap,
DA9052_PARK_REGISTER,
&val); break; case DA9053_BC: default: /* * For other chips parking of I2C register * to a safe place is not required.
*/ break;
}
return 0;
}
/* * According to errata item 24, multiwrite mode should be avoided * in order to prevent register data corruption after power-down.
*/ staticint da9052_i2c_disable_multiwrite(struct da9052 *da9052)
{ int reg_val, ret;
ret = regmap_read(da9052->regmap, DA9052_CONTROL_B_REG, ®_val); if (ret < 0) return ret;
if (!(reg_val & DA9052_CONTROL_B_WRITEMODE)) {
reg_val |= DA9052_CONTROL_B_WRITEMODE;
ret = regmap_write(da9052->regmap, DA9052_CONTROL_B_REG,
reg_val); if (ret < 0) return ret;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.