summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/it87.c
Commit message (Collapse)AuthorAgeFilesLines
* hwmon: (it87) Add support for IT8792EGuenter Roeck2017-02-101-2/+16
| | | | | | | | | | The chip is similar to IT8732E, but supports only three fans and pwm outputs instead of four (the driver currently does not support the 4th fan and pwm output of IT8732E). Note that the chip ID is 0x8733, not 0x8792 as one would expect. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Do not overwrite bit 2..6 of pwm control registersGuenter Roeck2017-02-101-13/+24
| | | | | | | | | | | | | | In IT8620E, after setting pwm control to manual, it was observed that pwm values for fan 4..6 have reversed results (writing 0 results in fans running at full speed, writing 255 results in fans turned off). With the new PWM control, pwm polarity for pwm control 4..6 is specified in its pwm control registers. Those registers are overwritten when setting the pwm mode or the temperature mapping. Do not touch bit 2..6 of pwm control registers on register writes to fix the problem. Cc: stable@vger.kernel.org # 4.9+ Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Fix pwm4 detection for IT8620 and IT8628Guenter Roeck2017-02-101-1/+1
| | | | | | | | | pwm4 is enabled if bit 2 of GPIO control register 4 is disabled, not when it is enabled. Since the check is for the skip condition, it is reversed. This applies to both IT8620 and IT8628. Fixes: 36c4d98a7883d ("hwmon: (it87) Add support for all pwm channels ...") Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Ensure that pwm control cache is current before updating valuesGuenter Roeck2017-02-101-0/+2
| | | | | | | | | | If sensor attributes were never read, the pwm control data has not been initiialized, which can cause wrong driver behavior. Ensure that cached data is current before acting on it. Cc: stable@vger.kernel.org # 4.4+ Reported-by: Kevin Folz <kfolz@evertz.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Improve IT8622 supportGuenter Roeck2017-02-101-8/+59
| | | | | | | Configuration registers on ITE8622 are different to 8620 and 8628 and require special handling. Also, the chip supports up to 5 pwm controls. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add support for IT8622EGuenter Roeck2017-02-101-1/+15
| | | | | | | | IT8622E is similar to IT8620E, but only supports five pwm controls and five fan tachometers. Originally-from: Kevin Folz <kfolz@evertz.com>. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add feature flag indicating that VIN3 is connected to 5VGuenter Roeck2017-02-101-3/+7
| | | | | | | On IT8622E and IT8628E, VIN3 is expected to be connected to +5V. Add feature flag and reflect in input label. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) use permission-specific DEVICE_ATTR variantsJulia Lawall2017-01-021-10/+10
| | | | | | | | | | | | | | Use DEVICE_ATTR_RO for read only attributes and DEVICE_ATTR_RW for read/write attributes. This simplifies the source code, improves readbility, and reduces the chance of inconsistencies. The conversion was done automatically using coccinelle. It was validated by compiling both the old and the new source code and comparing its text, data, and bss size. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> [groeck: Updated description] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Drop useless commentsJean Delvare2016-09-081-4/+4
| | | | | | | | | | | Remove the index comments at the end of it87_attributes_in. They serve no purpose (as there is no reference to them in it87_in_is_visible) and some of them were obviously wrong. Signed-off-by: Jean Delvare <jdelvare@suse.de> Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Cc: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add missing sysfs attribute group terminatorJean Delvare2016-08-291-0/+1
| | | | | | | | | | | | Attribute array it87_attributes_in lacks its NULL terminator, causing random behavior when operating on the attribute group. Fixes: 52929715634a ("hwmon: (it87) Use is_visible for voltage sensors") Signed-off-by: Jean Delvare <jdelvare@suse.de> Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Cc: Guenter Roeck <linux@roeck-us.net> Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Features mask must be 32 bit wideGuenter Roeck2016-08-111-1/+1
| | | | | | | | | | | | | Coverity reports: result_independent_of_operands: data->features & (65536UL /* 1UL << 16 */) is always 0 regardless of the values of its operands. This occurs as the logical operand of if. data->features needs to be 32 bit wide since there are more than 16 features. Fixes: cc18da79d9b7 ("hwmon: (it87) Support up to 6 temperature sensors ... "); Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add support for IT8628EGuenter Roeck2016-04-191-2/+16
| | | | | | | IT8628E is functionally identical to IT8620E. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Fix pwm_temp_map for system with 6 pwm channelsGuenter Roeck2016-04-191-8/+15
| | | | | Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Support automatic pwm control on newer chipsGuenter Roeck2016-04-191-14/+187
| | | | | Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Enhance validation for fan4 and fan5Guenter Roeck2016-04-191-0/+23
| | | | | | | | | Several of the chips supported by this driver have a configuration register to enable fan4 and fan5. Use those registers to determine if fan4 and fan5 tachometers are supported. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Support disabling fan control for all pwm control and chipsGuenter Roeck2016-04-191-21/+31
| | | | | | | | | | On/Off mode is only supported for pwm controls 0-2, and not supported at all for IT8603E/IT8623E. For pwm controls 3-6 and for IT8603E/IT8623E, SmartGuardian mode is always enabled. Use it and set the pwm value to the maximum if fan control is disabled. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Formatting cleanupGuenter Roeck2016-04-191-75/+80
| | | | | | | | | | | | | | | | | | | | Fix various checkpatch complaints to clean up the code and make it easier to read. CHECK: Do not include the paragraph about writing to the FSF CHECK: Alignment should match open parenthesis CHECK: Logical continuations should be on the previous line CHECK: No space is necessary after a cast CHECK: Please don't use multiple blank lines CHECK: Please use a blank line after function/struct/union/enum declarations CHECK: spaces preferred around that '+' (ctx:VxV) WARNING: Missing a blank line after declarations No functional change. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Use defines for array sizes and sensor countsGuenter Roeck2016-04-191-24/+34
| | | | | | | | Using array size defines makes it much easier to find errors in index values and loop counts. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Use BIT macroGuenter Roeck2016-04-191-144/+146
| | | | | | | | Using the BIT macro makes the code a little easier to read and has the added benefit of making checkpatch happy. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add support for VIN7 to VIN10 on IT8620EGuenter Roeck2016-04-191-5/+24
| | | | | | | IT8620E supports three additional voltage sensors. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Simplify reading voltage registersGuenter Roeck2016-04-191-9/+13
| | | | | | | | | Voltage registers are non-sequential. Use a register array instead of a macro to map sensor index to register to simplify the code and to make it easier to add additional voltage sensors. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Support up to 6 temperature sensors on IT8620EGuenter Roeck2016-04-191-8/+40
| | | | | | | Add support for the additional temperature sensors on IT8620E. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Convert to use new hwmon APIGuenter Roeck2016-04-191-74/+19
| | | | | | | | | Convert to use devm_hwmon_device_register_with_groups to simplify code and reduce code size. This also attaches sysfs attributes to the hwmon device and no longer to the platform device. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Use single group and is_visible for miscellaneous attributesGuenter Roeck2016-04-191-48/+33
| | | | | | | | | Use is_visible to determine if attributes should be generated or not. This simplifies the code and reduces object size by about 120 bytes on x86_64. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Use is_visible for pwm attributesGuenter Roeck2016-04-191-72/+65
| | | | | | | Simplify code and reduce object size by about 250 bytes on x86_64. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Use is_visible for fan attributesGuenter Roeck2016-04-191-85/+55
| | | | | | | Simplify code and reduce object size by almost 500 bytes on x86_64. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Use is_visible for temperature sensorsGuenter Roeck2016-04-191-51/+36
| | | | | | | Simplify code and reduce object size by more than 200 bytes on x86_64. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Use is_visible for voltage sensorsGuenter Roeck2016-04-191-68/+56
| | | | | | | Simplify code and reduce object size by more than 300 bytes on x86_64. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Rearrange code to avoid forward declarationsGuenter Roeck2016-04-191-336/+327
| | | | | | | Cleanup only, no functional change. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add support for second Super-IO chipGuenter Roeck2016-04-191-15/+34
| | | | | | | | The Super-IO chip can also reside at SIO address 0x4e, and there can be two Super-IO chips in the system. Add support for it. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Pass SIO base address as parameter to superio functionsGuenter Roeck2016-04-191-65/+72
| | | | | | | | This will let us support more than one chip on different SIO addresses with the same driver. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Don't use pdev as static driver variableGuenter Roeck2016-04-191-3/+5
| | | | | | | | | | Using the same varible name for function names and as static variable invites misuse and prevents us from adding support for a second chip. Rename pdev to it87_pdev and limit its use to where it is needed. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Simplify error return in it87_device_addGuenter Roeck2016-04-191-7/+3
| | | | | | | | Return directly on errors if there is no cleanup necessary. Don't create an error message on memory allocation errors. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add support for second pwm frequency registerGuenter Roeck2016-04-191-31/+69
| | | | | | | Recent chips have a separate register to select the pwm2 frequency. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add support for all pwm channels on IT8620EGuenter Roeck2016-04-191-20/+94
| | | | | | | | | IT8620E supports up to 6 pwm channels. Add support for it. Also check if fan tachometers 4..6 are enabled before instantiating the respective sysfs attributes. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add feature flag for AVCC3 supportGuenter Roeck2016-04-191-8/+13
| | | | | | | | | AVCC3 is supported on IT8620E, similar to IT8603E. Add feature flag to indicate AVCC3 support. Don't enable it for now on IT8620E since it is unclear if this chip supports it correctly. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add support for IT8732FJustin Maggard2015-08-091-7/+36
| | | | | | | | | Add support for the IT8732F. This chip is pretty similar to IT8721F, with the main difference being that the ADC LSB is 10.9 mV instead of 12 mV. Signed-off-by: Justin Maggard <jmaggard@netgear.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Use feature macros on sio_dataGuenter Roeck2015-04-091-2/+5
| | | | | | | Feature macros work on sio_data as well, so use them there. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add support for 6th fan of IT8620EGuenter Roeck2015-04-051-15/+33
| | | | | | | IT8620E supports up to 6 fan tachometers. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add support for IT8620EGuenter Roeck2015-04-051-1/+42
| | | | | | | | | | | IT8620E is mostly compatible to IT7828F. Add generic support for it. IT8620E supports up to 6 fan tachometers and 6 pwm controls. Support for the 6th tachometer and for the additional pwm controls are addded in separate patches. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add support for IT8790EGuenter Roeck2015-04-051-1/+13
| | | | | | | | | IT8790E is a super-IO chip with three fan tachometers. It is mostly compatible to IT8728F, but only supports three fan tachometers instead of five. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Introduce feature flag to reflect internal in7 sensorGuenter Roeck2015-04-051-11/+16
| | | | | | | | | On some chips, in7 is always an internal voltage sensor. Introduce feature flag to reflect this condition to simplify adding support for new chips. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Introduce configuration field for chip suffixGuenter Roeck2015-04-051-3/+17
| | | | | | | | | ITE chips may have 'E', 'F', or both 'E' and 'F' suffixes. Introduce suffic configuration to the it87_devices structure to simplify adding new chips. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Fix PWM frequency display for chips with newer PWM controlGuenter Roeck2015-04-051-9/+25
| | | | | | | | | | On chips with newer PWM control, the PWM frequency divider is 256 instead of 128. Since the base PWM frequency remained the same, the actual PWM frequency is half of what it used to be with the older PWM control mechanism. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Fix pwm sysfs attribute removalGuenter Roeck2015-03-301-1/+1
| | | | | | | | | | | Detection if a pwm channel is supported was wrong on removal, causing the code to try removing non-existing sysfs attributes. That didn't matter much because sysfs attribute removal of non-existing files fails silently, and because the wrong evaluation always returned false, but should nevertheless be fixed. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) No need to skip fan4 for IT8603Guenter Roeck2015-03-091-4/+0
| | | | | | | IT8603 only supports three fans, so it is not necessary to skip fan4. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add support for IT8786EThomas Lorblanches2015-03-091-6/+16
| | | | | | | | | | IT8786E is mostly compatible with IT8771 / IT8772. Parameters determined by testing various combinations. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Thomas Lorblanches <zlika_ese@hotmail.com> [Guenter Roeck: merged from github, addressed review comments] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add feature flag for VID supportGuenter Roeck2015-03-091-20/+11
| | | | | | | | | Newer chips don't typically support VID inputs or control. Add a feature flag for VID support to simplify adding support for new chips. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add feature flags for fans count and 16-bit fan configurationGuenter Roeck2015-03-091-33/+36
| | | | | | | | | Fans 4-5 are not supported on all chips and revisions. Also, 16-bit fan counters are always enabled on some chips. Provide feature flags to simplify adding support for new chips. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Don't configure 16 bit fan counters it not necessaryGuenter Roeck2015-03-091-3/+6
| | | | | | | | On IT8728F, IT8771E, and IT8772E, fans counters are always 16 bit and don't need to be configured for it. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
OpenPOWER on IntegriCloud