From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-vk1-f176.google.com (mail-vk1-f176.google.com [209.85.221.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18C19435AA3 for ; Tue, 21 Jul 2026 23:22:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784676162; cv=none; b=rvX6mzqFRyLKj23L+TJUFQAzXASGSS5qtilwuQU69/GsO6bWle4mkSjeh3c7vpxCKKXQEoifgHK49wjDgWLs/dqsGkiFiMyVuzVinEsTAhx41RIaNmzwURQaNEg1XRo091lsMp9O1mWOUkWImX9JsSKitysUC/HuVkVn+hltpDM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784676162; c=relaxed/simple; bh=QYpxUU9b0mpz+k23Ko+GxcX3nWGQhGbT1UxhOLy1VdE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ATRtUBUy0ta9LvTJv0Zq9/pG91CUOmuxCcmh+hEXsSZaUOUFrQUQrMt2XdP1/UAr3C1ThIaOm5qg30d4xkZ7ip5VN92xarX/qJqj4zpkzs51161+0SIOtE8/plR7z/EUG/P3KmAiYQbKWezGVemRdWz8DrlsRu3lzvM8eZNa3eg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mJNg66UT; arc=none smtp.client-ip=209.85.221.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mJNg66UT" Received: by mail-vk1-f176.google.com with SMTP id 71dfb90a1353d-5bf9506704fso2916336e0c.2 for ; Tue, 21 Jul 2026 16:22:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784676160; x=1785280960; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=pxmnV5EYMgRiguaN7PhOdxhulBwnM9DxidYXYq4D6wM=; b=mJNg66UTB/0KGCBhVVAwGHfEqOnLh/sWUecRpBxgo49ZHx2b9qHNeqc8fL4Ang4gCU dxS/SKXqWE7fcwPBVIuFfDCbMILsdQVVAFprFS5YltEwXnvuc9lHwBuupYT8miJzFymF Dr9UbQOJndyfK7zxUzhjAQB6UDoM03gPykAGhUbPRT+AOeIP6TEI45c70rM5jy5wucGN w0oZgtXOHVr6KHIM6xzq7+d3lLpUAEwanYfDbOIT7U14MBJpl/P/9G8erRl08RvCQO8z RCewf9+A75tPSO15uJtaAx0R1JeWa4iEcUcDmPdhMDVEhqitFVC+HxtG6ttnpBgZToJO 02/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784676160; x=1785280960; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=pxmnV5EYMgRiguaN7PhOdxhulBwnM9DxidYXYq4D6wM=; b=WtQJJTKnCBLKcBlOd/93W1m9hyVtDkbijqYUZHILRySJlRcl63sMz6I2kM/derGKhM rTQmYrhDX4zzuMZiq13QkXhSam0sF/A/vesv1rYDICcSMRnBEV0NQlfRae8tGs3o6b6a uMRRc94w0tF3xonlEJtDuClALqzl9YvnjRGe4SOCjZxy0E/H8duyJaGz6lv/wAtsVE9r aLBQhPy/oBrH/6eJ3wEXThvsES8GV5eyF6GmIg9EX4BghnC9Je5y2W9zrt6z4udKenST AeI2uGNv0dODNHohrojMGgrO1JmtXqtTBY/LtHwTX8Njg99Kew4hxd7AiVKKax247GDB yR8A== X-Forwarded-Encrypted: i=1; AHgh+RogUQpLh3FsOrwNusyepEnBaDLjyCa5dPzUnUrOplyUzJ3j9XDI1YmeWFpiNSPeFNYuQsu68V/K99DPDOg=@vger.kernel.org X-Gm-Message-State: AOJu0YxOlPGE29CsReWyAFm2g2EfuuXlF287+jdmMpQ7D9VuQ0VtDbDn ZFjVhNn4Mkpyw0et6dBaHx1tKJBtWMnurYaoO1BM6SIjt4dJ5EkuaTxv X-Gm-Gg: AR+sD10NKis+9wxJXP7asDwnqeSBQ4EQmflysjySaR3TeMsaPD8t/vGE5bTBuvfkHWM 8iktXtnxsKGoMy/pZ8WtXG88/cGSGT0vKfVvpkTDe+mzCtgpUgFeQs31hgCmKzIhlB2HekgGYme nNzGe7RuP9X5kFJNexqiOcs0oNGdj2hfON2xOu1GXgeO0A1cUyxT11K1huejQGB7Osxhu8WH2Si al9ryk7emMXm+lFoUdBIxOZ7Hw9CQAHnwZka9AUgz51V8Dn2kCMt8PhaBybCC409YviznKtntyf PACRnJw/JKl1cuPTMkX4yXlS2TIaQ+pwEMbLUwf1QftOhbniNgfPtqK7AYfTNq/sBFBcHA1+Mh1 k21iQFXk3QSzzXuwXJWyDMplnKedzq2rKhfACzDR+pIdx7pzPo//Crrqv4nITbeQF2qWQNeW+mF 664EuNlVqrNrLCm4T7GZIVCutNT779MM47T4wbjkqKInLoVUwihw== X-Received: by 2002:a05:6122:d0e:b0:5bb:aae2:1754 with SMTP id 71dfb90a1353d-5c1bf8f630amr5782093e0c.13.1784676159967; Tue, 21 Jul 2026 16:22:39 -0700 (PDT) Received: from [192.168.60.4] ([207.115.103.98]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-5c2c6275db6sm1141816e0c.3.2026.07.21.16.22.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Jul 2026 16:22:39 -0700 (PDT) Message-ID: <84b521b8-112b-4fed-ab82-e1e16d770e66@gmail.com> Date: Wed, 22 Jul 2026 07:22:32 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v7] platform/x86: panasonic-laptop: add fan speed mode for newer models To: Guenter Roeck , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= Cc: platform-driver-x86@vger.kernel.org, Kenneth Chan , Hans de Goede , LKML , linux-hwmon@vger.kernel.org References: <20260718185704.3466-1-alexyeo362@gmail.com> <531e3c48-bb61-4741-8fe7-a2dbc213eb1e@roeck-us.net> Content-Language: en-US From: Alex Yeo In-Reply-To: <531e3c48-bb61-4741-8fe7-a2dbc213eb1e@roeck-us.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2026/07/20 10:41 PM, Guenter Roeck wrote: > 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 >>>   #include >>>   #include >>>   #include >>> @@ -136,6 +139,14 @@ >>>   #include >>>   #include >>>   #include >>> +#include >>> +#include >>> +#include > > FWIW, I don't see why this is needed. > If you mean linux/hwmon-sysfs.h, I agree. I will remove that in v8. For the other includes: >>> +#include this was previously missing >>> +#include used this for registering the fan as a PWM fan on hwmon. > >>>   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. > Both the hwmon and thermal devices share the same control path (pcc_pwm_fan_speed_read and pcc_pwm_fan_speed_set). To prevent them from executing concurrently and interleaving, I added pwm_fan_lock to serialize access. Reading and writing fan speed requires a multi-step ACPI transaction (e.g., checking/setting manual mode first before accessing or setting fan speed). This is because I rely on querying ACPI for the current state instead of keeping state cached in the driver. Because of this, the mutex is placed in the outer hwmon and thermal callbacks rather than inside the low-level ACPI helper functions. If there's a more appropriate way to synchronize this across both interfaces (e.g. use hwmon_lock in place of a driver level mutex), I'd be interested to hear it. Thanks