Commit Graph

5546 Commits

Author SHA1 Message Date
Jinjie Ruan
3fd38c6434 hwmon: (ina3221): Simplify with scoped for each OF child loop
Use scoped for_each_child_of_node_scoped() when iterating over device
nodes to make code a bit simpler.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Message-ID: <20240822062956.3490387-4-ruanjinjie@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-27 08:11:15 -07:00
Jinjie Ruan
d5733a9387 hwmon: (aspeed-pwm-tacho): Simplify with scoped for each OF child loop
Use scoped for_each_child_of_node_scoped() when iterating over device
nodes to make code a bit simpler.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Message-ID: <20240822062956.3490387-3-ruanjinjie@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-27 08:11:15 -07:00
Jinjie Ruan
24b070d7d8 hwmon: (aspeed-g6-pwm-tacho): Simplify with scoped for each OF child loop
Use scoped for_each_child_of_node_scoped() when iterating over device
nodes to make code a bit simpler.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Message-ID: <20240822062956.3490387-2-ruanjinjie@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-27 08:11:15 -07:00
Mario Limonciello
4599510091 hwmon: (k10temp): Use cpu_feature_enabled() for detecting zen
This removes some boilerplate from the code and will allow adding
future CPUs by just device IDs.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Message-ID: <20240820053558.1052853-1-superm1@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-27 08:11:15 -07:00
Derek J. Clark
b82b38a499 hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.

Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.

Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.

Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-27 08:10:33 -07:00
Rob Herring (Arm)
0830d3bbda hwmon: (stts751) Add "st" vendor prefix to "stts751" compatible string
The documented compatible string is "st,stts751", not "stts751". Even if
"stts751" was in use, there's no need to list "stts751" in the DT match
table. The I2C core will strip any vendor prefix and match against the
i2c_device_id table which has an "stts751" entry.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Message-ID: <20240826191811.1416011-1-robh@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-27 08:10:23 -07:00
Yuntao Liu
b6964d66a0 hwmon: (ntc_thermistor) fix module autoloading
Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded
based on the alias from of_device_id table.

Fixes: 9e8269de10 ("hwmon: (ntc_thermistor) Add DT with IIO support to NTC thermistor driver")
Signed-off-by: Yuntao Liu <liuyuntao12@huawei.com>
Message-ID: <20240815083021.756134-1-liuyuntao12@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-27 08:10:23 -07:00
Yue Haibing
720c741c22 hwmon: (sch5627) Remove unused declaration sch56xx_watchdog_unregister()
Commit 2be5f0d753 ("hwmon: (sch56xx) Use devres functions for watchdog")
removed the implementation but leave declaration.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Message-ID: <20240816095740.877729-1-yuehaibing@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-27 08:10:23 -07:00
Liao Chen
fa8df3cbd3 hwmon: (gsc-hwmon) fix module autoloading
Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded
based on the alias from of_device_id table.

Signed-off-by: Liao Chen <liaochen4@huawei.com>
Message-ID: <20240814024555.3875387-1-liaochen4@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-27 08:10:23 -07:00
Maximilian Luz
63be321e5a hwmon: Add thermal sensor driver for Surface Aggregator Module
Some of the newer Microsoft Surface devices (such as the Surface Book
3 and Pro 9) have thermal sensors connected via the Surface Aggregator
Module (the embedded controller on those devices). Add a basic driver
to read out the temperature values of those sensors.

The EC can have up to 16 thermal sensors connected via a single
sub-device, each providing temperature readings and a label string.

Link: https://github.com/linux-surface/surface-aggregator-module/issues/59
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Co-developed-by: Ivor Wanders <ivor@iwanders.net>
Signed-off-by: Ivor Wanders <ivor@iwanders.net>
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Message-ID: <20240811001503.753728-1-luzmaximilian@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-27 08:10:23 -07:00
Denis Pauk
1f432e4cf1 hwmon: (nct6775) add G15CF to ASUS WMI monitoring list
Boards G15CF has got a nct6775 chip, but by default there's no use of it
because of resource conflict with WMI method.

Add the board 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: Attila <attila@fulop.one>
Message-ID: <20240812152652.1303-1-pauk.denis@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-27 08:10:23 -07:00
Javier Carrasco
f775f6d170 hwmon: (chipcap2) Drop cc2_disable() in the probe and return dev_err_probe()
There is no need to actively disable a regulator that has not been
enabled by the driver, which makes the call to cc2_disable() in the
probe function meaningless, because the probe function never enables
the device's dedicated regulator.

Once the call to cc2_disable() is dropped, the error paths can directly
return dev_err_probe() in all cases.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Message-ID: <20240813-chipcap2-probe-improvements-v2-1-e9a2932a8a00@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-27 08:10:23 -07:00
Guenter Roeck
05aa8cbeab hwmon: (lm92) Update documentation
Update datasheet references. Replace misleading 'force parameter needed'
with 'must be instantiated explicitly'. Explain the reason for the missing
auto-detection. Mention all supported chips in Kconfig.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-27 08:10:23 -07:00
Guenter Roeck
c21eced115 hwmon: (lm92) Convert to with_info hwmon API
Convert driver to with_info hwmon API to simplify the code and
to reduce its size.

No functional change.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-27 08:10:23 -07:00
Guenter Roeck
1359590a5c hwmon: (lm92) Convert to use regmap
Use regmap for local caching and for multi-byte operations to be able
to use regmap API functions and to reduce the need for locking in the
driver.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-27 08:10:23 -07:00
Guenter Roeck
fcb49571b4 hwmon: (lm92) Replace chip IDs with limit register resolution
The chip IDs are not used by the driver. Drop them. Use driver data to
store the limit register resolution instead, and use this information
when writing temperature limits to improve chip specific rounding and
to avoid writing into unused register bits.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-27 08:10:22 -07:00
Guenter Roeck
82efdeff3c hwmon: (lm92) Reorder include files to alphabetic order
Simplify driver maintenance by reordering files to alphabetic order.

No functional change.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-27 08:10:22 -07:00
Guenter Roeck
3a3dbff8a7 hwmon: (lm92) Improve auto-detection accuracy
Checking three configuration register bits and the manufacturer ID
register to auto-detect LM92 is a bit vague. Repeat twice on replicated
register addresses to improve detection accuracy.  Check the manufacturer
ID first and bail out immediately without reading the other register if
there is a mismatch to reduce the number of i2c transfers needed in that
case. Also explicitly test for an error from reading the configuration
register to avoid potential situations where the returned error masked
against 0xe0 is 0.

While at it, drop "lm92: Found National Semiconductor LM92 chip" detection
noise.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-27 08:10:22 -07:00
Rob Herring (Arm)
85f72ffe0f hwmon: (vexpress) Use of_property_present()
Use of_property_present() to test for property presence rather than
of_get_property(). This is part of a larger effort to remove callers
of of_get_property() and similar functions. of_get_property() leaks
the DT property data pointer which is a problem for dynamically
allocated nodes which may be freed.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Link: https://lore.kernel.org/r/20240731191312.1710417-13-robh@kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-27 08:10:11 -07:00
Cosmo Chou
7bbc079531 hwmon: (pt5161l) Fix invalid temperature reading
The temperature reading function was using a signed long for the ADC
code, which could lead to mishandling of invalid codes on 32-bit
platforms. This allowed out-of-range ADC codes to be incorrectly
interpreted as valid values and used in temperature calculations.

Change adc_code to u32 to ensure that invalid ADC codes are correctly
identified on all platforms.

