Re: [RFC PATCH v7] platform/x86: panasonic-laptop: add fan speed mode for newer models

From: Guenter Roeck

Date: Mon Jul 20 2026 - 10:50:53 EST


On 7/20/26 06:46, Ilpo Järvinen wrote:
On Sun, 19 Jul 2026, Alex Yeo wrote:

...

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index b83113c26f88..2d67188de2a9 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -119,6 +119,9 @@
* - v0.1 start from toshiba_acpi driver written by John Belmonte
*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/printk.h>
#include <linux/acpi.h>
#include <linux/backlight.h>
#include <linux/bits.h>
@@ -136,6 +139,14 @@
#include <linux/types.h>
#include <linux/uaccess.h>
#include <acpi/video.h>
+#include <linux/sysfs.h>
+#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>

FWIW, I don't see why this is needed.

...

struct pcc_acpi {
...
+ /*
+ * This mutex ensures that the hwmon and thermal functions
+ * for fan operations do not conflict as the PWM fan is
+ * exposed to both.
+ */
+ struct mutex pwm_fan_lock;

Maybe ask why this additional lock is used instead of relying on
(for hwmon attributes) and using (for thermal) the hwmon subsystem
lock.

Guenter