mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Werner Sembach <wse@tuxedocomputers.com>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>
Cc: rui.zhang@intel.com, "Hans de Goede" <hdegoede@redhat.com>,
	"Armin Wolf" <W_Armin@gmx.de>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	platform-driver-x86@vger.kernel.org
Subject: Re: Thermal driver with safeguards
Date: Thu, 9 Jan 2025 22:36:07 +0100	[thread overview]
Message-ID: <6ed0eb0c-c31b-41b0-93ca-c6581249c7b7@linaro.org> (raw)
In-Reply-To: <41483e2b-361b-4b84-88a7-24fc1eaae745@tuxedocomputers.com>

On 02/12/2024 15:52, Werner Sembach wrote:
> Hi,
> 
> given a pair of a temperature sensor and a fan, I want to implement a 
> driver. that allows userspace to directly control the fan if it wants 
> to. But have a minimum fan speed when certain high temperatures are 
> reached to avoid crashes or hardware damage.

 From the userspace, use directly the thermal-engine which is currently 
under development [1]. You can add your platform specific code in a 
plugin while the thermal engine will catch all the thermal events and 
pass them to it [2].

The thermal engine has a configuration file which will setup the thermal 
framework to be woken up at different temperatures.

The thermal engine will be proposed for a distro package, so the 
platform support will be automatically supported.

Beside the trip points can be setup in the device to act on higher 
temperature.

What is unclear is how the fan is managed. I suggest to have a look at 
pwm-fan.c in drivers/hwmon

> e.g.
> 
> - temperature of target die is 80°C -> fan speed must be at least 30%
> 
> - temperature of target die is 90°C -> fan speed must be at least 40%
> 
> - temperature of target die is 105°C -> fan speed must be 100%
> 
> - temperature of target die is 110°C -> device shuts off to protect the 
> hardware
> 
> Would the thermal subsystem be the right place for this to implement 
> this protection in driver?
> 
> It already has functions around periodic temperature polling and trip 
> points.

[1] https://github.com/Linaro/libpm/tree/master
[2] 
https://github.com/Linaro/libpm/blob/master/thermal-engine/plugins/te-plugin-example-game.c


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

  parent reply	other threads:[~2025-01-09 21:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-02 14:52 Werner Sembach
2025-01-09 20:10 ` Werner Sembach
2025-01-13 22:17   ` Pavel Machek
2025-01-14 10:14     ` Werner Sembach
2025-01-09 21:36 ` Daniel Lezcano [this message]
2025-01-10 16:56   ` Werner Sembach
2025-01-10 17:43     ` Daniel Lezcano
2025-01-16 11:00       ` Werner Sembach

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6ed0eb0c-c31b-41b0-93ca-c6581249c7b7@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=W_Armin@gmx.de \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=wse@tuxedocomputers.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®