Age | Commit message (Collapse) | Author | Files | Lines |
|
The FSF address may change, and providing it does not add any value.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Simplify detecting duplicate include files and finding the right place
for adding new ones.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
The chip reports if remote diodes are present, which can be used for
the fault attrributes.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Writing the update_interval attribute could result in an overflow if
a number close to the maximum unsigned long was written. At the same
time, even though the chip supports setting the conversion rate,
the selected conversion rate was not actually written to the chip.
Fix the second problem by selecting valid (supported) conversion rates,
and writing the selected conversion rate to the chip. This also fixes the
first problem, since arbitrary conversion rates are now converted to
actually supported conversion rates.
Also, set the default chip conversion rate to 1 second. Previously, the
chip was configured for continuous conversion, but readings were only
retrieved every seond, which doesn't make much sense. If we only read a
value from the chip every second, we can as well save some power and only
convert in one-second intervals.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Use the smp_call_on_cpu() function to call system management
mode on CPU 0.
Make call secure by adding get_online_cpus() to avoid e.g. suspend
resume cycles in between.
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Douglas_Warzecha@dell.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: akataria@vmware.com
Cc: boris.ostrovsky@oracle.com
Cc: chrisw@sous-sol.org
Cc: david.vrabel@citrix.com
Cc: hpa@zytor.com
Cc: jdelvare@suse.com
Cc: jeremy@goop.org
Cc: linux@roeck-us.net
Cc: pali.rohar@gmail.com
Cc: rusty@rustcorp.com.au
Cc: virtualization@lists.linux-foundation.org
Cc: xen-devel@lists.xenproject.org
Link: http://lkml.kernel.org/r/1472453327-19050-7-git-send-email-jgross@suse.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
|
|
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>
|
|
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>
|
|
git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull more hwmon updates from Guenter Roeck:
- Improved error handling in tmp102, lm75, and lm90 drivers
- Bug fixes in sht3x, ftsteutates, iio_hwmon, and adt7411 drivers
* tag 'hwmon-for-linus-v4.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
hwmon: (adt7411) set sane values for CFG1 and CFG3
hwmon: (iio_hwmon) fix memory leak in name attribute
hwmon: (ftsteutates) Fix potential memory access error
hwmon: (tmp102) Improve error handling
hwmon: (lm75) Improve error handling
hwmon: (lm90) Improve error handling
hwmon: (lm90) Add missing assignment
hwmon: (sht3x) set initial jiffies to last_update
|
|
According to the datasheet we have to set some bits as 0 and others as 1.
Make sure we do this for CFG1 and CFG3.
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
The "name" variable's memory is now freed when the device is destructed
thanks to devm function.
Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Fixes: e0f8a24e0edfd ("staging:iio::hwmon interface client driver.")
Fixes: 61bb53bcbdd86 ("hwmon: (iio_hwmon) Add support for humidity sensors")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Using set_bit() to set a bit in an integer is not a good idea, since
the function expects an unsigned long as argument, which can be 64 bit
wide. Coverity reports this problem as
>>> CID 1364488: Memory - illegal accesses (INCOMPATIBLE_CAST)
>>> Pointer "&ret" points to an object whose effective type is "int"
>>> (32 bits, signed) but is dereferenced as a wider "unsigned
+long" (64 bits, unsigned). This may lead to memory corruption.
245 set_bit(1, (unsigned long *)&ret);
Just use BIT instead.
Cc: Thilo Cestonaro <thilo@cestona.ro>
Fixes: 08426eda58e0 ("hwmon: Add driver for FTS BMC chip "Teutates"")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Use devm_add_action_or_reset() instead of devm_add_action(), and
check its return code.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Use devm_add_action_or_reset() instead of devm_add_action(), and
check its return value.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Replace devm_add_action() with devm_add_action_or_reset(),
and check its return value.
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Coverity reports the following error.
>>> CID 1364474: Error handling issues (CHECKED_RETURN)
>>> Calling "lm90_read_reg" without checking return value (as is done
>>> elsewhere 28 out of 29 times).
532 lm90_read_reg(client, LM90_REG_R_REMOTE_LOWH);
533 if (val < 0)
534 return val;
Fixes: 10bfef47bd259 ("hwmon: (lm90) Read limit registers only once")
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Handling the wraparound requires the data->last_update to be set to an
initial jiffies value. Otherwise on 32-bit systems you will not be able
to request a reading till the 5 minute jiffies rollover happens.
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: David Frey <david.frey@sensirion.com>
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Fixes: 7c84f7f80d6fc ("hwmon: add support for Sensirion SHT3x sensors")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c updates from Wolfram Sang:
"Here is the I2C pull request for 4.8:
- the core and i801 driver gained support for SMBus Host Notify
- core support for more than one address in DT
- i2c_add_adapter() has now better error messages. We can remove all
error messages from drivers calling it as a next step.
- bigger updates to rk3x driver to support rk3399 SoC
- the at24 eeprom driver got refactored and can now read special
variants with unique serials or fixed MAC addresses.
The rest is regular driver updates and bugfixes"
* 'i2c/for-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (66 commits)
i2c: i801: use IS_ENABLED() instead of checking for built-in or module
Documentation: i2c: slave: give proper example for pm usage
Documentation: i2c: slave: describe buffer problems a bit better
i2c: bcm2835: Don't complain on -EPROBE_DEFER from getting our clock
i2c: i2c-smbus: drop useless stubs
i2c: efm32: fix a failure path in efm32_i2c_probe()
Revert "i2c: core: Cleanup I2C ACPI namespace"
Revert "i2c: core: Add function for finding the bus speed from ACPI"
i2c: Update the description of I2C_SMBUS
i2c: i2c-smbus: fix i2c_handle_smbus_host_notify documentation
eeprom: at24: tweak the loop_until_timeout() macro
eeprom: at24: add support for at24mac series
eeprom: at24: support reading the serial number for 24csxx
eeprom: at24: platform_data: use BIT() macro
eeprom: at24: split at24_eeprom_write() into specialized functions
eeprom: at24: split at24_eeprom_read() into specialized functions
eeprom: at24: hide the read/write loop behind a macro
eeprom: at24: call read/write functions via function pointers
eeprom: at24: coding style fixes
eeprom: at24: move at24_read() below at24_eeprom_write()
...
|
|
Remove including <linux/version.h> that don't need it.
Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
According to the datasheet you should only write 1 to this bit. If it is
not set, at least AIN3 will return bad values on newer silicon revisions.
Fixes: d84ca5b345c2 ("hwmon: Add driver for ADT7411 voltage and temperature sensor")
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
This driver implements hardware monitoring and watchdog support
for the FTS BMC Chip "Teutates".
Signed-off-by: Thilo Cestonaro <thilo@cestona.ro>
[groeck: Updated subject and description; fixed dependencies]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
The enables control of the SHT31 sensors heating element that can turned
on to remove excess humidity.
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: David Frey <david.frey@sensirion.com>
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
With this change, JC-42.4 compatible temperature sensors can be configured
in devicetree by providing a generic "jedec,jc-42.4-temp" binding.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
By converting the driver to regmap, we can use regmap to cache non-volatile
registers. Stop caching the temperature register; while potentially reading
it more often can result in reading it more often than necessary, this is
offset by the gain due to not re-reading the limit registers.
A positive side effect of this change is that limit registers can now be
read and updated before the first temperature conversion is complete.
Acked-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
So far the chip was forced into polarity 0, even if it was preconfigured
differently. Do not touch the polarity when configuring the chip.
Also, the configuration register was read beack to check if the
configuration 'sticks'. Ultimately, that is similar to checking if the
chip is a tmp102 in the first place. Checking if a write into the
configuration register was successful is really not the way to do it,
and quite risky if the chip is not a tmp102, so drop that check.
Instead, verify if the configuration register has unexpected bits set
before writing into it.
Acked-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
If the chip was in shutdown mode when the driver was loaded, the first
conversion is ready no more than 35 milli-seconds after the chip was
taken out of shutdown. The driver delay was so far set to 333 ms (HZ / 3),
which is much higher than the maximum time needed by the chip.
Reduce the time to 35 milli-seconds.
Introduce a 'valid' flag to ensure that sensor data is actually read
even if requested less than 333 ms after the driver was loaded.
Acked-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
checkpatch rightfully complains that else after return is unnecessary.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Use bool for valid flag and leave it up to the compiler to find
an optimal representation.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Read limit registers only once at startup or after errors to improve
driver performance.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Return both error code and register value as return code from
read functions, and always check for errors.
This reduces code size on x86_64 by more than 1k while at
the same time improving error resiliency.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Since all other cleanup handled with devm_add_action, we can use
devm_hwmon_device_register_with_groups() to register the hwmon
device, and drop the remove function.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Use devm_add_action where possible to simplify error handling and
cleanup on remove.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Convert to use regmap. Leave caching to regmap and drop the register
update function. While this can result in additional read operations
if the temperature register is read continuously, it avoids re-reading
the limit registers and thus overall reduces complexity.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Since we know the chip's update interval, let's make it available
to the user.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
lm75_read_value and lm75_write_value don't really add any value.
Replace with direct smbus access functions.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Use devm_add_action() to register the function to restore the original
chip configuration. Use devm_hwmon_device_register_with_groups()
to register the hwmon device, and drop the remove function as no
longer needed.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
In 2011, commit 774466add7c ("hwmon: (jc42) Change detection class")
changed the detection class of these chips to I2C_CLASS_SPD based
on this premise: "makes more sense because these chips always live on
memory modules"
Today these chips have applications beyond memory modules. Examples are
JC42.4 compatible chips such as MCP9804 and MCP9808, but also MCP9805,
which is marked as JC42.4 compliant and suggested for use not only for
DIMMS, but also as generic temperature sensor.
Add I2C_CLASS_HWMON as an additional detection class to allow detection
by hwmon class i2c adapters.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
[groeck: Updated description]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
The FSF address can change, so drop it from the driver.
Acked-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
By registering a cleanup function with devm_add_action(), we can
simplify the error path in the probe function and drop the remove
function entirely.
Acked-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
MCP9808 is not officially compliant to JC-42, similar to MCP9804,
but its registers are compatible to JC-42.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
The result of an integer divide by an unsigned is undefined.
This causes unexpected results when writing negative values
into the limit registers.
Maintain the shunt_resistors variables as signed integer to avoid
the problem. Also, for simplicity and ease of use, clamp shunt
resistor value on writes instead of rejecting bad values.
Cc: Andrew F. Davis <afd@ti.com>
Acked-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
trivial fix to spelling mistake in dev_dbg message
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
This allow us to debug how long take each SMM call and how long is system
frozen in SMM handler.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Some Dell machines (e.g. Dell Precision M3800) have two fans, first with
index=0 and second with index=2. So export also attributes for third fan
device with index=2.
Reported-by: Tolga Cakir <cevelnet@gmail.com>
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Tested-by: Tolga Cakir <cevelnet@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Use ATTRIBUTE_GROUPS macro and devm_hwmon_device_register_with_groups() to
simplify the code a bit.
The update_lock mutex is not used, so remove it.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Use ATTRIBUTE_GROUPS macro and devm_hwmon_device_register_with_groups() to
simplify the code a bit.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Use ATTRIBUTE_GROUPS macro and devm_hwmon_device_register_with_groups() to
simplify the code a bit.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Add support for the the INA3221 26v capable, Triple channel,
Bi-Directional, Zero-Drift, Low-/High-Side, Current/Voltage Monitor
with I2C interface.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
This driver implements support for the Sensirion SHT3x-DIS chip,
a humidity and temperature sensor. Temperature is measured
in degrees celsius, relative humidity is expressed as a percentage.
In the sysfs interface, all values are scaled by 1000,
i.e. the value for 31.5 degrees celsius is 31500.
Signed-off-by: Pascal Sachs <pascal.sachs@sensirion.com>
[groeck: Fixed 'Variable length array is used' gcc warning]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|
|
On more Dell machines (e.g. Dell Precision M3800) fan_type() call is too
expensive (CPU is too long in SMM mode) and cause kernel to hang. This is
bug in Dell SMM or BIOS.
This patch caches type for each fan (as it should not change) and changes
the way how fan presense is detected. First it try function fan_status()
as was before commit f989e55452c7 ("i8k: Add support for fan labels"). And
if that fails fallback to fan_type(). *_status() functions can fail in case
fan is not currently accessible (e.g. present on GPU which is currently
turned off).
Reported-by: Tolga Cakir <cevelnet@gmail.com>
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=112021
Cc: stable@vger.kernel.org # v4.0+, will need backport
Tested-by: Tolga Cakir <cevelnet@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|