Commit Graph

31 Commits

Author SHA1 Message Date
Harald Judt 374d1f9835 hwmon: (nct6775) Add support for hibernate
Hibernation uses its own set of callback functions, even if the code
is the same as the code used for suspend/restore.

Signed-off-by: Harald Judt <h.judt@gmx.at>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:39 -07:00
Jingoo Han a8b3a3a53f hwmon: use dev_get_platdata()
Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:39 -07:00
Dan Carpenter f58876ac8c hwmon: (nct6775) Fix size of data->temp array
Smatch complains that we have a array overflow:

	drivers/hwmon/nct6775.c:1456 nct6775_update_device()
		error: buffer overflow 'data->temp' 4 <= 4

Guenter Roeck says that the array should have been made larger in
7cbbd6aee6 (Add support for critical low/high temperature limits on
NCT6106).  This patch does that.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:39 -07:00
Guenter Roeck df612d5fb7 hwmon: (nct6775) Avoid using device platform data outside probe function
Plan going forward is to attach all device attributes to the hwmon device and no
longer to the platform device. With that change, accessing platform data outside
the probe function will be more difficult. To avoid the problem, change code
to no longer rely on it.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:39 -07:00
David Bartley 578ab5f0e4 hwmon: (nct6775) Add support for NCT6791D
Signed-off-by: David Bartley <andareed@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:39 -07:00
Guenter Roeck 3084699304 hwmon: (nct6775) Add support for beep attributes
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:39 -07:00
Guenter Roeck b7a6135348 hwmon: (nct6775) Add support for critical low/high temperature limits on NCT6106
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:39 -07:00
Guenter Roeck 6c009501ff hwmon: (nct6775) Add support for NCT6102D/6106D
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:39 -07:00
Guenter Roeck 698a7c24a5 hwmon: (nct6775) Support two SuperIO chips in the same system
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:39 -07:00
Guenter Roeck f73cf632df hwmon: (nct6775) Allocate attributes dynamically from templates
Static attribute allocation is large and very repetitive.
Allocate attributes and attribute groups dynamically instead.
This reduces the size of the driver source by more than 600 lines,
and object size by more than 20k (more than 30%).

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:38 -07:00
Guenter Roeck 41fa9a944f hwmon: (nct6775) Drop unsupported fan alarm attributes for NCT6775
NCT6775 does not support alarms for fans 4 and 5. Drop the attributes.

cc: stable@vger.kernel.org # 3.10+
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-06-27 10:31:43 -07:00
Guenter Roeck b1d2bff6a6 hwmon: (nct6775) Fix temperature alarm attributes
Driver displays wrong alarms for temperature attributes.

Turns out that temperature alarm bits are not fixed, but determined
by temperature source mapping. To fix the problem, walk through
the temperature sources to determine the correct alarm bit associated
with a given attribute.

Cc: stable@vger.kernel.org # 3.10+
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-06-27 10:31:43 -07:00
Guenter Roeck 169c05cd54 hwmon: (nct6775) Do not create non-existing attributes
Overtemperature and hysteresis registers only exist for primary
temperature registers, not for alternates, so do not assign
those registers when initializing alternates.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-05-11 22:55:07 -07:00
Guenter Roeck 6445e6600f hwmon: (nct6775) Fix coding style problems
Add space around binary operators (CodingStyle, chapter 3.1).

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-21 09:42:52 -07:00
Guenter Roeck 6d4b3621bb hwmon: (nct6775) Constify strings
nct6775_sio_names should be a constant pointer to an array of
constant strings.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-21 09:42:45 -07:00
Guenter Roeck c409fd43bd hwmon: (nct6775) Use ARRAY_SIZE for loops where possible
This ensures that the loop iterations are correct even if/when
the number of elements in an array changes.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-13 08:44:35 -07:00
Guenter Roeck 573728c647 hwmon: (nct6775) Enable both AUXTIN and VIN3 on NCT6776
Per datasheet, VIN3 and AUXTIN share the same external pin. However, there
is no clean way to detect this condition. Furthermore, both are reported
by the BIOS on Supermicro C7H61. It may thus be possible that chip revisions
exist where both attributes are supported at the same time.
Better play safe and report both.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:42 -07:00
Guenter Roeck 2c7fd30da2 hwmon: (nct6775) Expand scope of supported chips
NCT6775, NCT6776, and NCT6779 have a number of variants with the same
chip ID but different chip labels. Add text "or compatible" to the
message displayed when the driver is loaded and rephrase the Kconfig
entry to reflect that it also supports compatible chips.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:42 -07:00
Guenter Roeck 236d903948 hwmon: (nct6775) Drop read/write lock
The read/write lock is acquired for each read/write operation from/to the chip.
This occurs either during initialization, when it is not needed, or during
updates, when the update_lock is held as well, and it is not needed either.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:40 -07:00
Guenter Roeck 0fc1f8fc61 hwmon: (nct6775) Only report VID if supported and enabled
VID is not always enabled (NCT6775, NCT6776) or supported (NCT6779).

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:39 -07:00
Guenter Roeck 8e9285b0bb hwmon: (nct6775) Detect and report additional temperature sources
Scan all temperature sources used for fan control and report if additional
monitoring registers are available.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:39 -07:00
Guenter Roeck bbd8decd41 hwmon: (nct6775) Add support for weighted fan control
The NCT677X series support weighted fan control. In this mode, a secondary
temperature source is used in addition to the primary temperature source to
control fan speed. Add support for this feature.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:39 -07:00
Guenter Roeck cdcaeceb74 hwmon: (nct6775) Add support for automatic fan control
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:39 -07:00
Guenter Roeck 77eb5b3703 hwmon: (nct6775) Add support for pwm, pwm_mode, and pwm_enable
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:39 -07:00
Guenter Roeck 84d19d92f7 hwmon: (nct6775) Add power management support
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:39 -07:00
Guenter Roeck 47ece9645f hwmon: (nct6775) Add support for fan debounce module parameter
If set, fan debounce is enabled when loading the driver.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:39 -07:00
Guenter Roeck 5c25d954d3 hwmon: (nct6775) Add support for fanX_pulses sysfs attribute
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:39 -07:00
Guenter Roeck 1c65dc365e hwmon: (nct6775) Add support for fan speed attributes
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:39 -07:00
Guenter Roeck aa136e5dad hwmon: (nct6775) Add support for temperature sensors
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:38 -07:00
Guenter Roeck a6bd587842 hwmon: (nct6775) Add case open detection
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:38 -07:00
Guenter Roeck 9de2e2e84e hwmon: Driver for Nuvoton NCT6775F, NCT6776F, and NCT6779D
This driver will replace the w83627ehf driver for NCT6775F and NCT6776F,
and provides support for NCT6779D.

This patch provides support for voltage monitor attributes.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:38 -07:00