diff options
Diffstat (limited to 'drivers/edp')
-rw-r--r-- | drivers/edp/psy_depletion.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/edp/psy_depletion.c b/drivers/edp/psy_depletion.c index 2f3755b8d957..5c26caa2fb1e 100644 --- a/drivers/edp/psy_depletion.c +++ b/drivers/edp/psy_depletion.c @@ -111,20 +111,21 @@ static int depl_rbat(struct depl_driver *drv, unsigned int capacity) struct psy_depletion_rbat_lut *q; int rbat; + rbat = drv->pdata->r_const; p = drv->pdata->rbat_lut; + if (!p) + return rbat; while (p->capacity > capacity) p++; if (p == drv->pdata->rbat_lut) - return p->rbat; + return rbat + p->rbat; q = p - 1; - rbat = depl_interpolate(capacity, p->capacity, p->rbat, + rbat += depl_interpolate(capacity, p->capacity, p->rbat, q->capacity, q->rbat); - rbat += drv->pdata->r_const; - return rbat; } |