Commit Graph

2258 Commits

Author SHA1 Message Date
Linus Torvalds 16cd9d1c0f Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
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
2013-11-15 16:35:10 -08:00
Wei Ni 3e0f964f2a hwmon: (lm90) Add power control
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>
2013-11-15 10:40:39 +01:00
Wei Ni 1daaceb26d hwmon: (lm90) Add support for TI TMP451
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>
2013-11-15 10:40:39 +01:00
Wei Ni 40465d9424 hwmon: (lm90) Use enums for the indexes of temp8 and temp11
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>
2013-11-15 10:40:39 +01:00
Wei Ni 109b1283fb hwmon: (lm90) Add support to handle IRQ
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>
2013-11-15 10:40:39 +01:00
Wei Ni 072de4969f hwmon: (lm90) Define status bits
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>
2013-11-15 10:40:38 +01:00
Guenter Roeck e41fae2b1e hwmon: (lm90) Fix max6696 alarm handling
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>
2013-11-15 10:40:38 +01:00
Wolfram Sang 16735d022f tree-wide: use reinit_completion instead of INIT_COMPLETION
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>
2013-11-15 09:32:21 +09:00
Linus Torvalds f095ca6b31 spi: Updates for v3.13
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()
  ...
2013-11-12 15:01:39 +09:00
Mark Brown 82f85cf98f Merge remote-tracking branch 'spi/topic/wr' into spi-next 2013-10-25 09:51:41 +01:00
Dan Carpenter 26336c8a36 hwmon: (w83793) Clean up a signedness issue
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>
2013-10-19 09:04:25 -07:00
Dan Carpenter 1e687e806b hwmon: (nct6775) Remove an unused variable
We don't actually use "j" for anything.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-19 09:04:24 -07:00
Guenter Roeck 0011ddfe6a hwmon: (emc1403) Add support for EMC1404 and EMC1424
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>
2013-10-18 09:12:04 -07:00
Guenter Roeck 454aee17fd hwmon: (emc1403) Convert to use devm_hwmon_device_register_with_groups
Simplify code and reduce its size.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-18 09:12:03 -07:00
Guenter Roeck 3f08d7f49f hwmon: (pmbus/ltc2978): Add support for LTC2978A
Detect LTC2978A chip ID. Treat it as LC2978.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-18 09:12:03 -07:00
Guenter Roeck c24c407e96 hwmon: (pmbus/ltc2978): Add support for LTC2977
LTC2977 is a pin compatible replacement for LTC2978.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-18 09:12:03 -07:00
Guenter Roeck c8ccab7ab5 hwmon: (pmbus/lm25066) Add support for LM25063
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-18 09:12:02 -07:00
LABBE Corentin 84fb029faa hwmon: Correct some typos
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-18 09:12:02 -07:00
Sachin Kamat c50588abab hwmon: (gpio-fan) Include linux/of.h header
'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>
2013-10-18 09:12:02 -07:00
Sachin Kamat 2825f033da hwmon: (lm70) Remove redundant spi_set_drvdata
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>
2013-10-18 09:12:01 -07:00
Sachin Kamat 20652ab8ca hwmon: (adcxx) Remove redundant spi_set_drvdata
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>
2013-10-18 09:12:01 -07:00
Fengguang Wu 650a2c02b5 hwmon: (jc42) fix coccinelle warnings
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>
2013-10-18 09:12:01 -07:00
Fengguang Wu 2a253c4789 hwmon: (ltc4261) fix coccinelle warnings
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>
2013-10-18 09:12:00 -07:00
Fengguang Wu 3ea85ba7af hwmon: (lm95234) fix coccinelle warnings
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>
2013-10-18 09:12:00 -07:00
Fengguang Wu 4109a71608 hwmon: (max6697) fix coccinelle warnings
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>
2013-10-18 09:11:59 -07:00
Fengguang Wu e5840c78f3 hwmon: (max6642 fix coccinelle warnings
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>
2013-10-18 09:11:59 -07:00
Fengguang Wu 31ab1ad70b hwmon: (ds1621) fix coccinelle warnings
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>
2013-10-18 09:11:59 -07:00
Fengguang Wu 9c09bd8d89 hwmon: (nct6775) fix coccinelle warnings
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>
2013-10-18 09:11:58 -07:00
Guenter Roeck 62f9a57c0b hwmon: (jc42) Convert to use devm_hwmon_device_register_with_groups
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-18 09:11:58 -07:00
Guenter Roeck 38f150fe38 hwmon: (ltc4261) Convert to use devm_hwmon_device_register_with_groups
Also use new macro ATTRIBUTE_GROUPS to declare attribute groups.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-18 09:11:58 -07:00
Guenter Roeck 89de734471 hwmon: (ina209) Convert to use devm_hwmon_device_register_with_groups
Also use new macro ATTRIBUTE_GROUPS to declare attribute groups.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-18 09:11:57 -07:00
Guenter Roeck 9d86bd6ba3 hwmon: (lm95234) Convert to use devm_hwmon_device_register_with_groups
Also use new macro ATTRIBUTE_GROUPS to declare attribute groups.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-18 09:11:57 -07:00
Guenter Roeck f3643ac7ff hwmon: (tmp401) Convert to use devm_hwmon_device_register_with_groups
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-18 09:11:52 -07:00
Guenter Roeck 468bf0e395 hwmon: (ina2xx) Convert to use devm_hwmon_device_register_with_groups
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>
2013-10-13 16:16:29 -07:00
Guenter Roeck 38c75dc36d hwmon: (max16065) Convert to use devm_hwmon_device_register_with_groups
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>
2013-10-13 16:16:29 -07:00
Guenter Roeck 8d3735522f hwmon: (max6697) Convert to use devm_hwmon_device_register_with_groups
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-13 16:16:28 -07:00
Guenter Roeck 3710263f13 hwmon: (lm73) Convert to use devm_hwmon_device_register_with_groups
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>
2013-10-13 16:16:28 -07:00
Guenter Roeck 9bd024e9fd hwmon: (max6642) Convert to use devm_hwmon_device_register_with_groups
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>
2013-10-13 16:16:28 -07:00
Guenter Roeck 0d36dce0f1 hwmon: (ds1621) Convert to use devm_hwmon_device_register_with_groups
Also use new macro __ATTRIBUTE_GROUPS to declare attribute groups.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-13 16:16:28 -07:00
Guenter Roeck a150d95b7c hwmon: (nct6775) Convert to use devm_hwmon_device_register_with_groups
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-13 16:16:28 -07:00
Guenter Roeck 74188cba08 hwmon: Provide managed hwmon registration
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>
2013-10-13 16:16:28 -07:00
Guenter Roeck 615fc8cb0f hwmon: (nct6775) Convert to use hwmon_device_register_with_groups
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-13 16:16:28 -07:00
Guenter Roeck c3b7cddc70 hwmon: (pmbus) Convert to use hwmon_device_register_with_groups
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-13 16:16:27 -07:00
Guenter Roeck 9a85d53cfc hwmon: (ltc4245) Convert to use hwmon_device_register_with_groups
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-13 16:16:27 -07:00
Guenter Roeck 7258a12536 hwmon: (gpio-fan) Convert to use hwmon_device_register_with_groups
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-13 16:16:27 -07:00
Guenter Roeck 8269b75ae7 hwmon: (ds1621) Convert to use hwmon_device_register_with_groups
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-13 16:16:27 -07:00
Guenter Roeck bab2243ce1 hwmon: Introduce hwmon_device_register_with_groups
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>
2013-10-13 16:16:27 -07:00
Guenter Roeck 522928a87f hwmon: (f71882fg) Remove extra return statement
Leftover from commit 33cd66e3 (hwmon: (f71882fg) Convert to use
devm_ functions).

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-13 16:16:27 -07:00
Guenter Roeck 39b103b4d2 hwmon: (f75375s) Don't crash the kernel unnecessarily
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>
2013-10-13 16:16:27 -07:00
Guenter Roeck 674d0ed858 hwmon: (atxp1) Set and use error code from vid_to_reg()
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>
2013-10-13 16:16:26 -07:00