aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/ads1015.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
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>
2019-04-15hwmon: (ads1015) Fix build warningGuenter Roeck1-1/+1
If CONFIG_OF is not enabled, the following build warning is observed. drivers/hwmon/ads1015.c:310:34: warning: ‘ads1015_of_match’ defined but not used Marking ads1015_of_match as __maybe_unused fixes the problem. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-12-16hwmon: (ads1015) Use permission specific SENSOR[_DEVICE]_ATTR variantsGuenter Roeck1-10/+10
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. Cc: Dirk Eibach <eibach@gdsys.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-08-13hwmon: (ads1015) Convert to using %pOF instead of full_nameRob Herring1-8/+6
Now that we have a custom printf format specifier, convert users of full_name to use %pOF instead. This is preparation to remove storing of the full path string for each node. Signed-off-by: Rob Herring <robh@kernel.org> Cc: Dirk Eibach <eibach@gdsys.de> Cc: Jean Delvare <jdelvare@suse.com> Cc: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-06-11hwmon: (ads1015) move header file out of I2C realmWolfram Sang1-1/+1
include/linux/i2c is not for client devices. Move the header file to a more appropriate location. Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-04-02hwmon: (ads1015) Add OF device ID tableJavier Martinez Canillas1-1/+21
The driver doesn't have a struct of_device_id table but supported devices are registered via Device Trees. This is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID and that the MODALIAS reported will always be of the form i2c:<device>. But this could change in the future so the correct approach is to have an OF device ID table if the devices are registered via OF. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2016-02-18hwmon: (ads1015) Handle negative conversion values correctlyPeter Rosin1-1/+1
Make the divisor signed as DIV_ROUND_CLOSEST is undefined for negative dividends when the divisor is unsigned. Signed-off-by: Peter Rosin <peda@axentia.se> Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-09-22hwmon: (ads1015) Use of_property_read_u32 at appropriate placesAxel Lin1-13/+8
Simplify the code a bit and also improve readability. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-08-05hwmon: (ads1015) Fix out-of-bounds array accessAxel Lin1-0/+2
Current code uses data_rate as array index in ads1015_read_adc() and uses pga as array index in ads1015_reg_to_mv, so we must make sure both data_rate and pga settings are in valid value range. Return -EINVAL if the setting is out-of-range. Signed-off-by: Axel Lin <axel.lin@ingics.com> Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-07-29hwmon: (ads1015) Fix off-by-one for valid channel index checkingAxel Lin1-1/+1
Current code uses channel as array index, so the valid channel value is 0 .. ADS1015_CHANNELS - 1. Signed-off-by: Axel Lin <axel.lin@ingics.com> Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11hwmon: (ads1015) Add support for ADS1115Evgeniy Dushistov1-6/+21
This patch adds support for ads1115 device to ads1015 driver. Based on work of Emiliano Carnati <carnatiatebneuro.com>. Tested on ARM CPU based board. Signed-off-by: Evgeniy A. Dushistov <dushistov@mail.ru> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-09-23hwmon: (ads1015) Convert to use devm_ functionsGuenter Roeck1-8/+4
Convert to use devm_ functions to reduce code size and simplify the code. Cc: Dirk Eibach <eibach@gdsys.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-04-18hwmon: (ads1015) Fix build warningGuenter Roeck1-17/+16
The following build warning is seen in some configurations. drivers/hwmon/ads1015.c: In function 'show_in': drivers/hwmon/ads1015.c:129: warning: 'in' may be used uninitialized in this function Fix by separating the register read function from the code converting the result into mV. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Dirk Eibach <eibach@gdsys.de> Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
2012-03-18hwmon: convert drivers/hwmon/* to use module_i2c_driver()Axel Lin1-12/+1
This patch converts the drivers in drivers/hwmon/* to use the module_i2c_driver() macro which makes the code smaller and a bit simpler. Signed-off-by: Axel Lin <axel.lin@gmail.com> Cc: Corentin Labbe <corentin.labbe@geomatys.fr> Cc: Dirk Eibach <eibach@gdsys.de> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Steve Glendinning <steve.glendinning@smsc.com> Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Guillaume Ligneul <guillaume.ligneul@gmail.com> Cc: David George <david.george@ska.ac.za> Cc: "Hans J. Koch" <hjk@hansjkoch.de> Cc: Marc Hulsman <m.hulsman@tudelft.nl> Cc: Rudolf Marek <r.marek@assembler.cz> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-02-23hwmon: (ads1015) Fix file leak in probe functionGuenter Roeck1-2/+1
An error while creating sysfs attribute files in the driver's probe function results in an error abort, but already created files are not removed. This patch fixes the problem. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: stable@vger.kernel.org # 3.0+ Cc: Dirk Eibach <eibach@gdsys.de> Acked-by: Jean Delvare <khali@linux-fr.org>
2011-11-04hwmon: Use i2c_smbus_{read,write}_word_swappedJean Delvare1-17/+4
Make use of the new i2c_smbus_{read,write}_word_swapped functions. This makes the driver code more compact and readable. It also ensures proper error handling. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Dirk Eibach <eibach@gdsys.de> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Guillaume Ligneul <guillaume.ligneul@gmail.com>
2011-03-21hwmon: (ads1015) Make gain and datarate configurableDirk Eibach1-40/+109
Configuration for ads1015 gain and datarate is possible via devicetree or platform data. This is a followup patch to previous ads1015 patches on Jean Delvares tree. Signed-off-by: Dirk Eibach <eibach@gdsys.de> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2011-03-21hwmon: (ads1015) Drop dynamic attribute groupJean Delvare1-32/+18
It is cheaper to handle attributes individually. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Dirk Eibach <eibach@gdsys.de>
2011-03-21hwmon: Add support for Texas Instruments ADS1015Dirk Eibach1-0/+282
Signed-off-by: Dirk Eibach <eibach@gdsys.de> Signed-off-by: Jean Delvare <khali@linux-fr.org>