summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/tmp401.c
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>
2018-12-16hwmon: (tmp401) Auto-convert to use SENSOR_DEVICE_ATTR_{RO, RW, WO}Guenter Roeck1-69/+57
Conversion was done done using the coccinelle script at https://github.com/groeck/coccinelle-patches/raw/master/hwmon/sensor-devattr-w6.cocci Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-01-10hwmon: (tmp401) use smb word operations instead of 2 smb byte operationsJeroen De Wachter1-35/+14
tmp401 separately read/wrote high and low bytes of temperature values while the hardware supports reading/writing those values in one operation. Driver has been modified to use word operations where possible. Tested with a tmp432 sensor on a mips64 platform. Signed-off-by: Jeroen De Wachter <jeroen.de_wachter.ext@nokia.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-01-02hwmon: (tmp401) use permission-specific DEVICE_ATTR variantsJulia Lawall1-6/+5
Use 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>
2016-06-27hwmon: (tmp401) Add support for TI TMP461Andrew F. Davis1-6/+29
Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-29hwmon: (tmp401) Do not auto-detect chip on I2C address 0x37Guenter Roeck1-1/+1
I2C address 0x37 may be used by EEPROMs, which can result in false positives. Do not attempt to detect a chip at this address. Reviewed-by: Jean Delvare <jdelvare@suse.de> Cc: stable@vger.kernel.org # v4.0+ Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-12-08hwmon: (tmp401) Detect TMP435 on all addresses it supportsGuenter Roeck1-5/+4
TMP435 supports a range of I2C addresses, not just 0x4c. Cc: Patrick Titiano <ptitiano@baylibre.com> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-12-04hwmon: (tmp401) Bail out from tmp401_probe() in case of write errorsBartosz Golaszewski1-10/+14
The return value of i2c_smbus_read_byte_data() is checked in tmp401_init_client(), but only a warning is printed and the device is registered anyway. This leads to devices being registered even if they cannot be physically detected. Bail out from probe in case of write errors and notify the user. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-12-04hwmon: (tmp401) Add support for TI TMP435Patrick Titiano1-2/+11
Signed-off-by: Patrick Titiano <ptitiano@baylibre.com> [Bartosz Golaszewski: prepared for submission, code review fixes] Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> [Guenter Roeck: Merged two patches into one] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-18hwmon: (tmp401) Convert to use devm_hwmon_device_register_with_groupsGuenter Roeck1-64/+28
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-05-19hwmon: (tmp401) Drop redundant safety on cache lifetimeJean Delvare1-1/+1
time_after (as opposed to time_after_equal) already ensures that the cache lifetime is at least as much as requested. There is no point in manually adding another jiffy to that value, and this can confuse the reader into wrong interpretation. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Imre Deak <imre.deak@intel.com> Cc: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-21hwmon: (tmp401) Add support for TMP432Guenter Roeck1-37/+155
TMP432 is similar to TMP431 with a second external temperature sensor. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2013-04-21hwmon: (tmp401) Add support for update_interval attributeGuenter Roeck1-1/+53
Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2013-04-21hwmon: (tmp401) Reset valid flag when resetting temperature historyGuenter Roeck1-2/+6
Cached data is no longer valid after resetting the temperature history. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2013-04-21hwmon: (tmp401) Simplification and cleanupGuenter Roeck1-234/+137
Use two-dimensional array pointing to registers Merge temperature and limit access functions into a single function Return error codes from I2C reads Use DIV_ROUND_CLOSEST for rounding operations and improve rounding Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2013-04-14hwmon: (tmp401) Use sysfs_create_group / sysfs_remove_groupGuenter Roeck1-63/+91
instead of creating and removing sysfs attribute files individually. Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-14hwmon: (tmp401) Drop unused defines, use BIT for bit masksGuenter Roeck1-11/+10
Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2013-04-07hwmon: (tmp401) Fix device detection for TMP411B and TMP411CGuenter Roeck1-2/+16
Turns out that TMP411B and TMP411C have different and unique device IDs. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2013-04-07hwmon: (tmp401) Add support for TMP431Guenter Roeck1-3/+12
TMP431 is compatible to TMP401. Also add support for additional I2C addresses supported by TMP411B and TMP411C. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2013-04-07hwmon: Fix checkpatch warning 'quoted string split across lines'Guenter Roeck1-2/+3
Cc: Corentin Labbe <corentin.labbe@geomatys.fr> Cc: Mark M. Hoffman <mhoffman@lightlink.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Cc: Marc Hulsman <m.hulsman@tudelft.nl> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-01-25hwmon: Replace SENSORS_LIMIT with clamp_valGuenter Roeck1-7/+7
SENSORS_LIMIT and the generic clamp_val have the same functionality, and clamp_val is more efficient. This patch reduces text size by 9052 bytes and bss size by 11624 bytes for x86_64 builds. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: George Joseph <george.joseph@fairview5.com> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-07-21hwmon: (tmp401) Convert to use devm_ functionsGuenter Roeck1-3/+3
Convert to use devm_ functions to reduce code size and simplify the code. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-03-21Merge tag 'hwmon-for-linus' of ↵Linus Torvalds1-12/+1
git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon changes for v3.4 from Guenter Roeck: "Mostly cleanup. No new drivers this time around, but support for several chips added to existing drivers: TPS40400, TPS40422, MTD040, MAX34446, ZL9101M, ZL9117M, and LM96080. Also, added watchdog support for SCH56xx, and additional attributes for a couple of drivers." * tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (137 commits) hwmon: (sch56xx) Add support for the integrated watchdog (v2) hwmon: (w83627ehf) Add support for temperature offset registers hwmon: (jc42) Remove unnecessary device IDs hwmon: (zl6100) Add support for ZL9101M and ZL9117M hwmon: (adm1275) Add support for ADM1075 hwmon: (max34440) Add support for MAX34446 hwmon: (pmbus) Add more virtual registers hwmon: (pmbus) Add support for Lineage Power MDT040 hwmon: (pmbus) Add support for TI TPS40400 and TPS40422 hwmon: (max34440) Add support for 'lowest' output voltage attribute hwmon: (jc42) Convert to use devm_kzalloc hwmon: (max16065) Convert to use devm_kzalloc hwmon: (smm665) Convert to use devm_kzalloc hwmon: (ltc4261) Convert to use devm_kzalloc hwmon: (pmbus) Simplify remove functions hwmon: (pmbus) Convert pmbus drivers to use devm_kzalloc hwmon: (lineage-pem) Convert to use devm_kzalloc hwmon: (hwmon-vid) Fix checkpatch issues hwmon: (hwmon-vid) Add new entries to VRM model table hwmon: (lm80) Add detection of NatSemi/TI LM96080 ...
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-21Typos: change aditional to additional.Justin P. Mattock1-1/+1
The below patch fixes some typos "aditional" to "additional", and also fixes a comment with another word mispelled. Signed-off-by: Justin P. Mattock <justinmattock@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-01-05hwmon: replaced strict_str* with kstr*Frans Meulenbroeks1-5/+5
replaced strict_strtol with kstrtol and replaced strict_strtuol with kstrtuol This satisfies checkpatch -f Compile tested only: no warnings or errors given Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-05-27hwmon: (tmp401) Reorganize code to get rid of static forward declarationsAndre Prendel1-108/+97
Signed-off-by: Andre Prendel <andre.prendel@gmx.de> Acked-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-05-27hwmon: (tmp401) Use constants for sysfs file permissionsAndre Prendel1-22/+28
Replace octal representation of file permissions by the corresponding constants. Signed-off-by: Andre Prendel <andre.prendel@gmx.de> Acked-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-03-05hwmon: Fix off-by-one kind valuesJean Delvare1-4/+3
Recent changes on the I2C front have left off-by-one array indexes in 3 hwmon drivers. Fix them. Faulty commit: e5e9f44c2 i2c: Drop I2C_CLIENT_INSMOD_2 to 8 Reported-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Andre Prendel <andre.prendel@gmx.de> Cc: stable@kernel.org
2009-12-14i2c: Drop I2C_CLIENT_INSMOD_2 to 8Jean Delvare1-2/+1
These macros simply declare an enum, so drivers might as well declare it themselves. This puts an end to the arbitrary limit of 8 chip types per i2c driver. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Wolfram Sang <w.sang@pengutronix.de>
2009-12-14i2c: Get rid of struct i2c_client_address_dataJean Delvare1-1/+1
Struct i2c_client_address_data only contains one field at this point, which makes its usefulness questionable. Get rid of it and pass simple address lists around instead. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Wolfram Sang <w.sang@pengutronix.de>
2009-12-14i2c: Drop the kind parameter from detect callbacksJean Delvare1-2/+2
The "kind" parameter always has value -1, and nobody is using it any longer, so we can remove it. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Wolfram Sang <w.sang@pengutronix.de>
2009-12-09hwmon: (tmp401/tmp421) Clean up detect functionsJean Delvare1-29/+26
As kind is now hard-coded to -1, there is room for code clean-ups. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Andre Prendel <andre.prendel@gmx.de>
2009-06-15hwmon: (tmp401) Add support for TI's TMP411 sensors chipAndre Prendel1-24/+149
This adds support for TI's TMP411 sensor chip. Preliminary support were done by Gabriel Konat, Sander Leget and Wouter Willems. The chip is compatible with TI's TMP401 sensor chip. It has additional support for historical minimun/maximum measurements. Signed-off-by: Andre Prendel <andre.prendel@gmx.de> Acked-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-06-15hwmon: (tmp401) Add support for TI's TMP401 sensor chipHans de Goede1-0/+565
This is a new hwmon driver for TI's TMP401 temperature sensor IC. This driver was written on behalf of an embedded systems vendor under the Linux driver project. It has been tested using a TI TMP401 sample attached to a i2c-tiny-usb adapter. Which was provided by Till Harbaum, many thanks to him for this! Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>