Commit graph

190 commits

Author SHA1 Message Date
Frank Crawford 0be1007717 hwmon: (it87) Disable/enable SMBus access for IT8622E chipset
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-21 07:27:23 -07:00
Frank Crawford 376e1a937b hwmon: (it87) Add calls to smbus_enable/smbus_disable as required
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-21 07:27:23 -07:00
Frank Crawford 0282ba4a4f hwmon: (it87) Test for error in it87_update_device
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-21 07:27:08 -07:00
Frank Crawford 9989b3c0ff hwmon: (it87) Disable SMBus access for environmental controller registers.
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-19 07:08:40 -07:00
Frank Crawford dedbe4c149 hwmon: (it87) Use voltage scaling macro where appropriate
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-04-19 07:08:33 -07:00
Frank Crawford 968b66ffeb hwmon (it87): Fix voltage scaling for chips with 10.9mV ADCs
Fix voltage scaling for chips that have 10.9mV ADCs, where scaling was
not performed.

Fixes: ead8080351 ("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-03-21 19:14:55 -07:00
Frank Crawford d44cb4cd74 hwmon: (it87) Add new chipset IT87952E
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-03 07:30:11 -08:00
Frank Crawford 2a64e9d445 hwmon: (it87) Allow multiple chip IDs for force_id
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-03 07:30:11 -08:00
Frank Crawford f09c796505 hwmon: (it87) Add chip_id in some info message
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-03 07:30:11 -08:00
Frank Crawford 1f21531d4f hwmon: (it87) List full chip model name
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-03 07:30:11 -08:00
Frank Crawford e114737850 hwmon: (it87) Disable configuration exit for certain chips
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-03 07:30:11 -08:00
Frank Crawford 4119693bd2 hwmon: (it87) Allow disabling exiting of configuration mode
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-03 07:30:11 -08:00
Frank Crawford b361a1cf62 hwmon: (it87) Group all related MODULE_PARM definitions together
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-03 07:30:10 -08:00
Frank Crawford ff9dedd2da hwmon: (it87) Set second Super-IO chip in configuration mode
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-03 07:30:10 -08:00
Frank Crawford d47e377c7b hwmon: (it87) Allow calling __superio_enter outside muxed region
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>
2023-02-03 07:30:10 -08:00
Frank Crawford a1bedbcc1c hwmon: (it87) Add DMI table for future extensions
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-04 16:45:02 -08:00
Ahmad Khalifa b3b19931a5 hwmon: (it87) Check for a valid chip before using force_id
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-04 16:45:02 -08:00
Ahmad Khalifa 12c44ab8b4 hwmon: (it87) Add param to ignore ACPI resource conflicts
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-12-04 16:45:01 -08:00
Jonathan Cameron 31b34d6208 hwmon: (it87) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
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>
2022-09-25 14:22:12 -07:00
Paul Fertser 952a11ca32 hwmon: cleanup non-bool "valid" data fields
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-10-12 07:22:41 -07:00
Guenter Roeck 9d2227bb9b hwmon: Use kobj_to_dev()
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>
2021-04-20 06:50:14 -07:00
Thomas Gleixner c942fddf87 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157
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>
2019-05-30 11:26:37 -07:00
Maciej S. Szmigiero 384548e569 hwmon: (it87) Reapply probe path chip registers settings after resume
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-13 08:24:38 -07:00
Maciej S. Szmigiero 557cbf49d2 hwmon: (it87) Split out chip registers setting code on probe path
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-08-13 08:24:38 -07:00
Guenter Roeck 8358378b22 hwmon: (it87) Avoid registering the same chip on both SIO addresses
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: e84bd9535e ("hwmon: (it87) Add support for second Super-IO chip")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-03-22 00:18:21 -07:00
Guenter Roeck e531ffc0ff hwmon: (it87) Add support for IT8792E
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-10 21:35:08 -08:00
Guenter Roeck 4c7b8ca1ae hwmon: (it87) Do not overwrite bit 2..6 of pwm control registers
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-10 21:35:08 -08:00
Guenter Roeck d66777caa5 hwmon: (it87) Fix pwm4 detection for IT8620 and IT8628
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: 36c4d98a78 ("hwmon: (it87) Add support for all pwm channels ...")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-02-10 21:35:08 -08:00
Guenter Roeck 82dbe987b7 hwmon: (it87) Ensure that pwm control cache is current before updating values
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-10 21:35:08 -08:00
Guenter Roeck 638c1c07f9 hwmon: (it87) Improve IT8622 support
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-10 21:35:08 -08:00
Guenter Roeck 8af1abae72 hwmon: (it87) Add support for IT8622E
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-10 21:35:08 -08:00
Guenter Roeck a9eebd4f28 hwmon: (it87) Add feature flag indicating that VIN3 is connected to 5V
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-02-10 21:35:08 -08:00
Julia Lawall ddc64ae839 hwmon: (it87) use permission-specific DEVICE_ATTR variants
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>
2017-01-02 10:19:45 -08:00
Jean Delvare d5f3f6c812 hwmon: (it87) Drop useless comments
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-09-08 21:34:17 -07:00
Jean Delvare 3c3292634f hwmon: (it87) Add missing sysfs attribute group terminator
Attribute array it87_attributes_in lacks its NULL terminator,
causing random behavior when operating on the attribute group.

Fixes: 5292971563 ("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-29 05:31:31 -07:00
Guenter Roeck aa8b187eea hwmon: (it87) Features mask must be 32 bit wide
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: cc18da79d9 ("hwmon: (it87) Support up to 6 temperature sensors ... ");
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2016-08-11 18:35:47 -07:00
Guenter Roeck 71a9c23246 hwmon: (it87) Add support for IT8628E
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-19 06:32:38 -07:00
Guenter Roeck 0624d86198 hwmon: (it87) Fix pwm_temp_map for system with 6 pwm channels
Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2016-04-19 06:32:37 -07:00
Guenter Roeck 2cbb9c370f hwmon: (it87) Support automatic pwm control on newer chips
Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2016-04-19 06:32:37 -07:00
Guenter Roeck a0df926d33 hwmon: (it87) Enhance validation for fan4 and fan5
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-19 06:32:37 -07:00
Guenter Roeck f1bbe61860 hwmon: (it87) Support disabling fan control for all pwm control and chips
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-19 06:32:37 -07:00
Guenter Roeck c962024e30 hwmon: (it87) Formatting cleanup
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-19 06:32:37 -07:00
Guenter Roeck 2310048db7 hwmon: (it87) Use defines for array sizes and sensor counts
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-19 06:32:37 -07:00
Guenter Roeck 48b2ae7fe9 hwmon: (it87) Use BIT macro
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-19 06:32:37 -07:00
Guenter Roeck f838aa2611 hwmon: (it87) Add support for VIN7 to VIN10 on IT8620E
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-19 06:32:37 -07:00
Guenter Roeck 559313c4e9 hwmon: (it87) Simplify reading voltage registers
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-19 06:32:37 -07:00
Guenter Roeck cc18da79d9 hwmon: (it87) Support up to 6 temperature sensors on IT8620E
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-19 06:32:37 -07:00
Guenter Roeck 8638d0afb4 hwmon: (it87) Convert to use new hwmon API
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-19 06:32:36 -07:00
Guenter Roeck d376684880 hwmon: (it87) Use single group and is_visible for miscellaneous attributes
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-19 06:32:36 -07:00
Guenter Roeck 5c3912616d hwmon: (it87) Use is_visible for pwm attributes
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>
2016-04-19 06:32:36 -07:00