summaryrefslogtreecommitdiff
path: root/drivers/hwmon/ads1015.c
Commit message (Collapse)AuthorAgeFilesLines
* hwmon: (ads1015) Convert to using %pOF instead of full_nameRob Herring2017-08-131-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>
* hwmon: (ads1015) move header file out of I2C realmWolfram Sang2017-06-111-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>
* hwmon: (ads1015) Add OF device ID tableJavier Martinez Canillas2017-04-021-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>
* hwmon: (ads1015) Handle negative conversion values correctlyPeter Rosin2016-02-181-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>
* hwmon: (ads1015) Use of_property_read_u32 at appropriate placesAxel Lin2014-09-221-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>
* hwmon: (ads1015) Fix out-of-bounds array accessAxel Lin2014-08-051-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>
* hwmon: (ads1015) Fix off-by-one for valid channel index checkingAxel Lin2014-07-291-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>
* hwmon: (ads1015) Add support for ADS1115Evgeniy Dushistov2013-08-111-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>
* hwmon: (ads1015) Convert to use devm_ functionsGuenter Roeck2012-09-231-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>
* hwmon: (ads1015) Fix build warningGuenter Roeck2012-04-181-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>
* hwmon: convert drivers/hwmon/* to use module_i2c_driver()Axel Lin2012-03-181-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>
* hwmon: (ads1015) Fix file leak in probe functionGuenter Roeck2012-02-231-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>
* hwmon: Use i2c_smbus_{read,write}_word_swappedJean Delvare2011-11-041-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>
* hwmon: (ads1015) Make gain and datarate configurableDirk Eibach2011-03-211-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>
* hwmon: (ads1015) Drop dynamic attribute groupJean Delvare2011-03-211-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>
* hwmon: Add support for Texas Instruments ADS1015Dirk Eibach2011-03-211-0/+282
Signed-off-by: Dirk Eibach <eibach@gdsys.de> Signed-off-by: Jean Delvare <khali@linux-fr.org>