summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/max31827.c
Commit message (Collapse)AuthorAgeFilesLines
* hwmon: Remove I2C_CLASS_HWMON from drivers w/o detect() and address_listHeiner Kallweit2024-02-111-1/+0
| | | | | | | | | | | Class-based I2C probing requires detect() and address_list to be set in the I2C client driver, see checks in i2c_detect(). It's misleading to declare I2C_CLASS_HWMON support if this precondition isn't met. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/75747c6a-d414-4b07-8f66-5a5cdddc3c36@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (max31827) Add custom attribute for resolutionDaniel Matyas2023-12-111-11/+111
| | | | | | | | | | | | | | | | | | | Added custom channel-specific (temp1) attribute for resolution. The wait time for a conversion in one-shot mode (enable = 0) depends on the resolution. When resolution is 12-bit, the conversion time is 140ms, but the minimum update_interval is 125ms. Handled this problem by waiting an additional 15ms (125ms + 15ms = 140ms). Added 'mask' parameter to the shutdown_write() function. Now it can either write or update bits, depending on the value of mask. This is needed, because for alarms a write is necessary, but for resolution only the resolution bits should be updated. Signed-off-by: Daniel Matyas <daniel.matyas@analog.com> Link: https://lore.kernel.org/r/20231031182158.124608-5-daniel.matyas@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (max31827) Return closest value in update_intervalDaniel Matyas2023-12-111-3/+2
| | | | | | | | | | When user writes a value to update_interval which does not match the possible values, instead of returning invalid error, return the closest value. Signed-off-by: Daniel Matyas <daniel.matyas@analog.com> Link: https://lore.kernel.org/r/20231031182158.124608-4-daniel.matyas@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (max31827) Update bits with shutdown_write()Daniel Matyas2023-12-111-4/+11
| | | | | | | | | | | Added 'mask' parameter to the shutdown_write() function. Now it can either write or update bits, depending on the value of mask. This is needed, because for alarms a write is necessary, but for resolution only the resolution bits should be updated. Signed-off-by: Daniel Matyas <daniel.matyas@analog.com> Link: https://lore.kernel.org/r/20231031182158.124608-3-daniel.matyas@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (max31827) Add support for max31828 and max31829Daniel Matyas2023-12-111-11/+53
| | | | | | | | | | | Created of_match_table and id_table entries for max31828 and max31829. When adi,flt-q and/or adi,alrm-pol are not mentioned, the default configuration is loaded based on the type of the chip. Signed-off-by: Daniel Matyas <daniel.matyas@analog.com> Link: https://lore.kernel.org/r/20231031182158.124608-2-daniel.matyas@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (max31827) Handle new properties from the devicetreeDaniel Matyas2023-12-111-6/+69
| | | | | | | | | | | | Used fwnode to retrieve data from the devicetree in the init_client function. If the uint32 properties are not present, the default values are used for max31827 chip. Signed-off-by: Daniel Matyas <daniel.matyas@analog.com> Link: https://lore.kernel.org/r/20231031182158.124608-1-daniel.matyas@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: max31827: include regulator headerAntoniu Miclaus2023-11-141-0/+1
| | | | | | | | | Include `linux/regulator/consumer.h` since the driver is using `devm_regulator_get_enable` function. Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Link: https://lore.kernel.org/r/20231031091324.23991-1-antoniu.miclaus@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (max31827) handle vref regulatorAntoniu Miclaus2023-10-281-0/+4
| | | | | | | | | Add missing implementation for the max31827 supply regulator. This is a hardware required property that is not handled. Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Link: https://lore.kernel.org/r/20230925122929.10610-1-antoniu.miclaus@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (max31827) Modify conversion wait timeDaniel Matyas2023-10-281-1/+1
| | | | | | | | | | There is nothing in the datasheet indicating that the 1ms error is needed and I didn't encounter any error during testing with 140ms wait time. Signed-off-by: Daniel Matyas <daniel.matyas@analog.com> Link: https://lore.kernel.org/r/20230919093456.10592-2-daniel.matyas@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (max31827) Make code cleanerDaniel Matyas2023-10-281-69/+54
| | | | | | | | | | | | | | Used enums and while loops to replace switch for selecting and getting update interval from conversion rate bits. Divided the write_alarm_val function into 2 functions. The new function is more generic: it can be used not only for alarm writes, but for any kind of writes which require the device to be in shutdown mode. Signed-off-by: Daniel Matyas <daniel.matyas@analog.com> Link: https://lore.kernel.org/r/20230919093456.10592-1-daniel.matyas@analog.com [groeck: Reverted error return value change (EOPNOTSUPP -> EINVAL)] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: max31827: Switch back to use struct i2c_driver::probeUwe Kleine-König2023-06-261-1/+1
| | | | | | | | | struct i2c_driver::probe_new is about to go away. Switch the driver to use the probe callback with the same prototype. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230626085145.554616-1-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: Add MAX31827 driverDaniel Matyas2023-06-081-0/+466
MAX31827 is a low-power temperature switch with I2C interface. The device is a ±1°C accuracy from -40°C to +125°C (12 bits) local temperature switch and sensor with I2C/SM- Bus interface. The combination of small 6-bump wafer-lev- el package (WLP) and high accuracy makes this temper- ature sensor/switch ideal for a wide range of applications. Signed-off-by: Daniel Matyas <daniel.matyas@analog.com> Link: https://lore.kernel.org/r/20230524160131.14081-2-daniel.matyas@analog.com [groeck: Improved define alignment, return -EINVAL after bad user input, fixed up compatible statement] Signed-off-by: Guenter Roeck <linux@roeck-us.net>