public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: SungHwan Jung <onenowy@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	"Lee, Chun-Yi" <jlee@suse.com>, Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	platform-driver-x86@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v3 2/2] platform/x86: acer-wmi: add fan speed monitoring for Predator PHN16-71
Date: Thu, 23 Nov 2023 17:30:23 +0200 (EET)	[thread overview]
Message-ID: <b01745a3-8097-4a67-e7bb-559990db2cb7@linux.intel.com> (raw)
In-Reply-To: <20231123152229.4920-3-onenowy@gmail.com>

On Fri, 24 Nov 2023, SungHwan Jung wrote:

> Support CPU and GPU fan speed monitoring through WMI for Predator
> PHN16-71.
> 
> This patch depends on patch "platform/x86: acer-wmi: Add platform
> profile and mode key support for Predator PHN16-71"
> 
> "select ACPI_VIDEO" cause recursive dependency and it is not recommended
> to use "select" for visible symbol, "select" has changed to "depends on".
> 
> Signed-off-by: SungHwan Jung <onenowy@gmail.com>
> ---
>  drivers/platform/x86/Kconfig    |  3 +-
>  drivers/platform/x86/acer-wmi.c | 98 ++++++++++++++++++++++++++++++++-
>  2 files changed, 99 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
> index 7e69fdacc..33ddb644e 100644
> --- a/drivers/platform/x86/Kconfig
> +++ b/drivers/platform/x86/Kconfig
> @@ -177,7 +177,8 @@ config ACER_WMI
>  	depends on INPUT
>  	depends on RFKILL || RFKILL = n
>  	depends on ACPI_WMI
> -	select ACPI_VIDEO
> +	depends on HWMON
> +	depends on ACPI_VIDEO
>  	select INPUT_SPARSEKMAP
>  	select LEDS_CLASS
>  	select NEW_LEDS
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index e3650dce0..f2f3b1c45 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
>  static const struct key_entry acer_wmi_keymap[] __initconst = {
> @@ -241,6 +244,7 @@ struct hotkey_function_type_aa {
>  #define ACER_CAP_TURBO_LED     BIT(8)
>  #define ACER_CAP_TURBO_FAN     BIT(9)
>  #define ACER_CAP_PLATFORM_PROFILE BIT(10)
> +#define ACER_CAP_FAN_SPEED_READ BIT(11)

It would be nice to align these with tabs.

> @@ -1722,6 +1727,25 @@ static int acer_gsensor_event(void)
>  	return 0;
>  }
>  
> +static int acer_get_fan_speed(int fan)
> +{
> +	if (quirks->predator_v4) {
> +		acpi_status status;
> +		u64 fanspeed;
> +
> +		status = WMI_gaming_execute_u64(
> +			ACER_WMID_GET_GAMING_SYS_INFO_METHODID,
> +			fan == 0 ? ACER_WMID_CMD_GET_PREDATOR_V4_CPU_FAN_SPEED :
> +				   ACER_WMID_CMD_GET_PREDATOR_V4_GPU_FAN_SPEED,
> +			&fanspeed);
> +
> +		if (ACPI_FAILURE(status))
> +			return -EIO;
> +		return fanspeed >> 8;

Define a named field using GENMASK() and use FIELD_GET() ?


-- 
 i.


  reply	other threads:[~2023-11-23 15:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-23 15:22 [PATCH v3 0/2] Add support for Acer Predator PHN16-71 SungHwan Jung
2023-11-23 15:22 ` [PATCH v3 1/2] platform/x86: acer-wmi: Add platform profile and mode key support for " SungHwan Jung
2023-11-23 15:22 ` [PATCH v3 2/2] platform/x86: acer-wmi: add fan speed monitoring " SungHwan Jung
2023-11-23 15:30   ` Ilpo Järvinen [this message]
2023-11-23 15:31   ` Ilpo Järvinen

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=b01745a3-8097-4a67-e7bb-559990db2cb7@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=jdelvare@suse.com \
    --cc=jlee@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=onenowy@gmail.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /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