Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit babef976 authored by Javi Merino's avatar Javi Merino Committed by Kevin Hilman
Browse files

thermal: power_allocator: round the division when divvying up power



In situations where there is an uneven number of cooling devices, the
division of power among them can lead to a milliwatt being dropped on
the floor due to rounding errors.  This doesn't sound like a lot, but
some devices only grant the lowest cooling device state for their
maximum power.  So for instance, if the granted_power is the maximum
power and all devices are getting their maximum power, one would get
max_power - 1, making it choose cooling device state 1, instead of 0.

Round the division to make the calculation more accurate.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: default avatarJavi Merino <javi.merino@arm.com>
Signed-off-by: default avatarEduardo Valentin <edubezval@gmail.com>
(cherry picked from commit ea54cac9065112724f3432e0574ba3e346fd695d)
Signed-off-by: default avatarKevin Hilman <khilman@linaro.org>
parent 22793eb9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment