在 2025/1/21 22:12, Armin Wolf 写道:
Am 21.01.25 um 07:44 schrieb Huisong Li:
The hwmon_device_register() is deprecated. When I try to repace it with
hwmon_device_register_with_info() for acpi_power_meter driver, I
found that
the power channel attribute in linux/hwmon.h have to extend and is more
than 32 after this replacement.
However, the maximum number of hwmon channel attributes is 32 which is
limited by current hwmon codes. This is not good to add new channel
attribute for some hwmon sensor type and support more channel attribute.
This series are aimed to do this. And also make sure that
acpi_power_meter
driver can successfully replace the deprecated hwmon_device_register()
later.
Hi,
what kind of new power attributes do you want to add to the hwmon API?
The attributes you list is right.
AFAIK the acpi-power-meter driver supports the following attributes:
power1_accuracy -> HWMON_P_ACCURACY
power1_cap_min -> HWMON_P_CAP_MIN
power1_cap_max -> HWMON_P_CAP_MAX
power1_cap_hyst -> HWMON_P_CAP_HYST
power1_cap -> HWMON_P_CAP
power1_average -> HWMON_P_AVERAGE
power1_average_min -> HWMON_P_AVERAGE_MIN
power1_average_max -> HWMON_P_AVERAGE_MAX
power1_average_interval -> HWMON_P_AVERAGE_INTERVAL
power1_average_interval_min -> HWMON_P_AVERAGE_INTERVAL_MIN
power1_average_interval_max -> HWMON_P_AVERAGE_INTERVAL_MAX
power1_alarm -> HWMON_P_ALARM
power1_model_number
power1_oem_info
power1_serial_number
power1_is_battery
name -> handled by hwmon core
The remaining attributes are in my opinion not generic enough to add
them to the generic
hwmon power attributes. I think you should implement them as a
attribute_group which can
be passed to hwmon_device_register_with_info() using the
"extra_groups" parameter.
This is a good idea. Thanks.
Huisong Li (21):
hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
media: video-i2c: Use HWMON_CHANNEL_INFO macro to simplify code
net: aquantia: Use HWMON_CHANNEL_INFO macro to simplify code
net: nfp: Use HWMON_CHANNEL_INFO macro to simplify code
net: phy: marvell: Use HWMON_CHANNEL_INFO macro to simplify code
net: phy: marvell10g: Use HWMON_CHANNEL_INFO macro to simplify code
rtc: ab-eoz9: Use HWMON_CHANNEL_INFO macro to simplify code
rtc: ds3232: Use HWMON_CHANNEL_INFO macro to simplify code
w1: w1_therm: w1: Use HWMON_CHANNEL_INFO macro to simplify code
net: phy: aquantia: Use HWMON_CHANNEL_INFO macro to simplify code
hwmon: (asus_wmi_sensors) Fix type of 'config' in struct
hwmon_channel_info to u64
hwmon: (hp-wmi-sensors) Fix type of 'config' in struct
hwmon_channel_info to u64
hwmon: (mr75203) Fix the type of 'config' in struct
hwmon_channel_info
to u64
hwmon: (pwm-fan) Fix the type of 'config' in struct
hwmon_channel_info
to u64
hwmon: (scmi-hwmon) Fix the type of 'config' in struct
hwmon_channel_info to u64
hwmon: (tmp401) Fix the type of 'config' in struct hwmon_channel_info
to u64
hwmon: (tmp421) Fix the type of 'config' in struct hwmon_channel_info
to u64
net/mlx5: Fix the type of 'config' in struct hwmon_channel_info to
u64
platform/x86: dell-ddv: Fix the type of 'config' in struct
hwmon_channel_info to u64
hwmon: (asus-ec-sensors) Fix the type of 'config' in struct
hwmon_channel_info to u64
hwmon: (lm90) Fix the type of 'config' in struct
hwmon_channel_info to
u64
drivers/hwmon/asus-ec-sensors.c | 6 +-
drivers/hwmon/asus_wmi_sensors.c | 8 +-
drivers/hwmon/hp-wmi-sensors.c | 6 +-
drivers/hwmon/hwmon.c | 4 +-
drivers/hwmon/lm90.c | 4 +-
drivers/hwmon/mr75203.c | 6 +-
drivers/hwmon/pwm-fan.c | 4 +-
drivers/hwmon/scmi-hwmon.c | 6 +-
drivers/hwmon/tmp401.c | 4 +-
drivers/hwmon/tmp421.c | 2 +-
drivers/media/i2c/video-i2c.c | 12 +-
.../ethernet/aquantia/atlantic/aq_drvinfo.c | 14 +-
.../net/ethernet/mellanox/mlx5/core/hwmon.c | 8 +-
.../net/ethernet/netronome/nfp/nfp_hwmon.c | 40 +--
drivers/net/phy/aquantia/aquantia_hwmon.c | 32 +-
drivers/net/phy/marvell.c | 24 +-
drivers/net/phy/marvell10g.c | 24 +-
drivers/platform/x86/dell/dell-wmi-ddv.c | 6 +-
drivers/rtc/rtc-ab-eoz9.c | 24 +-
drivers/rtc/rtc-ds3232.c | 24 +-
drivers/w1/slaves/w1_therm.c | 12 +-
include/linux/hwmon.h | 300 +++++++++---------
22 files changed, 205 insertions(+), 365 deletions(-)
.