int charger_get_input_current(int *input_current) { int rv; int reg; rv = i2c_read8(I2C_PORT_CHARGER, BQ24773_ADDR, BQ24773_INPUT_CURRENT, ®); if (rv) return rv; *input_current = REG8_TO_CURRENT(reg, R_AC); return EC_SUCCESS; }
int charger_get_input_current(int *input_current) { int rv; int reg; #ifdef CONFIG_CHARGER_BQ24770 rv = raw_read16(REG_INPUT_CURRENT, ®); #elif defined(CONFIG_CHARGER_BQ24773) rv = raw_read8(REG_INPUT_CURRENT, ®); #endif if (rv) return rv; #ifdef CONFIG_CHARGER_BQ24770 *input_current = REG_TO_CURRENT(reg, R_AC); #elif defined(CONFIG_CHARGER_BQ24773) *input_current = REG8_TO_CURRENT(reg, R_AC); #endif return EC_SUCCESS; }