Commit graph

3383 commits

Author SHA1 Message Date
Linus Torvalds
c403993a41 Lots of small changes to the IPMI driver. Most of the changes
are logging cleanup and style fixes.  There are a few smaller
 bug fixes.
 
 -corey
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJbzj7MAAoJEGHzjJCRm/+B26wP/071VwhIpOabn6sxfibCIYyi
 sbpiaGKGGY8C2/qxhiAOkdpn9GuPFT2xgUkp6OXDHBCsFb4V4360ghfj6XbNpkYH
 LUOTqAP0hgCHr/lGHkTjlGilExvDSkt1iixnPCYNxXqHqasHjYZMLjiPaF+EgjP9
 3FbY5C6145OCcU85L5VoRqnuEqHHFUDbQxjABcuuUSa0YPrjC6OPex00rQ8toZBz
 DvdVV4j9mb10UO0Arn0FIb5Pdt1a0ZbyRLBs/RBO9yCpEBLy/FVXtpzGTKvwVG7p
 E1L6UlM28xLydYfo/n8emSqw0l/CHxwpRRl4N3DPn6iYjWG2nEwt9PWh5IhlU/+k
 iXCiY+bV8Q0vil0eG7C/b2sAarY3OugvJEIpbcwQogPpNYzvzRRWBu/mNftjEkhk
 W2HPr1CojKf47ypdqC8dUcY0oT2inFSGYpvkZnLG9SZpFJ1DtZVqAA+6ZCuw/5a9
 AH2t9rUA91vnM5ujTeQ5WKw+5RYpD8r5YkAwVX2m6n4xbwzMZAVgH8niSqDB04Jj
 DckkKEqXZy/gsEw51U6OYGiDqmMb3jXUWJ/AmcYCqBitK8Z20FqZly33X67UYSsn
 cgoRt3g2E2UxJIdhAWaFmN5PQxsEpogbrdjZ7U3/UpPwXsLSgG3rG6WqYKzQVJv6
 vc3RUFssrEQSbYTb/laJ
 =ladh
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-4.20' of https://github.com/cminyard/linux-ipmi

Pull IPMI updates from Corey Minyard:
 "Lots of small changes to the IPMI driver. Most of the changes are
  logging cleanup and style fixes. There are a few smaller bug fixes"