Fixes: 1b2ca93cd0 ("hwmon: Add driver for Astera Labs PT5161L retimer")
Signed-off-by: Cosmo Chou <chou.cosmo@gmail.com>
Message-ID: <20240819104630.2375441-1-chou.cosmo@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-26 20:58:05 -07:00
Ross Brown
9efaebc007 hwmon: (asus-ec-sensors) remove VRM temp X570-E GAMING
X570-E GAMING does not have VRM temperature sensor.

Signed-off-by: Ross Brown <true.robot.ross@gmail.com>
Signed-off-by: Eugene Shalygin <eugene.shalygin@gmail.com>
Link: https://lore.kernel.org/r/20240730062320.5188-2-eugene.shalygin@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-25 15:26:25 -07:00
Guenter Roeck
90368fa397 hwmon: (max1619) Improve chip detection code
Bail out immediately if reading any of the registers used for chip
detection fails, or if it returns an unexpected value. Drop all log
messages from detection code.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:53 -07:00
Guenter Roeck
13047ebe63 hwmon: (max1619) Add support for update_interval attribute
The chip supports reading and writing the conversion rate.
Add support for the update_interval sysfs attribute.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:53 -07:00
Guenter Roeck
f0b1f1f468 hwmon: (max1619) Convert to with_info API
Convert driver to with_info hwmon API to simplify the code and
with it its maintainability.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:53 -07:00
Guenter Roeck
f8016132ce hwmon: (max1619) Convert to use regmap
Use regmap for local caching, to hide register read/write address
differences, and for multi-byte operations. With this change,
the driver specific lock is no longer necessary.

While at it, check errors seen when initializing the chip and bail out
if chip initialization fails.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:53 -07:00
Guenter Roeck
02c3c4e702 hwmon: (max1619) Mask valid alarm bits
Bit 0, 5, and 6 in the status register are reserved and, if set, do not
indicate an alarm. Bit 7 is the 'busy' bit and also does not indicate
an alarm. Mask the non-alarm bits to avoid reporting them to userspace.

Cc: Tzung-Bi Shih <tzungbi@kernel.org>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:53 -07:00
Guenter Roeck
216147e624 hwmon: (max1619) Reorder include files to alphabetic order
Simplify maintenance by reordering include files to alphabetic order.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:53 -07:00
Guenter Roeck
88c0f840df hwmon: (max1619) Clamp temperature range when writing limits
Module test code reports underflows when writing sensor limits.

temp2_min: Suspected underflow: [min=-77000, read 101000, written -2147483648]
temp2_max: Suspected underflow: [min=-77000, read 101000, written -2147483648]
temp2_crit: Suspected underflow: [min=-77000, read 101000, written -2147483648]

Clamp temperature ranges when writing limits to fix the problem.
While at it, use sign_extend32() when reading temperatures to make
the code easier to understand.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:53 -07:00
Guenter Roeck
3adc2857bb hwmon: (max6697) Document discrepancy in overtemperature status bit values
In the MAX6581 datasheet Revision 0 to 3, the local channel overtemperature
status is reported in bit 6 of register 0x45, and the overtemperature
status for remote channel 7 is reported in bit 7. In Revision 4 and later,
the local channel overtemperature status is reported in bit 7, and the
remote channel 7 overtemperature status is reported in bit 6. A real
chip was found to match the functionality documented in Revision 4 and
later.

