Both datasheet and comments of store_temp_mode() tell us that temp1~4_type
is writable, so fix it.
Signed-off-by: Yao Wang <wangyao@lemote.com>
Signed-off-by: Huacai Chen <chenhc@lemote.com>
Fixes: 39deb6993e (" hwmon: (w83795) Simplify temperature sensor type handling")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Fix macros for tacometer fault reading.
This fix is relevant for three Mellanox systems MQMB7, MSN37, MSN34,
which are about to be released to the customers.
At the moment, none of them is at customers sites.
Fixes: 65afb4c8e7 ("hwmon: (mlxreg-fan) Add support for Mellanox FAN driver")
Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
The current register (04h) has a sign bit at MSB. The comments
for this calculation also mention that it's a signed register.
However, the regval is unsigned type so result of calculation
turns out to be an incorrect value when current is negative.
This patch simply fixes this by adding a casting to s16.
Fixes: 5d389b1251 ("hwmon: (ina2xx) Make calibration register value fixed")
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
In case an under-voltage happens before probing the driver wont
write the critical warning into the kernel log. So don't init
of last_throttled during probe and fix this issue.
Fixes: 74d1e00791 ("hwmon: Add support for RPi voltage sensor")
Reported-by: "Noralf Trønnes" <noralf@tronnes.org>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
When using DT configurations, the id pointer might turn out to
be NULL. Then the driver encounters NULL pointer access:
Unable to handle kernel read from unreadable memory at vaddr 00000018
[...]
PC is at ina2xx_probe+0x114/0x200
LR is at ina2xx_probe+0x10c/0x200
[...]
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
The reason is that i2c core returns the id pointer by matching
id_table with client->name, while the client->name is actually
using the name from the first string in the DT compatible list,
not the best one. So i2c core would fail to match the id_table
if the best matched compatible string isn't the first one, and
then would return a NULL id pointer.
This probably should be fixed in i2c core. But it doesn't hurt
to make the driver robust. So this patch fixes it by using the
"chip" that's added to unify both DT and non-DT configurations.
Additionally, since id pointer could be null, so as id->name:
ina2xx 10-0047: power monitor (null) (Rshunt = 1000 uOhm)
ina2xx 10-0048: power monitor (null) (Rshunt = 10000 uOhm)
So this patch also fixes NULL name pointer, using client->name
to play safe and to align with hwmon->name.
Fixes: bd0ddd4d08 ("hwmon: (ina2xx) Add OF device ID table")
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
If gcc decides not to inline make_sensor_label():
WARNING: vmlinux.o(.text+0x4df549c): Section mismatch in reference from the function .create_device_attrs() to the function .init.text:.make_sensor_label()
The function .create_device_attrs() references
the function __init .make_sensor_label().
This is often because .create_device_attrs lacks a __init
annotation or the annotation of .make_sensor_label is wrong.
As .probe() can be called after freeing of __init memory, all __init
annotiations in the driver are bogus, and should be removed.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
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 *
...
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
- 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
...
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>
'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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>