Pull hwmon fixes and updates from Jean Delvare:
"All lm90 driver fixes and improvements"
* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
Documentation: dt: hwmon: Add OF document for LM90
hwmon: (lm90) Add power control
hwmon: (lm90) Add support for TI TMP451
hwmon: (lm90) Use enums for the indexes of temp8 and temp11
hwmon: (lm90) Add support to handle IRQ
hwmon: (lm90) Define status bits
hwmon: (lm90) Fix max6696 alarm handling
The device lm90 can be controlled by the vcc rail.
Adding the regulator support to power on/off the vcc rail.
Enable the "vcc" regulator before accessing the device.
[JD: Rename variables to avoid confusion with registers.]
Signed-off-by: Wei Ni <wni@nvidia.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
TI TMP451 is mostly compatible with ADT7461, except for
local temperature low byte and max conversion rate.
Add support to the LM90 driver.
Signed-off-by: Wei Ni <wni@nvidia.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Using enums for the indexes and nrs of temp8 and temp11.
This make the code much more readable.
Signed-off-by: Wei Ni <wni@nvidia.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
When the temperature exceed the limit range value,
the driver can handle the interrupt.
Signed-off-by: Wei Ni <wni@nvidia.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Add bit defines for the status register. And add a function
lm90_is_tripped() which will read status register and return
tripped or not, then lm90_alert can call it directly, and in the
future the IRQ thread also can use it.
[JD: Adjusted to include all the new MAX6696 status flags.]
Signed-off-by: Wei Ni <wni@nvidia.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Bit 2 of status register 2 on MAX6696 (external diode 2 open)
sets ALERT; the bit thus has to be listed in alert_alarms.
Also display a message in the alert handler if the condition
is encountered.
Even though not all overtemperature conditions cause ALERT
to be set, we should not ignore them in the alert handler.
Display messages for all out-of-range conditions.
Reported-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Cc: stable@vger.kernel.org
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Use this new function to make code more comprehensible, since we are
reinitialzing the completion, not initializing.
[akpm@linux-foundation.org: linux-next resyncs]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org> (personally at LCE13)
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
As well as the usual driver updates and cleanups there's a few
improvements to the core here:
- The start of some improvements to factor out more of the SPI message
loop into the core. Right now this is just simplifying the code a
bit but hopefully next time around we'll also have managed to roll
out some noticable performance improvements which drivers can take
advantage of.
- Support for loading modules for ACPI enumerated SPI devices.
- Managed registration for SPI controllers.
- Helper for another common I/O pattern.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)
iQIcBAABAgAGBQJSd9ZZAAoJELSic+t+oim9/UkP/1sxozJ0bpnSLRTrI5B5b8Xt
x13r/Hb9WaAxhZW4C/lgWUS1J/S1k4uuJHYFfS3+a3lqF5ulww+vkSuNuF8V0fCJ
egFuO5iQJwA6Npw8IqSf+29geNX8mMXu881g42Znur+SLlkno5sw5Fl7izJ/gfzN
SGNNp9sSi8j59XcUvSZZbOYYjji2n78RCmWD+gdaS7HilDXDYO2Jnh6N7BJ24/6/
lin+SzVRhSTHHH8Gz8UBfgKwDPDFB38Z/DIUSfz1bJP6EnkLKCpq1NqRJE/a4Wqs
vWhWO6f7WFJID8qs/q6UNnBzGs8tIXpMMQtRgB4NcJYdG6V7Vl1qYYgEyKwdQE3L
M7nTLNLppfqhUh4xg0O957ifpW7WYiA7grL5skF+yZNUMCeBkIsCLh847i+w113t
qwqxw6sQHeZbIzDq3BXU7zKUXJ+XEERTFNBHC8lWqcIm/cD8xjhwuhMtebkc75GU
PFCMeIIFd6BWbUPghXZnyTsHEITxFAyDJbEMj+KqtiscMKaubmrQ1qENMoIzpJof
lBPjT78vFIY4A31v21l1FwD/E6BeI/+epZn6UHGfuoepeCaZjGfuGKBxSyY7KF/n
okGwLKrRn84w6zN98XuoHcbPRtl35cHdom1VHHELs/7gPq6wW7/mn0bsOXkK5WDp
txUO/nlCkAcXPo+hfVAM
=emSz
-----END PGP SIGNATURE-----
Merge tag 'spi-v3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi updates from Mark Brown:
"As well as the usual driver updates and cleanups there's a few
improvements to the core here:
- The start of some improvements to factor out more of the SPI
message loop into the core. Right now this is just simplifying the
code a bit but hopefully next time around we'll also have managed
to roll out some noticable performance improvements which drivers
can take advantage of.
- Support for loading modules for ACPI enumerated SPI devices.
- Managed registration for SPI controllers.
- Helper for another common I/O pattern"
* tag 'spi-v3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (116 commits)
spi/hspi: add device tree support
spi: atmel: fix return value check in atmel_spi_probe()
spi: spi-imx: only enable the clocks when we start to transfer a message
spi/s3c64xx: Fix doubled clock disable on suspend
spi/s3c64xx: Do not ignore return value of spi_master_resume/suspend
spi: spi-mxs: Use u32 instead of uint32_t
spi: spi-mxs: Don't set clock for each xfer
spi: spi-mxs: Clean up setup_transfer function
spi: spi-mxs: Remove check of spi mode bits
spi: spi-mxs: Fix race in setup method
spi: spi-mxs: Remove bogus setting of ssp clk rate field
spi: spi-mxs: Remove full duplex check, spi core already does it
spi: spi-mxs: Fix chip select control bits in DMA mode
spi: spi-mxs: Fix extra CS pulses and read mode in multi-transfer messages
spi: spi-mxs: Change flag arguments in txrx functions to bit flags
spi: spi-mxs: Always clear INGORE_CRC, to keep CS asserted
spi: spi-mxs: Remove mxs_spi_enable and mxs_spi_disable
spi: spi-mxs: Always set LOCK_CS
spi/s3c64xx: Add missing pm_runtime_put on setup fail
spi/s3c64xx: Add missing pm_runtime_set_active() call in probe()
...
We cap the upper bound of "mtimeout" but since it's signed we should
check for negative values as well. The mistake is harmless. But I have
changed it to unsigned as a cleanup.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
EMC1404 and EMC1424 are similar to EMC1403 and EMC1423,
but support an additional external temperature sensor.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
'of_match_ptr' is defined in linux/of.h. Include it explicitly.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Driver core sets driver data to NULL upon failure or remove.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Kaiwan N Billimoria <kaiwan@designergraphix.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Driver core sets driver data to NULL upon failure or remove.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Marc Pignat <marc.pignat@hevs.ch>
Acked-by: Marc Pignat <marc.pignat@hevs.ch>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/jc42.c:521:1-3: WARNING: PTR_RET can be used
Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
Generated by: coccinelle/api/ptr_ret.cocci
CC: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/ltc4261.c:243:1-3: WARNING: PTR_RET can be used
Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
Generated by: coccinelle/api/ptr_ret.cocci
CC: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/lm95234.c:704:1-3: WARNING: PTR_RET can be used
Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
Generated by: coccinelle/api/ptr_ret.cocci
CC: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/max6697.c:649:1-3: WARNING: PTR_RET can be used
Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
Generated by: coccinelle/api/ptr_ret.cocci
CC: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/max6642.c:299:1-3: WARNING: PTR_RET can be used
Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
Generated by: coccinelle/api/ptr_ret.cocci
CC: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/ds1621.c:381:1-3: WARNING: PTR_RET can be used
Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
Generated by: coccinelle/api/ptr_ret.cocci
CC: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/nct6775.c:3866:1-3: WARNING: PTR_RET can be used
Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
Generated by: coccinelle/api/ptr_ret.cocci
CC: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Also introduce dev variable in probe function to simplify access
to client->dev, and use new macro ATTRIBUTE_GROUPS to declare
attribute groups.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Modify code to use is_visible to determine if an attribute should be created
or not, then use devm_hwmon_device_register_with_groups to create the hwmon
device and all attributes in one operation.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Also introduce new variable dev pointing to client->dev in the probe
function, and use new macro ATTRIBUTE_GROUPS to declare attribute groups.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Also rename new_client variable to client and introduce
new variable dev pointing to client->dev in the probe function,
and use new macro ATTRIBUTE_GROUPS to declare attribute groups.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Drivers using the new hwmon_device_register_with_groups API often have a
remove function which consists solely of a call hwmon_device_unregister().
Provide support for devm_hwmon_device_register_with_groups and
devm_hwmon_device_unregister to allow this repeated code to be removed
and help eliminate error handling code.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
hwmon_device_register_with_groups() lets callers register a hwmon device
together with all sysfs attributes in a single call.
When using hwmon_device_register_with_groups(), hwmon attributes are attached
to the hwmon device directly and no longer with its parent device.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
The f75375s driver crashes the kernel if it detects an an internal
implementation error. While the detected conditions suggest that
there is a bug in the code, the condition is not fatal.
Replace BUG() with WARN().
Cc: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
vid_to_reg() returns -1 if it encounters an error. Return -EINVAL instead.
Its only caller, atxp1_storevcore(), doesn't use the return code but
returns -1 instead, which is wrong anyway as it means -EPERM.
Use the return value from vid_to_reg() instead to report the error.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <khali@linux-fr.org>