The code was fixed with commit 1ea3fd1eb9 ("hwmon: (max6697) Fix swapped
temp{1,8} critical alarms"). At that time it looked like this was an
original bug. It only turned out later that the problem was the result of
incorrect information in the chip datasheet.

Document the discrepancy to avoid confusion caused by old versions of the
datasheet.

Cc: Tzung-Bi Shih <tzungbi@kernel.org>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:53 -07:00
Guenter Roeck
c1b93b5414 hwmon: (max1668) Convert to use with_info hwmon API
Convert to use with_info API to simplify the code and to reduce its size.

This patch reduces object file size by approximately 25%.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:53 -07:00
Guenter Roeck
355c529077 hwmon: (max1668) Replace chip type with number of channels
The only difference between supported chips is the number of channels.
Drop enum chips and list the number of channels in struct i2c_device_id
directly.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:53 -07:00
Guenter Roeck
021730acbc hwmon: (max1668) Convert to use regmap
Use regmap for caching to simplify the code and to hide read/write
register address differences.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:53 -07:00
Guenter Roeck
696dbe45fb hwmon: (max1668) Use BIT macro
Use bit macro to make the code easier to understand and reduce duplication.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:53 -07:00
Guenter Roeck
74b6451beb hwmon: (max1668) Reorder include files to alphabetic order
Reorder include files to alphabetic order to simplify driver maintenance.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:52 -07:00
Nuno Sa
e21d6d4c7a hwmon: (ltc2947) Move to firmware agnostic API
Use the device property APIs so the driver does not depend on OF to
work.

While at it, properly include mod_devicetable for struct of_device_id
and fix some parameter alignment in the changed places.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240726-dev-hwmon-ltc6947-fw-agnostic-v1-1-f7d6cab7d438@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:52 -07:00
Chris Packham
777c97ff08 hwmon: (adt7475) Add support for configuring initial PWM state
By default the PWM duty cycle in hardware is 100%. On some systems this
can cause unwanted fan noise. Add the ability to specify the fan
connections and initial state of the PWMs via device properties.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Link: https://lore.kernel.org/r/20240722221737.3407958-4-chris.packham@alliedtelesis.co.nz
[groeck: Cleaned up formatting]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:52 -07:00
Guenter Roeck
1e56afb1e6 hwmon: (max6697) Add support for tempX_min and tempX_min_alarm
MAX6581 supports setting the minimum temperature as well as minimum
temperature alarms. Add support for it.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:52 -07:00
Guenter Roeck
678c2a4582 hwmon: (max6697) Convert to with_info hwmon API
Convert to with_info hwmon API to simplify the code and reduce its size.

This patch reduces object file size by approximately 25%.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:52 -07:00
Guenter Roeck
3a2a8cc3fe hwmon: (max6697) Convert to use regmap
Use regmap for register caching, and use regmap API for bit operations
to simplify the code.

This patch reduces object file size by approximately 10%.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:52 -07:00
Guenter Roeck
c02b25dcf6 hwmon: (max6697) Use bit operations where possible
Use bit operations to improve code maintainability.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:52 -07:00
Guenter Roeck
f81489a136 hwmon: (max6697) Drop platform data support
Platform data is not used anywhere in the upstram kernel.
Drop support for it to simplify code maintenance.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:52 -07:00
Guenter Roeck
351047fc59 hwmon: (max6697) Reorder include files
Reorder include files to alphabetic order to improve maintainability.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:52 -07:00
Guenter Roeck
119abf7d18 hwmon: (max16065) Fix alarm attributes
Chips reporting overcurrent alarms report it in the second alarm register.
That means the second alarm register has to be read, even if the chip only
supports 8 or fewer ADC channels.

MAX16067 and MAX16068 report undervoltage and overvoltage alarms in
separate registers. Fold register contents together to report both with
the existing alarm attribute. This requires actually storing the chip type
in struct max16065_data. Rename the variable 'chip' to match the variable
name used in the probe function.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Fixes: f5bae2642e ("hwmon: Driver for MAX16065 System Manager and compatibles")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:52 -07:00
Guenter Roeck
744ec4477b hwmon: (max16065) Fix overflows seen when writing limits
Writing large limits resulted in overflows as reported by module tests.

in0_lcrit: Suspected overflow: [max=5538, read 0, written 2147483647]
in0_crit: Suspected overflow: [max=5538, read 0, written 2147483647]
in0_min: Suspected overflow: [max=5538, read 0, written 2147483647]

Fix the problem by clamping prior to multiplications and the use of
DIV_ROUND_CLOSEST, and by using consistent variable types.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Fixes: f5bae2642e ("hwmon: Driver for MAX16065 System Manager and compatibles")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:52 -07:00
Javier Carrasco
97adb1aace hwmon: (ltc2992) use device_for_each_child_node_scoped() to access child nodes
The iterated nodes are direct children of the device node, and the
`device_for_each_child_node()` macro accounts for child node
availability.

`fwnode_for_each_available_child_node()` is meant to access the child
nodes of an fwnode, and therefore not direct child nodes of the device
node.

In this case, the child nodes are not required outside the loop, and
the scoped version of the macro can be used to remove the repetitive
`goto put` pattern.

Use `device_for_each_child_node_scoped_scoped()` to indicate device's
direct child nodes.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240721-device_for_each_child_node-available-v2-2-f33748fd8b2d@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:52 -07:00
Armin Wolf
b4be51302d hwmon: (dell-smm) Add Dell Latitude 7320 to fan control whitelist
Add the Dell Latitude 7320 to the fan control whitelist to allow
for manual fan control.

Closes: https://github.com/Wer-Wolf/i8kutils/issues/8
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Acked-by: Pali Rohár <pali@kernel.org>
Link: https://lore.kernel.org/r/20240719203706.19466-1-W_Armin@gmx.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:52 -07:00
Guenter Roeck
3ec621cd6f hwmon: (lm95234) Use multi-byte regmap operations
Use  multi-byte regmap operations to simplify the code
and to reduce dependency on locking.

No functional change.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:52 -07:00
Guenter Roeck
280220236b hwmon: (lm95234) Add support for tempX_enable attribute
LM95233/LM95234 support enabling temperature channels one by one.
Add support for tempX_enable attribute to be able to use that
functionality.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:52 -07:00
Guenter Roeck
f27ab9f05c hwmon: (lm95234) Convert to with_info hwmon API
Convert to with_info API to simplify the code and reduce its size.

This patch reduces the object file size by about 30%.

No functional change.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:52 -07:00
Guenter Roeck
963f9bc976 hwmon: (lm95234) Convert to use regmap
Use regmap to replace local caching and to be able to use regmap API
functions.

No functional change.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:52 -07:00
Guenter Roeck
e38b05f0a2 hwmon: (lm95234) Use find_closest to find matching update interval
Use find_closest() instead of manually coding it to find best update
interval.

Since find_closest() uses rounding to find the best match, the resulting
update interval will now reflect the update interval that is closest to
the requested value, not the value that is lower or equal to the requested
value.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:52 -07:00
Guenter Roeck
8abff91c61 hwmon: (lm95234) Reorder include files to be in alphabetic order
Alphabetic include file order simplifies maintenance and makes it easier
to add or remove files.

No functional change.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:51 -07:00
Guenter Roeck
c37d0f08f8 hwmon: (amc6821) Use multi-byte regmap operations
Use multi-byte regmap operations where possible to reduce code size.

No functional changes.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:51 -07:00
Guenter Roeck
21a93a9e31 hwmon: (max6639) Use multi-byte regmap operations
Use multi-byte regmap operations where possible to reduce code size
and the need for mutex protection.

No functional changes.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:51 -07:00
Guenter Roeck
ad231314b6 hwmon: (tmp464) Use multi-byte regmap operations
Use multi-byte regmap operations where possible to reduce code size
and the need for mutex protection.

No functional changes.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:51 -07:00
Guenter Roeck
4ce612b16e hwmon: (adt7x10) Use multi-byte regmap operations
Use multi-byte regmap operations where possible to reduce code size
and the need for mutex protection.

No functional changes.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:51 -07:00
Guenter Roeck
7b4882d9b8 hwmon: (nct7802) Use multi-byte regmap operations
Use multi-byte regmap operations where possible to reduce code size
and the need for mutex protection.

No functional changes.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:51 -07:00
Guenter Roeck
717c04cf43 hwmon: (lm95245) Use multi-byte regmap operations
Use multi-byte regmap operations where possible to reduce code size
and the need for mutex protection.

No functional change.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:51 -07:00
Guenter Roeck
a0a16d960f hwmon: (tmp401) Use multi-byte regmap operations
Use multi-byte regmap operations where possible to reduce code size
and the need for mutex protection.

No functional change.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:51 -07:00
Guenter Roeck
381cfd6305 hwmon: (adt7470) Use multi-byte regmap operations
Use multi-byte regmap operations where possible to reduce code size
and the need for mutex protection.

No functional change.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-31 10:43:51 -07:00
Shyam Sundar S K
59c34008d3 x86/amd_nb: Add new PCI IDs for AMD family 1Ah model 60h
Add new PCI device IDs into the root IDs and miscellaneous IDs lists to
provide support for the latest generation of AMD 1Ah family 60h processor
models.

Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>
Link: https://lore.kernel.org/r/20240722092801.3480266-1-Shyam-sundar.S-k@amd.com
2024-07-29 08:53:49 +02:00
Linus Torvalds
1a251f52cf minmax: make generic MIN() and MAX() macros available everywhere
This just standardizes the use of MIN() and MAX() macros, with the very
traditional semantics.  The goal is to use these for C constant
expressions and for top-level / static initializers, and so be able to
simplify the min()/max() macros.

These macro names were used by various kernel code - they are very
traditional, after all - and all such users have been fixed up, with a
few different approaches:

 - trivial duplicated macro definitions have been removed

   Note that 'trivial' here means that it's obviously kernel code that
   already included all the major kernel headers, and thus gets the new
   generic MIN/MAX macros automatically.

 - non-trivial duplicated macro definitions are guarded with #ifndef

   This is the "yes, they define their own versions, but no, the include
   situation is not entirely obvious, and maybe they don't get the
   generic version automatically" case.

 - strange use case #1

   A couple of drivers decided that the way they want to describe their
   versioning is with

	#define MAJ 1
	#define MIN 2
	#define DRV_VERSION __stringify(MAJ) "." __stringify(MIN)

   which adds zero value and I just did my Alexander the Great
   impersonation, and rewrote that pointless Gordian knot as

	#define DRV_VERSION "1.2"

   instead.

 - strange use case #2

   A couple of drivers thought that it's a good idea to have a random
   'MIN' or 'MAX' define for a value or index into a table, rather than
   the traditional macro that takes arguments.

   These values were re-written as C enum's instead. The new
   function-line macros only expand when followed by an open
   parenthesis, and thus don't clash with enum use.

Happily, there weren't really all that many of these cases, and a lot of
users already had the pattern of using '#ifndef' guarding (or in one
case just using '#undef MIN') before defining their own private version
that does the same thing. I left such cases alone.

Cc: David Laight <David.Laight@aculab.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-07-28 15:49:18 -07:00
Linus Torvalds
acc5965b9f Char/Misc and other driver changes for 6.11-rc1
Here is the "big" set of char/misc and other driver subsystem changes
 for 6.11-rc1.  Nothing major in here, just loads of new drivers and
 updates.  Included in here are:
   - IIO api updates and new drivers added
   - wait_interruptable_timeout() api cleanups for some drivers
   - MODULE_DESCRIPTION() additions for loads of drivers
   - parport out-of-bounds fix
   - interconnect driver updates and additions
   - mhi driver updates and additions
   - w1 driver fixes
   - binder speedups and fixes
   - eeprom driver updates
   - coresight driver updates
   - counter driver update
   - new misc driver additions
   - other minor api updates
 
 All of these, EXCEPT for the final Kconfig build fix for 32bit systems,
 have been in linux-next for a while with no reported issues.  The
 Kconfig fixup went in 29 hours ago, so might have missed the latest
 linux-next, but was acked by everyone involved.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCZppR4w8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ykwoQCeIaW3nbOiNTmOupvEnZwrN3yVNs8An3Q5L+Br
 1LpTASaU6A8pN81Z1m5g
 =6U1z
 -----END PGP SIGNATURE-----

Merge tag 'char-misc-6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char / misc and other driver updates from Greg KH:
 "Here is the "big" set of char/misc and other driver subsystem changes
  for 6.11-rc1. Nothing major in here, just loads of new drivers and
  updates. Included in here are:

   - IIO api updates and new drivers added

   - wait_interruptable_timeout() api cleanups for some drivers

   - MODULE_DESCRIPTION() additions for loads of drivers

   - parport out-of-bounds fix

   - interconnect driver updates and additions

   - mhi driver updates and additions

   - w1 driver fixes

   - binder speedups and fixes

   - eeprom driver updates

   - coresight driver updates

   - counter driver update

   - new misc driver additions

   - other minor api updates

  All of these, EXCEPT for the final Kconfig build fix for 32bit
  systems, have been in linux-next for a while with no reported issues.
  The Kconfig fixup went in 29 hours ago, so might have missed the
  latest linux-next, but was acked by everyone involved"

* tag 'char-misc-6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (330 commits)
  misc: Kconfig: exclude mrvl-cn10k-dpi compilation for 32-bit systems
  misc: delete Makefile.rej
  binder: fix hang of unregistered readers
  misc: Kconfig: add a new dependency for MARVELL_CN10K_DPI
  virtio: add missing MODULE_DESCRIPTION() macro
  agp: uninorth: add missing MODULE_DESCRIPTION() macro
  spmi: add missing MODULE_DESCRIPTION() macros
  dev/parport: fix the array out-of-bounds risk
  samples: configfs: add missing MODULE_DESCRIPTION() macro
  misc: mrvl-cn10k-dpi: add Octeon CN10K DPI administrative driver
  misc: keba: Fix missing AUXILIARY_BUS dependency
  slimbus: Fix struct and documentation alignment in stream.c
  MAINTAINERS: CC dri-devel list on Qualcomm FastRPC patches
  misc: fastrpc: use coherent pool for untranslated Compute Banks
  misc: fastrpc: support complete DMA pool access to the DSP
  misc: fastrpc: add missing MODULE_DESCRIPTION() macro
  misc: fastrpc: Add missing dev_err newlines
  misc: fastrpc: Use memdup_user()
  nvmem: core: Implement force_ro sysfs attribute
  nvmem: Use sysfs_emit() for type attribute
  ...
2024-07-19 15:55:08 -07:00
Linus Torvalds
222dfb8326 - Make error checking of AMD SMN accesses more robust in the callers as
they're the only ones who can interpret the results properly
 
  - The usual cleanups and fixes, left and right
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEzv7L6UO9uDPlPSfHEsHwGGHeVUoFAmaVOU0ACgkQEsHwGGHe
 VUqeFBAAl9X4bj08GwSAXfqBangXaGpKO4Nx0VZiFCYDkQ/TDnchMEBbpRWSuVzS
 SEnVSrcAXCxKqhv295UyFMmv2a+q3UUidkxTzRfznekMZMMylHYcfCFrg16w9ZNJ
 N/cBquTu96hSJHd2/usNUvNPLllTrMoIg3gofBav+NTaHQQDmzvM5htfewREY9OF
 SRS/86o3u5oIsRKKiJRyzfLzzX9lEGUvU+lvxv/yu1x2Q6SG0guhfM3HeaSxCIOs
 yeB23bwe/N/pO5KlqOtEJJL49Ypu2k/jfiS2rhH6AxSqNfXVpBlDbnahu9sA973n
 irzWwycJhVU4OQ3pqmPXdcKDqn7GmUWDsjrkEIOqJeBCSukmlM7APi8Ss8yGZ3X4
 HgDw10c900ldrxSo0H5PdpeULvowpeptpzBY8gzcdum4s0vNUvZLy/n1AKo7ydea
 oJ+ZBdXvywnR66uGQLkTxLvpGTNgyFrKDORHuyOAwJTN5CbLuco2SV/82mkcQCZt
 sAgyiWFvIcLoHZPfY8BNztYWVX01lWDIxFHJE8ca/B97mBeZCC3w1DnHJla8Kxsg
 zCMV0yn61BdMvjVS9AGaKqEuN0gYYrs/QOjtOp5ggAv7QC1ke/wqgZoFGvLbmcP9
 pIf8GzCt34u3tACGAl76toP0rtnMjGvKD8xXdHGHf7AAj1jKo28=
 =rd6Q
 -----END PGP SIGNATURE-----

Merge tag 'x86_misc_for_v6.11_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull misc x86 updates from Borislav Petkov:

 - Make error checking of AMD SMN accesses more robust in the callers as
   they're the only ones who can interpret the results properly

 - The usual cleanups and fixes, left and right

* tag 'x86_misc_for_v6.11_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/kmsan: Fix hook for unaligned accesses
  x86/platform/iosf_mbi: Convert PCIBIOS_* return codes to errnos
  x86/pci/xen: Fix PCIBIOS_* return code handling
  x86/pci/intel_mid_pci: Fix PCIBIOS_* return code handling
  x86/of: Return consistent error type from x86_of_pci_irq_enable()
  hwmon: (k10temp) Rename _data variable
  hwmon: (k10temp) Remove unused HAVE_TDIE() macro
  hwmon: (k10temp) Reduce k10temp_get_ccd_support() parameters
  hwmon: (k10temp) Define a helper function to read CCD temperature
  x86/amd_nb: Enhance SMN access error checking
  hwmon: (k10temp) Check return value of amd_smn_read()
  EDAC/amd64: Check return value of amd_smn_read()
  EDAC/amd64: Remove unused register accesses
  tools/x86/kcpuid: Add missing dir via Makefile
  x86, arm: Add missing license tag to syscall tables files
2024-07-15 19:53:07 -07:00
Linus Torvalds
500a711df6 hwmon updates for v6.11-rc1
* Obsolete driver removals
 
   - Removed obsolete adm1021 and max6642 drivers
 
 * New drivers
 
   - MPS MP2891
 
   - MPS MP2993
 
   - MPS MP9941
 
   - MPS MP5920
 
   - SPD5118 (Temperature Sensor and EEPROM)
 
 * Added device support to existing drivers
 
   - g762: G761
 
   - dell-smm: Dell OptiPlex 7060
 
   - asus-ec-sensors: ProArt X670E-CREATOR WIFI
 
   - corsair-psu: HX1200i Series 2023 psu
 
   - nzxt-smart2: Additional USB IS for NZXT RGB & Fan Controller
 
 * Notable enhancements and fixes
 
   - Removed use of i2c_match_id()
 
   - Constified struct regmap_config where feasible
 
   - Cleaned up amc6821 driver, and converted to use regmap and with_info API
 
   - Converted max6639 driver to use with_info API; added support for
     additional sysfs attributes
 
   - Fixed various sysfs attribute underflows
 
   - Added PEC support to hwmon core, and use in lm90 and max31827 drivers
 
 * Various other minor fixes and improvements
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEiHPvMQj9QTOCiqgVyx8mb86fmYEFAmaUaiIACgkQyx8mb86f
 mYHnbRAAhyaqFF1w5B/XEuZOQ3obG+pAV1ZioE7wXpeRDlniJ9/WgFe4bPpvTNQm
 C2LHW6kVtwxybM/FOJz9BN32WiP9v2kp9upb7hhHHo32+5dv57iQR5lB+JC/7lpy
 HLisqLrPc5eDQlUiOdeph5fsKyuydxQkefbR1x4shxmcgn+D5M+AYjuAZOA6fSun
 spSzgTyPGWgGfhQjSzKoA7DHG3S2pFxRTfqOArvKLOM+ahyOCFuS8Kbq/JpqvalB
 moiyIJUeOrgJcTcHSecQ/uFxFiShGBs6EQ1Ao8O9kO0WFw7ke1fw/fWESeTvtiBm
 0Z3zfqAIKcnCXvKEupltWXf6kASx5LSlycODTZQlXEROeYhzhJw3J5qF4h0r4+EM
 oKmptVLLLekVYrjQlarBtHqpdfnwsL1GuQTk5fZz7ZbG85/ktKV6aGTeKGYdBvll
 zZSjz3Jys2u191uxATpJ3vmjaggPylX6dXgmJ9u9lW16+/OnNq7sWURekIfE3F+P
 dpZsaia2KN3WAnX/qLQWOOOBbkIIGxn48e+Hi6QY9igVUbY+P/BBfhb9UiWonLKU
 exRxAFNV5a4nM0ipJF4odwMqzC9ZjrpY6zFQFZCrG79zOO62/gADUAVzwu2LGGig
 p6hqGJmEOkJgYd0zo8KP8ABwgffn8EAtgXBtQU0RS/ls7Z0S58U=
 =ebWS
 -----END PGP SIGNATURE-----

Merge tag 'hwmon-for-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon updates from Guenter Roeck:
 "Obsolete driver removals:

   - Removed obsolete adm1021 and max6642 drivers

  New drivers:

   - MPS MP2891, MP2993, MP9941, and MP5920

   - SPD5118 (Temperature Sensor and EEPROM)

  Added device support to existing drivers:

   - g762: G761

   - dell-smm: Dell OptiPlex 7060

   - asus-ec-sensors: ProArt X670E-CREATOR WIFI

   - corsair-psu: HX1200i Series 2023 psu

   - nzxt-smart2: Additional USB IS for NZXT RGB & Fan Controller

  Notable enhancements and fixes:

   - Removed use of i2c_match_id()

   - Constified struct regmap_config where feasible

   - Cleaned up amc6821 driver, and converted to use regmap and
     with_info API

   - Converted max6639 driver to use with_info API; added support for
     additional sysfs attributes

   - Fixed various sysfs attribute underflows

   - Added PEC support to hwmon core, and use in lm90 and max31827
     drivers

  And various other minor fixes and improvements"

* tag 'hwmon-for-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (103 commits)
  hwmon: (max6697) Fix swapped temp{1,8} critical alarms
  hwmon: (max6697) Fix underflow when writing limit attributes
  hwmon: Remove obsolete adm1021 and max6642 drivers
  hwmon: (pmbus/ltc4286) Drop unused i2c device ids
  hwmon: (g762) Initialize fans after configuring clock
  hwmon: (amc6821) Add support for pwm1_mode attribute
  hwmon: (amc6821) Convert to with_info API
  hwmon: (amc6821) Convert to use regmap
  hwmon: (amc6821) Drop unnecessary enum chips
  hwmon: (amc6821) Use BIT() and GENMASK()
  hwmon: (amc6821) Use tabs for column alignment in defines
  hwmon: (amc6821) Reorder include files, drop unnecessary ones
  hwmon: (amc6821) Add support for fan1_target and pwm1_enable mode 4
  hwmon: (amc6821) Rename fan1_div to fan1_pulses
  hwmon: (amc6821) Make reading and writing fan speed limits consistent
  hwmon: (amc6821) Stop accepting invalid pwm values
  hwmon: (w83627ehf) Fix underflows seen when writing limit attributes
  hwmon: (nct6775-core) Fix underflows seen when writing limit attributes
  hwmon: (lm95234) Fix underflows seen when writing limit attributes
  hwmon: (adc128d818) Fix underflows seen when writing limit attributes
  ...
2024-07-15 17:39:13 -07:00
Linus Torvalds
89c4913893 chrome platform changes for 6.11
* New
 
   - Add "cros_ec_hwmon" driver to expose fan speed and temperature.
 
   - Add "cros_charge-control" driver to control charge thresholds and
     behaviour.
 
   - Add module parameter "log_poll_period_ms" in cros_ec_debugfs for
     tuning the poll period.
 
   - Support version 3 of EC_CMD_GET_NEXT_EVENT and keyboard matrix.
 
 * Fixes
 
   - Fix a race condition in accessing MEC (Microchip EC) memory between
     ACPI and kernel.  Serialize the memory access by an AML (ACPI
     Machine Language) mutex.
 
   - Fix an issue of wrong EC message version in cros_ec_debugfs.
 
 * Misc
 
   - Fix kernel-doc errors and cleanups.
 -----BEGIN PGP SIGNATURE-----
 
 iIkEABYKADEWIQS0yQeDP3cjLyifNRUrxTEGBto89AUCZo04zBMcdHp1bmdiaUBr
 ZXJuZWwub3JnAAoJECvFMQYG2jz0bf0BAOjE7APATFsKLuFmtKxk/1XlsspsRTWK
 vocdNAKuj9I5AQCdcrHcDreLz5ldqodCpOc4TXiZoLHIkELNQcQtOorhDw==
 =To8o
 -----END PGP SIGNATURE-----

Merge tag 'tag-chrome-platform-for-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux

Pull chrome platform updates from Tzung-Bi Shih:
 "New code:

   - Add "cros_ec_hwmon" driver to expose fan speed and temperature

   - Add "cros_charge-control" driver to control charge thresholds and
     behaviour

   - Add module parameter "log_poll_period_ms" in cros_ec_debugfs for
     tuning the poll period

   - Support version 3 of EC_CMD_GET_NEXT_EVENT and keyboard matrix

  Fixes:

   - Fix a race condition in accessing MEC (Microchip EC) memory between
     ACPI and kernel. Serialize the memory access by an AML (ACPI
     Machine Language) mutex

   - Fix an issue of wrong EC message version in cros_ec_debugfs

  Misc:

   - Fix kernel-doc errors and cleanups"

* tag 'tag-chrome-platform-for-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux: (28 commits)
  power: supply: cros_charge-control: Fix signedness bug in charge_behaviour_store()
  power: supply: cros_charge-control: Avoid accessing attributes out of bounds
  power: supply: cros_charge-control: don't load if Framework control is present
  power: supply: add ChromeOS EC based charge control driver
  platform/chrome: cros_ec_proto: Introduce cros_ec_get_cmd_versions()
  platform/chrome: Update binary interface for EC-based charge control
  ACPI: battery: add devm_battery_hook_register()
  dt-bindings: input: cros-ec-keyboard: Add keyboard matrix v3.0
  platform/chrome: cros_ec_lpc: Handle zero length read/write
  platform/chrome: cros_ec_lpc: Fix error code in cros_ec_lpc_mec_read_bytes()
  platform/chrome: cros_ec_debugfs: fix wrong EC message version
  platform/chrome: cros_ec_proto: update Kunit test for get_next_data_v3
  platform/chrome: cros_ec_proto: add missing MODULE_DESCRIPTION() macro
  hwmon: (cros_ec) Fix access to restricted __le16
  hwmon: (cros_ec) Prevent read overflow in probe()
  platform/chrome: cros_ec_lpc: Add quirks for Framework Laptop
  platform/chrome: cros_ec_lpc: Add a new quirk for AML mutex
  platform/chrome: cros_ec_lpc: Add a new quirk for ACPI id
  platform/chrome: cros_ec_lpc: MEC access can use an AML mutex
  platform/chrome: cros_ec_lpc: MEC access can return error code
  ...
2024-07-15 17:25:38 -07:00
Guenter Roeck
1ea3fd1eb9 hwmon: (max6697) Fix swapped temp{1,8} critical alarms
The critical alarm bit for the local temperature sensor (temp1) is in
bit 7 of register 0x45 (not bit 6), and the critical alarm bit for remote
temperature sensor 7 (temp8) is in bit 6 (not bit 7).

This only affects MAX6581 since all other chips supported by this driver
do not support those critical alarms.

Fixes: 5372d2d71c ("hwmon: Driver for Maxim MAX6697 and compatibles")
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-14 11:49:01 -07:00
Guenter Roeck
cbf7467828 hwmon: (max6697) Fix underflow when writing limit attributes
Using DIV_ROUND_CLOSEST() on an unbound value can result in underflows.
Indeed, module test scripts report:

temp1_max: Suspected underflow: [min=0, read 255000, written -9223372036854775808]
temp1_crit: Suspected underflow: [min=0, read 255000, written -9223372036854775808]

Fix by introducing an extra set of clamping.

Fixes: 5372d2d71c ("hwmon: Driver for Maxim MAX6697 and compatibles")
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-14 11:48:50 -07:00
Guenter Roeck
ed99ae74f2 hwmon: Remove obsolete adm1021 and max6642 drivers
ADM1021, MAX6642, and compatible chips are supported by the lm90 driver.
Remove the obsolete stand-alone drivers to reduce maintenance overhead.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-14 11:48:43 -07:00
Uwe Kleine-König
04e3bb0b00 hwmon: (pmbus/ltc4286) Drop unused i2c device ids
The driver doesn't make use of the different numbers assigned to the
different devices. So drop them.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/9a48ba0368e0c8cddc94c5e4cf3edd7eadc03a2d.1720600141.git.u.kleine-koenig@baylibre.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-10 07:11:34 -07:00
Guenter Roeck
f4a180247e hwmon: (g762) Initialize fans after configuring clock
Adding support for G761 included adding support for an internal clock.
Enabling the internal clock requires setting a bit in the FAN_CMD2
register. This is implemented in g762_fan_init(). However, g762_fan_init()
is called before clock support is selected, and the flag indicating that
the internal clock should be used is not yet set.

Initialize the clock before initializing the fan to solve the problem.
While at it, also add "g7621" to the i2c_device_id array.

Cc: Christian Marangi <ansuelsmth@gmail.com>
Fixes: 6ce402327a ("hwmon: g672: add support for g761")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-09 15:45:48 -07:00
Guenter Roeck
4814241a58 hwmon: (amc6821) Add support for pwm1_mode attribute
AMC6821 supports configuring if a fan is DC or PWM controlled.
Add support for the pwm1_mode attribute to make it runtime configurable.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
e98ab50e1f hwmon: (amc6821) Convert to with_info API
Convert to use with_info API to simplify the code and make it easier
to maintain. This also reduces code size by approximately 20%.

No functional change intended.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
a051d507ba hwmon: (amc6821) Convert to use regmap
Use regmap for register accesses and caching.

While at it, use sysfs_emit() instead of sprintf() to write sysfs
attribute data, and remove spurious debug messages which would only
be seen as result of a bug in the code. Also make sure that error
codes are propagated and not replaced with -EIO.

While at it, introduce rounding of written temperature values and for
internal calculations to reduce deviation from written values and as
much as possible.

No functional change intended except for differences introduced by
rounding.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
8d061050fd hwmon: (amc6821) Drop unnecessary enum chips
The driver only supports a single chip, so an enum
to determine the chip type is unnecessary. Drop it.

No functional change intended.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
a9c2f41f02 hwmon: (amc6821) Use BIT() and GENMASK()
Use BIT() and GENMASK() for bit and mask definitions
to help distinguish bit and mask definitions from other
defines and to make the code easier to read.

No functional change intended.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
d632e82993 hwmon: (amc6821) Use tabs for column alignment in defines
Using tabs for column alignment makes the code easier to read.

No functional change intended.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
e5cd7dd9a4 hwmon: (amc6821) Reorder include files, drop unnecessary ones
Reorder include files to alphabetic order to simplify maintenance,
and drop the unnecessary kernel.h include.

No functional change intended.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
becbd16ed2 hwmon: (amc6821) Add support for fan1_target and pwm1_enable mode 4
After setting fan1_target and setting pwm1_enable to 4,
the fan controller tries to achieve the requested fan speed.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
154a0c2bd6 hwmon: (amc6821) Rename fan1_div to fan1_pulses
The chip does not have a fan divisor. What it does have is a configuration
to set either 2 or 4 pulses per fan rotation. Rename the attribute to
reflect its use. Update documentation accordingly.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
8f4fd97df2 hwmon: (amc6821) Make reading and writing fan speed limits consistent
The default value of the maximum fan speed limit register is 0,
essentially translating to an unlimited fan speed. When reading
the limit, a value of 0 is reported in this case. However, writing
a value of 0 results in writing a value of 0xffff into the register,
which is inconsistent.

To solve the problem, permit writing a limit of 0 for the maximim fan
speed, effectively translating to "no limit". Write 0 into the register
if a limit value of 0 is written. Otherwise limit the range to
<1..6000000> and write 1..0xffff into the register. This ensures that
reading and writing from and to a limit register return the same value
while at the same time not changing reported values when reading the
speed or limits.

While at it, restrict fan limit writes to non-negative numbers; writing
a negative limit does not make sense and should be reported instead of
being corrected.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
af4d04b8ce hwmon: (amc6821) Stop accepting invalid pwm values
The pwm value range is well defined from 0..255. Don't accept any values
outside this range.

This changes the valid range of pwm1_auto_point2_pwm from 0..254 to 0..255,
meaning it can now be equivalent to not only pwm1_auto_point1_pwm (which is
always 0) but also to pwm1_auto_point3_pwm (which is always 255). While
that may not be practical, there seems to be no technical reason for
preventing a user from doing it.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
5c1de37969 hwmon: (w83627ehf) Fix underflows seen when writing limit attributes
DIV_ROUND_CLOSEST() after kstrtol() results in an underflow if a large
negative number such as -9223372036854775808 is provided by the user.
Fix it by reordering clamp_val() and DIV_ROUND_CLOSEST() operations.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-07 07:48:25 -07:00
Guenter Roeck
0403e10bf0 hwmon: (nct6775-core) Fix underflows seen when writing limit attributes
DIV_ROUND_CLOSEST() after kstrtol() results in an underflow if a large
negative number such as -9223372036854775808 is provided by the user.
Fix it by reordering clamp_val() and DIV_ROUND_CLOSEST() operations.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-07 07:48:25 -07:00
Guenter Roeck
af64e3e153 hwmon: (lm95234) Fix underflows seen when writing limit attributes
DIV_ROUND_CLOSEST() after kstrtol() results in an underflow if a large
negative number such as -9223372036854775808 is provided by the user.
Fix it by reordering clamp_val() and DIV_ROUND_CLOSEST() operations.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-07 07:48:25 -07:00
Guenter Roeck
8cad724c85 hwmon: (adc128d818) Fix underflows seen when writing limit attributes
DIV_ROUND_CLOSEST() after kstrtol() results in an underflow if a large
negative number such as -9223372036854775808 is provided by the user.
Fix it by reordering clamp_val() and DIV_ROUND_CLOSEST() operations.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-07 07:48:25 -07:00
Javier Carrasco
0811b8b03b hwmon: (gsc-hwmon) constify read-only struct regmap_bus
`gsc_hwmon_regmap_bus` is not modified and can be declared as const to
move its data to a read-only section.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240705-hwmon-const-regmap-v1-1-7cde543ba818@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-05 14:37:01 -07:00
Dan Carpenter
99bf7c2ecc hwmon: (ltc2991) re-order conditions to fix off by one bug
LTC2991_T_INT_CH_NR is 4.  The st->temp_en[] array has LTC2991_MAX_CHANNEL
(4) elements.  Thus if "channel" is equal to LTC2991_T_INT_CH_NR then we
have read one element beyond the end of the array.  Flip the conditions
around so that we check if "channel" is valid before using it as an array
index.

Fixes: 2b9ea4262a ("hwmon: Add driver for ltc2991")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/Zoa9Y_UMY4_ROfhF@stanley.mountain
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-04 18:14:50 -07:00
Greg Kroah-Hartman
14c4dc8bb6 IIO: 2nd set of new device support, features and cleanup for 6.11
The big one here is we finally have Paul Cercueil's (and others)
 DMA buffer support for IIO devices enabling high speed zero
 copy transfer of data to and from sensors supported by IIO (and for
 example USB).  This should aid with upstream support of a range of
 higher performance ADCs and DACs.
 
 Two merges from other trees
 - spi/spi_devm_optimize used for simplification in ad7944.
 - dmaengine/topic_dma_vec to enable the DMABUF series.
 
 One feature with impact outside IIO.
 - Richer set of dev_err_probe() like helpers to cover ERR_PTR() cases.
 
 New device support
 ==================
 adi,ad7173
 - Add support for AD4111, AD4112, AD4114, AD4115 and ADC4116 pseudo
   differential ADCs. Major driver rework was needed to enabled these.
 adi,ad7944
 - Use devm_spi_optimize_message() to avoid a local devm cleanup
   callback. This is the example case from the patch set, others will
   follow.
 mediatek,mt6359-auxadc
 - New driver for this ADC IP found in MT6357, MT6358 and MT6359 PMICs.
 st,accel
 - Add support for the LIS2DS12 accelerometer
 ti,ads1119
 - New driver for this 16 bit 2-differential or 4-single ended channel
   ADC.
 
 Features
 ========
 dt-bindings
 - Introduce new common-mode-channel property to help handle pseudo
   differential ADCs where we have something that looks like one side
   of differential input, but which is only suited for use with a
   slow moving reference.
 adi,adf4350
 - Support use as a clock provider.
 iio-hmwon
 - Support reading of labels from IIO devices by their consumers and
   use this in the hwmon bridge.
 
 Cleanup and minor fixes
 =======================
 Treewide
 - Use regmap_clear_bits() / regmap_set_bits() to simplify open coded
   equivalents.
 - Use devm_regulator_get_enable_read_voltage() to replace equivalent
   opencoded boilerplate. In some cases enabled complete conversion to
   devm handling and removal of explicit remove() callbacks.
 - Introduce dev_err_ptr_probe() and other variants and make use of
   of them in a couple of examples driver cleanups. Will find use in
   many more drivers soon.
 adi,ad7192
 - Introduce local struct device *dev and use dev_err_probe() to give
   more readable code.
 adi,adi-axi-adc/dac
 - Improved consistency of messages using dev_err_probe()
 adi,adis
 - Split the trigger handling into cases that needed paging and those that
   don't resulting in more readable code.
 - Use cleanup.h to simplify error paths via scoped cleanup.
 - Add adis specific lock helpers and make use of them in a number of drivers.
 adi,ad7192
 - Update maintainer (Alisa-Dariana Roman)
 adi,ad7606
 - dt-binding cleanup.
 avago,apds9306
 - Add a maintainer entry (Subhajit Ghosh)
 linear,ltc2309
 - Fix a wrong endian type.
 st,stm32-dfsdm
 - Fix a missing port property in the dt-binding.
 st,sensors
 - Relax whoami match failure to a warning print rather than probe failure.
   This enables fallback compatibles to existing parts from those that don't
   necessarily even exit yet.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmaEXkQRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FojAVBAAnaPB1CCyh61JkMQx815wn87looa+JRi3
 v8J/NsM64gYEwG6aNLLxrHAMFECw4GVrL4rHA5bCJFlSYioSKgs0VB7ltOJ/2258
 CsnSxgJ+4fN0468oZz63WuvrmxBsLGbPRGdE/6pkLMJiGHC0Bb/v3ngrJ/LUbAt6
 j0zAFZ2lb5+iuM8MW5vUE0AcwoQakZEg75N4jD6vHSiLvk6dAduj+R8k6z4OlER9
 MaotfjIqYieQ/4SplMcJEd63IxodKjBJacZHFu7uN8d7VWkDhNPyPrJ388GoeXP6
 CK1cTQWO7ZD2yCdY5LjXJYCAejgtiCIMtM7ghe0ZU/OuDBOFgmoaHrmi48pceF9o
 h8KeOsZIa9oF8SSZuKROTQWAwh33F6elf+IoUWYp61hJwft1BQF060rTsGfm7Qq5
 bFOPwMn+BJASC3ARtjNAI/posdAyS4Tb7fBBsDZ9bMW1Y02X/jlhDvDby1WNAcSY
 LEttjsA/naCfquXy4ng+T9sNB+sy2x92FwgEv1Z9MrnMKp5T+mX6XWQ/xhHplGGa
 VAohB/31EatglJqPS0U9mLr1cmUsBS7ItHG9bDB5mOE9wQA5yAqhEqTbe2P3sWWO
 OW43UVaS1VTd10XbY3l0Jjpwe3qsMZNt6M+JaCSizUCLQiEc0h06THcB/xgxdbad
 sTmopNgIR3Y=
 =+9tp
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-6.11b' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

IIO: 2nd set of new device support, features and cleanup for 6.11

The big one here is we finally have Paul Cercueil's (and others)
DMA buffer support for IIO devices enabling high speed zero
copy transfer of data to and from sensors supported by IIO (and for
example USB).  This should aid with upstream support of a range of
higher performance ADCs and DACs.

Two merges from other trees
- spi/spi_devm_optimize used for simplification in ad7944.
- dmaengine/topic_dma_vec to enable the DMABUF series.

One feature with impact outside IIO.
- Richer set of dev_err_probe() like helpers to cover ERR_PTR() cases.

New device support
==================
adi,ad7173
- Add support for AD4111, AD4112, AD4114, AD4115 and ADC4116 pseudo
  differential ADCs. Major driver rework was needed to enabled these.
adi,ad7944
- Use devm_spi_optimize_message() to avoid a local devm cleanup
  callback. This is the example case from the patch set, others will
  follow.
mediatek,mt6359-auxadc
- New driver for this ADC IP found in MT6357, MT6358 and MT6359 PMICs.
st,accel
- Add support for the LIS2DS12 accelerometer
ti,ads1119
- New driver for this 16 bit 2-differential or 4-single ended channel
  ADC.

Features
========
dt-bindings
- Introduce new common-mode-channel property to help handle pseudo
  differential ADCs where we have something that looks like one side
  of differential input, but which is only suited for use with a
  slow moving reference.
adi,adf4350
- Support use as a clock provider.
iio-hmwon
- Support reading of labels from IIO devices by their consumers and
  use this in the hwmon bridge.

Cleanup and minor fixes
=======================
Treewide
- Use regmap_clear_bits() / regmap_set_bits() to simplify open coded
  equivalents.
- Use devm_regulator_get_enable_read_voltage() to replace equivalent
  opencoded boilerplate. In some cases enabled complete conversion to
  devm handling and removal of explicit remove() callbacks.
- Introduce dev_err_ptr_probe() and other variants and make use of
  of them in a couple of examples driver cleanups. Will find use in
  many more drivers soon.
adi,ad7192
- Introduce local struct device *dev and use dev_err_probe() to give
  more readable code.
adi,adi-axi-adc/dac
- Improved consistency of messages using dev_err_probe()
adi,adis
- Split the trigger handling into cases that needed paging and those that
  don't resulting in more readable code.
- Use cleanup.h to simplify error paths via scoped cleanup.
- Add adis specific lock helpers and make use of them in a number of drivers.
adi,ad7192
- Update maintainer (Alisa-Dariana Roman)
adi,ad7606
- dt-binding cleanup.
avago,apds9306
- Add a maintainer entry (Subhajit Ghosh)
linear,ltc2309
- Fix a wrong endian type.
st,stm32-dfsdm
- Fix a missing port property in the dt-binding.
st,sensors
- Relax whoami match failure to a warning print rather than probe failure.
  This enables fallback compatibles to existing parts from those that don't
  necessarily even exit yet.

* tag 'iio-for-6.11b' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (112 commits)
  iio: adc: ad7173: Fix uninitialized symbol is_current_chan
  iio: adc: Add support for MediaTek MT6357/8/9 Auxiliary ADC
  math.h: Add unsigned 8 bits fractional numbers type
  dt-bindings: iio: adc: Add MediaTek MT6359 PMIC AUXADC
  iio: common: scmi_iio: convert to dev_err_probe()
  iio: backend: make use of dev_err_cast_probe()
  iio: temperature: ltc2983: convert to dev_err_probe()
  dev_printk: add new dev_err_probe() helpers
  iio: xilinx-ams: Add labels
  iio: adc: ad7944: use devm_spi_optimize_message()
  Documentation: iio: Document high-speed DMABUF based API
  iio: buffer-dmaengine: Support new DMABUF based userspace API
  iio: buffer-dma: Enable support for DMABUFs
  iio: core: Add new DMABUF interface infrastructure
  MAINTAINERS: Update AD7192 driver maintainer
  iio: adc: ad7192: use devm_regulator_get_enable_read_voltage
  iio: st_sensors: relax WhoAmI check in st_sensors_verify_id()
  MAINTAINERS: Add AVAGO APDS9306
  dt-bindings: iio: adc: adi,ad7606: comment and sort the compatible names
  dt-bindings: iio: adc: adi,ad7606: add missing datasheet link
  ...
2024-07-04 11:04:20 +02:00
Alex Vdovydchenko
cd228e7b65 hwmon: add MP5920 driver
Add support for MPS Hot-Swap controller mp5920. This driver exposes
telemetry and limit value readings and writings.

Signed-off-by: Alex Vdovydchenko <xzeol@yahoo.com>
Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20240702115252.981416-3-xzeol@yahoo.com
[groeck: Use min_t() to limit length of displayed model string]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-02 12:36:31 -07:00
Javier Carrasco
f642714b78 hwmon: (tps23861) Constify struct regmap_config
`tps23861_regmap_config` is not modified and can be declared as const to
move its data to a read-only section.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240702-hwmon-const-regmap-v1-3-63f6d4765fe0@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-02 11:31:30 -07:00
Javier Carrasco
4bc82dd20b hwmon: (tmp513) Constify struct regmap_config
`tmp51x_regmap_config` is not modified and can be declared as const to
move its data to a read-only section.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240702-hwmon-const-regmap-v1-2-63f6d4765fe0@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-02 11:31:02 -07:00
Javier Carrasco
9d047eb05c hwmon: (ina238) Constify struct regmap_config
`ina238_regmap_config` is not modified and can be declared as const to
move its data to a read-only section.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240702-hwmon-const-regmap-v1-1-63f6d4765fe0@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-02 11:30:10 -07:00
Wayne Tung
39b24cced7 hwmon: (adt7475) Fix default duty on fan is disabled
According to the comments on fan is disabled, we change to manual mode
and set the duty cycle to 0.
For setting the duty cycle part, the register is wrong. Fix it.

Fixes: 1c301fc539 ("hwmon: Add a driver for the ADT7475 hardware monitoring chip")
Signed-off-by: Wayne Tung <chineweff@gmail.com>
Link: https://lore.kernel.org/r/20240701073252.317397-1-chineweff@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-01 15:45:57 -07:00
Guenter Roeck
b3e992f69c hwmon: (jc42) Strengthen detect function
Configuration register bit 5 must read 0 for all JC42.4 compliant chips.
Several capability register bits must be set for all TSE2004 compliant
chips. Use that information to strengthen the detect function.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-30 13:15:26 -07:00
Guenter Roeck
c98cf41dfb hwmon: (jc42) Use common device ID for TSE2004av compliant sensors
TSE2004av standardizes the device ID of compliant temperature sensors to
be 0x22xx, where xx is the device revision. Use a single define for all
TSE2004av compliant temperature sensors, and relax the device id mask to
match the upper 8 bit of the device id register.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-30 13:15:23 -07:00
Armin Wolf
ef8df816ee hwmon: (dell-smm) Add Dell OptiPlex 7060 to DMI table
The BIOS on this machine is buggy and will in some cases return
an error when trying to get the fan state, but reading of the
RPM values and the temperature sensors still works.

Closes: https://github.com/vitorafsr/i8kutils/issues/38
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Acked-by: Pali Rohár <pali@kernel.org>
Link: https://lore.kernel.org/r/20240628214723.19665-1-W_Armin@gmx.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-30 09:13:08 -07:00
Sean Anderson
440db4075f hwmon: iio: Add labels from IIO channels
Add labels from IIO channels to our channels. This allows userspace to
display more meaningful names instead of "in0" or "temp5".

Although lm-sensors gracefully handles errors when reading channel
labels, the ABI says the label attribute

> Should only be created if the driver has hints about what this voltage
> channel is being used for, and user-space doesn't.

Therefore, we test to see if the channel has a label before
creating the attribute.

Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://patch.msgid.link/20240624174601.1527244-3-sean.anderson@linux.dev
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-06-28 20:07:18 +01:00
Noah Wang
38b2b02236 hwmon: add MP2891 driver
Add support for MPS VR controller mp2891. This driver exposes
telemetry and limit value readings and writtings.

Signed-off-by: Noah Wang <noahwang.wang@outlook.com>
Link: https://lore.kernel.org/r/SEYPR04MB64828A352836982C0184AA10FAD62@SEYPR04MB6482.apcprd04.prod.outlook.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-28 10:27:47 -07:00
Sean Anderson
52c1e818d6 hwmon: iio: Use iio_read_channel_processed_scale for IIO_POWER
Instead of rescaling power channels after the fact, use the dedicated
scaling API. This should reduce any inaccuracies resulting from the
scaling.

Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
Link: https://lore.kernel.org/r/20240620212005.821805-1-sean.anderson@linux.dev
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-21 08:09:32 -07:00