Skip to content

Commit

Permalink
Fix pipa fastcharge problem caused by using float number for VBAT cal…
Browse files Browse the repository at this point in the history
…culation
  • Loading branch information
liyafe1997 committed Oct 22, 2024
1 parent 779ac30 commit ed868ac
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions drivers/power/supply/ti/bq2597x_charger_pipa.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ enum {
ADC_MAX_NUM,
};

static float sc8551_adc_lsb[] = {
static int sc8551_adc_lsb[] = {
[ADC_IBUS] = SC8551_IBUS_ADC_LSB,
[ADC_VBUS] = SC8551_VBUS_ADC_LSB,
[ADC_VAC] = SC8551_VAC_ADC_LSB,
Expand Down Expand Up @@ -1108,10 +1108,8 @@ static int bq2597x_get_adc_data(struct bq2597x *bq, int channel, int *result)
*result = t;
/* vbat need calibration read by NU2105 */
if (channel == ADC_VBAT) {
kernel_neon_begin();
t = t * (1 + 1.803 * 0.001);
t = t * (1 + 1803 / 1000000);
*result = t;
kernel_neon_end();
}
} else {
ret = bq2597x_read_word(bq, ADC_REG_BASE + (channel << 1), &val);
Expand All @@ -1123,9 +1121,7 @@ static int bq2597x_get_adc_data(struct bq2597x *bq, int channel, int *result)
*result = t;

if (bq->chip_vendor == SC8551) {
kernel_neon_begin();
*result = (int)(t * sc8551_adc_lsb[channel]);
kernel_neon_end();
*result = (u64)t * (u64)sc8551_adc_lsb[channel] / 10000000;
}
}

Expand Down

0 comments on commit ed868ac

Please sign in to comment.