Commit Graph

7 Commits

Author SHA1 Message Date
Pawel Dembicki
6a422a96bc hwmon: ltc2991: fix register bits defines
In the LTC2991, V5 and V6 channels use the low nibble of the
"V5, V6, V7, and V8 Control Register" for configuration, but currently,
the high nibble is defined.

This patch changes the defines to use the low nibble.

Fixes: 2b9ea4262a ("hwmon: Add driver for ltc2991")
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
Message-ID: <20240830111349.30531-1-paweldembicki@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-09-01 06:39:57 -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
Javier Carrasco
234c07400e hwmon: (ltc2991) use device_for_each_child_node_scoped()
Switch to the _scoped() version introduced in commit 365130fd47
("device property: Introduce device_for_each_child_node_scoped()")
to remove the need for manual calling of fwnode_handle_put() in the
paths where the code exits the loop early.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240404-hwmon_device_for_each_child_node_scoped-v1-1-53997abde43c@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Uwe Kleine-König
d8a66f3621 hwmon: Drop explicit initialization of struct i2c_device_id::driver_data to 0
These drivers don't use the driver_data member of struct i2c_device_id,
so don't explicitly initialize this member.

This prepares putting driver_data in an anonymous union which requires
either no initialization or named designators. But it's also a nice
cleanup on its own.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20240430085654.1028864-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-01 07:47:49 -07:00
Antoniu Miclaus
34c76a5120 hwmon: (ltc2991) remove device reference from state
Remove device reference from struct ltc2991_state since it is used only
inside the init function.

Pass the struct device as parameter to the init function instead.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Link: https://lore.kernel.org/r/20231031095647.48376-1-antoniu.miclaus@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-12-11 06:20:28 -08:00
Colin Ian King
d9995cd969 hwmon: ltc2991: Fix spelling mistake "contiuous" -> "continuous"
There is a spelling mistake in a dev_err_probe messages. Fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20231031084240.2148339-1-colin.i.king@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-11-14 05:32:47 -08:00
Antoniu Miclaus
2b9ea4262a hwmon: Add driver for ltc2991
Add support for LTC2991 Octal I2C Voltage, Current, and Temperature
Monitor.

The LTC2991 is used to monitor system temperatures, voltages and
currents. Through the I2C serial interface, the eight monitors can
individually measure supply voltages and can be paired for
differential measurements of current sense resistors or temperature
sensing transistors. Additional measurements include internal
temperature and internal VCC.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Link: https://lore.kernel.org/r/20231026103413.27800-2-antoniu.miclaus@analog.com
[groeck: Fixed up documentation warning]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-10-29 22:22:20 -07:00