From nobody Sun Apr 5 16:42:34 2026 Received: from mail.tuxedocomputers.com (mail.tuxedocomputers.com [157.90.84.7]) (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 876543264F2; Tue, 24 Mar 2026 18:04:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=157.90.84.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774375485; cv=none; b=WCp8PwbjatVZS6AbCpPGIWvVJmeaCyIRRyVIblI4bi8jJ9+bhLdGoSW0L0n5asW6gCIA/6NGNregZ3FQDTzN+r4WeC/e7/rKJ0L9xZs1XP/8m0wU2b2r3BB5PUcyO4hBUv9cgk21GwWkjomeCPtPKDPT6TIMjyHHXYG0jvsqffY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774375485; c=relaxed/simple; bh=fFuaXxXRcnavsSqX/KBHqCjEEt3KYioCwZ87CkBvz1k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bHxJ+xIOclAitQkYUvb9lG5aPnmCWmqA44nD9/KLUJ6220+mMVS+Uf71h16/EHmT8+7qytM8+hDSdqsrHNQc5bviaVT36RsBljo4dpB/BajsJ8gjqVZ9ySg1iQC877jxSaEFfOcDM6VbJOEBwukAIIM93J1BeaBDqx4drpWNaX8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tuxedocomputers.com; spf=pass smtp.mailfrom=tuxedocomputers.com; dkim=pass (1024-bit key) header.d=tuxedocomputers.com header.i=@tuxedocomputers.com header.b=IZpubg6X; arc=none smtp.client-ip=157.90.84.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tuxedocomputers.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxedocomputers.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=tuxedocomputers.com header.i=@tuxedocomputers.com header.b="IZpubg6X" Received: from wse-pc.fritz.box (i5C75F50F.versanet.de [92.117.245.15]) (Authenticated sender: wse@tuxedocomputers.com) by mail.tuxedocomputers.com (Postfix) with ESMTPA id 69A022FC0218; Tue, 24 Mar 2026 19:04:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxedocomputers.com; s=default; t=1774375480; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hA/Xh/shQGB0az6ZWD4A2njCJRUAAfWgKeI4yZ9LD+M=; b=IZpubg6XaqX4GonkXmyn5Tbkd3KirLIbFmukXhlyMVmuKrLdLZdd8eJ+00KNnbUediNzEl Vc+K3tHfj49DXA976qNMZFvEF4cUKh8+bEo+OTf6H7v9+LuHZwTbIkV6tp6z48J0RT74Z/ 93PtWyBajDvmjGTblUqga2upic+OrsE= Authentication-Results: mail.tuxedocomputers.com; auth=pass smtp.auth=wse@tuxedocomputers.com smtp.mailfrom=wse@tuxedocomputers.com From: Werner Sembach To: W_Armin@gmx.de, hansg@kernel.org, ilpo.jarvinen@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Werner Sembach Subject: [PATCH v7 1/5] platform/x86: uniwill-laptop: Rework hwmon feature defines Date: Tue, 24 Mar 2026 19:02:36 +0100 Message-ID: <20260324180437.69594-2-wse@tuxedocomputers.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260324180437.69594-1-wse@tuxedocomputers.com> References: <20260324180437.69594-1-wse@tuxedocomputers.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Armin Wolf Split hwmon feature define in smaller parts to accommodate for diverse hardware. You can now specify the presence of a cpu and/or a gpu temp sensor separately and if one or 2 fans exists. Signed-off-by: Armin Wolf Reviewed-by: Werner Sembach Tested-by: Werner Sembach Signed-off-by: Werner Sembach --- drivers/platform/x86/uniwill/uniwill-acpi.c | 68 ++++++++++++++++++--- 1 file changed, 61 insertions(+), 7 deletions(-) diff --git a/drivers/platform/x86/uniwill/uniwill-acpi.c b/drivers/platform= /x86/uniwill/uniwill-acpi.c index 6341dca20b76a..048b265bff374 100644 --- a/drivers/platform/x86/uniwill/uniwill-acpi.c +++ b/drivers/platform/x86/uniwill/uniwill-acpi.c @@ -319,8 +319,11 @@ #define UNIWILL_FEATURE_TOUCHPAD_TOGGLE BIT(2) #define UNIWILL_FEATURE_LIGHTBAR BIT(3) #define UNIWILL_FEATURE_BATTERY BIT(4) -#define UNIWILL_FEATURE_HWMON BIT(5) -#define UNIWILL_FEATURE_NVIDIA_CTGP_CONTROL BIT(6) +#define UNIWILL_FEATURE_CPU_TEMP BIT(5) +#define UNIWILL_FEATURE_GPU_TEMP BIT(6) +#define UNIWILL_FEATURE_PRIMARY_FAN BIT(7) +#define UNIWILL_FEATURE_SECONDARY_FAN BIT(8) +#define UNIWILL_FEATURE_NVIDIA_CTGP_CONTROL BIT(9) =20 struct uniwill_data { struct device *dev; @@ -427,7 +430,7 @@ static const struct key_entry uniwill_keymap[] =3D { { KE_END } }; =20 -static inline bool uniwill_device_supports(struct uniwill_data *data, +static inline bool uniwill_device_supports(const struct uniwill_data *data, unsigned int features) { return (data->features & features) =3D=3D features; @@ -937,6 +940,48 @@ static const struct attribute_group *uniwill_groups[] = =3D { NULL }; =20 +static umode_t uniwill_is_visible(const void *drvdata, enum hwmon_sensor_t= ypes type, u32 attr, + int channel) +{ + const struct uniwill_data *data =3D drvdata; + unsigned int feature; + + switch (type) { + case hwmon_temp: + switch (channel) { + case 0: + feature =3D UNIWILL_FEATURE_CPU_TEMP; + break; + case 1: + feature =3D UNIWILL_FEATURE_GPU_TEMP; + break; + default: + return 0; + } + break; + case hwmon_fan: + case hwmon_pwm: + switch (channel) { + case 0: + feature =3D UNIWILL_FEATURE_PRIMARY_FAN; + break; + case 1: + feature =3D UNIWILL_FEATURE_SECONDARY_FAN; + break; + default: + return 0; + } + break; + default: + return 0; + } + + if (uniwill_device_supports(data, feature)) + return 0444; + + return 0; +} + static int uniwill_read(struct device *dev, enum hwmon_sensor_types type, = u32 attr, int channel, long *val) { @@ -1020,7 +1065,7 @@ static int uniwill_read_string(struct device *dev, en= um hwmon_sensor_types type, } =20 static const struct hwmon_ops uniwill_ops =3D { - .visible =3D 0444, + .is_visible =3D uniwill_is_visible, .read =3D uniwill_read, .read_string =3D uniwill_read_string, }; @@ -1048,7 +1093,10 @@ static int uniwill_hwmon_init(struct uniwill_data *d= ata) { struct device *hdev; =20 - if (!uniwill_device_supports(data, UNIWILL_FEATURE_HWMON)) + if (!uniwill_device_supports(data, UNIWILL_FEATURE_CPU_TEMP) && + !uniwill_device_supports(data, UNIWILL_FEATURE_GPU_TEMP) && + !uniwill_device_supports(data, UNIWILL_FEATURE_PRIMARY_FAN) && + !uniwill_device_supports(data, UNIWILL_FEATURE_SECONDARY_FAN)) return 0; =20 hdev =3D devm_hwmon_device_register_with_info(data->dev, "uniwill", data, @@ -1687,7 +1735,10 @@ static struct uniwill_device_descriptor lapac71h_des= criptor __initdata =3D { UNIWILL_FEATURE_SUPER_KEY | UNIWILL_FEATURE_TOUCHPAD_TOGGLE | UNIWILL_FEATURE_BATTERY | - UNIWILL_FEATURE_HWMON, + UNIWILL_FEATURE_CPU_TEMP | + UNIWILL_FEATURE_GPU_TEMP | + UNIWILL_FEATURE_PRIMARY_FAN | + UNIWILL_FEATURE_SECONDARY_FAN, }; =20 static struct uniwill_device_descriptor lapkc71f_descriptor __initdata =3D= { @@ -1696,7 +1747,10 @@ static struct uniwill_device_descriptor lapkc71f_des= criptor __initdata =3D { UNIWILL_FEATURE_TOUCHPAD_TOGGLE | UNIWILL_FEATURE_LIGHTBAR | UNIWILL_FEATURE_BATTERY | - UNIWILL_FEATURE_HWMON, + UNIWILL_FEATURE_CPU_TEMP | + UNIWILL_FEATURE_GPU_TEMP | + UNIWILL_FEATURE_PRIMARY_FAN | + UNIWILL_FEATURE_SECONDARY_FAN, }; =20 static int phxarx1_phxaqf1_probe(struct uniwill_data *data) --=20 2.43.0