Re: [PATCH v8 3/3] platform/x86: dell-pc: Implement platform_profile

From: Ilpo Järvinen
Date: Thu May 30 2024 - 04:39:58 EST


On Wed, 29 May 2024, Lyndon Sanche wrote:

> Some Dell laptops support configuration of preset fan modes through
> smbios tables.
>
> If the platform supports these fan modes, set up platform_profile to
> change these modes. If not supported, skip enabling platform_profile.
>
> Signed-off-by: Lyndon Sanche <lsanche@xxxxxxxxxx>
> ---
> MAINTAINERS | 6 +
> drivers/platform/x86/dell/Kconfig | 13 +
> drivers/platform/x86/dell/Makefile | 1 +
> drivers/platform/x86/dell/dell-pc.c | 307 +++++++++++++++++++
> drivers/platform/x86/dell/dell-smbios-base.c | 1 +
> drivers/platform/x86/dell/dell-smbios.h | 1 +
> 6 files changed, 329 insertions(+)
> create mode 100644 drivers/platform/x86/dell/dell-pc.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index d6c90161c7bf..09ff0dfd65cb 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -6116,6 +6116,12 @@ F: Documentation/ABI/obsolete/procfs-i8k
> F: drivers/hwmon/dell-smm-hwmon.c
> F: include/uapi/linux/i8k.h
>
> +DELL PC DRIVER
> +M: Lyndon Sanche <lsanche@xxxxxxxxxx>
> +L: platform-driver-x86@xxxxxxxxxxxxxxx
> +S: Maintained
> +F: drivers/platform/x86/dell/dell-pc.c
> +
> DELL REMOTE BIOS UPDATE DRIVER
> M: Stuart Hayes <stuart.w.hayes@xxxxxxxxx>
> L: platform-driver-x86@xxxxxxxxxxxxxxx
> diff --git a/drivers/platform/x86/dell/Kconfig b/drivers/platform/x86/dell/Kconfig
> index 195a8bf532cc..85a78ef91182 100644
> --- a/drivers/platform/x86/dell/Kconfig
> +++ b/drivers/platform/x86/dell/Kconfig
> @@ -91,6 +91,19 @@ config DELL_RBTN
> To compile this driver as a module, choose M here: the module will
> be called dell-rbtn.
>
> +config DELL_PC
> + tristate "Dell PC Extras"
> + default m
> + depends on ACPI
> + depends on DMI
> + depends on DELL_SMBIOS
> + select ACPI_PLATFORM_PROFILE
> + help
> + This driver adds support for controlling the fan modes via platform_profile
> + on supported Dell systems regardless of formfactor.
> + Module will simply do nothing if thermal management commands are not
> + supported.
> +
> #
> # The DELL_SMBIOS driver depends on ACPI_WMI and/or DCDBAS if those
> # backends are selected. The "depends" line prevents a configuration
> diff --git a/drivers/platform/x86/dell/Makefile b/drivers/platform/x86/dell/Makefile
> index 8176a257d9c3..79d60f1bf4c1 100644
> --- a/drivers/platform/x86/dell/Makefile
> +++ b/drivers/platform/x86/dell/Makefile
> @@ -9,6 +9,7 @@ obj-$(CONFIG_DCDBAS) += dcdbas.o
> obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o
> obj-$(CONFIG_DELL_RBTN) += dell-rbtn.o
> obj-$(CONFIG_DELL_RBU) += dell_rbu.o
> +obj-$(CONFIG_DELL_PC) += dell-pc.o
> obj-$(CONFIG_DELL_SMBIOS) += dell-smbios.o
> dell-smbios-objs := dell-smbios-base.o
> dell-smbios-$(CONFIG_DELL_SMBIOS_WMI) += dell-smbios-wmi.o
> diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c
> new file mode 100644
> index 000000000000..a86ad921d4ee
> --- /dev/null
> +++ b/drivers/platform/x86/dell/dell-pc.c
> @@ -0,0 +1,307 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Driver for Dell laptop extras
> + *
> + * Copyright (c) Lyndon Sanche <lsanche@xxxxxxxxxx>
> + *
> + * Based on documentation in the libsmbios package:
> + * Copyright (C) 2005-2014 Dell Inc.
> + */
> +
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> +#include <linux/module.h>
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/err.h>
> +#include <linux/dmi.h>
> +#include <linux/bitfield.h>
> +#include <linux/bits.h>
> +#include <linux/platform_profile.h>
> +#include <linux/slab.h>

Thanks for the update. I've now applied this into review-ilpo branch.

I reordered those headers into alphabetical order while applying. In
future, when adding new headers, try adhere to the alphabetical order.

--
i.