summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/nct7904.c
Commit message (Collapse)AuthorAgeFilesLines
* hwmon: (nct7904) Fix the incorrect value of vsen_mask & tcpu_mask & ↵amy.shih2019-10-201-3/+12
| | | | | | | | | | | | | | temp_mode in nct7904_data struct. Voltage sensors overlap with external temperature sensors. Detect the multi-function of voltage, thermal diode, thermistor and reserved from register VT_ADC_MD_REG to set value of vsen_mask & tcpu_mask & temp_mode in nct7904_data struct. If the value is reserved, needs to disable the vsen_mask & tcpu_mask. Signed-off-by: amy.shih <amy.shih@advantech.com.tw> Link: https://lore.kernel.org/r/20191014082451.2895-1-Amy.Shih@advantech.com.tw Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (nct7904) Add array fan_alarm and vsen_alarm to store the alarms in ↵amy.shih2019-10-021-2/+20
| | | | | | | | | | | | | | | | nct7904_data struct. SMI# interrupt for fan and voltage is Two-Times Interrupt Mode. Fan or voltage exceeds high limit or going below low limit, it will causes an interrupt if the previous interrupt has been reset by reading all the interrupt Status Register. Thus, add the array fan_alarm and vsen_alarm to store the alarms for all of the fan and voltage sensors. Signed-off-by: amy.shih <amy.shih@advantech.com.tw> Link: https://lore.kernel.org/r/20190919030205.11440-1-Amy.Shih@advantech.com.tw Fixes: 486842db3b79 ("hwmon: (nct7904) Add extra sysfs support for fan, voltage and temperature.") Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (nct7904) Fix the incorrect value of vsen_mask in nct7904_data structamy.shih2019-10-021-4/+7
| | | | | | | | | | | Voltage sensors overlap with external temperature sensors. Detect the multi-function of voltage, thermal diode and thermistor from register VT_ADC_MD_REG to set value of vsen_mask in nct7904_data struct. Signed-off-by: amy.shih <amy.shih@advantech.com.tw> Link: https://lore.kernel.org/r/20190918084801.9859-1-Amy.Shih@advantech.com.tw Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (nct7904) Fix incorrect SMI status register setting of LTD ↵amy.shih2019-09-121-2/+9
| | | | | | | | | | | | temperature and fan. According to datasheet, the SMI status register setting of LTD temperature is SMI_STS3, and the SMI status register setting of fan is SMI_STS5 and SMI_STS6. Signed-off-by: amy.shih <amy.shih@advantech.com.tw> Link: https://lore.kernel.org/r/20190912113300.4714-1-Amy.Shih@advantech.com.tw Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (nct7904) Fix incorrect temperature limitation register setting of LTD.amy.shih2019-09-031-8/+8
| | | | | | | | | | | | | | According to kernel hwmon sysfs-interface documentation, temperature critical max value, typically greater than corresponding temp_max values. Thus, reads the LTD_HV_HL (LTD HIGH VALUE HIGH LIMITATION) and LTD_LV_HL (LTD LOW VALUE HIGH LIMITATION) for case hwmon_temp_crit and hwmon_temp_crit_hyst. Reads the LTD_HV_LL (HIGH VALUE LOW LIMITATION) and LTD_LV_LL (LOW VALUE LOW LIMITATION) for case hwmon_temp_max and hwmon_temp_max_hyst. Signed-off-by: amy.shih <amy.shih@advantech.com.tw> Link: https://lore.kernel.org/r/20850618155720.24857-1-Amy.Shih@advantech.com.tw Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (nct7904) Add extra sysfs support for fan, voltage and temperature.amy.shih2019-09-031-45/+424
| | | | | | | | | | | | | | | | | | | | | | | | | | NCT-7904D also supports reading of channel limitation registers as well as SMI status registers for fan, voltage and temperature monitoring. It also supports reading the temperature sensor type (thermal diode, thermistor, AMD SB-TSI or Intel PECI). Add the following sysfs nodes: -fan[1-*]_min -fan[1-*]_alarm -in[1-*]_min -in[1-*]_max -in[1-*]_alarm -temp[1-*]_max -temp[1-*]_max_hyst -temp[1-*]_emergency -temp[1-*]_emergency_hyst -temp[1-*]_alarm -temp[1-*]_type Signed-off-by: Amy Shih <amy.shih@advantech.com.tw> Link: https://lore.kernel.org/r/20190807013842.24451-1-Amy.Shih@advantech.com.tw [groeck: Clarified description] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (nct7904) Changes comments in probe function.amy.shih2019-07-081-2/+2
| | | | | | | | Linux style for comments is the C89 "/* ... */" style, changes the comments to Linux style. Signed-off-by: amy.shih <amy.shih@advantech.com.tw> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (nct7904) Add error handling in probe function.amy.shih2019-07-081-5/+18
| | | | | | | | When register read and write operations return errors, needs to add error handling. Signed-off-by: amy.shih <amy.shih@advantech.com.tw> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (nct7904) Fix the incorrect value of tcpu_mask in nct7904_data struct.amy.shih2019-06-231-9/+63
| | | | | | | | | | | Detect the multi-function of voltage, thermal diode and thermistor from register VT_ADC_MD_REG to set value of tcpu_mask in nct7904_data struct, set temp[1-5]_input the input values TEMP_CH1~4 and LTD of temperature. Set temp[6~13]_input the input values of DTS temperature that correspond to sensors TCPU1~8. Signed-off-by: amy.shih <amy.shih@advantech.com.tw> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157Thomas Gleixner2019-05-301-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on 3 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 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 [author] [kishon] [vijay] [abraham] [i] [kishon]@[ti] [com] 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 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 [author] [graeme] [gregory] [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i] [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema] [hk] [hemahk]@[ti] [com] 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 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1105 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* hwmon: (nct7904) Use new HWMON_CHANNEL_INFO() macroGuenter Roeck2019-04-151-82/+46
| | | | | | | The new macro simplifies the code, reduces the likelihood of errors, and makes the code easier to read. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (nct7904) Replace S_<PERMS> with octal valuesGuenter Roeck2019-02-181-5/+5
| | | | | | | | | | | | | 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>
* hwmon: (nct7904) Fix UNSPECIFIED_INT warningJakob Albert2018-07-081-4/+4
| | | | | | | | Fix UNSPECIFIED_INT warning reported by checkpatch.pl Signed-off-by: Lorenz Kaestle <lorenz.kaestle@fau.de> Signed-off-by: Jakob Albert <jakob.j.albert@fau.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (nct7904) Fix CODE_INDENT errorJakob Albert2018-07-081-24/+24
| | | | | | | | Fix CODE_INDENT error reported by checkpatch.pl Signed-off-by: Lorenz Kaestle <lorenz.kaestle@fau.de> Signed-off-by: Jakob Albert <jakob.j.albert@fau.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (nct7904) Fix SPACING errorsJakob Albert2018-07-081-6/+6
| | | | | | | | Fix SPACING errors reported by checkpatch.pl Signed-off-by: Lorenz Kaestle <lorenz.kaestle@fau.de> Signed-off-by: Jakob Albert <jakob.j.albert@fau.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (nct7904) Convert to use new hwmon registration APIGuenter Roeck2016-09-081-285/+270
| | | | | | | Simplify code and reduce code size by using the new hwmon registration API. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (nct7904) Export I2C module alias informationJavier Martinez Canillas2015-08-051-0/+1
| | | | | | | | | | | | The I2C core always reports the MODALIAS uevent as "i2c:<client name" regardless if the driver was matched using the I2C id_table or the of_match_table. So the driver needs to export the I2C table and this be built into the module or udev won't have the necessary information to auto load the correct module when the device is added. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Cc: stable@vger.kernel.org # v4.1+ Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (nct7904) Rename pwm attributes to match hwmon ABIGuenter Roeck2015-07-291-28/+29
| | | | | | | | pwm attributes have well defined names, which should be used. Cc: Vadim V. Vlasov <vvlasov@dev.rtsoft.ru> Cc: stable@vger.kernel.org #v4.1+ Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (nct7904) Strengthen detect functionGuenter Roeck2015-03-091-1/+2
| | | | | | | | | The bank register has five unused bits. Verify that those bits are zero to strengthen the detect function. Cc: Vadim V. Vlasov <vvlasov@dev.rtsoft.ru> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <jdelvare@suse.de>
* hwmon: Add Nuvoton NCT7904 hwmon driverVadim V. Vlasov2015-03-091-0/+592
The NCT7904D is a hardware monitor supporting up to 20 voltage sensors, internal temperature sensor, Intel PECI and AMD SB-TSI CPU temperature interface, up to 12 fan tachometer inputs, up to 4 fan control channels with SmartFan. Signed-off-by: Vadim V. Vlasov <vvlasov@dev.rtsoft.ru> [Guenter Roeck: Fixed whitespace errors, dropped redundant comment] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
OpenPOWER on IntegriCloud