• Rafael J. Wysocki's avatar
    thermal/of: Use the .should_bind() thermal zone callback · 94c6110b
    Rafael J. Wysocki authored
    Make the thermal_of driver use the .should_bind() thermal zone callback
    to provide the thermal core with the information on whether or not to
    bind the given cooling device to the given trip point in the given
    thermal zone.  If it returns 'true', the thermal core will bind the
    cooling device to the trip and the corresponding unbinding will be
    taken care of automatically by the core on the removal of the involved
    thermal zone or cooling device.
    
    This replaces the .bind() and .unbind() thermal zone callbacks which
    assumed the same trip points ordering in the driver and in the thermal
    core (that may not be true any more in the future).  The .bind()
    callback would walk the given thermal zone's cooling maps to find all
    of the valid trip point combinations with the given cooling device and
    it would call thermal_zone_bind_cooling_device() for all of them using
    trip point indices reflecting the ordering of the trips in the DT.
    
    The .should_bind() callback still walks the thermal zone's cooling maps,
    but it can use the trip object passed to it by the thermal core to find
    the trip in question in the first place and then it uses the
    corresponding 'cooling-device' entries to look up the given cooling
    device.  To be able to match the trip object provided by the thermal
    core to a specific device node, the driver sets the 'priv' field of each
    trip to the corresponding device node pointer during initialization.
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    Reviewed-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
    Tested-by: Daniel Lezcano <daniel.lezcano@linaro.org> # rk3399-rock960
    Link: https://patch.msgid.link/2236794.NgBsaNRSFp@rjwysocki.net
    [ rjw: Removed excessive of_node_put() ]
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    94c6110b
thermal_of.c 12.6 KB