• Linus Walleij's avatar
    thermal: db8500: Rewrite to be a pure OF sensor · 6c375ecc
    Linus Walleij authored
    This patch rewrites the DB8500 thermal sensor to be a
    pure OF sensor, so that it can be used with thermal zones
    defined in the device tree.
    This driver was initially merged before we had generic
    thermal zone device tree bindings, and now it gets
    modernized to the way we do things these days.
    The old driver depended on a set of trigger points
    provided in the device tree or platform data to
    interpolate the current temperature between trigger
    points depending on whether the trend was rising or
    falling. This was bad because the trigger points should
    be used for defining temperature zone policies and
    bind to cooling devices.
    As the PRCMU (power reset control management unit) can
    only issue IRQs when we pass temperature trigger points
    upward or downward We instead define a number of
    temperature points inside the driver ranging from
    15 to 100 degrees celsius. The effect is that when
    we register the device we quickly trigger 15, 20 ... up
    to the room temperature in succession and then we
    get continous event IRQs also under normal operating
    conditions, and the temperature of the system is now
    reported more accurately (+/- 2.5 degrees celsius)
    while in the past the first trigger point was at 70
    degrees and the average temperature was simply reported
    as 35 degrees celsius (between 70 degrees and 0) until
    we passed 70 degrees which didn't accurately represent
    the temperature of the system.
    As a result of dropping all the trigger points from the
    driver and reusing the core DT thermal zone management
    code we reduce the code footprint quite a bit.
    Cc: Vincent Guittot <vincent.guittot@linaro.org>
    Suggested-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
    Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    Reviewed-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
    Signed-off-by: default avatarEduardo Valentin <edubezval@gmail.com>
db8500_thermal.c 6.44 KB