summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/ltc2947-core.c
Commit message (Collapse)AuthorAgeFilesLines
* hwmon: ltc2947: constify pointers to hwmon_channel_infoKrzysztof Kozlowski2023-04-191-1/+1
| | | | | | | | 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>
* hwmon: (ltc2947) fix temperature scalingDerek Nguyen2022-11-201-1/+1
| | | | | | | | | | | | | The LTC2947 datasheet (Rev. B) calls out in the section "Register Description: Non-Accumulated Result Registers" (pg. 30) that "To calculate temperature, multiply the TEMP register value by 0.204°C and add 5.5°C". Fix to add 5.5C and not 0.55C. Fixes: 9f90fd652bed ("hwmon: Add support for ltc2947") Signed-off-by: Derek Nguyen <derek.nguyen@collins.com> Signed-off-by: Brandon Maier <brandon.maier@collins.com> Link: https://lore.kernel.org/r/20221110192108.20624-1-brandon.maier@collins.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (ltc2947) Switch to EXPORT_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()Jonathan Cameron2022-09-251-4/+3
| | | | | | | | | | | | These newer PM macros allow the compiler to see what code it can remove if !CONFIG_PM_SLEEP. This allows the removal of __maybe_unused markings whilst achieving the same result. In this case it also lets the structure itself be removed. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20220925172759.3573439-9-jic23@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: Make use of devm_clk_get_enabled()Uwe Kleine-König2022-09-251-16/+1
| | | | | | | | | | | Several drivers manually register a devm handler to disable their clk. Convert them to devm_clk_get_enabled(). Acked-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (ltc2947) Properly handle errors when looking for the external clockUwe Kleine-König2021-09-241-2/+6
| | | | | | | | | | | The return value of devm_clk_get should in general be propagated to upper layer. In this case the clk is optional, use the appropriate wrapper instead of interpreting all errors as "The optional clk is not available". Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20210923201113.398932-1-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: Add support for ltc2947Nuno Sá2019-11-061-0/+1183
The ltc2947 is a high precision power and energy monitor with an internal sense resistor supporting up to +/- 30A. Three internal no Latency ADCs ensure accurate measurement of voltage and current, while high-bandwidth analog multiplication of voltage and current provides accurate power measurement in a wide range of applications. Internal or external clocking options enable precise charge and energy measurements. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20191021154115.319073-1-nuno.sa@analog.com [groeck: Removed unnecessary checks when reading temperature and energy; PAGE{0,1} -> LTC2947_PAGE_{0,1}] Signed-off-by: Guenter Roeck <linux@roeck-us.net>