summaryrefslogtreecommitdiff
path: root/drivers/hwmon/it87.c
AgeCommit message (Collapse)AuthorFilesLines
2023-04-21hwmon: (it87) Disable/enable SMBus access for IT8622E chipsetFrank Crawford1-0/+1
Configure the IT8622E chip to disable/re-enable access via an SMBus when reading or writing the chip's registers. Signed-off-by: Frank Crawford <frank@crawford.emu.id.au> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-21hwmon: (it87) Add calls to smbus_enable/smbus_disable as requiredFrank Crawford1-46/+135
Disable/re-enable access through SMBus for chip registers when they are are being read or written. For simple cases this is done at the same time as when a mutex is set, however, within loops or during initialisation it is done separately. Signed-off-by: Frank Crawford <frank@crawford.emu.id.au> [groeck: Fixed multi-line alignment] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-21hwmon: (it87) Test for error in it87_update_deviceFrank Crawford1-2/+52
Handle errors from it87_update_device(), which currently only occurs if SMBus access locking fails. Signed-off-by: Frank Crawford <frank@crawford.emu.id.au> [groeck: Fixed handling in show_temp_type()] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (it87) Disable SMBus access for environmental controller registers.Frank Crawford1-2/+56
Add functions to disable and re-enable access by the SMBus for specific chips. Signed-off-by: Frank Crawford <frank@crawford.emu.id.au> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: (it87) Use voltage scaling macro where appropriateFrank Crawford1-1/+1
Apply scaling macro to match the labels for internal voltage sensors. Signed-off-by: Frank Crawford <frank@crawford.emu.id.au> Link: https://lore.kernel.org/r/20230318080543.1226700-3-frank@crawford.emu.id.au Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-03-21hwmon (it87): Fix voltage scaling for chips with 10.9mV ADCsFrank Crawford1-1/+3
Fix voltage scaling for chips that have 10.9mV ADCs, where scaling was not performed. Fixes: ead8080351c9 ("hwmon: (it87) Add support for IT8732F") Signed-off-by: Frank Crawford <frank@crawford.emu.id.au> Link: https://lore.kernel.org/r/20230318080543.1226700-2-frank@crawford.emu.id.au [groeck: Update subject and description to focus on bug fix] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-02-03hwmon: (it87) Add new chipset IT87952EFrank Crawford1-1/+15
Add IT87952E, a new chip ID (DEV ID 0x8695), which appears to be an updated version of the IT8792E and takes the same configuration. The model name comes from the model name printed on the chip. There is no datasheet publicly available. Signed-off-by: Frank Crawford <frank@crawford.emu.id.au> Link: https://lore.kernel.org/r/20230128060308.1549707-7-frank@crawford.emu.id.au Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-02-03hwmon: (it87) Allow multiple chip IDs for force_idFrank Crawford1-8/+13
Extend the force_id module parameter to allow specifying one or both chip IDs separately. If only a single parameter is given it defaults to using that value for all chips, similar to previous usage. Signed-off-by: Frank Crawford <frank@crawford.emu.id.au> Link: https://lore.kernel.org/r/20230128060308.1549707-6-frank@crawford.emu.id.au Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-02-03hwmon: (it87) Add chip_id in some info messageFrank Crawford1-2/+4
In cases where there are multiple chips, print out which chip is referred to, in the informational message. Signed-off-by: Frank Crawford <frank@crawford.emu.id.au> Link: https://lore.kernel.org/r/20230128060308.1549707-5-frank@crawford.emu.id.au Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-02-03hwmon: (it87) List full chip model nameFrank Crawford1-23/+23
ITE model names do not always match the chip ID. Convert from just adding a suffix to specifying the full model name. Signed-off-by: Frank Crawford <frank@crawford.emu.id.au> Link: https://lore.kernel.org/r/20230128060308.1549707-4-frank@crawford.emu.id.au Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-02-03hwmon: (it87) Disable configuration exit for certain chipsFrank Crawford1-2/+2
IT8790E and IT8792E/IT8795E have been identified as chips that can have issues when disabling configuration mode. Set to never exit configuration mode. Signed-off-by: Frank Crawford <frank@crawford.emu.id.au> Link: https://lore.kernel.org/r/20230128060308.1549707-3-frank@crawford.emu.id.au Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-02-03hwmon: (it87) Allow disabling exiting of configuration modeFrank Crawford1-8/+18
Disabling configuration mode on some chips can result in system hang-ups and access failures to the Super-IO chip at the second SIO address. Never exit configuration mode on these chips to avoid the problem. This patch should be applied in conjunction with a previous one to initialise the second chip for certain mother boards. Signed-off-by: Frank Crawford <frank@crawford.emu.id.au> Link: https://lore.kernel.org/r/20230128060308.1549707-2-frank@crawford.emu.id.au [groeck: Change feature bit from 28 to 19 to be continuous] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-02-03hwmon: (it87) Group all related MODULE_PARM definitions togetherFrank Crawford1-8/+15
Group the MODULE_PARM definitions together to make them easier for future maintenance, rather than having them spread across the file. Signed-off-by: Frank Crawford <frank@crawford.emu.id.au> Link: https://lore.kernel.org/r/20230121085754.1693336-2-frank@crawford.emu.id.au Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-02-03hwmon: (it87) Set second Super-IO chip in configuration modeFrank Crawford1-0/+48
On various Gigabyte AM4 boards (AB350, AX370), the second Super-IO chip (IT8792E) needs to be in configuration mode before accessing the first due to a bug in IT8792E which otherwise results in LPC bus access errors. This needs to be done before accessing the first Super-IO chip since the second chip may have been accessed prior to loading this driver. The problem is also reported to affect IT8795E, which is used on X299 boards and has the same chip ID as IT8792E (0x8733). It also appears to affect systems with IT8790E, which is used on some Z97X-Gaming boards as well as Z87X-OC, and other more recent Gigabyte boards. Signed-off-by: Frank Crawford <frank@crawford.emu.id.au> Link: https://lore.kernel.org/r/20230104060926.619686-3-frank@crawford.emu.id.au [groeck: Made description pass checkpatch] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-02-03hwmon: (it87) Allow calling __superio_enter outside muxed regionFrank Crawford1-4/+9
Allow for superio_enter to be called without requesting the muxed memory region, in particular for initialisation of the second chipset, which must be put into configuration mode, but without an associated call to leave configuration mode. Signed-off-by: Frank Crawford <frank@crawford.emu.id.au> Link: https://lore.kernel.org/r/20230104060926.619686-2-frank@crawford.emu.id.au [groeck: Clarified subject] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-12-04hwmon: (it87) Add DMI table for future extensionsFrank Crawford1-19/+53
Add in DMI matching table to match various board quirks and settings. This will be useful for future extentions, but will start with the existing definition of the Shuttle SN68PT. Signed-off-by: Frank Crawford <frank@crawford.emu.id.au> Link: https://lore.kernel.org/r/20221105232531.1619387-1-frank@crawford.emu.id.au Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-12-04hwmon: (it87) Check for a valid chip before using force_idAhmad Khalifa1-1/+7
Check there is a chip before using force_id parameter as there is no value in registering a non-existent chip Signed-off-by: Ahmad Khalifa <ahmad@khalifa.ws> Link: https://lore.kernel.org/r/20221004210100.540120-3-ahmad@khalifa.ws Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-12-04hwmon: (it87) Add param to ignore ACPI resource conflictsAhmad Khalifa1-2/+8
Add parameter to ignore ACPI resource conflicts as an alternate to using 'acpi_enforce_resources=lax'. Some BIOSes reserve resources and don't use them and the system wide parameter may result in failures to certain drivers. Signed-off-by: Ahmad Khalifa <ahmad@khalifa.ws> Link: https://lore.kernel.org/r/20221004210100.540120-2-ahmad@khalifa.ws Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-09-25hwmon: (it87) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()Jonathan Cameron1-4/+4
These newer PM macros allow the compiler to see what code it can remove if !CONFIG_PM_SLEEP. This allows the removal of __maybe_unused markings whilst achieving the same result. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20220925172759.3573439-7-jic23@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-10-12hwmon: cleanup non-bool "valid" data fieldsPaul Fertser1-6/+6
We have bool so use it consistently in all the drivers. The following Coccinelle script was used: @@ identifier T; type t = { char, int }; @@ struct T { ... - t valid; + bool valid; ... } @@ identifier v; @@ ( - v->valid = 0 + v->valid = false | - v->valid = 1 + v->valid = true ) followed by sed to fixup the comments: sed '/bool valid;/{s/!=0/true/;s/zero/false/}' Few whitespace changes were fixed manually. All modified drivers were compile-tested. Signed-off-by: Paul Fertser <fercerpav@gmail.com> Link: https://lore.kernel.org/r/20210924195202.27917-1-fercerpav@gmail.com [groeck: Fixed up 'u8 valid' to 'boool valid' in atxp1.c] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-04-20hwmon: Use kobj_to_dev()Guenter Roeck1-6/+6
coccinelle complains about WARNING opportunity for kobj_to_dev() in several files, resulting in one-by-one patch submissions. Handle all remaining instances in one go. 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>
2017-08-13hwmon: (it87) Reapply probe path chip registers settings after resumeMaciej S. Szmigiero1-2/+74
After a suspend / resume cycle we possibly need to reapply chip registers settings that we had set or fixed in a probe path, since they might have been reset to default values or set incorrectly by a BIOS again. Tested on a Gigabyte M720-US3 board, which requires routing internal VCCH5V to in7 (and had it wrong again on resume from S3). Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name> [groeck: Return value from it87_resume_sio() is unused; make it void] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-08-13hwmon: (it87) Split out chip registers setting code on probe pathMaciej S. Szmigiero1-50/+88
This commit splits out chip registers setting code on probe path to separate functions so they can be reused for setting the device properly again when system resumes from suspend. While we are at it let's also make clear that on IT8720 and IT8782 it's the VCCH5V line that is (possibly) routed to in7. This will make it consistent with a similar message that it printed on IT8783. Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-03-22hwmon: (it87) Avoid registering the same chip on both SIO addressesGuenter Roeck1-5/+19
IT8705F is known to respond on both SIO addresses. Registering it twice may result in system lockups. Reported-by: Russell King <linux@armlinux.org.uk> Fixes: e84bd9535e2b ("hwmon: (it87) Add support for second Super-IO chip") Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-02-10hwmon: (it87) Add support for IT8792EGuenter Roeck1-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>
2017-02-10hwmon: (it87) Do not overwrite bit 2..6 of pwm control registersGuenter Roeck1-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>
2017-02-10hwmon: (it87) Fix pwm4 detection for IT8620 and IT8628Guenter Roeck1-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>
2017-02-10hwmon: (it87) Ensure that pwm control cache is current before updating valuesGuenter Roeck1-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>
2017-02-10hwmon: (it87) Improve IT8622 supportGuenter Roeck1-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>
2017-02-10hwmon: (it87) Add support for IT8622EGuenter Roeck1-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>
2017-02-10hwmon: (it87) Add feature flag indicating that VIN3 is connected to 5VGuenter Roeck1-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>
2017-01-02hwmon: (it87) use permission-specific DEVICE_ATTR variantsJulia Lawall1-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>
2016-09-08hwmon: (it87) Drop useless commentsJean Delvare1-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>
2016-08-29hwmon: (it87) Add missing sysfs attribute group terminatorJean Delvare1-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>
2016-08-11hwmon: (it87) Features mask must be 32 bit wideGuenter Roeck1-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>
2016-04-19hwmon: (it87) Add support for IT8628EGuenter Roeck1-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>
2016-04-19hwmon: (it87) Fix pwm_temp_map for system with 6 pwm channelsGuenter Roeck1-8/+15
Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2016-04-19hwmon: (it87) Support automatic pwm control on newer chipsGuenter Roeck1-14/+187
Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2016-04-19hwmon: (it87) Enhance validation for fan4 and fan5Guenter Roeck1-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>
2016-04-19hwmon: (it87) Support disabling fan control for all pwm control and chipsGuenter Roeck1-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>
2016-04-19hwmon: (it87) Formatting cleanupGuenter Roeck1-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>
2016-04-19hwmon: (it87) Use defines for array sizes and sensor countsGuenter Roeck1-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>
2016-04-19hwmon: (it87) Use BIT macroGuenter Roeck1-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>
2016-04-19hwmon: (it87) Add support for VIN7 to VIN10 on IT8620EGuenter Roeck1-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>
2016-04-19hwmon: (it87) Simplify reading voltage registersGuenter Roeck1-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>
2016-04-19hwmon: (it87) Support up to 6 temperature sensors on IT8620EGuenter Roeck1-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>
2016-04-19hwmon: (it87) Convert to use new hwmon APIGuenter Roeck1-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>
2016-04-19hwmon: (it87) Use single group and is_visible for miscellaneous attributesGuenter Roeck1-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>
2016-04-19hwmon: (it87) Use is_visible for pwm attributesGuenter Roeck1-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>