summaryrefslogtreecommitdiff
path: root/drivers/hwmon/jc42.c
AgeCommit message (Collapse)Author
2015-03-09hwmon: (jc42) Add support for additional IDT temperature sensorsGuenter Roeck
TS3000GB0 has a new device ID (0x2913). Since IDT's datasheets suggest that the upper 8 bit of the device ID reflect the chip ID and the lower 8 bit reflect the version number, modify the code to accept all chips with ID 0x29xx. Also add support for TS3001 and TSE2004. Some of the datasheets for older chips are no longer available from the IDT web site, so replace explicit links in the documentation with a generic note. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-01-26hwmon: (jc42) Allow negative hysteresis temperaturesJean Delvare
The driver supports negative high and critical limits, it can return negative hysteresis values, so there is no good reason to not let the user write negative hysteresis values. Signed-off-by: Jean Delvare <jdelvare@suse.de> Cc: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-01-26hwmon: (jc42) Fix integer overflow when writing hysteresis valueGuenter Roeck
Subtracting an unsigned long from a signed value causes an overflow with large values. Use clamp_val() to reduce the number range prior to subtracting it from the temperature limit. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <jdelvare@suse.de>
2015-01-26hwmon: (jc42) Fix integer overflowGuenter Roeck
Mixed use of long and int caused an integer overflow when writing large limits. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <jdelvare@suse.de>
2015-01-26hwmon: (jc42) Use sign_extend32 for sign extensionGuenter Roeck
Despite the name, sign_extend32 works just fine for 16 bit variables, so it is safe to use. Cc: Martin Kepplinger <martink@posteo.de> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21hwmon: (jc42) Add support for STTS2004 and AT30TSE004Guenter Roeck
Also fix links to datasheets for other supported sensors from ST Microelectronics, and add links to several Atmel datasheets. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21hwmon: (jc42) Convert function macros into functionsGuenter Roeck
Convert function macros into functions to make the code easier to read and reduce code size. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21hwmon: (jc42) Rearrange code to avoid forward declarationsGuenter Roeck
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-18hwmon: (jc42) fix coccinelle warningsFengguang Wu
drivers/hwmon/jc42.c:521:1-3: WARNING: PTR_RET can be used Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR Generated by: coccinelle/api/ptr_ret.cocci CC: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-18hwmon: (jc42) Convert to use devm_hwmon_device_register_with_groupsGuenter Roeck
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-02-06hwmon: (jc42) Add support for MCP98244Guenter Roeck
Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <khali@linux-fr.org>
2013-01-26hwmon: Replace SENSORS_LIMIT with clamp_valGuenter Roeck
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-27hwmon: (jc42) Don't reset hysteresis on device removalJean Delvare
Restoring the configuration register on device removal has the side effect of also resetting the hysteresis value. This is inconsistent as the other limits are not reset, only hysteresis. So, following the principle of least surprise, preserve the hysteresis value when restoring the configuration register. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-07-27hwmon: (jc42) Simplify hysteresis maskJean Delvare
Define JC42_CFG_HYST_MASK as the mask _before_ shifting instead of after shifting. This simplifies the current code slightly, and will simplify the code to come even more. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-06-25hwmon: Update my e-mail addressGuenter Roeck
My old e-mail address won't be valid for much longer. Time to update it. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-03-19hwmon: (jc42) Remove unnecessary device IDsGuenter Roeck
We don't really use or need separate device IDs for the various JC42.4 compliant chips, so remove them and just stick with jc42. Also update a datasheet references for SE98A, STTS424, and STTS424E02. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-03-19hwmon: (jc42) Convert to use devm_kzallocGuenter Roeck
Marginally less code and eliminate the possibility of memory leaks. Also replace new_client variable with client and introduce dev variable to make the code a bit easier to read. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-03-19hwmon: (jc42) Fix multi-line commentsGuenter Roeck
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-03-19hwmon: convert drivers/hwmon/* to use module_i2c_driver()Axel Lin
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-03-07hwmon: (jc42) Add support for AT30TS00, TS3000GB2, TSE2002GB2, and MCP9804Guenter Roeck
Also update IDT datasheet locations. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Cc: stable@vger.kernel.org # 3.0+ Acked-by: Jean Delvare <khali@linux-fr.org>
2012-03-07hwmon: (jc42) Add support for ST Microelectronics STTS2002 and STTS3000Jean Delvare
These are fully compatible with Jedec JC 42.4 as far as I can see. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Guenter Roeck <guenter.roeck@ericsson.com> Cc: stable@vger.kernel.org # 3.0+ Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-01-08Merge branch 'hwmon-for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging * 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: max1111.c: fix checkpatch warning hwmon: (lm75) fix checkpatch warnings hwmon: (lm80) fix checkpatch messages hwmon: replaced strict_str* with kstr* hwmon: (lm75) fix checkpatch warning hwmon: (lm75) added error handling hwmon: (ltc4261) set data->valid to 0 if error hwmon: (f75375s) Add support for F75387SG/RG hwmon: (f75375s) Disable setting DC fan control mode for F75373 hwmon: (f75375s) Initialize pwmX_mode and pwmX_enable if there is no platform data hwmon: (f75375s) Fix value range for PWM modes hwmon: (f75375s) Use standard sysfs attribute names hwmon: (f75375s) Fix checkpatch errors and warnings hwmon: (pmbus/zl6100) Only instantiate external temperature sensor if enabled hwmon: (pmbus/zl6100) Add support for Ericsson BMR45[0,1] and BMR46[2,3,4] hwmon: (pmbus/zl6100) Add support for ZL2005 hwmon: (pmbus/adm1275) Validate device ID
2012-01-05hwmon: replaced strict_str* with kstr*Frans Meulenbroeks
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>
2012-01-04switch ->is_visible() to returning umode_tAl Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-11-04hwmon: Use i2c_smbus_{read,write}_word_swappedJean Delvare
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-05-25hwmon: (jc42) Change detection classJean Delvare
While the JC42-compatible chips are temperature sensors, I2C_CLASS_SPD makes more sense because these chips always live on memory modules. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Guenter Roeck <guenter.roeck@ericsson.com>
2011-02-16hwmon: (jc42) do not allow writing to locked registersClemens Ladisch
On systems where the temperature sensor is actually used, the BIOS is likely to have locked the alarm registers. In that case, all writes through the corresponding sysfs files would be silently ignored. To prevent this, detect the locks and make the affected sysfs files read-only. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Cc: stable@kernel.org Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-02-16hwmon: (jc42) fix type mismatchClemens Ladisch
In set_temp_crit_hyst(), make the variable 'val' have the correct type for strict_strtoul(). Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Cc: stable@kernel.org Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-08-10hwmon: add support for JEDEC JC 42.4 compliant temperature sensorsGuenter Roeck
[akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Randy Dunlap <rdunlap@xenotime.net> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>