public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Luke Jones <luke@ljones.dev>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Bastien Nocera <hadess@hadess.net>,
	linux-kernel@vger.kernel.org, pobrn@protonmail.com,
	linux@roeck-us.net, platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH v11] asus-wmi: Add support for custom fan curves
Date: Wed, 29 Sep 2021 01:01:09 +1300	[thread overview]
Message-ID: <X1850R.K87ZAZR7ALEU2@ljones.dev> (raw)
In-Reply-To: <b3eee6a7-5c8b-e0f9-d7cc-291fbdebd3b1@redhat.com>



On Tue, Sep 28 2021 at 13:59:31 +0200, Hans de Goede 
<hdegoede@redhat.com> wrote:
> Hi,
> 
> On 9/28/21 1:56 PM, Luke Jones wrote:
>>  Hmm,
>>  A change via /sys/firmware/acpi/platform_profile does disable the 
>> fan-curve until a user re-enables it.
> 
> Ah ok, so did get that part right :)
> 
> So basically any write to /sys/firmware/acpi/platform_profile
> will reset the pwm1_enable to "2" if it was not "2" already.
> 
>>  It doesn't wipe the actual curve setting though, I thought that 
>> would be bad UX,
> 
> Ok that is fine.
> 
>>  but yes the curve is definitely disabled on profile change and will 
>> remain disabled until turned on again. At which point another 
>> profile change will disable it again.
>> 
>>  And as stated in previous reply use of 
>> /sys/devices/platform/asus-nb-wmi/hwmon/hwmon<N>/pwm<N>_enable to 
>> check the status is stabilised (1 = manual fan).
>> 
>>  Looking at it with fresh eyes I just spotted some things I can 
>> clean up further. Very sorry, there'll be a v15 :(
> 
> No worries, maybe wait a bit with posting v15 till Bastien has a 
> chance
> to way in on this discussion though.

No problem at all. Very little will change except for code clean up :)

> 
> Regards,
> 
> Hans
> 
> 
> 
>>  On Tue, Sep 28 2021 at 13:44:32 +0200, Hans de Goede 
>> <hdegoede@redhat.com> wrote:
>>>  Hi,
>>> 
>>>  On 9/28/21 1:36 PM, Bastien Nocera wrote:
>>>>   On Wed, 2021-09-08 at 11:22 +1200, Luke D. Jones wrote:
>>>>>   Add support for custom fan curves found on some ASUS ROG 
>>>>> laptops.
>>>>> 
>>>>>   These laptops have the ability to set a custom curve for the CPU
>>>>>   and GPU fans via two ACPI methods.
>>>>> 
>>>>>   This patch adds two pwm<N> attributes to the hwmon sysfs,
>>>>>   pwm1 for CPU fan, pwm2 for GPU fan. Both are under the hwmon of 
>>>>> the
>>>>>   name `asus_custom_fan_curve`. There is no safety check of the 
>>>>> set
>>>>>   fan curves - this must be done in userspace.
>>>>> 
>>>>>   The fans have settings [1,2,3] under pwm<N>_enable:
>>>>>   1. Enable and write settings out
>>>>>   2. Disable and use factory fan mode
>>>>>   3. Same as 2, additionally restoring default factory curve.
>>>>> 
>>>>>   Use of 2 means that the curve the user has set is still stored 
>>>>> and
>>>>>   won't be erased, but the laptop will be using its default 
>>>>> auto-fan
>>>>>   mode. Re-enabling the manual mode then activates the curves 
>>>>> again.
>>>>> 
>>>>>   Notes:
>>>>>   - pwm<N>_enable = 0 is an invalid setting.
>>>>>   - pwm is actually a percentage and is scaled on writing to 
>>>>> device.
>>>> 
>>>>   I was trying to update:
>>>> 
>>>>  
>>>> https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/merge_requests/80
>>>>   but I don't understand what files I need to check for what 
>>>> values to
>>>>   detect whether custom fan curves were used.
>>>> 
>>>>   Can you help me out here?
>>> 
>>>  How to deal with this is actually one of my remaining questions 
>>> too.
>>> 
>>>  I've not looked at the new code closely yet, but if I understand
>>>  things correctly, the now code basically only allows to set 1
>>>  custom profile and setting that profile overrides the last
>>>  profile set through /sys/firmware/acpi/platform_profile.
>>> 
>>>  And any write to /sys/firmware/acpi/platform_profile will
>>>  overwrite / replace the last custom set profile (if any) with
>>>  the one matching the requested platform-profile.
>>> 
>>>  So basically users of custom fan profiles are expected to
>>>  disable power-profiles-daemon or at least to refrain from
>>>  making any platform_profile changes.
>>> 
>>>  And if power-profile-daemon is actually active and
>>>  makes a change then any custom settings will be thrown away,
>>>  IOW p-p-d will always win. So I believe that it no longer needs
>>>  to check for custom profiles, since any time it requests a
>>>  standard profile that will overwrite any custom profile
>>>  which may be present.
>>> 
>>>  Luke, do I have that right ?
>>> 
>>>>   Also, was this patch accepted in the pdx86 tree?
>>> 
>>>  No, I still need to find/make some time to review it and
>>>  I still have the same question as you :)
>>> 
>>>  Regards,
>>> 
>>>  Hans
>>> 
>> 
>> 
> 



      reply	other threads:[~2021-09-28 12:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-07 23:22 [PATCH v11 0/1] asus-wmi: Add support for custom fan curves Luke D. Jones
2021-09-07 23:22 ` [PATCH v11] " Luke D. Jones
2021-09-08 12:32   ` kernel test robot
2021-09-08 17:49   ` kernel test robot
2021-09-28 11:36   ` Bastien Nocera
2021-09-28 11:43     ` Luke Jones
2021-09-28 11:56       ` Hans de Goede
2021-09-28 11:59         ` Luke Jones
2021-09-28 12:03           ` Hans de Goede
2021-09-28 12:15             ` Luke Jones
2021-09-28 14:11               ` Hans de Goede
2021-09-28 11:44     ` Hans de Goede
2021-09-28 11:56       ` Luke Jones
2021-09-28 11:59         ` Hans de Goede
2021-09-28 12:01           ` Luke Jones [this message]

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=X1850R.K87ZAZR7ALEU2@ljones.dev \
    --to=luke@ljones.dev \
    --cc=hadess@hadess.net \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=pobrn@protonmail.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