From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.170 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796184076; b=zKyLzk3R+vFw8PzrE58R9qlbVZlwr7rHp84Iw9FWEvQaEdfsTUPQO2pILv4SWrmBkiSC JIdVXWlr8gmDo3zCWxQRoYD8zqIYjCltSCunTMaJp1pLyOiUvVL4FY9o+3B385/hIKh+C FzTI2oz+svDJNJZUjNRZtZVD1BTz+bjazK+JVo6NzJz1q8Yk6yIhQLoMCZRs5D/yQqFN1 CfcigS2EPfC2r7O+EK7FFnnyzHgIEsMjXmzICScWh0bolWUTqp15w3bXNnRcncHG8tpj3 lr+/6bhPpM0si78PlXRU4U4cBFYle0X/Lp0g0DXqrl0oBfXghWs8uQSHKlfJvxfIygQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796184076; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Message-ID:Date:MIME-Version:User-Agent:From:Subject:To:Cc:References: Content-Language:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=pfyaKZjFtWNMA+ftiRQFrsIT8P7QxLe1MMjitDhttCA=; b=bCkeRu8XrqeLQA2nl7GUMazMYB1nQv5gJ08YHDjsuy96HjUsZkcMxkktJUsljgh1XyL0 CN0v3p8pGrh86CdBOTkXZrDwgG1a3oYgmlZ89P2o6zGM08Zq8bDzMs2bKmPLV613gOWnc Yz73UsxOXHNz2bawPa5dV6antJ6sjjMWIKcx0CzCPiR19ab0v/PVvv9lZJhvXkvtBCgwV 7QM5PeDWR0IfDv09En0bNTlzFqQSxK3/9NZMVhvRPL3VQh7IM4S0CzZE4BaoO42fY6HBP KislL7CL8zME0EdgS0JbqNPb9pC0RgG/B6SFsYfNw9ogZf7DazoqnnQSdF5cKIOzcMQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=tEfSDxwf; arc=none smtp.remote-ip=74.125.82.170 Received: from mail-dy1-f170.google.com (mail-dy1-f170.google.com [74.125.82.170]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47116606A322 for ; Wed, 2 Dec 2026 04:01:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 47116606A322 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.a=rsa-sha256 header.s=20260707 header.b=tEfSDxwf Received: by mail-dy1-f170.google.com with SMTP id 5a478bee46e88-38692f62b22so1902635eec.0 for ; Tue, 01 Dec 2026 20:01:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796184075; x=1796788875; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:content-language :references:cc:to:subject:from:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to:content-type; bh=pfyaKZjFtWNMA+ftiRQFrsIT8P7QxLe1MMjitDhttCA=; b=tEfSDxwfFFQSStP0uR9HOcOLyfsHd4JQoJ6s0aWWkBDfoCRC27NrEvwunuuBxa30bZ 8yeMl6sdhHkVjAav++LV0AyXfkzG8L+MxAPRUAgZQc8032dPrMe0FszXymkVrS8H/KtK iT7jIAYmXFktDkcHvaxAFV0EUt6jAx4vE2R9vm8x5MqJpfkQGZcaKkJ1L5qi0pF9lgxG rzfJrh3Ij05Uz4gsd8Uzm705Xw0PSMrij/4PflCPuMwQUX7s2g7K3l0ULWVvkZ/YfEzK 5NaQrTKy8+hWki3eZsDHaU4Cw8MyG4FFx8tvWPTGmK8T6LdvwWY1TiIVdiCzAyILsrew Fhxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796184075; x=1796788875; h=content-transfer-encoding:content-type:in-reply-to:content-language :references:cc:to:subject:from: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=pfyaKZjFtWNMA+ftiRQFrsIT8P7QxLe1MMjitDhttCA=; b=T7U4/nC1mY+79T31OEKfORqcqJIXSozh9yS0ItRsd3sCjaZZxbiNwSloaNZGzIv0wh bGde/6IORMNIpsnmBThLiws8shz1QOeMYWHVrig2nv3TELrPRGF02HNomltXROKJQJO6 dJHooL2ysBcGtDxVtRFHs6PWsy1QrRx1/ghJ2U1ISs5U8OoIwts+I9d1MONQDvBf3JHF LFhSCYU4nJxpvsBy9ODSDY/hzMmOw8q75c5fi0v+cTQQh77EuNVbcPGtbrl9zBUXt3UW bgOiap2ouvfXoAiE2MhlR8Xqw+mqFRSbHuNDkL46OvpbtzxWKoYLPxNM4aV+0/MuUCiQ koew== X-Forwarded-Encrypted: i=1; AL+hErF1OpoKVZk1YG0rYX1z36DKLyrKeH1Vkgw9a+fs7XaXKC571P39XosrCWeZ133vdLcrXLuvLGRgVOJZ/0I=@vger.kernel.org X-Gm-Message-State: APuU4Z/uOPdKzzCZpisnB60EuuddGCVjpoZRv1ExLDtEvlUbYFWHcQ+Z UF7xW5xYb3LGve2aNHxMna4ymbOFrvCa4/rdoo2nXeIG26SD/h0oEwRB X-Gm-Gg: AZFdTZdm5NgTTh9LaEPx+FsoeJEZZrlQiuQq+5GyZIbydmmTnRQRZttjt2eDERWUqXC DmrpM+L/E9ukGb8fNIfxZCld1IGfC3m07H6XQxi/YM8s80Z1yjGf33I2qMmjZeggg6LgvmSB1FC DEUqgfsJjZczB6WbzHTlr5wvvXZzcQKxDPgBG+S1J3GsrCHoVdif+pTdBzFgvyviDnKYQjuFc52 YrNKwjGSl1sjTxCCxEx1p2YAiCi/BHYcKrC7rd5SQMNM+rUoAoEGhvyuOsbPC85LioSFScB99A1 QoYpcmAdA3+4ciGKYafm2SsyYsg1YwASnnG7kT6k+3KMY/XGO6o/mYa2zLS6MqJgec2Abdzta4s M7VYV4kKVD0rJNCFMIgmYE622KB9HZvypIENl0B6mQy97+JryWsuxwiQhttkTOwWfP/+/fMaTQN 18jLSQBD0svOMLA0HwZ60EqRI7SbyQk3Tnt95X3usFxNfErQ3y1bmy0Wd9xd57NIzaTVSGzxcy/ 3TDEEo6TzIPXxNKW0OAzKdiDc7JeSlvzj85nzSTh/MWUtrZ5+7dgxgYkiVxar9HdQcvaqqYyNBU b8SJ6LBFWvPUYxUm1lCgVNtH2O9DxRnj/A1sdNMIWBqgFYhVEeSyE6mTNJOkQWPaDJRQyC/WSYs eFY+23Jvv X-Received: by 2002:a05:7301:dd86:b0:351:2958:1740 with SMTP id 5a478bee46e88-3856fb641famr38207120eec.37.1796184075360; Tue, 01 Dec 2026 20:01:15 -0800 (PST) Received: from ?IPV6:2607:f598:b3da:290:d166:e547:104c:84c3? ([2607:f598:b3da:290:d166:e547:104c:84c3]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-38566cd40c5sm140112726eec.10.2026.12.01.20.01.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Dec 2026 20:01:15 -0800 (PST) Message-ID: Date: Tue, 1 Dec 2026 20:01:13 -0800 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Bozhen Peng Subject: [PATCH v4 1/4] platform/x86: bitland-mifs-wmi: Allow per-model hwmon configuration To: Ilpo Jarvinen , Mingyou Chen , Ilya Gladyshev Cc: Hans de Goede , Armin Wolf , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org References: <90c6fa9e-6f3a-4618-af97-e39d8daf18ed@gmail.com> Content-Language: en-US In-Reply-To: <90c6fa9e-6f3a-4618-af97-e39d8daf18ed@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit The WUJIE15 PRO HPT has two fans and no CPU temperature reading. Move the hwmon chip info and fan labels into a per-model configuration so its sensor layout can be added separately. Keep the current layout as the default. No functional change intended. Signed-off-by: Bozhen Peng --- drivers/platform/x86/bitland-mifs-wmi.c | 43 +++++++++++++++++++------ 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86/bitland-mifs-wmi.c index 7bad8942249d43bd378d7adf8da26261fd684df7..04125c602f3bde13426fa463415cdafe0b0d07fe 100644 --- a/drivers/platform/x86/bitland-mifs-wmi.c +++ b/drivers/platform/x86/bitland-mifs-wmi.c @@ -94,9 +94,18 @@ struct bitland_profile_entry { bool battery; /* Set in place of the AC entry while on battery */ }; +struct bitland_hwmon_config { + const struct hwmon_chip_info *chip_info; + const char * const *fan_labels; + size_t num_fans; +}; + +static const struct bitland_hwmon_config default_hwmon_config; + struct bitland_mifs_quirks { const struct bitland_profile_entry *profile_entries; size_t num_profile_entries; + const struct bitland_hwmon_config *hwmon; bool return_code_at_end; bool skip_ac_type_check; @@ -552,12 +561,18 @@ static const struct platform_profile_ops laptop_profile_ops = { .profile_set = laptop_profile_set, }; -static const char *const fan_labels[] = { +static const char * const default_fan_labels[] = { "CPU", /* 0 */ "GPU", /* 1 */ "SYS", /* 2 */ }; +static const struct bitland_hwmon_config * +bitland_hwmon_config(const struct bitland_mifs_wmi_data *data) +{ + return data->quirks->hwmon ?: &default_hwmon_config; +} + static int laptop_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, int channel, long *val) { @@ -603,13 +618,15 @@ static int laptop_hwmon_read_string(struct device *dev, enum hwmon_sensor_types type, u32 attr, int channel, const char **str) { - if (type == hwmon_fan && attr == hwmon_fan_label) { - if (channel >= 0 && channel < ARRAY_SIZE(fan_labels)) { - *str = fan_labels[channel]; - return 0; - } - } - return -EINVAL; + struct bitland_mifs_wmi_data *data = dev_get_drvdata(dev); + const struct bitland_hwmon_config *config = bitland_hwmon_config(data); + + if (type != hwmon_fan || attr != hwmon_fan_label || + channel < 0 || channel >= config->num_fans) + return -EINVAL; + + *str = config->fan_labels[channel]; + return 0; } static const struct hwmon_channel_info *laptop_hwmon_info[] = { @@ -631,6 +648,12 @@ static const struct hwmon_chip_info laptop_chip_info = { .info = laptop_hwmon_info, }; +static const struct bitland_hwmon_config default_hwmon_config = { + .chip_info = &laptop_chip_info, + .fan_labels = default_fan_labels, + .num_fans = ARRAY_SIZE(default_fan_labels), +}; + static int laptop_kbd_led_set(struct led_classdev *led_cdev, enum led_brightness value) { @@ -900,6 +923,7 @@ static int bitland_notifier_callback(struct notifier_block *nb, static int bitland_mifs_wmi_probe(struct wmi_device *wdev, const void *context) { + const struct bitland_hwmon_config *hwmon; struct bitland_mifs_wmi_data *drv_data; enum bitland_wmi_device_type dev_type = (enum bitland_wmi_device_type)(unsigned long)context; @@ -971,10 +995,11 @@ static int bitland_mifs_wmi_probe(struct wmi_device *wdev, const void *context) } /* Register hwmon */ + hwmon = bitland_hwmon_config(drv_data); drv_data->hwmon_dev = devm_hwmon_device_register_with_info(&wdev->dev, "bitland_mifs", drv_data, - &laptop_chip_info, + hwmon->chip_info, NULL); if (IS_ERR(drv_data->hwmon_dev)) return PTR_ERR(drv_data->hwmon_dev);