summaryrefslogtreecommitdiff
path: root/drivers/hwmon/adt7x10.c
AgeCommit message (Collapse)AuthorFilesLines
2023-04-19hwmon: adt7x10: constify pointers to hwmon_channel_infoKrzysztof Kozlowski1-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>
2022-09-26hwmon: (adt7x10) Switch to EXPORT_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()Jonathan Cameron1-6/+1
These newer PM macros allow the compiler to see what code it can remove if !CONFIG_PM_SLEEP. This allows the removal of messy #ifdef barriers whilst achieving the same result. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20220925172759.3573439-5-jic23@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-02-28hwmon: (adt7x10) Use hwmon_notify_eventCosmin Tanislav1-4/+4
The hwmon subsystem provides means of notifying userspace about events. Use it. Signed-off-by: Cosmin Tanislav <cosmin.tanislav@analog.com> Link: https://lore.kernel.org/r/20211221215841.2641417-8-demonsingur@gmail.com [groeck: Pass hwmon device to interrupt handler] Tested-by: Cosmin Tanislav <cosmin.tanislav@analog.com> Reviewed-by: Cosmin Tanislav <cosmin.tanislav@analog.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-02-28hwmon: (adt7x10) Remove empty driver removal callbackCosmin Tanislav1-5/+0
Not used to do anything anymore. Signed-off-by: Cosmin Tanislav <cosmin.tanislav@analog.com> Link: https://lore.kernel.org/r/20211221215841.2641417-6-demonsingur@gmail.com Tested-by: Cosmin Tanislav <cosmin.tanislav@analog.com> Reviewed-by: Cosmin Tanislav <cosmin.tanislav@analog.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-02-28hwmon: (adt7x10) Use devm_request_threaded_irqCosmin Tanislav1-5/+5
To simplify the core driver remove function. Signed-off-by: Cosmin Tanislav <cosmin.tanislav@analog.com> Link: https://lore.kernel.org/r/20211221215841.2641417-5-demonsingur@gmail.com Tested-by: Cosmin Tanislav <cosmin.tanislav@analog.com> Reviewed-by: Cosmin Tanislav <cosmin.tanislav@analog.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-02-28hwmon: (adt7x10) Use devm_hwmon_device_register_with_infoCosmin Tanislav1-125/+124
Describe the only available channel, implement read, write and is_visible callbacks. Also, pass name to core driver for the i2c device so that it can be used to register hwmon device. Signed-off-by: Cosmin Tanislav <cosmin.tanislav@analog.com> Link: https://lore.kernel.org/r/20211221215841.2641417-4-demonsingur@gmail.com [groeck: Adjusted to use regmap] Tested-by: Cosmin Tanislav <cosmin.tanislav@analog.com> Reviewed-by: Cosmin Tanislav <cosmin.tanislav@analog.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-02-28hwmon: (adt7x10) Add device managed action for restoring configCosmin Tanislav1-5/+11
To simplify the core driver remove function. Signed-off-by: Cosmin Tanislav <cosmin.tanislav@analog.com> Link: https://lore.kernel.org/r/20211221215841.2641417-3-demonsingur@gmail.com [groeck: Adjust to use regmap; only register restore function if needed] Tested-by: Cosmin Tanislav <cosmin.tanislav@analog.com> Reviewed-by: Cosmin Tanislav <cosmin.tanislav@analog.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-02-28hwmon: (adt7x10) Convert to use regmapGuenter Roeck1-144/+81
Using regmap lets us use the regmap subsystem for SPI vs. I2C register accesses. It lets us hide access differences in backend code and lets the common code just access registers without knowing their size. We can also use regmap for register caching. Tested-by: Cosmin Tanislav <cosmin.tanislav@analog.com> Reviewed-by: Cosmin Tanislav <cosmin.tanislav@analog.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-10-12hwmon: (adt7x10) Make adt7x10_remove() return voidUwe Kleine-König1-2/+1
Up to now adt7x10_remove() returns zero unconditionally. Make it return void instead which makes it easier to see in the callers that there is no error to handle. Also the return value of i2c and spi remove callbacks is ignored anyway. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20211011132754.2479853-3-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-05-24treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61Thomas Gleixner1-14/+1
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not write to the free software foundation inc 675 mass ave cambridge ma 02139 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 441 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc) Reviewed-by: Richard Fontana <rfontana@redhat.com> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190520071858.739733335@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17hwmon: (adt7x10) Use permission specific SENSOR[_DEVICE]_ATTR variantsGuenter Roeck1-34/+25
Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, and to reduce the chance of inconsistencies. Also replace any remaining S_<PERMS> in the driver with octal values. The conversion was done automatically with coccinelle. The semantic patches and the scripts used to generate this commit log are available at https://github.com/groeck/coccinelle-patches/hwmon/. This patch does not introduce functional changes. It was verified by compiling the old and new files and comparing text and data sizes. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-01-02hwmon: (adt7x10) use permission-specific DEVICE_ATTR variantsJulia Lawall1-4/+3
Use DEVICE_ATTR_RO for read only attributes and DEVICE_ATTR_RW for read/write attributes. This simplifies the source code, improves readbility, and reduces the chance of inconsistencies. The conversion was done automatically using coccinelle. It was validated by compiling both the old and the new source code and comparing its text, data, and bss size. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> [groeck: Updated description] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-08hwmon: (adt7x10) Add alarm interrupt supportLars-Peter Clausen1-3/+38
This allows an userspace application to poll() on the alarm files to get notified in case of a temperature threshold event. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Reviewed-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-08hwmon: (adt7410) Add support for the adt7310/adt7320Lars-Peter Clausen1-0/+476
The adt7310/adt7320 is the SPI version of the adt7410/adt7420. The register map layout is a bit different, i.e. the register addresses differ between the two variants, but the bit layouts of the individual registers are identical. So both chip variants can easily be supported by the same driver. The issue of non matching register address layouts is solved by a simple look-up table which translates the I2C addresses to the SPI addresses. The patch moves the bulk of the adt7410 driver to a common module that will be shared by the adt7410 and adt7310 drivers. This common module implements the driver logic and uses a set of virtual functions to perform IO access. The adt7410 and adt7310 driver modules provide proper implementations of these IO accessor functions for I2C respective SPI. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Reviewed-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>