Re: [PATCH] thermal: tell cooling devices when a trip_point changes

From: Matt Longnecker
Date: Thu Jul 31 2014 - 13:13:01 EST


I should have labeled my message RFC. My intent was to generate some public discussion about a problem I've hit -- not to get this particular patch merged.

On 07/31/2014 01:30 AM, Zhang Rui wrote:
On Wed, 2014-07-30 at 16:10 -0700, Matt Longnecker wrote:
Some hardware can react autonomously at a programmed temperature.

if you have a temperature sensor, then you should have a thermal zone
device driver for it, right?


Yes, but....

In existing "downstream" Tegra kernels, thermal sensor drivers directly register thermal zones with thermal_core.c. Drivers get information for the zone (e.g. trip points, cooling maps, etc). Each driver has its own format for this zone-related information.

Now we're moving away from board files and toward device tree.

of-thermal offers a canonical way to encode zone-related information in device tree. I don't want to invent a competing alternative.

As of-thermal parses device tree, it creates thermal zones. Sensor drivers no longer need to register zones -- they just register with of-thermal as sensor drivers.

of-thermal hides trip points and cooling maps from sensor drivers. This is good and bad. It's good because it eliminates a _lot_ of thermal zone boilerplate code from sensor drivers. It's bad because it breaks an existing usecase:
* the kernel configures the hardware thermal reaction (e.g. catastrophic shutdown) according to platform-data provided at boot
* a user adjusts the shutdown temperature at runtime by poking at /sys/class/thermal/thermal_zone*/trip_point_*_temp

My patch offers one way to support this usecase in systems using of-thermal to manage thermal zones. I'm happy to discuss alternatives.

For example, an SoC might implement a last ditch throttle or a
hardware thermal shutdown.

And it should be handled by the thermal zone driver, who has the
knowledge of when to do throttle/shutdown.


of-thermal doesn't support this because it doesn't propagate trip point changes to sensor drivers.

Thanks,
Matt Longnecker
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/