summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/jc42.c
AgeCommit message (Collapse)AuthorFilesLines
2022-12-04hwmon: (jc42) Consistently use bit and bitfield macros in the driverMartin Blumenstingl1-18/+18
Use BIT() and GENMASK() macros for defining the bitfields inside the registers. Also use FIELD_GET() and FIELD_PREP() where appropriate. This makes the coding style within the driver consistent. No functional changes intended. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-12-04hwmon: (jc42) Fix missing unlock on error in jc42_write()Yang Yingliang1-1/+1
Add the missing unlock before return from function jc42_write() in the error handling case. Fixes: 37dedaee8bc6 ("hwmon: (jc42) Convert register access and caching to regmap/regcache") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Link: https://lore.kernel.org/r/20221027062931.598247-1-yangyingliang@huawei.com Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-12-04hwmon: (jc42) Restore the min/max/critical temperatures on resumeMartin Blumenstingl1-1/+9
The JC42 compatible thermal sensor on Kingston KSM32ES8/16ME DIMMs (using Micron E-Die) is an ST Microelectronics STTS2004 (manufacturer 0x104a, device 0x2201). It does not keep the previously programmed minimum, maximum and critical temperatures after system suspend and resume (which is a shutdown / startup cycle for the JC42 temperature sensor). This results in an alarm on system resume because the hardware default for these values is 0°C (so any environment temperature greater than 0°C will trigger the alarm). Example before system suspend: jc42-i2c-0-1a Adapter: SMBus PIIX4 adapter port 0 at 0b00 temp1: +34.8°C (low = +0.0°C) (high = +85.0°C, hyst = +85.0°C) (crit = +95.0°C, hyst = +95.0°C) Example after system resume (without this change): jc42-i2c-0-1a Adapter: SMBus PIIX4 adapter port 0 at 0b00 temp1: +34.8°C (low = +0.0°C) ALARM (HIGH, CRIT) (high = +0.0°C, hyst = +0.0°C) (crit = +0.0°C, hyst = +0.0°C) Apply the cached values from the JC42_REG_TEMP_UPPER, JC42_REG_TEMP_LOWER, JC42_REG_TEMP_CRITICAL and JC42_REG_SMBUS (where the SMBUS register is not related to this issue but a side-effect of using regcache_sync() during system resume with the previously cached/programmed values. This fixes the alarm due to the hardware defaults of 0°C because the previously applied limits (set by userspace) are re-applied on system resume. Fixes: 175c490c9e7f ("hwmon: (jc42) Add support for STTS2004 and AT30TSE004") Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Link: https://lore.kernel.org/r/20221023213157.11078-3-martin.blumenstingl@googlemail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-12-04hwmon: (jc42) Convert register access and caching to regmap/regcacheMartin Blumenstingl1-102/+131
Switch the jc42 driver to use an I2C regmap to access the registers. Also move over to regmap's built-in caching instead of adding a custom caching implementation. This works for JC42_REG_TEMP_UPPER, JC42_REG_TEMP_LOWER and JC42_REG_TEMP_CRITICAL as these values never change except when explicitly written. The cache For JC42_REG_TEMP is dropped (regmap can't cache it because it's volatile, meaning it can change at any time) as well for simplicity and consistency with other drivers. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Link: https://lore.kernel.org/r/20221023213157.11078-2-martin.blumenstingl@googlemail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-10-04Merge tag 'hwmon-for-v6.1' of ↵Linus Torvalds1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon updates from Guenter Roeck: "New drivers: - Driver for MAX31760 fan speed controller - Driver for TEXAS TPS546D24 Buck Converter - Driver for EMC2301/2/3/5 RPM-based PWM Fan Speed Controller Removed drivers: - Drop obsolete asus_wmi_ec_sensors driver Cleanups, affecting various drivers: - Use DEFINE_SIMPLE_DEV_PM_OPS where appropriate - Remove forward declarations - Move from strlcpy with unused retval to strscpy - Make use of devm_clk_get_enabled() - Drop devm_of_pwm_get() Other notable cleanup and improvements: - Support for additional USB devide ID and support for reporting of rail mode via debugfs added to corsair-psu driver - Support for aditional USB ID in nzxt-smart2 driver - Support for Aquacomputer High Flow Next in aquacomputer_d5next driver - Major cleanup of pwm-fan driver - Major cleanup of mr75203 driver, and added support for new device revision And various other minor fixes and cleanups" * tag 'hwmon-for-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (86 commits) hwmon: (corsair-psu) add USB id of new revision of the HX1000i psu hwmon: (pmbus/mp2888) Fix sensors readouts for MPS Multi-phase mp2888 controller dt-bindings: hwmon: sensirion,shtc1: Clean up spelling mistakes and grammar hwmon: (nct6683) remove unused variable in nct6683_create_attr_group hwmon: w83627hf: Reorder symbols to get rid of a few forward declarations hwmon: (ina3221) Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() hwmon: (w83627ehf) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (tmp108) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (tmp103) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (tmp102) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (pwm-fan) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (nct6775) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (max6639) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (max31730) witch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (max31722) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (ltc2947) Switch to EXPORT_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (lm90) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (it87) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (gpio-fan) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (adt7x10) Switch to EXPORT_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() ...
2022-09-19hwmon: move from strlcpy with unused retval to strscpyWolfram Sang1-1/+1
Follow the advice of the below link and prefer 'strscpy' in this subsystem. Conversion is 1:1 because the return value is not used. Generated by a coccinelle script. Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20220818210014.6769-1-wsa+renesas@sang-engineering.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-08-16i2c: Make remove callback return voidUwe Kleine-König1-2/+1
The value returned by an i2c driver's remove function is mostly ignored. (Only an error message is printed if the value is non-zero that the error is ignored.) So change the prototype of the remove function to return no value. This way driver authors are not tempted to assume that passing an error to the upper layer is a good idea. All drivers are adapted accordingly. There is no intended change of behaviour, all callbacks were prepared to return 0 before. Reviewed-by: Peter Senna Tschudin <peter.senna@gmail.com> Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au> Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Crt Mori <cmo@melexis.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Marek Behún <kabel@kernel.org> # for leds-turris-omnia Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Petr Machata <petrm@nvidia.com> # for mlxsw Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for surface3_power Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> # for bmc150-accel-i2c + kxcjk-1013 Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> # for media/* + staging/media/* Acked-by: Miguel Ojeda <ojeda@kernel.org> # for auxdisplay/ht16k33 + auxdisplay/lcd2s Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for versaclock5 Reviewed-by: Ajay Gupta <ajayg@nvidia.com> # for ucsi_ccg Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # for iio Acked-by: Peter Rosin <peda@axentia.se> # for i2c-mux-*, max9860 Acked-by: Adrien Grassein <adrien.grassein@gmail.com> # for lontium-lt8912b Reviewed-by: Jean Delvare <jdelvare@suse.de> # for hwmon, i2c-core and i2c/muxes Acked-by: Corey Minyard <cminyard@mvista.com> # for IPMI Reviewed-by: Vladimir Oltean <olteanv@gmail.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for drivers/power Acked-by: Krzysztof Hałasa <khalasa@piap.pl> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
2022-05-20hwmon: (jc42) Add support for S-34TS04AOleksandr Shamray1-0/+6
S-34TS04A is a JC42 compatible 2-wire serial EEPROM with temperature sensor from Seiko Instruments/ABLIC. Signed-off-by: Oleksandr Shamray <oleksandrs@nvidia.com> Reviewed-by: Vadim Pasternak <vadimp@nvidia.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-05-17hwmon: (jc42) add HWMON_C_TZ_REGISTEREduardo Valentin1-0/+2
Add a thermal zone interface to the devices added under jc42 driver. This way, thermal zones described in device tree can make use of the of nodes of these devices. Cc: Guenter Roeck <linux@roeck-us.net> (maintainer:JC42.4 TEMPERATURE SENSOR DRIVER) Cc: Jean Delvare <jdelvare@suse.com> (maintainer:HARDWARE MONITORING) Cc: linux-hwmon@vger.kernel.org (open list:JC42.4 TEMPERATURE SENSOR DRIVER) Cc: linux-kernel@vger.kernel.org (open list) Signed-off-by: Eduardo Valentin <eduval@amazon.com> Signed-off-by: Eduardo Valentin <evalenti@kernel.org> Link: https://lore.kernel.org/r/20220318233011.13980-1-eduval@amazon.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-12-26hwmon: (jc42) Add support for ONSEMI N34TS04Guenter Roeck1-0/+4
N34TS04 is a JC42.4 compatible temperature sensor from ONSEMI. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-09-23hwmon: use simple i2c probe functionStephen Kitt1-2/+2
Many hwmon drivers don't use the id information provided by the old i2c probe function, and the remainder can easily be adapted to the new form ("probe_new") by calling i2c_match_id explicitly. This avoids scanning the identifier tables during probes. Drivers which didn't use the id are converted as-is; drivers which did are modified as follows: * if the information in i2c_client is sufficient, that's used instead (client->name); * anything else is handled by calling i2c_match_id() with the same level of error-handling (if any) as before. A few drivers aren't included in this patch because they have a different set of maintainers. They will be covered by other patches. Signed-off-by: Stephen Kitt <steve@sk2.org> Link: https://lore.kernel.org/r/20200813160222.1503401-1-steve@sk2.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-04-18hwmon: (jc42) Fix name to have no illegal charactersSascha Hauer1-1/+1
The jc42 driver passes I2C client's name as hwmon device name. In case of device tree probed devices this ends up being part of the compatible string, "jc-42.4-temp". This name contains hyphens and the hwmon core doesn't like this: jc42 2-0018: hwmon: 'jc-42.4-temp' is not a valid name attribute, please fix This changes the name to "jc42" which doesn't have any illegal characters. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.kernel.org/r/20200417092853.31206-1-s.hauer@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>
2019-04-15hwmon: (jc42) Use HWMON_CHANNEL_INFO macroGuenter Roeck1-13/+5
The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood of errors, and makes the code easier to read. The conversion was done automatically with coccinelle. The semantic patch used to make this change is as follows. @r@ initializer list elements; identifier i; @@ -u32 i[] = { - elements, - 0 -}; @s@ identifier r.i,j,ty; @@ -struct hwmon_channel_info j = { - .type = ty, - .config = i, -}; @script:ocaml t@ ty << s.ty; elements << r.elements; shorter; elems; @@ shorter := make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty))); elems := make_ident (String.concat "," (List.map (fun x -> Printf.sprintf "\n\t\t\t %s" x) (Str.split (Str.regexp " , ") elements))) @@ identifier s.j,t.shorter; identifier t.elems; @@ - &j + HWMON_CHANNEL_INFO(shorter,elems) This patch does not introduce functional changes. Many thanks to Julia Lawall for providing the semantic patch. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-02-18hwmon: (jc42) Replace S_<PERMS> with octal valuesGuenter Roeck1-4/+4
Replace S_<PERMS> 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-11-30hwmon: (jc42) optionally try to disable the SMBUS timeoutPeter Rosin1-0/+21
With a nxp,se97 chip on an atmel sama5d31 board, the I2C adapter driver is not always capable of avoiding the 25-35 ms timeout as specified by the SMBUS protocol. This may cause silent corruption of the last bit of any transfer, e.g. a one is read instead of a zero if the sensor chip times out. This also affects the eeprom half of the nxp-se97 chip, where this silent corruption was originally noticed. Other I2C adapters probably suffer similar issues, e.g. bit-banging comes to mind as risky... The SMBUS register in the nxp chip is not a standard Jedec register, but it is not special to the nxp chips either, at least the atmel chips have the same mechanism. Therefore, do not special case this on the manufacturer, it is opt-in via the device property anyway. Cc: stable@vger.kernel.org # 4.9+ Signed-off-by: Peter Rosin <peda@axentia.se> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-08-13hwmon: (jc42) Add support for CAT34TS02CGuenter Roeck1-0/+4
CAT34TS02C is similar to CAT34TS02 but has a different device ID. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-08-13hwmon: (jc42) Add support for GT30TS00, GT34TS02, and CAT34TS04Guenter Roeck1-0/+15
Giantec GT30TS00 GT30TS00 and GT34TS02 as well as ONS CAT34TS04 are used on DDR4 DIMMs. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2016-09-08hwmon: (jc42) Convert to use new hwmon registration APIGuenter Roeck1-144/+149
Simplify code and reduce code size by using the new hwmon registration API. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2016-07-12hwmon: (jc42) Add support for generic JC-42.4 devicetree bindingGuenter Roeck1-0/+10
With this change, JC-42.4 compatible temperature sensors can be configured in devicetree by providing a generic "jedec,jc-42.4-temp" binding. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2016-07-04hwmon: (jc42) Add I2C_CLASS_HWMON to detection classAlison Schofield1-1/+1
In 2011, commit 774466add7c ("hwmon: (jc42) Change detection class") changed the detection class of these chips to I2C_CLASS_SPD based on this premise: "makes more sense because these chips always live on memory modules" Today these chips have applications beyond memory modules. Examples are JC42.4 compatible chips such as MCP9804 and MCP9808, but also MCP9805, which is marked as JC42.4 compliant and suggested for use not only for DIMMS, but also as generic temperature sensor. Add I2C_CLASS_HWMON as an additional detection class to allow detection by hwmon class i2c adapters. Signed-off-by: Alison Schofield <amsfield22@gmail.com> Cc: Daniel Baluta <daniel.baluta@gmail.com> [groeck: Updated description] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2016-06-27hwmon: (jc42) Add support for Microchip MCP9808 temperature sensorAlison Schofield1-0/+4
MCP9808 is not officially compliant to JC-42, similar to MCP9804, but its registers are compatible to JC-42. Signed-off-by: Alison Schofield <amsfield22@gmail.com> Cc: Daniel Baluta <daniel.baluta@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09hwmon: (jc42) Add support for additional IDT temperature sensorsGuenter Roeck1-6/+10
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-25hwmon: (jc42) Allow negative hysteresis temperaturesJean Delvare1-3/+4
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-25hwmon: (jc42) Fix integer overflow when writing hysteresis valueGuenter Roeck1-0/+2
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-25hwmon: (jc42) Fix integer overflowGuenter Roeck1-1/+1
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-25hwmon: (jc42) Use sign_extend32 for sign extensionGuenter Roeck1-5/+1
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 Roeck1-0/+9
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 Roeck1-110/+72
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 Roeck1-97/+89
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-18hwmon: (jc42) fix coccinelle warningsFengguang Wu1-4/+1
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 Roeck1-36/+25
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-02-06hwmon: (jc42) Add support for MCP98244Guenter Roeck1-0/+4
Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <khali@linux-fr.org>
2013-01-25hwmon: Replace SENSORS_LIMIT with clamp_valGuenter Roeck1-3/+3
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 Delvare1-3/+10
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 Delvare1-7/+6
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 Roeck1-1/+1
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-18hwmon: (jc42) Remove unnecessary device IDsGuenter Roeck1-18/+0
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-18hwmon: (jc42) Convert to use devm_kzallocGuenter Roeck1-35/+25
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-18hwmon: (jc42) Fix multi-line commentsGuenter Roeck1-2/+4
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
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-03-07hwmon: (jc42) Add support for AT30TS00, TS3000GB2, TSE2002GB2, and MCP9804Guenter Roeck1-2/+18
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 Delvare1-0/+10
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 Torvalds1-2/+2
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 Meulenbroeks1-2/+2
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-03switch ->is_visible() to returning umode_tAl Viro1-1/+1
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-11-04hwmon: Use i2c_smbus_{read,write}_word_swappedJean Delvare1-32/+20
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 Delvare1-1/+1
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 Ladisch1-4/+29
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 Ladisch1-1/+1
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>