summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/w83795.c
AgeCommit message (Collapse)AuthorFilesLines
2010-10-28hwmon: (w83795) Fix PWM duty cycle frequency attributesJean Delvare1-28/+62
The PWM duty cycle frequenty attributes are improperly named (fanN_div instead of pwmN_div) and contain raw values instead of actual frequencies. Rename them and fix their contents. Also improve the logic when the user asks for a new frequency, to always pick the closest supported frequency. The algorithm could certainly be optimized, but the operation is infrequent enough that I don't think it's worth the effort. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (w83795) Add support for dynamic in0-2 limitsJean Delvare1-0/+56
The W83795G can be configured to set the in0, in1 and/or in2 voltage limits dynamically based on VID input pins. Switch the respective sysfs attributes to read-only. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (w83795) Fix LSB reading of fan speedsJean Delvare1-5/+5
Misplaced parentheses caused the wrong register value to be read, resulting in random LSB for fan speed values and limits. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (w83795) Clean up probe functionJean Delvare1-57/+34
* The data structure is zalloc'd, so no need to set individual fields to 0 explicitly. * Refactor the handling of pins that can be used for either temperature or voltage monitoring. * Misc other clean-ups. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (w83795) Fix in17-in20 gain factorJean Delvare1-3/+3
Gain bit set means 1x gain and cleared means 8x gain, not the other way around. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (w83795) Only start monitoring if neededJean Delvare1-3/+10
This saves an SMBus write if monitoring was already enabled. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (w83795) Add const markersJean Delvare1-8/+10
Attribute structures can be made const. Same for the I2C address list. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (w83795) Only create fan[1-8]_target files when neededJean Delvare1-23/+4
Only create fan[1-8]_target files when the fan in question can be controlled (PWM output is present.) Also name these files according to the standard. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (w83795) Move PWM attributes to a dedidated arrayJean Delvare1-10/+8
Use a dedicated 2D array for PWM attributes. This way, PWM attributes are handled the same way as other attributes, this is more consistent. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (w83795) Use 2D arrays for many device attributesJean Delvare1-29/+37
Use 2D arrays for in, fan, temp and dts device attributes. Using linear arrays is too risky as we have to skip some groups depending on the device model and configuration. Adding or removing an attribute would let the driver build silently but then it would crash at runtime. With 2D arrays, the consistency checking happens at build time, which is much safer. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (w83795) Merge w83795_create_files and w83795_remove_filesJean Delvare1-38/+17
Functions w83795_create_files and w83795_remove_files iterate over the same set of files, just calling a different function. Merge them into a single function which takes the action as a parameter. This saves code, and also ensure that file creation and deletion are in sync. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (w83795) Move file creation to a separate function tooJean Delvare1-55/+66
Function w83795_probe() is way too big, move file creation to a separate function to make it more readable. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (w83795) Move files removal to a separate functionJean Delvare1-50/+31
Sysfs files must be removed on device removal but also when device registration fails. Move the code to a separate function to avoid code redundancy. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (w83795) Improve detection routineJean Delvare1-23/+57
Check for additional identification registers. Improve debugging messages on failed detection. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (w83795) Refactor bank selectionJean Delvare1-43/+50
Move the bank selection code to a separate function, to avoid duplicating it in read and write functions. Improve error reporting on register access error. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (w83795) Drop duplicate enumJean Delvare1-19/+15
Enum chips and chip_types are redundant, get rid of the former. Fix the detection code to properly identify the chip variant and name the client accordingly. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (w83795) Misc cleanupsJean Delvare1-6/+1
* Improve driver description. * Drop unused macro. * Drop unreachable code. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: New driver for the W83795G/ADG monitoring chipsWei Song1-0/+2138
There is still much work needed, but I wanted to give Wei the credit he deserves. I've merged some of my own fixes already, to make gcc and checkpatch happy. Individual fixes and improvements from me will follow. [JD: Fix build errors] [JD: Coding style cleanups] [JD: Get rid of forward declarations] [JD: Drop VID support] [JD: Drop fault output control feature] [JD: Use lowercase for inline function names] [JD: Use strict variants of the strtol/ul functions] [JD: Shorten the read and write function names] Signed-off-by: Jean Delvare <khali@linux-fr.org>