aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/nct7802.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-08-07hwmon: (nct7802) Fix wrong detection of in4 presenceGuenter Roeck1-3/+3
The code to detect if in4 is present is wrong; if in4 is not present, the in4_input sysfs attribute is still present. In detail: - Ihen RTD3_MD=11 (VSEN3 present), everything is as expected (no bug). - If we have RTD3_MD!=11 (no VSEN3), we unexpectedly have a in4_input file under /sys and the "sensors" command displays in4_input. But as expected, we have no in4_min, in4_max, in4_alarm, in4_beep. Fix is_visible function to detect and report in4_input visibility as expected. Reported-by: Gilles Buloz <Gilles.Buloz@kontron.com> Cc: Gilles Buloz <Gilles.Buloz@kontron.com> Cc: stable@vger.kernel.org Fixes: 3434f37835804 ("hwmon: Driver for Nuvoton NCT7802Y") Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157Thomas Gleixner1-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>
2018-12-16hwmon: (nct7802) Auto-convert to use SENSOR_DEVICE_ATTR_{RO, RW, WO}Guenter Roeck1-251/+157
Auto-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-08-13hwmon: (nct7802) constify attribute_group structures.Arvind Yadav1-5/+5
attribute_groups are not supposed to change at runtime. All functions working with attribute_groups provided by <linux/sysfs.h> work with const attribute_group. So mark the non-const structs as const. File size before: text data bss dec hex filename 6161 9400 0 15561 3cc9 drivers/hwmon/nct7802.o File size After adding 'const': text data bss dec hex filename 6465 9080 0 15545 3cb9 drivers/hwmon/nct7802.o Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2016-12-12hwmon: (nct7802) Fix overflows seen when writing into limit attributesGuenter Roeck1-3/+5
Fix overflows seen when writing voltage and temperature limit attributes. The value passed to DIV_ROUND_CLOSEST() needs to be clamped, and the value parameter passed to nct7802_write_fan_min() is an unsigned long. Also, writing values larger than 2700000 into a fan limit attribute results in writing 0 into the chip's limit registers. The exact behavior when writing this value is unspecified. For consistency, report a limit of 1350000 if the chip register reads 0. This may be wrong, and the chip behavior should be verified with the actual chip, but it is better than reporting a value of 0 (which, when written, results in writing a value of 0x1fff into the chip register). Fixes: 3434f3783580 ("hwmon: Driver for Nuvoton NCT7802Y") Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-09hwmon: (nct7802) Add auto_point attributesConstantine Shulyupin1-4/+126
Introduced REG_PWM, pwm[1..3]_auto_point[1..5]_temp, pwm[1..3]_auto_point[1..5]_pwm, nct7802_auto_point_attrs, nct7802_auto_point_group, updated nct7802_regmap_is_volatile Signed-off-by: Constantine Shulyupin <const@MakeLinux.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-09hwmon: (nct7802) Add pwmX_enable attributeConstantine Shulyupin1-0/+48
Introduced REG_SMARTFAN_EN, SMARTFAN_EN_SHIFT, pwmX_enable, show_pwm_enable, store_pwm_enable. Signed-off-by: Constantine Shulyupin <const@MakeLinux.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-09hwmon: (nct7802) Add pwm mode attributesConstantine Shulyupin1-0/+26
Introduced: show_pwm_mode, pwm1_mode, pwm2_mode, pwm2_mode Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-09hwmon: (nct7802) Add pwm controlConstantine Shulyupin1-0/+47
Added fan output control registers. Modes of operation are PWM (default) and DC. Introduced show_pwm, store_pwm, nct7802_pwm_attrs, nct7802_pwm_group. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-09hwmon: (nct7802) add temperature sensor type attributeConstantine Shulyupin1-12/+60
Sensor type: 3 diode (current mode), MD=1 4 thermistor, MD=2 Reference: Nuvoton Hardware Monitoring IC NCT7802Y 7.2.32 Mode Selection Register Location : Index 22h Signed-off-by: Constantine Shulyupin <const@MakeLinux.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-07-29hwmon: (nct7802) Fix integer overflow seen when writing voltage limitsGuenter Roeck1-1/+1
Writing a large value into a voltage limit attribute can result in an overflow due to an auto-conversion from unsigned long to unsigned int. Cc: Constantine Shulyupin <const@MakeLinux.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Cc: stable@vger.kernel.org # v4.1+ Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-07-01hwmon: (nct7802) fix visibility of temp3Constantine Shulyupin1-1/+1
Excerpt from datasheet: 7.2.32 Mode Selection Register RTD3_MD : 00=Closed , 01=Reserved , 10=Thermistor mode , 11=Voltage sense Show temp3 only in Thermistor mode Cc: stable@vger.kernel.org # v3.19+ Signed-off-by: Constantine Shulyupin <const@MakeLinux.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-01-25hwmon: (nct7802) Constify struct regmap_configKrzysztof Kozlowski1-1/+1
The regmap_config struct may be const because it is not modified by the driver and regmap_init() accepts pointer to const. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-11-30hwmon: Driver for Nuvoton NCT7802YGuenter Roeck1-0/+860
NCT7802Y is an I2C based hardware monitoring chip from Nuvoton. Signed-off-by: Guenter Roeck <linux@roeck-us.net>