* tag 'for-linus-4.20' of https://github.com/cminyard/linux-ipmi: (21 commits)
  ipmi: Fix timer race with module unload
  ipmi:ssif: Add support for multi-part transmit messages > 2 parts
  MAINTAINERS: Add file patterns for ipmi device tree bindings
  ipmi: Remove platform driver overrides and use the id_table
  ipmi: Free the address list on module cleanup
  ipmi: Don't leave holes in the I2C address list in the ssif driver
  ipmi: fix return value of ipmi_set_my_LUN
  ipmi: Convert pr_xxx() to dev_xxx() in the BT code
  ipmi:dmi: Ignore IPMI SMBIOS entries with a zero base address
  ipmi:dmi: Use pr_fmt in the IPMI DMI code
  ipmi: Change to ktime_get_ts64()
  ipmi_si: fix potential integer overflow on large shift
  ipmi_si_pci: fix NULL device in ipmi_si error message
  ipmi: Convert printk(KERN_<level> to pr_<level>(
  ipmi: Use more common logging styles
  ipmi: msghandler: Add and use pr_fmt and dev_fmt, remove PFX
  pci:ipmi: Move IPMI PCI class id defines to pci_ids.h
  ipmi: Finally get rid of ipmi_user_t and ipmi_smi_t
  ipmi:powernv: Convert ipmi_smi_t to struct ipmi_smi
  hwmon:ibm: Change ipmi_user_t to struct ipmi_user *
  ...
2018-10-23 09:42:05 +01:00
Linus Torvalds
6214a9fe2a regmap: Updates for v5.0
A small update with a couple of new APIs that are useful for some small
 sets of devices:
 
  - Split up the single_rw flagging to map read and write separately as
    some devices support bulk operations for only read or only write.
  - Add a write version of the noinc API.
  - Clean up the code for LOG_DEVICE a bit.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlvNvQgTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0MAPB/9Ftz3U5DpfLoN/KEOQlGv6LeoryRcI
 kSRXm7zlZmIrMm4xQtR59oXDSh05uPaZnbXPcIajfQhq895Y6T1+idHbd9pBmDFq
 cZ+YeORg+5NSThnbJeNBa1hiMFvM8seCP2eeHEu6ZX+jWE7AmfFsW6re3e9uXg+m
 DQ9tCFMnByShHFfEhWkvQiZAfPHLgN7MK6FvxAjYoUq/GeGjhCyOz1S0vNZXc4pj
 P6hJHngr+6axZYQ+IXcwoGj1UdS3aZWvamL5eCV/plFYaf9uNYgnyaGxhY7/hddB
 Ty3GHJOhGWZq8fjIR/ejS6M2g0c36tWq38uGHGAenyJsta1Kub/fcdzQ
 =WHhl
 -----END PGP SIGNATURE-----

Merge tag 'regmap-v5.0' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap

Pull regmap updates from Mark Brown:
 "A small update with a couple of new APIs that are useful for some
  small sets of devices:

   - Split up the single_rw flagging to map read and write separately as
     some devices support bulk operations for only read or only write.

   - Add a write version of the noinc API.

   - Clean up the code for LOG_DEVICE a bit"

* tag 'regmap-v5.0' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
  regmap: use less #ifdef for LOG_DEVICE
  regmap: Add regmap_noinc_write API
  regmap: split up regmap_config.use_single_rw
  regmap: fix comment for regmap.use_single_write
2018-10-23 01:17:27 +01:00
Linus Torvalds
b8e445b689 hwmon updates for v4.20
- Add support for trace events to hwmon core
 - Add support for NCT6797D, NCT6798D, MAX31725/6, LTM4686
 - Support all AMD Family 15h Model 6xh and Model 7xh processors
   in k10temp driver
 - Convert ina3221 driver to _info API
 - Fixes, cleanups, and improvements in various drivers.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIbBAABAgAGBQJbyVR3AAoJEMsfJm/On5mB7zgP92NONVqvIBBFRj7ohjhz4iya
 y/8ITclQvxMzgrBTuYS9avA9NACKtaerfpiS8m4XjrKAt66/x2h6yTGRVKEDTqXA
 Qs9OZG83tocBYqZ3EI3FtMhbx3eOIdCj+v34ARNqPZSXJGkpiKa+9BmjR2VuMCtG
 ONcnk66os4g7rjgsBqYUqCkAQkse/Oys6iMPpg4VfZlL6/sKWCglsQVCqplW7dFR
 wxZtJqKYHNE4sddtT67cVaxKcuNdt96EmEoJCGirH0B2wW7FPefR4sYO9cmykDi+
 J6b7VErHWSi75LrXVZaXHllkau3NvZDCoGyVbVPu98w4TzjylCXciskOmXdTQkso
 57I2aPMUa4VLde27p/a3MLUXhswFng2w62rz2l/BLlWq4KbTorPZxnKrHT8EpU7T
 eQrLC5Q+mdJCRdhcDQEcx8+SKtdO9UFLUFD5xb2D74ZJ4N2DYYFa62Vr9I6Mk+AV
 aZa5wLQW6W5UY8+AcbhK2AJE60LiPaJsuobiLLwZ/5cB2M33Hgi0ySDkq/Y4fFjA
 t/D5iWDVhbwbK15baJyJEAlNQAM+Nr284RGfWTfHhqKxmx3/fIKw5OBjsRzIP5KV
 NN5JA8s8tuLP10MIY+jXRTu2knkTKQXgWp8YLuS8gI0meCiGt2fZ8kXXW5b9T5+F
 sH7cZuCGf+PRkEeYp8o=
 =Urmz
 -----END PGP SIGNATURE-----

Merge tag 'hwmon-for-v4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon updates from Guenter Roeck:

 - Add support for trace events to hwmon core

 - Add support for NCT6797D, NCT6798D, MAX31725/6, LTM4686

 - Support all AMD Family 15h Model 6xh and Model 7xh processors in
   k10temp driver

 - Convert ina3221 driver to _info API

 - Fixes, cleanups, and improvements in various drivers

* tag 'hwmon-for-v4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (46 commits)
  hwmon: (pmbus) Fix page count auto-detection.
  hwmon: (pmbus) remove redundant 'default n' from Kconfig
  hwmon: (core) Add trace events to _attr_show/store functions
  hwmon: (ina3221) Use _info API to register hwmon device
  hwmon: (npcm-750-pwm-fan) Change initial pwm target to 255
  hwmon: (ina3221) Validate shunt resistor value from DT
  hwmon: (tmp421) make const array 'names' static
  hwmon: (core) Add hwmon_in_enable attribute
  hwmon: (ina3221) mark PM functions as __maybe_unused
  hwmon: (ina3221) Read channel input source info from DT
  dt-bindings: hwmon: Add ina3221 documentation
  hwmon: (ina3221) Add suspend and resume functions
  hwmon: (ina3221) Fix INA3221_CONFIG_MODE macros
  hwmon: (ina3221) Add INA3221_CONFIG to volatile_table
  MAINTAINERS: Update PMBUS maintainer entry
  hwmon: (pwm-fan) Set fan speed to 0 on suspend
  hwmon: (pwm-fan) Silence error on probe deferral
  hwmon: (scpi-hwmon) remove redundant continue
  hwmon: (nct6775) Add support for NCT6798D
  hwmon: (nct6775) Add support for NCT6797D
  ...
2018-10-23 00:58:12 +01:00
Mark Brown
ae2399c48c
Merge remote-tracking branches 'regmap/topic/noinc' and 'regmap/topic/single-rw' into regmap-next 2018-10-21 12:07:26 +01:00
Dmitry Bazhenov
e7c6a55606 hwmon: (pmbus) Fix page count auto-detection.
Devices with compatible="pmbus" field have zero initial page count,
and pmbus_clear_faults() being called before the page count auto-
detection does not actually clear faults because it depends on the
page count. Non-cleared faults in its turn may fail the subsequent
page count auto-detection.

This patch fixes this problem by calling pmbus_clear_fault_page()
for currently set page and calling pmbus_clear_faults() after the
page count was detected.

Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Bazhenov <bazhenov.dn@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-15 12:44:36 -07:00
Bartlomiej Zolnierkiewicz
04e79eb704 hwmon: (pmbus) remove redundant 'default n' from Kconfig
'default n' is the default value for any bool or tristate Kconfig
setting so there is no need to write it explicitly.

Also since commit f467c5640c ("kconfig: only write '# CONFIG_FOO
is not set' for visible symbols") the Kconfig behavior is the same
regardless of 'default n' being present or not:

    ...
    One side effect of (and the main motivation for) this change is making
    the following two definitions behave exactly the same:

        config FOO
                bool

        config FOO
                bool
                default n

    With this change, neither of these will generate a
    '# CONFIG_FOO is not set' line (assuming FOO isn't selected/implied).
    That might make it clearer to people that a bare 'default n' is
    redundant.
    ...

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-11 20:08:16 -07:00
Nicolin Chen
61b8ab2c54 hwmon: (core) Add trace events to _attr_show/store functions
Trace events are useful for people who collect data from the
Ftrace outputs. There're people who analyse the relationship
of cpufreq, thermal and hwmon (power/voltage/current) using
the convenient and timestamped Ftrace outputs, while unlike
cpufreq and thermal subsystems the hwmon does not have trace
events supported yet.

So this patch adds initial trace events for the hwmon core.
To call hwmon_attr_base() for aligned attr index numbers, it
also moves the function upward.

Ftrace outputs:
 ...: hwmon_attr_show_string: index=2, attr_name=in2_label, val=VDD_5V
 ...: hwmon_attr_show: index=2, attr_name=in2_input, val=5112
 ...: hwmon_attr_show: index=2, attr_name=curr2_input, val=440

Note that the _attr_show and _attr_store functions are tied
to the _with_info API. So a hwmon driver requiring the trace
events feature should use _with_info API to register a hwmon
device.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-11 20:07:35 -07:00
Greg Kroah-Hartman
834d3cd294 Fix open-coded multiplication arguments to allocators
- Fixes several new open-coded multiplications added in the 4.19 merge window.
 -----BEGIN PGP SIGNATURE-----
 Comment: Kees Cook <kees@outflux.net>
 
 iQJKBAABCgA0FiEEpcP2jyKd1g9yPm4TiXL039xtwCYFAlu/fokWHGtlZXNjb29r
 QGNocm9taXVtLm9yZwAKCRCJcvTf3G3AJsB/EACgKV77Sad5Luyr3rCmUtGcQ7az
 yLIrqvGcxC55ZEoZwHmSjxiN+5X2kDF6SEFrebvDKFSbiRoC0a1IWRC4pWTpBhTs
 +i1qHVTlOrwBZFTwOn2uklvgkkUfjatG/6zWc7l/Ye070Hekk0SnbMozlggCOJRm
 yKglXaBx9MKmj/T60Vpfve4ubBLM0zSuRPlsBON2qUUp2YTHbEqHOoYawfSK4RuF
 y2hzZc5A0/F7TionkHjrkdEJ8jRkwii2x4iM9KSdhNRxBT0lZkk3xpD6PjRaXCzt
 N2BMU17kftI5498QyKHXdTYCuVPqTpm+Z3d/q+YTbjdpXre1xcZU06ZT9Bqa+LwB
 pRaN4eqd7nLFKvCQYnUp0GuDj5pxd3Xz2dpC0IkaliEM8xYad1+NZRq7SkRJYOpM
 /y05GRdln9ULJF/pet5IS6LtXY+FSn4z+9e+ztVIPQ/kJUqvmyKfWPpdp6TPtwjC
 vb9cbKD7LRPoBfrY0efPXe4aixCwmc4Ob4kljCZtkyrpV+iImYQn9XqTblU7sbHa
 Om8FxGxdX7Xu9HUoT7uHeb8ZNg1g0/XWAEhs7pY22fzHT14T+0fYRz8njmlrw3ed
 dRdzydOxkJMcCVKLitoiw2X1yNRRHtGbXq/UhrHMNbEkOzf73/3fYZK68849FaEK
 1oFOX/N/OI5kp7pNAQ==
 =NS8/
 -----END PGP SIGNATURE-----

Merge tag 'alloc-args-v4.19-rc8' of https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux

Kees writes:
  "Fix open-coded multiplication arguments to allocators

   - Fixes several new open-coded multiplications added in the 4.19
     merge window."

* tag 'alloc-args-v4.19-rc8' of https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  treewide: Replace more open-coded allocation size multiplications
2018-10-11 19:10:30 +02:00
Nicolin Chen
d4b0166d28 hwmon: (ina3221) Use _info API to register hwmon device
The hwmon core has a newer API which abstracts most of common
things in the core so as to simplify the hwmon device drivers.

This patch implements this _info API to ina3221 hwmon driver.

It also reduces the binary size:
   text	   data	    bss	    dec	    hex	filename
   5114	   1712	      0	   6826	   1aaa	drivers/hwmon/ina3221_before.o
   4456	    440	      0	   4896	   1320	drivers/hwmon/ina3221.o

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Kun Yi
f21c8e753b hwmon: (npcm-750-pwm-fan) Change initial pwm target to 255
Change initial PWM target to 255 to prevent overheating, for example
when BMC hangs in userspace or when userspace fan control application is
not implemented yet.

Signed-off-by: Kun Yi <kunyi@google.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Nicolin Chen
a6e43263ed hwmon: (ina3221) Validate shunt resistor value from DT
The input->shunt_resistor is int type while the value from DT is
unsigned int. Meanwhile, a divide-by-zero error would happen if
the value is 0. So this patch just simply validates the value.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Colin Ian King
8b9bf554dd hwmon: (tmp421) make const array 'names' static
The const array 'names' can be made static, saves populating it on
the stack and will make it read-only.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Nicolin Chen
68c0d69dee hwmon: (core) Add hwmon_in_enable attribute
According to hwmon ABI, in%d_enable is a sysfs interface that
allows user space to enable and disable the input sensor. So
this patch just simply adds the attribute to the list.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Arnd Bergmann
ead21c77d7 hwmon: (ina3221) mark PM functions as __maybe_unused
When CONFIG_PM_SLEEP is disabled, we get a warning about unused
suspend/resume functions:

drivers/hwmon/ina3221.c:451:12: error: 'ina3221_resume' defined but not used [-Werror=unused-function]
 static int ina3221_resume(struct device *dev)
drivers/hwmon/ina3221.c:428:12: error: 'ina3221_suspend' defined but not used [-Werror=unused-function]
 static int ina3221_suspend(struct device *dev)

Picking the correct #ifdef check is hard, so let's remove
that check and instead mark the functions as __maybe_unused
to let the compiler silently drop them instead.

Fixes: 7de1ab9dac8e ("hwmon: (ina3221) Add suspend and resume functions")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Nicolin Chen
a9e9dd9c6d hwmon: (ina3221) Read channel input source info from DT
An ina3221 chip has three input ports. Each port is used
to measure the voltage and current of its input source.

The DT binding now has defined bindings for their input
sources, so the driver should read these information and
handle accordingly.

This patch adds a new structure of input source specific
information including input source label, shunt resistor
value and its connection status. It exposes these labels
via in[123]_label sysfs nodes upon available, and also
disables those channels where there are no input source
being connected. Meanwhile, it also adds in[123]_enable
sysfs nodes for users to get control of three channels,
and returns -ENODATA code for any sensor read according
to hwmon ABI.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Nicolin Chen
59d608e152 hwmon: (ina3221) Add suspend and resume functions
Depending on the hardware design, an INA3221 chip might lose
its power during system suspend/resume. So this patch adds
a set of suspend and resume functions to cache the register
values including config register value and limit settings.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
[groeck: Moved call to dev_set_drvdata()]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Nicolin Chen
791ebc9d34 hwmon: (ina3221) Fix INA3221_CONFIG_MODE macros
The three INA3221_CONFIG_MODE macros are not correctly defined here.
The MODE3-1 bits are located at BIT 2-0 according to the datasheet.

So this patch just fixes them by shifting all of them with a correct
offset. However, this isn't a crital bug fix as the driver does not
use any of them at this point.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Nicolin Chen
c20217b30d hwmon: (ina3221) Add INA3221_CONFIG to volatile_table
The MSB (15th bit) of INA3221_CONFIG is a self-clear reset bit.
So this register should be added to the volatile_table of the
regmap_config. Otherwise, we will see this bit is sticky in the
regcache which might accidentally reset the chip when an actual
write happens to the register.

This might not be a severe bug for the current code line since
there's no second place touching the INA3221_CONFIG except the
reset routine in the probe().

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Thierry Reding
95dcd64bc5 hwmon: (pwm-fan) Set fan speed to 0 on suspend
Technically this is not required because disabling the PWM should be
enough. However, when support for atomic operations was implemented in
the PWM subsystem, only actual changes to the PWM channel are applied
during pwm_config(), which means that during after resume from suspend
the old settings won't be applied.

One possible solution is for the PWM driver to implement its own PM
operations such that settings from before suspend get applied on resume.
This has the disadvantage of completely ignoring any particular ordering
requirements that PWM user drivers might have, so it is best to leave it
up to the user drivers to apply the settings that they want at the
appropriate time.

Another way to solve this would be to read back the current state of the
PWM at the time of resume. That way, in case the configuration was lost
during suspend, applying the old settings in PWM user drivers would
actually get them applied because they differ from the current settings.
However, not all PWM drivers support reading the hardware state, and not
all hardware may support it.

The best workaround at this point seems to be to let PWM user drivers
tell the PWM subsystem that the PWM is turned off by, in addition to
disabling it, also setting the duty cycle to 0. This causes the resume
operation to apply a configuration that is different from the current
configuration, resulting in the proper state from before suspend getting
restored.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Thierry Reding
9f67f7583e hwmon: (pwm-fan) Silence error on probe deferral
Probe deferrals aren't actual errors, so silence the error message in
case the PWM cannot yet be acquired.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
zhong jiang
3045b5d61a hwmon: (scpi-hwmon) remove redundant continue
The continue will not truely skip any code. hence it is safe to
remove it.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Guenter Roeck
0599682b82 hwmon: (nct6775) Add support for NCT6798D
NCT6798D is, with the exception of fan and pwm channel configuration
registers, similar to other chips of the series. One interesting
difference is the chip ID, which is now extended to 13 bit (the 12-bit
chip ID value overlaps with the chip ID of NCT6797D).

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Guenter Roeck
e41da286a2 hwmon: (nct6775) Add support for NCT6797D
Add support for NCT6797D. With the exception of fan/pwm configuration
registers, it is mostly compatible with NCT6795D.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Guenter Roeck
3be8c9d103 hwmon: (nct6775) Fix names of DIMM temperature sources
For NCT6795D and NCT6796D, the DIMM temperature sources are named
"Agent[01] Dimm [01]" per datasheet. Match names in datasheets to
avoid confusion.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Guenter Roeck
3fdb06aff5 hwmon: (nct6796) Clean up and amend fan/pwm configuration for NCT6796D
Now that everything is separated, clean up fan and pwm configuration
for NCT6796D. While doing that, take the forgotten configuration register
cre0 into account to determine if AUXFANIN2 (fan5) and AUXFANOUT2 (pwm5)
are connected.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Guenter Roeck
b75a806389 hwmon: (nct6775) Separate fan/pwm configuration detection for NCT6795D
Separate fan/pwm configuration detection for NCT6795D into separate
case statement to make the code easier to read.

No functional change.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Guenter Roeck
2d99925a15 hwmon: (nct6775) Separate fan/pwm configuration detection for NCT6793D
While detecting the configuration for multiple chips in one go reduces
code size, it also increases code complexity. Separate chip detection
to improve code readability. As first step, separate detection for
NCT6793D.

No functional change.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Guenter Roeck
7dcdbdeb1b hwmon: (nct6775) Fix fan6/pwm6 detection for NCT6792D
Per datasheet, AUXFANIN3 (fan6) and AUXFANOUT3 (pwm6) are only connected
if DSW_EN is false.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Guenter Roeck
b2833f397d hwmon: (nct6775) Improve instruction grouping
When determining support for a given fan or pwm control, the code is
easier to read if the necessary instructions are grouped together.

No functional change.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Guenter Roeck
a4e0a080ca hwmon: (nct6775) Use logical or instead of if statements where possible
Use
	boolean |= <expression>;
instead of
	if (!boolean)
		boolean = <expression>;
to assign values to boolean variables.

No functional change.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Guenter Roeck
2d888c5f22 hwmon: (nct6775) Declare and initialize LDN specific config variables earlier
Declare and initialize LDN / chip specific configuration variables
earlier. This simplifies re-using the configuration variables for
multiple chips and makes the code easier to read.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Guenter Roeck
97ce6df468 hwmon: (nct6775) Move config variable declarations and initializations
Group configuration variable declarations and initialization together.
While this results in reading more registers than necessary for a given
chip, it improves code readability and simplifies extending the code.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Guenter Roeck
a6c54f2cde hwmon: (nct6775) Replace 'regval' with variables named after config registers
Using variables named after configuration registers makes it more obvious
which configuration register value is used, especially if more than one
configuration register value is used to determine a configuration detail.

No functional change.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Guenter Roeck
0085a5108d hwmon: (nct6775) Rename configuration register variables
Use variable names from chip datasheets (crXX) instead of regval_XX
for configuration register variables. This is shorter and, together
with subsequent changes, makes the code easier to read.

No functional change.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Guenter Roeck
61b6c66a8f hwmon: (nct6775) Only display fan speed tolerance conditionally
A fan speed tolerance only makes sense if a fan target speed has been
configured in the first place. Otherwise we get odd output such as

fan1_target:0
fan1_tolerance:337500

Only display values other than 0 if a fan target speed has been configured.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Guenter Roeck
0665a1d623 hwmon: (lm92) Fix whitespace issues
Smatch complains:

drivers/hwmon/lm92.c:209 set_temp_hyst() warn: inconsistent indenting

While at it, fix various other whitespace issues reported by checkpatch
(double empty lines, missing empty lines, whitespace at empty line).

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Nathan Chancellor
a31796c30e hwmon: (scmi) Remove redundant pointer check
Clang warns when the address of a pointer is used in a boolean context
as it will always return true.

drivers/hwmon/scmi-hwmon.c:59:24: warning: address of array
'sensor->name' will always evaluate to 'true'
[-Wpointer-bool-conversion]
        if (sensor && sensor->name)
                   ~~ ~~~~~~~~^~~~
1 warning generated.

Remove the check as it isn't doing anything currently; if validation
of the contents of the data structure was intended by the original
author (since this line has been present from the first version of
this driver), it can be added in a follow-up patch.

Reported-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
zhong jiang
2738b767be hwmon: (asus_atk0110) Use PTR_ERR_OR_ZERO instead of reimplementing its function
PTR_ERR_OR_ZERO has implemented the same function. We prefer to use
inlined function rather than code-opened implementation.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Kun Yi
a54ca77a98 hwmon: (lm75) Add MAX31725/6 support
MAX31725/MAX31726 are local temperature sensors with +/- 0.5 degree
Celsius accuracy and 16-bit (0.00390625 degrees Celsius) resolution.
They have a register mapping and encoding compatible with the lm75
series drivers. Address scan and extended temperature range are
not supported by this patch.

Tested on real hardware and verified temperature readings are correct.

Signed-off-by: Kun Yi <kunyi@google.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Fabio Estevam
39ea6ea325 hwmon: (sht15) Switch to SPDX identifier
Adopt the SPDX license identifier headers to ease license compliance
management.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Fabio Estevam
9450f52cec hwmon: (mc13783-adc) Switch to SPDX identifier
Adopt the SPDX license identifier headers to ease license compliance
management.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Dan Carpenter
c3bf6076cc hwmon: (nct6775) Clean up a condition
I removed the "dsw_en &&" chunk of the condition because we know that
"dsw_en" is set.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Guenter Roeck
53dfa0088e hwmon: (k10temp) Support all Family 15h Model 6xh and Model 7xh processors
BIOS developer guides refer to Family 15h Models 60h-6fh and Family 15h
Models 70h-7fh. So far the driver only checked for Models 60h and 70h.
However, there are now processors with other model numbers in the same
families. Example is A10-9620P family 15h model 65h. Follow the developer
guides and mask the lower 4 bit of the model number to determine the
registers to use for reading temperatures and temperature limits.

Reported-by: Guglielmo Fanini <g.fanini@gmail.com>
Cc: Guglielmo Fanini <g.fanini@gmail.com>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Rob Herring
e9d02c6414 hwmon: (ibmpowernv) drop unnecessary OF name NULL checks
Checking the child node names is pointless as the DT node name can
never be NULL, so remove it.

Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: linux-hwmon@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Guenter Roeck
86103cffe8 hwmon: (iio_hwmon) Do not duplicate or sanitize fixed string
Calling devm_kstrdup() on a fixed string is unnecessary, as is validating
its contents. Rearrange the code to avoid both.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Rob Herring
0debe4d0b8 hwmon: Convert to using %pOFn instead of device_node.name
In preparation to remove the node name pointer from struct device_node,
convert printf users to use the %pOFn format specifier.

Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Michael Hennerich
4e15d05d9c drivers: hwmon: (pmbus/ltc2978) Add support for LTM4686 uModule
This patch adds support for LTM4686 Ultrathin Dual 10A or
Single 20A uModule Regulator with Digital Power System Management.

Datasheet: http://www.analog.com/ltm4686

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Kees Cook
329e098939 treewide: Replace more open-coded allocation size multiplications
As done treewide earlier, this catches several more open-coded
allocation size calculations that were added to the kernel during the
merge window. This performs the following mechanical transformations
using Coccinelle:

	kvmalloc(a * b, ...) -> kvmalloc_array(a, b, ...)
	kvzalloc(a * b, ...) -> kvcalloc(a, b, ...)
	devm_kzalloc(..., a * b, ...) -> devm_kcalloc(..., a, b, ...)

Signed-off-by: Kees Cook <keescook@chromium.org>
2018-10-05 18:06:30 -07:00
Greg Kroah-Hartman
eb9a29f9e5 Various bug fixes for nct6775 driver
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJbon6nAAoJEMsfJm/On5mByxoP/3Z5fQWqWKZHlOYgej2xPR8I
 9gMTwCca95awTgD/0toiQLOlwfevIwbdk0MWJSkr3fIqoFY/hOwwvF3mqOo/i6oN
 f8/oFTE0IKoaW0glNWkKK+kZb3d1WopJ1SP9is6KGYhx3b462mS0/i/on6VgQ1Yv
 HitLKs+UF+8rEDnXRMECnbg3gw8lznoxExOSIsxW3m8uWIgIQECdN1DHDza9QYux
 4CLf1gHhk4q4eCgZCRXVPM4NeQlXrPCevnTbLkBUfqR1lCNohqJf2oNcDZYLlCYs
 uQAcByLkfPcifP7a9zMB7QVsWrZmOFgiTIS+Ct9d1XhA2n1+hUA+W3up79JXpr/n
 GS2V1b9KktL5XyRIUmRR5OoV09x2eAuuwLfq/d/Ff7z2KT+gZHdJqz1II0lzivtb
 xgNql/JBjmQvu1fX+g3PYqtXY/BVyNtUMWOtNnfgTBX39Z7L28P1HPCdRjglVKZi
 JVGD5G8XYhVfB3RMSE7b19lFOeRDvnoCNCiU4fmKPRI8IeT6aQUT5sOwjkxtrKkP
 pmSaHqYgawWvTojpD9DrhwHR77WIi1n482OFwB5XjCxc70LaJ0RC0wtRCPhQ1HtB
 cOY/JUt0biqHoX3UD1tcjMl+x3sQ23TViI5hik3iOJ7rwg6gwjL/Mj+LzJRKPfZ0
 906DisKO8TUM/tJlULx9
 =rHpH
 -----END PGP SIGNATURE-----

Merge tag 'hwmon-for-linus-v4.19-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Guenter writes:
   "Various bug fixes for nct6775 driver"
2018-09-19 22:59:30 +02:00
Corey Minyard
3f901c8651 hwmon:ibm: Change ipmi_user_t to struct ipmi_user *
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Cc: Darrick J. Wong <darrick.wong@oracle.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
2018-09-18 16:15:33 -05:00