Re: [PATCH v3] platform/x86: thinkpad_acpi: lap or desk mode interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




----- Original Message -----
> Newer Lenovo Thinkpad platforms have support to identify whether the
>   system is on-lap or not using an ACPI DYTC event from the firmware.
> 
>   This patch provides the ability to retrieve the current mode via sysfs
>   entrypoints and will be used by userspace for thermal mode and WWAN
>   functionality
> 
> Co-developed-by: Nitin Joshi <njoshi1@xxxxxxxxxx>
> Signed-off-by: Nitin Joshi <njoshi1@xxxxxxxxxx>
> Reviewed-by: Sugumaran <slacshiminar@xxxxxxxxxx>
> Signed-off-by: Mark Pearson <markpearson@xxxxxxxxxx>
> ---
> Changes in v3:
> - Fixed inaccurate comments
> - Used BIT macro to check lapmode bit setting as recommended and update
>   define name
> - Check for new_state == dytc_lapmode in dytc_lapmode_refresh
> 
> Changes in v2:
> - cleaned up initialisation sequence to be cleaner and avoid spamming
>   platforms that don't have DYTC with warning message. Tested on P52
> - Adding platform-driver-x86 mailing list for review as requested
> 
>  drivers/platform/x86/thinkpad_acpi.c | 110 +++++++++++++++++++++++++++
>  1 file changed, 110 insertions(+)
> 
> diff --git a/drivers/platform/x86/thinkpad_acpi.c
> b/drivers/platform/x86/thinkpad_acpi.c
> index 0f704484ae1d..ce3bfb546109 100644
> --- a/drivers/platform/x86/thinkpad_acpi.c
> +++ b/drivers/platform/x86/thinkpad_acpi.c
> @@ -4049,6 +4049,7 @@ static bool hotkey_notify_6xxx(const u32 hkey,
>  		pr_debug("EC reports: Thermal Control Command set completed (DYTC)\n");
>  		/* recommended action: do nothing, we don't have
>  		 * Lenovo ATM information */
> +		tpacpi_driver_event(hkey);

Do you want to update the comments just above now that the notification is handled?

<snip>
> +static void dytc_lapmode_refresh(void)
> +{
> +	int new_state;
> +
> +	new_state = dytc_lapmode_get();
> +	if ((new_state == -ENODEV) || (new_state == -EIO) || (new_state ==
> dytc_lapmode))
> +		return;
> +
> +	if (dytc_lapmode != new_state) {

There's no need to check here, you're exiting the function on new_state == dytc_lapmode

> +		dytc_lapmode = new_state;
> +		dytc_lapmode_notify_change();
> +	}
> +}

Rest looks fine.

Cheers




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux