summaryrefslogtreecommitdiff
path: root/drivers/hwmon
AgeCommit message (Collapse)Author
2023-04-19hwmon: adm9240: constify pointers to hwmon_channel_infoKrzysztof Kozlowski
Statically allocated array of pointed to hwmon_channel_info can be made const for safety. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: adm1177: constify pointers to hwmon_channel_infoKrzysztof Kozlowski
Statically allocated array of pointed to hwmon_channel_info can be made const for safety. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (nct6775) update ASUS WMI monitoring list B360/H410/H610/Z390...Denis Pauk
Boards such as * EX-B460M-V5, * EX-H410M-V3, * PRIME B360M-D, * PRIME B360M-K, * PRIME H410M-A, * PRIME H410M-D, * PRIME H410M-E, * PRIME H410M-F, * PRIME H410M-K, * PRIME H410M-K R2.0, * PRIME H510M-K R2.0, * PRIME Z390-A, * PRIME Z390-A/H10, * PRIME Z390-P, * PRIME Z390M-PLUS, * PRIME Z490-A, * PRIME Z490-P, * PRIME Z490-V, * PRIME Z490M-PLUS, * PRO B460M-C, * PRO H410M-C, * ROG MAXIMUS XI APEX, * ROG MAXIMUS XI CODE, * ROG MAXIMUS XI EXTREME, * ROG MAXIMUS XI FORMULA, * ROG MAXIMUS XI GENE, * ROG MAXIMUS XI HERO, * ROG MAXIMUS XI HERO (WI-FI), * ROG MAXIMUS XII APEX, * ROG MAXIMUS XII EXTREME, * ROG MAXIMUS XII FORMULA, * ROG MAXIMUS XII HERO (WI-FI), * ROG STRIX B460-F GAMING, * ROG STRIX B460-G GAMING, * ROG STRIX B460-H GAMING, * ROG STRIX B460-I GAMING, * TUF GAMING B460-PLUS, * TUF GAMING B460-PRO (WI-FI), * TUF GAMING B460M-PLUS, * TUF GAMING B460M-PLUS (WI-FI), * TUF GAMING B460M-PRO, * TUF GAMING B550-PLUS (WI-FI), * TUF GAMING B550M ZAKU (WI-FI), * TUF Z390-PLUS GAMING, * TUF Z390-PLUS GAMING (WI-FI), * TUF Z390-PRO GAMING, * TUF Z390M-PRO GAMING, * TUF Z390M-PRO GAMING (WI-FI), * WS Z390 PRO, * B560M-P, * EX-B560M-V5, * EX-H510M-V3, * EX-H610M-V3 D4, * PRIME B560-PLUS, * PRIME B560-PLUS AC-HES, * PRIME B560M-A, * PRIME B560M-A AC, * PRIME B560M-K, * PRIME B660-PLUS D4, * PRIME H510M-A, * PRIME H510M-A WIFI, * PRIME H510M-D, * PRIME H510M-E, * PRIME H510M-F, * PRIME H510M-K, * PRIME H610I-PLUS D4, * PRIME H610M-A D4, * PRIME H610M-A WIFI D4, * PRIME H610M-D D4, * PRIME H610M-E D4, * PRIME H610M-F D4, * PRIME H610M-K D4, * PRIME Z690-A, * PRIME Z690-P, * PRIME Z690-P D4, * PRIME Z690-P WIFI, * PRIME Z690-P WIFI D4, * PRIME Z690M-PLUS D4, * PRIME Z790-A WIFI, * PRIME Z790-P, * PRIME Z790-P D4, * PRIME Z790-P WIFI, * PRIME Z790-P WIFI D4, * PRIME Z790M-PLUS, * PRIME Z790M-PLUS D4, * Pro B560M-C, * Pro B560M-CT, * Pro H510M-C, * Pro H510M-CT, * Pro H610M-C, * Pro H610M-C D4, * Pro H610M-CT D4, * Pro H610T D4, * ProArt Z690-CREATOR WIFI, * ROG MAXIMUS Z690 HERO EVA, * ROG MAXIMUS Z790 APEX, * ROG MAXIMUS Z790 HERO, * ROG STRIX B560-A GAMING WIFI, * ROG STRIX B560-E GAMING WIFI, * ROG STRIX B560-F GAMING WIFI, * ROG STRIX B560-G GAMING WIFI, * ROG STRIX B560-I GAMING WIFI, * ROG STRIX Z690-A GAMING WIFI, * ROG STRIX Z690-I GAMING WIFI, * ROG STRIX Z790-A GAMING WIFI, * ROG STRIX Z790-A GAMING WIFI D4, * ROG STRIX Z790-E GAMING WIFI, * ROG STRIX Z790-F GAMING WIFI, * ROG STRIX Z790-H GAMING WIFI, * ROG STRIX Z790-I GAMING WIFI, * TUF GAMING B560-PLUS WIFI, * TUF GAMING B560M-E, * TUF GAMING B560M-PLUS, * TUF GAMING B560M-PLUS WIFI, * TUF GAMING Z690-PLUS, * TUF GAMING Z690-PLUS D4, * TUF GAMING Z690-PLUS WIFI, * TUF GAMING Z690-PLUS WIFI D4, * TUF GAMING Z790-PLUS D4, * TUF GAMING Z790-PLUS WIFI, * TUF GAMING Z790-PLUS WIFI D4, have got a nct6775 chip, but by default there's no use of it because of resource conflict with WMI method. This commit adds such boards to the WMI monitoring list. Link: https://bugzilla.kernel.org/show_bug.cgi?id=204807 Signed-off-by: Denis Pauk <pauk.denis@gmail.com> Tested-by: Alejandro González <alejandro.gonzalez.correo@gmail.com> Tested-by: bruno <bmilreu@gmail.com> Tested-by: renedis <renedis@hotmail.com> Link: https://lore.kernel.org/r/20230323212751.2474-3-pauk.denis@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (nct6775) Fix ROG B550-XE WIFI and Pro B660M-C D4 namesDenis Pauk
ROG STRIX B550-XE GAMING WIFI motherboard is incorrectly named as ROG STRIX B550-XE GAMING (WI-FI). Pro B660M-C D4 motherboard is incorrectly named as Pro B660M-C-D4. Validated by dmidecode output from https://github.com/linuxhw/DMI/ Link: https://bugzilla.kernel.org/show_bug.cgi?id=204807 Signed-off-by: Denis Pauk <pauk.denis@gmail.com> Link: https://lore.kernel.org/r/20230323212751.2474-2-pauk.denis@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (nct6775) Sort ASUS board listDenis Pauk
Rearrange board list in alphabetical order by: LC_ALL=C sort -u Link: https://bugzilla.kernel.org/show_bug.cgi?id=204807 Signed-off-by: Denis Pauk <pauk.denis@gmail.com> Link: https://lore.kernel.org/r/20230323212751.2474-1-pauk.denis@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: remove unused superio_outb functionTom Rix
clang with W=1 reports drivers/hwmon/vt1211.c:198:20: error: unused function 'superio_outb' [-Werror,-Wunused-function] static inline void superio_outb(int sio_cip, int reg, int val) ^ This function is not used so remove it. Signed-off-by: Tom Rix <trix@redhat.com> Acked-by: Juerg Haefliger <juergh@proton.me> Link: https://lore.kernel.org/r/20230323211535.2637939-1-trix@redhat.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (pwm-fan) set usage_power on PWM stateLorenz Brun
PWM fans are controlled solely by the duty cycle of the PWM signal, they do not care about the exact timing. Thus set usage_power to true to allow less flexible hardware to work as a PWM source for fan control. Signed-off-by: Lorenz Brun <lorenz@brun.one> Link: https://lore.kernel.org/r/20230309011009.2109696-1-lorenz@brun.one Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (it87) Use voltage scaling macro where appropriateFrank Crawford
Apply scaling macro to match the labels for internal voltage sensors. Signed-off-by: Frank Crawford <frank@crawford.emu.id.au> Link: https://lore.kernel.org/r/20230318080543.1226700-3-frank@crawford.emu.id.au Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (nct6775) update ASUS WMI monitoring list A520/B360/B460/B550...Denis Pauk
Boards such as * EX-B660M-V5 D4, * PRIME A520M-A, * PRIME A520M-A II, * PRIME A520M-E, * PRIME A520M-K, * PRIME B360M-A, * PRIME B360M-C, * PRIME B460M-A R2.0, * PRIME B550M-A AC, * PRIME B550M-A WIFI II, * PRIME B550M-K, * PRIME B650M-A AX II, * PRIME Z590-P WIFI, * PRIME Z590-V, * Pro A520M-C, * ProArt B650-CREATOR, * ProArt Z790-CREATOR WIFI, * Pro B660M-C, * Pro WS W680-ACE, * Pro WS W680-ACE IPMI, * ROG MAXIMUS XIII APEX, * ROG MAXIMUS XIII EXTREME, * ROG MAXIMUS XIII HERO, * ROG MAXIMUS Z690 APEX, * ROG MAXIMUS Z790 EXTREME, * ROG STRIX B660-A GAMING WIFI, * ROG STRIX Z590-A GAMING WIFI, * ROG STRIX Z590-E GAMING WIFI, * ROG STRIX Z590-F GAMING WIFI, * ROG STRIX Z590-I GAMING WIFI, * TUF GAMING A520M-PLUS, * TUF GAMING A520M-PLUS II, * TUF GAMING A520M-PLUS WIFI, * TUF GAMING B660M-E D4, * TUF GAMING B660-PLUS WIFI D4, * TUF GAMING X570-PLUS_BR, * TUF GAMING Z590-PLUS, * Z490-GUNDAM (WI-FI), * Z590 WIFI GUNDAM EDITION have got a nct6775 chip, but by default there's no use of it because of resource conflict with WMI method. This commit adds such boards to the WMI monitoring list. Link: https://bugzilla.kernel.org/show_bug.cgi?id=204807 Signed-off-by: Denis Pauk <pauk.denis@gmail.com> Tested-by: Nick Owens <mischief@offblast.org> Tested-by: A. M. <de99like@mennucci.debian.net> Link: https://lore.kernel.org/r/20230315225128.1236-1-pauk.denis@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (nct6775) Fix TUF GAMING B550M-E WIFI nameDenis Pauk
TUF GAMING B550M-E WIFI motherboard is incorrectly named as TUF GAMING B550M-E (WI-FI). Validated by dmidecode output from https://github.com/linuxhw/DMI/ Link: https://bugzilla.kernel.org/show_bug.cgi?id=204807 Signed-off-by: Denis Pauk <pauk.denis@gmail.com> Link: https://lore.kernel.org/r/20230315210135.2155-1-pauk.denis@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (nct6775) add Asus Pro A520M-C II/CSMHolger Kiehl
An NCT6798D chip is now detected: dmesg|grep nct6775 [ 23.765392] nct6775: Found NCT6798D or compatible chip at 0x2e:0x290 And sensors now shows: nct6798-isa-0290 Adapter: ISA adapter in0: 312.00 mV (min = +0.00 V, max = +1.74 V) in1: 1.02 V (min = +0.00 V, max = +0.00 V) ALARM in2: 3.42 V (min = +0.00 V, max = +0.00 V) ALARM in3: 3.38 V (min = +0.00 V, max = +0.00 V) ALARM in4: 1.03 V (min = +0.00 V, max = +0.00 V) ALARM in5: 1.02 V (min = +0.00 V, max = +0.00 V) ALARM in6: 200.00 mV (min = +0.00 V, max = +0.00 V) ALARM in7: 3.42 V (min = +0.00 V, max = +0.00 V) ALARM in8: 3.28 V (min = +0.00 V, max = +0.00 V) ALARM in9: 920.00 mV (min = +0.00 V, max = +0.00 V) ALARM in10: 512.00 mV (min = +0.00 V, max = +0.00 V) ALARM in11: 504.00 mV (min = +0.00 V, max = +0.00 V) ALARM in12: 1.03 V (min = +0.00 V, max = +0.00 V) ALARM in13: 256.00 mV (min = +0.00 V, max = +0.00 V) ALARM in14: 1.47 V (min = +0.00 V, max = +0.00 V) ALARM fan1: 0 RPM (min = 0 RPM) fan2: 0 RPM (min = 0 RPM) fan3: 355 RPM (min = 0 RPM) fan7: 0 RPM (min = 0 RPM) SYSTIN: +25.0°C (high = +80.0°C, hyst = +75.0°C) sensor = thermistor CPUTIN: +26.5°C (high = +80.0°C, hyst = +75.0°C) sensor = thermistor AUXTIN0: +97.0°C sensor = thermistor AUXTIN1: +25.0°C sensor = thermistor AUXTIN2: +25.0°C sensor = thermistor AUXTIN3: +1.0°C sensor = thermistor PECI Agent 0 Calibration: +26.0°C PCH_CHIP_CPU_MAX_TEMP: +0.0°C PCH_CHIP_TEMP: +0.0°C PCH_CPU_TEMP: +0.0°C TSI0_TEMP: +27.9°C intrusion0: ALARM intrusion1: OK beep_enable: disabled Signed-off-by: Holger Kiehl <holger.kiehl@dwd.de> Tested-by: Holger Kiehl <holger.kiehl@dwd.de> Link: https://lore.kernel.org/r/868bdc4f-9d45-475c-963e-f5232a8b95@praktifix.dwd.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (pmbus/core) Notify hwmon eventsPatrick Rudolph
Notify hwmon events using the pmbus irq handler. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com> Link: https://lore.kernel.org/r/20230301164434.1928237-4-Naresh.Solanki@9elements.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (pmbus/core) Add interrupt supportPatrick Rudolph
Implement PMBUS irq handler. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com> Link: https://lore.kernel.org/r/20230301164434.1928237-3-Naresh.Solanki@9elements.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (pmbus/core) Generalise pmbus get statusNaresh Solanki
Add function pmbus get status that can be used to get both pmbus specific status & regulator status Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> ... Change in V4 - None Changes in V3: - Add pmbus_is_enabled function Changes in V2: - Add __maybe attribute for pmbus_get_status function - Remove unrelated changes Link: https://lore.kernel.org/r/20230301164434.1928237-2-Naresh.Solanki@9elements.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (pmbus/core) Generalize pmbus status flag mapNaresh Solanki
The PMBus status flag map(pmbus_regulator_status_flag_map) is moved outside of the regulator #if block and the associated variable/struct name updated to reflect as generic PMBus status. This will make the PMBus status flag map more versatile and easier to incorporate into different contexts and functions. Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20230301164434.1928237-1-Naresh.Solanki@9elements.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (aquacomputer_d5next) Add fan PWM control for AquaeroLeonard Anderweit
Add the option to control fan PWM on Aquacomputer Aquaero. The Aquaero is the most complex Aquacomputer device, control is therefore more complicated then on already supported devices. Setting PWM requires multiple steps. First, an internal static PWM controller is set to the desired PWM value. Second, the fan is set to use that PWM controller. Last, the minimum and maximum accepted PWM values of the fan are set to allow all possible PWM values. Signed-off-by: Leonard Anderweit <leonard.anderweit@gmail.com> Link: https://lore.kernel.org/r/20230214220221.15003-7-leonard.anderweit@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (aquacomputer_d5next) Add temperature offset control for AquaeroLeonard Anderweit
Adds control over the Aquacomputer Aquaero temperature offset for all eight temperature sensors. Signed-off-by: Leonard Anderweit <leonard.anderweit@gmail.com> Link: https://lore.kernel.org/r/20230214220221.15003-6-leonard.anderweit@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (aquacomputer_d5next) Add infrastructure for Aquaero control reportsLeonard Anderweit
Add information on the Aquacomputer Aquaero control report and disable the control report checksum for Aquaero. The Aquaero does not use the checksum so it must be disabled to avoid overwriting the last two bytes of the control report. Signed-off-by: Leonard Anderweit <leonard.anderweit@gmail.com> Link: https://lore.kernel.org/r/20230214220221.15003-5-leonard.anderweit@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (aquacomputer_d5next) Device dependent control report settingsLeonard Anderweit
Add device dependent control report id, secondary control report id, secondary control report size and secondary control report for devices which need different control report settings. All currently supported devices use the same values. Signed-off-by: Leonard Anderweit <leonard.anderweit@gmail.com> Link: https://lore.kernel.org/r/20230214220221.15003-4-leonard.anderweit@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (aquacomputer_d5next) Support writing multiple control values at onceLeonard Anderweit
Add new function aqc_set_ctrl_vals() to support changing multiple control values at once while sending only one control report. Signed-off-by: Leonard Anderweit <leonard.anderweit@gmail.com> Link: https://lore.kernel.org/r/20230214220221.15003-3-leonard.anderweit@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (aquacomputer_d5next) Support one byte control valuesLeonard Anderweit
Add support for one byte control values. This extends aqc_set_ctrl_val() and aqc_get_ctrl_val() with a type. Currently supported types are AQC_8 (one byte) and AQC_BE16 (two bytes big endian). More types will be added in the future. Signed-off-by: Leonard Anderweit <leonard.anderweit@gmail.com> Link: https://lore.kernel.org/r/20230214220221.15003-2-leonard.anderweit@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (nct6775) ASUS PRIME Z590 boards supportErik Ekman
Tested on Z590M-PLUS. dmesg log: nct6775: Found NCT6798D or compatible chip at 0x2e:0x290 sensors output: nct6798-isa-0290 Adapter: ISA adapter in0: 672.00 mV (min = +0.00 V, max = +1.74 V) in1: 1000.00 mV (min = +0.00 V, max = +0.00 V) ALARM in2: 3.38 V (min = +0.00 V, max = +0.00 V) ALARM in3: 3.28 V (min = +0.00 V, max = +0.00 V) ALARM in4: 1.01 V (min = +0.00 V, max = +0.00 V) ALARM in5: 808.00 mV (min = +0.00 V, max = +0.00 V) ALARM in6: 1000.00 mV (min = +0.00 V, max = +0.00 V) ALARM in7: 3.38 V (min = +0.00 V, max = +0.00 V) ALARM in8: 3.20 V (min = +0.00 V, max = +0.00 V) ALARM in9: 528.00 mV (min = +0.00 V, max = +0.00 V) ALARM in10: 672.00 mV (min = +0.00 V, max = +0.00 V) ALARM in11: 528.00 mV (min = +0.00 V, max = +0.00 V) ALARM in12: 1.21 V (min = +0.00 V, max = +0.00 V) ALARM in13: 992.00 mV (min = +0.00 V, max = +0.00 V) ALARM in14: 1.02 V (min = +0.00 V, max = +0.00 V) ALARM fan1: 971 RPM (min = 0 RPM) fan2: 1525 RPM (min = 0 RPM) fan3: 0 RPM (min = 0 RPM) fan4: 1094 RPM (min = 0 RPM) fan5: 0 RPM (min = 0 RPM) fan6: 0 RPM (min = 0 RPM) fan7: 0 RPM (min = 0 RPM) SYSTIN: +36.0°C (high = +80.0°C, hyst = +75.0°C) sensor = thermistor CPUTIN: +40.0°C (high = +80.0°C, hyst = +75.0°C) sensor = thermistor AUXTIN0: +26.0°C sensor = thermistor AUXTIN1: +8.0°C sensor = thermistor AUXTIN2: +22.0°C sensor = thermistor AUXTIN3: +25.0°C sensor = thermistor PECI Agent 0 Calibration: +40.0°C PCH_CHIP_CPU_MAX_TEMP: +0.0°C PCH_CHIP_TEMP: +55.0°C PCH_CPU_TEMP: +0.0°C intrusion0: OK intrusion1: ALARM beep_enable: disabled Signed-off-by: Erik Ekman <erik@kryo.se> Link: https://lore.kernel.org/r/20230227090312.91091-1-erik@kryo.se Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (g762) add a check of devm_add_action in g762_of_clock_enableKang Chen
devm_add_action may fails, check it and do the cleanup. Signed-off-by: Kang Chen <void0red@gmail.com> Link: https://lore.kernel.org/r/20230227030913.893004-1-void0red@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (nzxt-smart2) handle failure of devm_add_action in nzxt_smart2_hid_probeKang Chen
1. replace the devm_add_action with devm_add_action_or_reset to ensure the mutex lock can be destroyed when it fails. 2. use local wrapper function mutex_fini instead of mutex_destroy to avoid undefined behaviours. 3. add a check of devm_add_action_or_reset and return early when it fails. Link: https://lore.kernel.org/all/f5043281-9b3e-e454-16fe-ef4cde36dfdb@roeck-us.net Signed-off-by: Kang Chen <void0red@gmail.com> Link: https://lore.kernel.org/r/20230227091534.907101-1-void0red@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (ibmpowernv, pwm-fan) Use of_property_present() for testing DT ↵Rob Herring
property presence It is preferred to use typed property access functions (i.e. of_property_read_<type> functions) rather than low-level of_get_property/of_find_property functions for reading properties. As part of this, convert of_get_property/of_find_property calls to the recently added of_property_present() helper when we just want to test for presence of a property and nothing more. Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20230310144706.1542434-1-robh@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (ltc4245) Use of_property_read_bool() for boolean propertiesRob Herring
It is preferred to use typed property access functions (i.e. of_property_read_<type> functions) rather than low-level of_get_property/of_find_property functions for reading properties. Convert reading boolean properties to of_property_read_bool(). Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20230310144707.1542525-1-robh@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (nct6775) Drop unneeded casting and conjunctionAndy Shevchenko
The 64-bit result will be cut to 32-bit automatically (by compiler) due to the type of the destination value. No need to have an explicit casting and especially additional conjunction which does the same. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230217191600.24837-1-andriy.shevchenko@linux.intel.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (nzxt-smart2) add another USB IDAleksandr Mezin
This seems to be a new revision of the device. RGB controls have changed, but this driver doesn't touch them anyway. Fan speed control reported to be working with existing userspace (hidraw) software, so I assume it's compatible. Fan channel count is the same. Recently added (0x1e71, 0x2019) seems to be the same device. Discovered in liquidctl project: https://github.com/liquidctl/liquidctl/issues/541 Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com> Link: https://lore.kernel.org/r/20230219105924.333007-1-mezin.alexander@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (gpio-fan) drop of_match_ptr for ID tableKrzysztof Kozlowski
The driver can match only via the DT table so the table should be always used and the of_match_ptr does not have any sense (this also allows ACPI matching via PRP0001, even though it might not be relevant here). This also fixes !CONFIG_OF error: drivers/hwmon/gpio-fan.c:484:34: error: ‘of_gpio_fan_match’ defined but not used [-Werror=unused-const-variable=] Note(groeck): The build error is only seen if Kconfig dependencies are messed up. The driver depends on OF_GPIO which should depend on OF. This was temporarily broken in linux-next, and it was possible to select CONFIG_OF=n and CONFIG_SENSORS_GPIO_FAN=y. Nevertheless, this is a sensible fix. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230312193723.478032-1-krzysztof.kozlowski@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19Merge branch 'hwmon-const' into HEADGuenter Roeck
2023-04-19hwmon: (k10temp) Check range scale when CUR_TEMP register is read-writeBabu Moger
Spec says, when CUR_TEMP_TJ_SEL == 3 and CUR_TEMP_RANGE_SEL == 0, it should use RangeUnadjusted is 0, which is (CurTmp*0.125 -49) C. The CUR_TEMP register is read-write when CUR_TEMP_TJ_SEL == 3 (bit 17-16). Add the check to detect it. Sensors command's output before the patch. $sensors k10temp-pci-00c3 Adapter: PCI adapter Tctl: +76.6°C <- Wrong value Tccd1: +26.5°C Tccd2: +27.5°C Tccd3: +27.2°C Tccd4: +27.5°C Tccd5: +26.0°C Tccd6: +26.2°C Tccd7: +25.0°C Tccd8: +26.5°C Sensors command's output after the patch. $sensors k10temp-pci-00c3 Adapter: PCI adapter Tctl: +28.8°C <- corrected value Tccd1: +27.5°C Tccd2: +28.5°C Tccd3: +28.5°C Tccd4: +28.5°C Tccd5: +27.0°C Tccd6: +27.5°C Tccd7: +27.0°C Tccd8: +27.5°C Signed-off-by: Babu Moger <babu.moger@amd.com> Fixes: 1b59788979ac ("hwmon: (k10temp) Add temperature offset for Ryzen 2700X") Link: https://lore.kernel.org/r/20230413213958.847634-1-babu.moger@amd.com Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-07hwmon: constify pointers to hwmon_channel_infoKrzysztof Kozlowski
HWmon core receives an array of pointers to hwmon_channel_info and it does not modify it, thus it can be array of const pointers for safety. This allows drivers to make them also const. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-03driver core: class: remove struct class_interface * from callbacksGreg Kroah-Hartman
The add_dev and remove_dev callbacks in struct class_interface currently pass in a pointer back to the class_interface structure that is calling them, but none of the callback implementations actually use this pointer as it is pointless (the structure is known, the driver passed it in in the first place if it is really needed again.) So clean this up and just remove the pointer from the callbacks and fix up all callback functions. Cc: Jean Delvare <jdelvare@suse.com> Cc: Guenter Roeck <linux@roeck-us.net> Cc: "David S. Miller" <davem@davemloft.net> Cc: Eric Dumazet <edumazet@google.com> Cc: Jakub Kicinski <kuba@kernel.org> Cc: Paolo Abeni <pabeni@redhat.com> Cc: Kurt Schwemmer <kurt.schwemmer@microsemi.com> Cc: Jon Mason <jdmason@kudzu.us> Cc: Dave Jiang <dave.jiang@intel.com> Cc: Allen Hubbe <allenbh@gmail.com> Cc: Dominik Brodowski <linux@dominikbrodowski.net> Cc: Matt Porter <mporter@kernel.crashing.org> Cc: Alexandre Bounine <alex.bou9@gmail.com> Cc: "James E.J. Bottomley" <jejb@linux.ibm.com> Cc: "Martin K. Petersen" <martin.petersen@oracle.com> Cc: Doug Gilbert <dgilbert@interlog.com> Cc: John Stultz <jstultz@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Stephen Boyd <sboyd@kernel.org> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Wang Weiyang <wangweiyang2@huawei.com> Cc: Yang Yingliang <yangyingliang@huawei.com> Cc: Jakob Koschel <jakobkoschel@gmail.com> Cc: Cai Xinchen <caixinchen1@huawei.com> Acked-by: Rafael J. Wysocki <rafael@kernel.org> Acked-by: Logan Gunthorpe <logang@deltatee.com> Link: https://lore.kernel.org/r/2023040250-pushover-platter-509c@gregkh Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-04-03Merge 6.3-rc5 into driver-core-nextGreg Kroah-Hartman
We need the fixes in here for testing, as well as the driver core changes for documentation updates to build on. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-31Merge back Intel thermal driver changes for 6.4-rc1.Rafael J. Wysocki
2023-03-27Merge back thermal control material for 6.4-rc1.Rafael J. Wysocki
2023-03-21hwmon (it87): Fix voltage scaling for chips with 10.9mV ADCsFrank Crawford
Fix voltage scaling for chips that have 10.9mV ADCs, where scaling was not performed. Fixes: ead8080351c9 ("hwmon: (it87) Add support for IT8732F") Signed-off-by: Frank Crawford <frank@crawford.emu.id.au> Link: https://lore.kernel.org/r/20230318080543.1226700-2-frank@crawford.emu.id.au [groeck: Update subject and description to focus on bug fix] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-03-21hwmon: (xgene) Fix ioremap and memremap leakTianyi Jing
Smatch reports: drivers/hwmon/xgene-hwmon.c:757 xgene_hwmon_probe() warn: 'ctx->pcc_comm_addr' from ioremap() not released on line: 757. This is because in drivers/hwmon/xgene-hwmon.c:701 xgene_hwmon_probe(), ioremap and memremap is not released, which may cause a leak. To fix this, ioremap and memremap is modified to devm_ioremap and devm_memremap. Signed-off-by: Tianyi Jing <jingfelix@hust.edu.cn> Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn> Link: https://lore.kernel.org/r/20230318143851.2191625-1-jingfelix@hust.edu.cn [groeck: Fixed formatting and subject] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-03-21hwmon: fix potential sensor registration fail if of_node is missingPhinex Hung
It is not sufficient to check of_node in current device. In some cases, this would cause the sensor registration to fail. This patch looks for device's ancestors to find a valid of_node if any. Fixes: d560168b5d0f ("hwmon: (core) New hwmon registration API") Signed-off-by: Phinex Hung <phinex@realtek.com> Link: https://lore.kernel.org/r/20230321060224.3819-1-phinex@realtek.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-03-21hwmon: (peci/cputemp) Fix miscalculated DTS for SKXIwona Winiarska
For Skylake, DTS temperature of the CPU is reported in S10.6 format instead of S8.8. Reported-by: Paul Fertser <fercerpav@gmail.com> Link: https://lore.kernel.org/lkml/ZBhHS7v+98NK56is@home.paul.comp/ Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com> Link: https://lore.kernel.org/r/20230321090410.866766-1-iwona.winiarska@intel.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-03-17drivers: remove struct module * setting from struct classGreg Kroah-Hartman
There is no need to manually set the owner of a struct class, as the registering function does it automatically, so remove all of the explicit settings from various drivers that did so as it is unneeded. This allows us to remove this pointer entirely from this structure going forward. Cc: "Rafael J. Wysocki" <rafael@kernel.org> Link: https://lore.kernel.org/r/20230313181843.1207845-2-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-15hwmon: (ltc2992) Set `can_sleep` flag for GPIO chipLars-Peter Clausen
The ltc2992 drivers uses a mutex and I2C bus access in its GPIO chip `set` and `get` implementation. This means these functions can sleep and the GPIO chip should set the `can_sleep` property to true. This will ensure that a warning is printed when trying to set or get the GPIO value from a context that potentially can't sleep. Fixes: 9ca26df1ba25 ("hwmon: (ltc2992) Add support for GPIOs.") Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20230314093146.2443845-2-lars@metafoo.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-03-15hwmon: (adm1266) Set `can_sleep` flag for GPIO chipLars-Peter Clausen
The adm1266 driver uses I2C bus access in its GPIO chip `set` and `get` implementation. This means these functions can sleep and the GPIO chip should set the `can_sleep` property to true. This will ensure that a warning is printed when trying to set or get the GPIO value from a context that potentially can't sleep. Fixes: d98dfad35c38 ("hwmon: (pmbus/adm1266) Add support for GPIOs") Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20230314093146.2443845-1-lars@metafoo.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-03-12hwmon: tmp512: drop of_match_ptr for ID tableKrzysztof Kozlowski
The driver will match mostly by DT table (even thought there is regular ID table) so there is little benefit in of_match_ptr (this also allows ACPI matching via PRP0001, even though it might not be relevant here). This also fixes !CONFIG_OF error: drivers/hwmon/tmp513.c:610:34: error: ‘tmp51x_of_match’ defined but not used [-Werror=unused-const-variable=] Fixes: 59dfa75e5d82 ("hwmon: Add driver for Texas Instruments TMP512/513 sensor chips.") Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230312193723.478032-2-krzysztof.kozlowski@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-03-12hwmon: (ucd90320) Add minimum delay between bus accessesLars-Peter Clausen
When probing the ucd90320 access to some of the registers randomly fails. Sometimes it NACKs a transfer, sometimes it returns just random data and the PEC check fails. Experimentation shows that this seems to be triggered by a register access directly back to back with a previous register write. Experimentation also shows that inserting a small delay after register writes makes the issue go away. Use a similar solution to what the max15301 driver does to solve the same problem. Create a custom set of bus read and write functions that make sure that the delay is added. Fixes: a470f11c5ba2 ("hwmon: (pmbus/ucd9000) Add support for UCD90320 Power Sequencer") Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20230312160312.2227405-1-lars@metafoo.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-03-12hwmon: (ina3221) return prober error codeMarcus Folkesson
ret is set to 0 which do not indicate an error. Return -EINVAL instead. Fixes: a9e9dd9c6de5 ("hwmon: (ina3221) Read channel input source info from DT") Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com> Link: https://lore.kernel.org/r/20230310075035.246083-1-marcus.folkesson@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-03-12hwmon: (xgene) Fix use after free bug in xgene_hwmon_remove due to race ↵Zheng Wang
condition In xgene_hwmon_probe, &ctx->workq is bound with xgene_hwmon_evt_work. Then it will be started. If we remove the driver which will call xgene_hwmon_remove to clean up, there may be unfinished work. The possible sequence is as follows: Fix it by finishing the work before cleanup in xgene_hwmon_remove. CPU0 CPU1 |xgene_hwmon_evt_work xgene_hwmon_remove | kfifo_free(&ctx->async_msg_fifo);| | |kfifo_out_spinlocked |//use &ctx->async_msg_fifo Fixes: 2ca492e22cb7 ("hwmon: (xgene) Fix crash when alarm occurs before driver probe") Signed-off-by: Zheng Wang <zyytlz.wz@163.com> Link: https://lore.kernel.org/r/20230310084007.1403388-1-zyytlz.wz@163.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-03-05hwmon: (adt7475) Fix masking of hysteresis registersTony O'Brien
The wrong bits are masked in the hysteresis register; indices 0 and 2 should zero bits [7:4] and preserve bits [3:0], and index 1 should zero bits [3:0] and preserve bits [7:4]. Fixes: 1c301fc5394f ("hwmon: Add a driver for the ADT7475 hardware monitoring chip") Signed-off-by: Tony O'Brien <tony.obrien@alliedtelesis.co.nz> Link: https://lore.kernel.org/r/20230222005228.158661-3-tony.obrien@alliedtelesis.co.nz Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-03-05hwmon: (adt7475) Display smoothing attributes in correct orderTony O'Brien
Throughout the ADT7475 driver, attributes relating to the temperature sensors are displayed in the order Remote 1, Local, Remote 2. Make temp_st_show() conform to this expectation so that values set by temp_st_store() can be displayed using the correct attribute. Fixes: 8f05bcc33e74 ("hwmon: (adt7475) temperature smoothing") Signed-off-by: Tony O'Brien <tony.obrien@alliedtelesis.co.nz> Link: https://lore.kernel.org/r/20230222005228.158661-2-tony.obrien@alliedtelesis.co.nz Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-03-03thermal: Add a thermal zone id accessorDaniel Lezcano
In order to get the thermal zone id but without directly accessing the thermal zone device structure, add an accessor. Use the accessor in the hwmon_scmi and acpi_thermal. No functional change intented. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>