diff options
author | Sivaram Nair <sivaramn@nvidia.com> | 2013-05-29 20:50:29 +0300 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2013-09-14 13:16:47 -0700 |
commit | 0da709ee9988435b4104898e94d65708404d4458 (patch) | |
tree | 4f210b5f4d000d2a443fe66d09bd4b1f9be07edc /drivers/edp | |
parent | dec6a353512309e7059389827f878cf10afa4dd1 (diff) |
EDP: psy depletion: allow null rbat lut
For boards that do not specify an rbat lut, use the r_const as the
RBAT.
Change-Id: Ica8045c65fed34b48f2b89a5be4bc1435320924f
Signed-off-by: Sivaram Nair <sivaramn@nvidia.com>
Reviewed-on: http://git-master/r/233805
(cherry picked from commit 43e96b352cdfb1438edc326da0ac4ae05e14c03e)
Reviewed-on: http://git-master/r/234945
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
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; } |