1
0
Fork 0
Commit Graph

2567 Commits (1e6f2416044c062a56091ebf8d76760956dd5872)

Author SHA1 Message Date
Guenter Roeck ad9beea43f hwmon: (tmp102) Convert to use hwmon_device_register_with_groups
Simplify code, reduce code size, and attach sysfs attributes to hwmon device.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:20 -07:00
Guenter Roeck fbd9af164c hwmon: (tmp102) Introduce dev variable in probe function
The pointer to client->dev is used several times in the probe function.
Simplify code by introducing a separate variable for it.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:20 -07:00
Guenter Roeck aa9bcddada hwmon: (lm70) Convert to use devm_hwmon_device_register_with_groups
Use devm_hwmon_device_register_with_groups API to attach attributes
to hwmon device, simplify code, and reduce code size.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:20 -07:00
Pawel Moll 3b9334ac83 mfd: vexpress: Convert custom func API to regmap
Components of the Versatile Express platform (configuration
microcontrollers on motherboard and daughterboards in particular)
talk to each other over a custom configuration bus. They
provide miscellaneous functions (from clock generator control
to energy sensors) which are represented as platform devices
(and Device Tree nodes). The transactions on the bus can
be generated by different "bridges" in the system, some
of which are universal for the whole platform (for the price
of high transfer latencies), others restricted to a subsystem
(but much faster).

Until now drivers for such functions were using custom "func"
API, which is being replaced in this patch by regmap calls.
This required:

* a rework (and move to drivers/bus directory, as suggested
  by Samuel and Arnd) of the config bus core, which is much
  simpler now and uses device model infrastructure (class)
  to keep track of the bridges; non-DT case (soon to be
  retired anyway) is simply covered by a special device
  registration function

* the new config-bus driver also takes over device population,
  so there is no need for special matching table for
  of_platform_populate nor "simple-bus" hack in the arm64
  model dtsi file (relevant bindings documentation has
  been updated); this allows all the vexpress devices
  fit into normal device model, making it possible
  to remove plenty of early inits and other hacks in
  the near future

* adaptation of the syscfg bridge implementation in the
  sysreg driver, again making it much simpler; there is
  a special case of the "energy" function spanning two
  registers, where they should be both defined in the tree
  now, but backward compatibility is maintained in the code

* modification of the relevant drivers:

  * hwmon - just a straight-forward API change
  * power/reset driver - API change
  * regulator - API change plus error handling
    simplification
  * osc clock driver - this one required larger rework
    in order to turn in into a standard platform driver

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Acked-by: Mark Brown <broonie@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Mike Turquette <mturquette@linaro.org>
2014-05-15 17:02:18 +01:00
Josef Gajdusek 3a18e1398f hwmon: (emc1403) Support full range of known chip revision numbers
The datasheet for EMC1413/EMC1414, which is fully compatible to
EMC1403/1404 and uses the same chip identification, references revision
numbers 0x01, 0x03, and 0x04. Accept the full range of revision numbers
from 0x01 to 0x04 to make sure none are missed.

Signed-off-by: Josef Gajdusek <atx@atx.name>
Cc: stable@vger.kernel.org
[Guenter Roeck: Updated headline and description]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-12 08:37:06 -07:00
Jean Delvare 8759f90465 hwmon: (emc1403) Fix resource leak on module unload
Commit 454aee17f claims to convert driver emc1403 to use
devm_hwmon_device_register_with_groups, however the patch itself makes
use of hwmon_device_register_with_groups instead. As the driver remove
function was still dropped, the hwmon device is no longer unregistered
on driver removal, leading to a resource leak.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Fixes: 454aee17f hwmon: (emc1403) Convert to use devm_hwmon_device_register_with_groups
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: stable@vger.kernel.org [3.13+]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-12 08:37:06 -07:00
Josef Gajdusek 17c048fc4b hwmon: (emc1403) fix inverted store_hyst()
Attempts to set the hysteresis value to a temperature below the target
limit fails with "write error: Numerical result out of range" due to
an inverted comparison.

Signed-off-by: Josef Gajdusek <atx@atx.name>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Cc: stable@vger.kernel.org
[Guenter Roeck: Updated headline and description]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-12 08:37:05 -07:00
Guenter Roeck c0940e95f7 Revert "hwmon: (coretemp) Refine TjMax detection"
This reverts commit 9fb6c9c73b.

Tjmax on some Intel CPUs is below 85 degrees C. One known example is
L5630 with Tjmax of 71 degrees C. There are other Xeon processors with
Tjmax of 70 or 80 degrees C. Also, the Intel IA32 System Programming
document states that the temperature target is in bits 23:16 of MSR 0x1a2
(MSR_TEMPERATURE_TARGET), which is 8 bits, not 7.

So even if turbostat uses similar checks to validate Tjmax, there is no
evidence that the checks are actually required. On the contrary, the
checks are known to cause problems and therefore need to be removed.

This fixes https://bugzilla.kernel.org/show_bug.cgi?id=75071.

Fixes: 9fb6c9c hwmon: (coretemp) Refine TjMax detection
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Cc: stable@vger.kernel.org # 3.14+
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-01 04:07:52 -07:00
Guenter Roeck f75d723091 hwmon: (ltc2945) Don't crash the kernel unnecessarily
An implementation error should not crash the kernel if it is avoidable.
Replace BUG() with WARN_ONCE().

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-04-24 06:09:43 -07:00
Pawel Moll b2e5411ee2 hwmon: (vexpress) Avoid creating non-existing attributes
The 'label' attribute was always created but returned -ENOENT
if there is no label and such behaviour is undefined from
libsensors' point of view.

Fixed by providing is_visible method in the attributes group,
so the attribute is not created at all when unnecessary.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-04-24 06:02:10 -07:00
Pawel Moll 52feaca5d6 hwmon: (vexpress) Use legal hwmon device names
The driver used to directly us a DT 'compatible' property for
the 'name' attribute of the hwmon devices. Unfortunately it
contains '-' which is illegal in this context. It messes up
libsensors and thus every application using it.

Fixed by providing equivalent (and simpler) name strings.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-04-24 06:01:59 -07:00
Linus Torvalds 042f7b7cbd Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Pull more powerpc updates from Ben Herrenschmidt:
 "Here are a few more powerpc things for you.

  So you'll find here the conversion of the two new firmware sysfs
  interfaces to the new API for self-removing files that Greg and Tejun
  introduced, so they can finally remove the old one.

  I'm also reverting the hwmon driver for powernv.  I shouldn't have
  merged it, I got a bit carried away here.  I hadn't realized it was
  never CCed to the relevant maintainer(s) and list(s), and happens to
  have some issues so I'm taking it out and it will come back via the
  proper channels.

  The rest is a bunch of LE fixes (argh, some of the new stuff was
  broken on LE, I really need to start testing LE myself !) and various
  random fixes here and there.

  Finally one bit that's not strictly a fix, which is the HVC OPAL
  change to "kick" the HVC thread when the firmware tells us there is
  new incoming data.  I don't feel like waiting for this one, it's
  simple enough, and it makes a big difference in console responsiveness
  which is good for my nerves"

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (26 commits)
  powerpc/powernv Adapt opal-elog and opal-dump to new sysfs_remove_file_self
  Revert "powerpc/powernv: hwmon driver for power values, fan rpm and temperature"
  power, sched: stop updating inside arch_update_cpu_topology() when nothing to be update
  powerpc/le: Avoid creatng R_PPC64_TOCSAVE relocations for modules.
  arch/powerpc: Use RCU_INIT_POINTER(x, NULL) in platforms/cell/spu_syscalls.c
  powerpc/opal: Add missing include
  powerpc: Convert last uses of __FUNCTION__ to __func__
  powerpc: Add lq/stq emulation
  powerpc/powernv: Add invalid OPAL call
  powerpc/powernv: Add OPAL message log interface
  powerpc/book3s: Fix mc_recoverable_range buffer overrun issue.
  powerpc: Remove dead code in sycall entry
  powerpc: Use of_node_init() for the fakenode in msi_bitmap.c
  powerpc/mm: NUMA pte should be handled via slow path in get_user_pages_fast()
  powerpc/powernv: Fix endian issues with sensor code
  powerpc/powernv: Fix endian issues with OPAL async code
  tty/hvc_opal: Kick the HVC thread on OPAL console events
  powerpc/powernv: Add opal_notifier_unregister() and export to modules
  powerpc/ppc64: Do not turn AIL (reloc-on interrupts) too early
  powerpc/ppc64: Gracefully handle early interrupts
  ...
2014-04-09 08:35:31 -07:00
Benjamin Herrenschmidt 4952ef9aec Revert "powerpc/powernv: hwmon driver for power values, fan rpm and temperature"
This reverts commit 0de7f8a917.

This driver wasn't merged via the proper maintainers (my fault ... ooops !)
and has serious issues so let's take it out for now and have a new better
one be merged the right way

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
2014-04-09 12:56:37 +10:00
Linus Torvalds 467a9e1633 CPU hotplug notifiers registration fixes for 3.15-rc1
The purpose of this single series of commits from Srivatsa S Bhat (with
 a small piece from Gautham R Shenoy) touching multiple subsystems that use
 CPU hotplug notifiers is to provide a way to register them that will not
 lead to deadlocks with CPU online/offline operations as described in the
 changelog of commit 93ae4f978c (CPU hotplug: Provide lockless versions
 of callback registration functions).
 
 The first three commits in the series introduce the API and document it
 and the rest simply goes through the users of CPU hotplug notifiers and
 converts them to using the new method.
 
 /
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABCAAGBQJTQow2AAoJEILEb/54YlRxW4QQAJlYRDUzwFJzJzYhltQYuVR+
 4D74XMtvXgoJfg3cwdSWvMKKpJZnA9BVN0f7Hcx9wYmgdexYUuHeZJmMNyc3S2+g
 KjKBIsugvgmZhHbbLd6TJ6GBbhGT5JLt9VmSfL9zIkveInU1YHFUUqL/mxdHm4J0
 BSGKjk2rN3waRJgmY+xfliFLtQjDKFwJpMuvrgtoUyfas3f4sIV43UNbqdvA/weJ
 rzedxXOlKH/id4b56lj/4iIzcoL3mwvJJ7r6n0CEMsKv87z09kqR0O+69Tsq/cgs
 j17CsvoJOmZGk3QTeKVMQWBsvk6aPoDu3zK83gLbQMt+qjOpSTbJLz/3HZw4/TrW
 ss4nuZne1DLMGS+6hoxYbTP+6Ni//Kn+l/LrHc5jb7m1X3lMO4W2aV3IROtIE1rv
 lEP1IG01NU4u9YwkVj1dyhrkSp8tLPul4SrUK8W+oNweOC5crjJV7vJbIPJgmYiM
 IZN55wln0yVRtR4TX+rmvN0PixsInE8MeaVCmReApyF9pdzul/StxlBze5BKLSJD
 cqo1kNPpsmdxoDucqUpQ/gSvy+IOl2qnlisB5PpV93sk7De6TFDYrGHxjYIW7jMf
 StXwdCDDQhzd2Q8Kfpp895A1dbIl8rKtwA6bTU2eX+BfMVFzuMdT44cvosx1+UdQ
 sWl//rg76nb13dFjvF+q
 =SW7Q
 -----END PGP SIGNATURE-----

Merge tag 'cpu-hotplug-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull CPU hotplug notifiers registration fixes from Rafael Wysocki:
 "The purpose of this single series of commits from Srivatsa S Bhat
  (with a small piece from Gautham R Shenoy) touching multiple
  subsystems that use CPU hotplug notifiers is to provide a way to
  register them that will not lead to deadlocks with CPU online/offline
  operations as described in the changelog of commit 93ae4f978c ("CPU
  hotplug: Provide lockless versions of callback registration
  functions").

  The first three commits in the series introduce the API and document
  it and the rest simply goes through the users of CPU hotplug notifiers
  and converts them to using the new method"

* tag 'cpu-hotplug-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (52 commits)
  net/iucv/iucv.c: Fix CPU hotplug callback registration
  net/core/flow.c: Fix CPU hotplug callback registration
  mm, zswap: Fix CPU hotplug callback registration
  mm, vmstat: Fix CPU hotplug callback registration
  profile: Fix CPU hotplug callback registration
  trace, ring-buffer: Fix CPU hotplug callback registration
  xen, balloon: Fix CPU hotplug callback registration
  hwmon, via-cputemp: Fix CPU hotplug callback registration
  hwmon, coretemp: Fix CPU hotplug callback registration
  thermal, x86-pkg-temp: Fix CPU hotplug callback registration
  octeon, watchdog: Fix CPU hotplug callback registration
  oprofile, nmi-timer: Fix CPU hotplug callback registration
  intel-idle: Fix CPU hotplug callback registration
  clocksource, dummy-timer: Fix CPU hotplug callback registration
  drivers/base/topology.c: Fix CPU hotplug callback registration
  acpi-cpufreq: Fix CPU hotplug callback registration
  zsmalloc: Fix CPU hotplug callback registration
  scsi, fcoe: Fix CPU hotplug callback registration
  scsi, bnx2fc: Fix CPU hotplug callback registration
  scsi, bnx2i: Fix CPU hotplug callback registration
  ...
2014-04-07 14:55:46 -07:00
Linus Torvalds 3e76b749ea Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
Pull hwmon updates from Jean Delvare:
 "This includes a number of driver conversions to
  devm_hwmon_device_register_with_groups, a few cleanups, and
  support for the ITE IT8623E"

* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  hwmon: (it87) Add support for IT8623E
  hwmon: (it87) Fix IT8603E define name
  hwmon: (lm90) Convert to use hwmon_device_register_with_groups
  hwmon: (lm90) Create all sysfs groups in one call
  hwmon: (lm90) Always use the dev variable in the probe function
  hwmon: (lm90) Create most optional attributes with sysfs_create_group
  hwmon: Avoid initializing the same field twice
  hwmon: (pc87360) Avoid initializing the same field twice
  hwmon: (lm80) Convert to use devm_hwmon_device_register_with_groups
  hwmon: (adm1021) Convert to use devm_hwmon_device_register_with_groups
  hwmon: (lm63) Avoid initializing the same field twice
  hwmon: (lm63) Convert to use devm_hwmon_device_register_with_groups
  hwmon: (lm63) Create all sysfs groups in one call
  hwmon: (lm63) Introduce 'dev' variable to point to client->dev
  hwmon: (lm63) Add additional sysfs group for temp2_type attribute
  hwmon: (f71805f) Fix author's address
2014-04-05 18:45:11 -07:00
Rudolf Marek 574e9bd8fa hwmon: (it87) Add support for IT8623E
Add support for the IT8623E found on Asus motherboards. It has same
hardware monitoring block as IT8603E.

Signed-off-by: Rudolf Marek <r.marek@assembler.cz>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
2014-04-04 18:01:35 +02:00
Rudolf Marek 7183ae8c20 hwmon: (it87) Fix IT8603E define name
Fix small typo in the define name for IT8603E.

Signed-off-by: Rudolf Marek <r.marek@assembler.cz>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
2014-04-04 18:01:35 +02:00
Guenter Roeck 1de8b250f6 hwmon: (lm90) Convert to use hwmon_device_register_with_groups
Simplify code, reduce code size, and attach hwmon attributes to hwmon device.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
2014-04-04 18:01:35 +02:00
Guenter Roeck 084489e64c hwmon: (lm90) Create all sysfs groups in one call
Create all sysfs groups in one call by using sysfs_create_groups
instead of calling sysfs_create_group individually for each group.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
2014-04-04 18:01:35 +02:00
Guenter Roeck d89fa6867d hwmon: (lm90) Always use the dev variable in the probe function
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
2014-04-04 18:01:35 +02:00
Guenter Roeck 742192f546 hwmon: (lm90) Create most optional attributes with sysfs_create_group
With the new hwmon API, all attributes have to be created as groups.
Use sysfs_create_group and sysfs_remove_group instead of device_create_file
and device_remove_file to prepare for the new API.

Exception is the 'pec' attribute which will stay with the i2c device.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
2014-04-04 18:01:34 +02:00
Jean Delvare 6cf0a91ebe hwmon: Avoid initializing the same field twice
All hwmon drivers allocate their data structure with some form of
kzalloc, so setting data fields to zero explicitly is a waste of time.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
2014-04-04 18:01:34 +02:00
Jean Delvare 5b58157598 hwmon: (pc87360) Avoid initializing the same field twice
data is kzalloc'd, so data->valid, data->innr and data->tempnr are
already 0. Also rework the initialization path to only set name and
data->fannr once.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
2014-04-04 18:01:34 +02:00
Guenter Roeck 118c9a61f1 hwmon: (lm80) Convert to use devm_hwmon_device_register_with_groups
Simplify code, reduce code size, and attach hwmon attributes to
hwmon device.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
2014-04-04 18:01:34 +02:00
Guenter Roeck c669ec8039 hwmon: (adm1021) Convert to use devm_hwmon_device_register_with_groups
Simplify code, reduce code size, and attach hwmon attributes to
hwmon device.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
2014-04-04 18:01:34 +02:00
Jean Delvare 5ec25c93e0 hwmon: (lm63) Avoid initializing the same field twice
data is kzalloc'd, so data->valid is already 0.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
2014-04-04 18:01:33 +02:00
Guenter Roeck e19eea8407 hwmon: (lm63) Convert to use devm_hwmon_device_register_with_groups
Simplify code, reduce code size, attach hwmon attributes to hwmon device.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
2014-04-04 18:01:33 +02:00
Guenter Roeck b76552b310 hwmon: (lm63) Create all sysfs groups in one call
We can create all sysfs groups in one call by using sysfs_create_groups
instead of using sysfs_create_group individually for each group.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
2014-04-04 18:01:33 +02:00
Guenter Roeck 2fd638feb6 hwmon: (lm63) Introduce 'dev' variable to point to client->dev
client->dev is used multiple times in several functions.
Introduce dev variable pointing to it to simplify the code.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
2014-04-04 18:01:33 +02:00
Guenter Roeck 0dcb28a152 hwmon: (lm63) Add additional sysfs group for temp2_type attribute
With the new hwmon API, we can only add groups of attributes, not individual
attributes. To prepare for the use of the new API, add an additional sensor
group for the temp2_type attribute and register it with sysfs_create_group
instead of device_create_file.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
2014-04-04 18:01:32 +02:00
Jean Delvare 964f945b5e hwmon: (f71805f) Fix author's address
The original address was incomplete, and this caused it to be missed
by the recent update to my new address.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
2014-04-04 18:01:32 +02:00
Aravind Gopalakrishnan ec0159503a hwmon: (k10temp) Add support for AMD F16 M30h processor
Adding new PCI ID to support AMD F16 M30h processor (Mullins).
While at it, modify Kconfig and Doc files to reflect the
support for newer processors

Note: PCI ID for this processor will make it into pci_ids.h
as part of this patch:
http://marc.info/?l=linux-kernel&m=139291362126057&w=2
which should be pulled into 3.15 when merge window opens
(It currently sits in 'for-next' branch of bp.git-
https://git.kernel.org/cgit/linux/kernel/git/bp/bp.git/log/?h=for-next)

Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-04-02 22:09:14 -07:00
Linus Torvalds 235c7b9feb Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Pull main powerpc updates from Ben Herrenschmidt:
 "This time around, the powerpc merges are going to be a little bit more
  complicated than usual.

  This is the main pull request with most of the work for this merge
  window.  I will describe it a bit more further down.

  There is some additional cpuidle driver work, however I haven't
  included it in this tree as it depends on some work in tip/timer-core
  which Thomas accidentally forgot to put in a topic branch.  Since I
  didn't want to carry all of that tip timer stuff in powerpc -next, I
  setup a separate branch on top of Thomas tree with just that cpuidle
  driver in it, and Stephen has been carrying that in next separately
  for a while now.  I'll send a separate pull request for it.

  Additionally, two new pieces in this tree add users for a sysfs API
  that Tejun and Greg have been deprecating in drivers-core-next.
  Thankfully Greg reverted the patch that removes the old API so this
  merge can happen cleanly, but once merged, I will send a patch
  adjusting our new code to the new API so that Greg can send you the
  removal patch.

  Now as for the content of this branch, we have a lot of perf work for
  power8 new counters including support for our new "nest" counters
  (also called 24x7) under pHyp (not natively yet).

  We have new functionality when running under the OPAL firmware
  (non-virtualized or KVM host), such as access to the firmware error
  logs and service processor dumps, system parameters and sensors, along
  with a hwmon driver for the latter.

  There's also a bunch of bug fixes accross the board, some LE fixes,
  and a nice set of selftests for validating our various types of copy
  loops.

  On the Freescale side, we see mostly new chip/board revisions, some
  clock updates, better support for machine checks and debug exceptions,
  etc..."

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (70 commits)
  powerpc/book3s: Fix CFAR clobbering issue in machine check handler.
  powerpc/compat: 32-bit little endian machine name is ppcle, not ppc
  powerpc/le: Big endian arguments for ppc_rtas()
  powerpc: Use default set of netfilter modules (CONFIG_NETFILTER_ADVANCED=n)
  powerpc/defconfigs: Enable THP in pseries defconfig
  powerpc/mm: Make sure a local_irq_disable prevent a parallel THP split
  powerpc: Rate-limit users spamming kernel log buffer
  powerpc/perf: Fix handling of L3 events with bank == 1
  powerpc/perf/hv_{gpci, 24x7}: Add documentation of device attributes
  powerpc/perf: Add kconfig option for hypervisor provided counters
  powerpc/perf: Add support for the hv 24x7 interface
  powerpc/perf: Add support for the hv gpci (get performance counter info) interface
  powerpc/perf: Add macros for defining event fields & formats
  powerpc/perf: Add a shared interface to get gpci version and capabilities
  powerpc/perf: Add 24x7 interface headers
  powerpc/perf: Add hv_gpci interface header
  powerpc: Add hvcalls for 24x7 and gpci (Get Performance Counter Info)
  sysfs: create bin_attributes under the requested group
  powerpc/perf: Enable BHRB access for EBB events
  powerpc/perf: Add BHRB constraint and IFM MMCRA handling for EBB
  ...
2014-04-02 13:42:59 -07:00
Shivaprasad G Bhat 0de7f8a917 powerpc/powernv: hwmon driver for power values, fan rpm and temperature
This patch adds basic kernel enablement for reading power values, fan
speed rpm and temperature values on powernv platforms which will
be exported to user space through sysfs interface.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-03-24 09:48:22 +11:00
Srivatsa S. Bhat 2480b6a3e5 hwmon, via-cputemp: Fix CPU hotplug callback registration
Subsystems that want to register CPU hotplug callbacks, as well as perform
initialization for the CPUs that are already online, often do it as shown
below:

	get_online_cpus();

	for_each_online_cpu(cpu)
		init_cpu(cpu);

	register_cpu_notifier(&foobar_cpu_notifier);

	put_online_cpus();

This is wrong, since it is prone to ABBA deadlocks involving the
cpu_add_remove_lock and the cpu_hotplug.lock (when running concurrently
with CPU hotplug operations).

Instead, the correct and race-free way of performing the callback
registration is:

	cpu_notifier_register_begin();

	for_each_online_cpu(cpu)
		init_cpu(cpu);

	/* Note the use of the double underscored version of the API */
	__register_cpu_notifier(&foobar_cpu_notifier);

	cpu_notifier_register_done();

Fix the hwmon via-cputemp code by using this latter form of callback
registration.

Cc: Jean Delvare <jdelvare@suse.de>
Cc: Ingo Molnar <mingo@kernel.org>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-20 13:43:48 +01:00
Srivatsa S. Bhat 3289705fe2 hwmon, coretemp: Fix CPU hotplug callback registration
Subsystems that want to register CPU hotplug callbacks, as well as perform
initialization for the CPUs that are already online, often do it as shown
below:

	get_online_cpus();

	for_each_online_cpu(cpu)
		init_cpu(cpu);

	register_cpu_notifier(&foobar_cpu_notifier);

	put_online_cpus();

This is wrong, since it is prone to ABBA deadlocks involving the
cpu_add_remove_lock and the cpu_hotplug.lock (when running concurrently
with CPU hotplug operations).

Instead, the correct and race-free way of performing the callback
registration is:

	cpu_notifier_register_begin();

	for_each_online_cpu(cpu)
		init_cpu(cpu);

	/* Note the use of the double underscored version of the API */
	__register_cpu_notifier(&foobar_cpu_notifier);

	cpu_notifier_register_done();

Fix the hwmon coretemp code by using this latter form of callback
registration.

Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Jean Delvare <jdelvare@suse.de>
Cc: Ingo Molnar <mingo@kernel.org>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-20 13:43:47 +01:00
Guenter Roeck f76992b00a hwmon: (pmbus/ltc2978) Add support for LTM4676
The chip's programming interface is quite similar to LTC3880
and supports the same set of sensors.

Reviewed-by: Robert Coulson <rob.coulson@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-19 18:59:40 -07:00
Guenter Roeck a2e1510743 hwmon: (pmbus/ltc2978) Add new chip ID for LTC2974
LTC2974 datasheet revision C lists the chip ID for LTC2974 as 0x0213.

Reviewed-by: Robert Coulson <rob.coulson@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-05 21:52:06 -08:00
Guenter Roeck 648cd48c9e hwmon: Do not accept invalid name attributes
hwmon name attributes must not include '-', as specified in
Documentation/hwmon/sysfs-interface. Also filter out spaces,
tabs, wildcards, and newline characters.

Tested-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-03 08:01:06 -08:00
Jingoo Han 768821a302 hwmon: (max6639) Use SIMPLE_DEV_PM_OPS macro
Use SIMPLE_DEV_PM_OPS macro in order to make the code simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Roland Stigge <stigge@antcom.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-03 08:01:06 -08:00
Guenter Roeck a41a8927e7 hwmon: (lm95245) Make temp2_crit_hyst read-only
The hysteresis register is shared among both temperature sensors.
This means changing one also affects the other. To avoid confusion,
established way to express this is to make only the first instance writable
and keep all other instances as read-only. Otherwise users may be
confused that changing the second writable value also affects the first,
while it is more obvious that a writable value may affect a different
read-only value.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
2014-03-03 08:01:06 -08:00
Guenter Roeck 7276d55e62 hwmon: (lm95245) Convert to use devm_hwmon_device_register_with_groups
Simplify code, reduce code size, and attach hwmon attributes
to hwmon device.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
2014-03-03 08:01:06 -08:00
Guenter Roeck ce50e7faf1 hwmon: (lm95245) Drop useless debug message
It doesn't provide value to get a log message whenever the driver
updates its cached data, so drop the message.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
2014-03-03 08:01:06 -08:00
Guenter Roeck 408c15eaca hwmon: (lm95245) Fix hysteresis temperatures
Hysteresis temperatures are defined as absolute temperatures,
not as delta value from the critical temperatures.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
2014-03-03 08:01:06 -08:00
Guenter Roeck 7981c5846a hwmon: (max6639) Convert to use devm_hwmon_device_register_with_groups
Simplify code, reduce code size, and attach sysfs attricutes to hwmon device.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
2014-03-03 08:01:06 -08:00
Guenter Roeck c1ea0a0431 hwmon: (max6639) Introduce local dev variable, and reduce noisiness
Introduce local variable 'dev' in probe function to make code easier
to read. Also drop dev_info message in probe to reduce noisiness
during boot.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
2014-03-03 08:01:06 -08:00
Guenter Roeck 71ba0f315c hwmon: (max6650) Introduce local 'dev' variable
This makes the code a bit easier to read.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-03 08:01:06 -08:00
Guenter Roeck 0b5e33b632 hwmon: (max6650) Drop error message after memory allocation failures
The core code already generates an error message.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-03 08:01:05 -08:00
Guenter Roeck 17eaa25c3e hwmon: (max6650) Convert to use devm_hwmon_device_register_with_groups
Simplify code, reduce code size, and attach sensor attributes
to hwmon device.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-03 08:01:05 -08:00
Guenter Roeck 1577f94bce hwmon: (max6650) Rearrange code to no longer require forward declarations
Cleanup only; no functional change.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-03 08:01:05 -08:00
Guenter Roeck 6c588b45b0 hwmon: (ltc4215) Convert to devm_hwmon_device_register_with_groups
Simplify code, reduce code size, and attach sysfs attributes to hwmon device.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
2014-03-03 08:01:05 -08:00
Guenter Roeck d72d19c26c hwmon: (coretemp) Convert to use devm_hwmon_device_register_with_groups
Simplify code, reduce code size, and attach sysfs attributes to hwmon device.

For this driver, the only attribute created is the name attribute.
Other attributes are still created and removed dynamically as cores
are added or removed.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Tested-by: Jean Delvare <jdelvare@suse.de>
2014-03-03 08:01:05 -08:00
Guenter Roeck c503a811e4 hwmon: (coretemp) Allocate platform data with devm_kzalloc
This simplifies error handling.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Tested-by: Jean Delvare <jdelvare@suse.de>
2014-03-03 08:01:05 -08:00
Guenter Roeck 1075305de4 hwmon: (coretemp) Use sysfs_create_group to create sysfs attributes
Instead of creating each attribute individually, use sysfs_create_group
to create all attributes for one core with a single call.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Tested-by: Jean Delvare <jdelvare@suse.de>
2014-03-03 08:01:05 -08:00
Guenter Roeck 4fa6cbb1b8 hwmon: (ltc4245) Remove devicetree conditionals
Devicetree functions are stubbed out if CONFIG_OF is undefined.
Therefore, conditional compilation is unnecessary and can be removed.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
2014-03-03 08:01:05 -08:00
Guenter Roeck bdd41aae69 hwmon: (ltc4245) Drop debug messages
The debug messages in this driver have little if any value. Drop them.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
2014-03-03 08:01:04 -08:00
Guenter Roeck 94c42cf9a1 hwmon: (ltc4245) Use device managed function to register hwmon device
This simplifies the code and reduces code size.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
2014-03-03 08:01:04 -08:00
Guenter Roeck 5230551a26 hwmon: (max1668) Convert to use devm_hwmon_device_register_with_groups
Simplify code, reduce code size, and attach hwmon attributes to hwmon device.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
2014-03-03 08:01:04 -08:00
Guenter Roeck c5a706697f hwmon: (max1668) Don't hide return value from i2c_smbus_write_byte_data
i2c_smbus_write_byte_data returns a valid error code.
Return it to the user instead of replacing it with -EIO.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
2014-03-03 08:01:04 -08:00
Guenter Roeck b4c9c1a798 hwmon: Driver for TI ADC128D818
ADC128D818 is a System Monitor with Temperature Sensor. It is similar to LM80
and LM96080, but has 16 bit wide sensor registers and no fan speed monitoring.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-03 08:01:04 -08:00
Jean Delvare ebf5e87791 hwmon: Sort Kconfig entries alphabetically
Entries have been added at more or less random positions over time, so
it becomes difficult to find what you are looking for or figure out
where to insert new entries.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-03 08:01:04 -08:00
Jean Delvare f91d22fc3e hwmon: (lm95245) Avoid initializing the same field twice
data is kzalloc'd, so data->valid is already 0.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-03 08:01:04 -08:00
Jean Delvare a5589cf193 hwmon: (lm95241) Avoid initializing the same field twice
data is kzalloc'd, so data->valid and data->model are already 0.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-03 08:01:04 -08:00
Guenter Roeck 9bf3babf3f hwmon: (emc2103) Return error from i2c_smbus_read_byte_data
There is no reason to replace one error with another.

smatch message:
drivers/hwmon/emc2103.c:352 set_fan_div() info: why not propagate 'status'
from i2c_smbus_read_byte_data() instead of (-5)?

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-03 08:01:04 -08:00
Guenter Roeck f44e5c5cf9 hwmon: (smm665): Return error from i2c_smbus_read_word_swapped
There is no reason to replace one error code with another,
and returning -1 as error code is wrong anyway.

Smatch log:
drivers/hwmon/smm665.c:225 smm665_read_adc() info: why not propagate 'rv'
from i2c_smbus_read_word_swapped() instead of (-1)?

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-03 08:01:03 -08:00
Axel Lin 2065bdd64c hwmon: (ltc4260) Fix trivial typo
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-03 08:01:03 -08:00
Jingoo Han 939a0a3fe9 hwmon: (jz4740) Use devm_ioremap_resource()
Use devm_ioremap_resource() in order to make the code simpler,
and move 'struct resource *mem' from 'struct jz4740_hwmon' to
jz4740_hwmon_probe() because the 'mem' variable is used only in
jz4740_hwmon_probe(). Also the redundant return value check of
platform_get_resource() is removed, because the value is checked
by devm_ioremap_resource().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-03 08:01:03 -08:00
Guenter Roeck 6700ce035f hwmon: Driver for Linear Technologies LTC2945
LTC2945 is a system monitor that measures current, voltage, and power.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-03 08:01:03 -08:00
Guenter Roeck 69e1ded651 hwmon: Driver for Linear Technologies LTC4260
LTC4260 is a Positive Voltage Hot Swap Controller.
The driver currently only supports voltage monitoring, not voltage control.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-03 08:01:03 -08:00
Guenter Roeck 79ffe8594f hwmon: Driver for Linear Technologies LTC4222
Driver Linear Technologies LTC4222 Dual Hot Swap Controller
The driver currently only supports voltage monitoring, not voltage control.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-03 08:01:03 -08:00
Guenter Roeck 4b49cca36e hwmon: (iio_hwmon) Convert to use hwmon_device_register_with_groups
Simplify code and create name attribute automatically.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-03 08:01:03 -08:00
Guenter Roeck f809621e8c hwmon: (lm95241) Convert to use devm_hwmon_device_register_with_groups
Simplify code, reduce code size, and attach hwmon attributes
to hwmon device.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-03-03 08:01:03 -08:00
Guenter Roeck 500a91571f hwmon: (max1668) Fix writing the minimum temperature
When trying to set the minimum temperature, the driver was erroneously
writing the maximum temperature into the chip.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Cc: stable@vger.kernel.org # v3.2+
Reviewed-by: Jean Delvare <jdelvare@suse.de>
2014-02-18 15:53:49 -08:00
Doug Anderson d3d89c468c hwmon: (ntc_thermistor) Avoid math overflow
The ntc thermistor code was doing math whose temporary result might
have overflowed 32-bits.  We need some casts in there to make it safe.

In one example I found:
- pullup_uV: 1800000
- result of iio_read_channel_raw: 3226
- 1800000 * 3226 => 0x15a1cbc80

Signed-off-by: Doug Anderson <dianders@chromium.org>
Cc: stable@vger.kernel.org # 3.10+
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-02-13 19:43:52 -08:00
Adam Thomson 4f545a4ba1 hwmon: (da9055) Remove use of regmap_irq_get_virq()
Remove use of regmap_irq_get_virq() in driver probe which was
conflicting with use of platform_get_irq_byname().
platform_get_irq_byname() already returns the VIRQ number due
to MFD core translation so using regmap_irq_get_virq() on that
returned value results in an incorrect IRQ being requested.
The driver probes then fail because of this.

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-02-06 17:22:33 -08:00
Guenter Roeck daa436e67c hwmon: (pmbus) Support per-page exponent in linear mode
Some chips use different exponents for sensors on different pages
or rails. Detect and store exponent per page to support this situation.

This fixes a problem with wrong voltages seen on UCD90120.

Reported-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Tested-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-02-02 21:21:40 -08:00
Jean Delvare 632007e201 hwmon: Fix SENSORS_TMP102 dependencies to eliminate build errors
Similar to what was done for the lm75 driver.

Add depends on THERMAL since that is what provides the
register/unregister functions above, but only if THERMAL_OF was
selected as this is an optional feature of the driver.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
2014-02-02 17:59:07 +01:00
Jean Delvare 920130a9de hwmon: Fix SENSORS_LM75 dependencies to eliminate build errors
Based on an earlier attempt by Randy Dunlap.

Fix SENSORS_LM75 dependencies to eliminate build errors:

drivers/built-in.o: In function `lm75_remove':
lm75.c:(.text+0x12bd8c): undefined reference to `thermal_zone_of_sensor_unregister'
drivers/built-in.o: In function `lm75_probe':
lm75.c:(.text+0x12c123): undefined reference to `thermal_zone_of_sensor_register'

Add depends on THERMAL since that is what provides the
register/unregister functions above, but only if THERMAL_OF was
selected as this is an optional feature of the driver.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
2014-02-02 17:59:07 +01:00
Linus Torvalds 9076e0cae7 Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
Pull hwmon updates from Jean Delvare:
 "This include it87 driver improvements, and a tree-wide change of my
  e-mail address"

* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  Update Jean Delvare's e-mail address
  hwmon: (it87) Print proper names for the IT8771E and IT8772E
  hwmon: (it87) Add support for the ITE IT8603E
2014-01-29 18:56:27 -08:00
Jean Delvare 7c81c60f37 Update Jean Delvare's e-mail address
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2014-01-29 20:40:08 +01:00
Jean Delvare b523bb7509 hwmon: (it87) Print proper names for the IT8771E and IT8772E
The driver prints IT8771F and IT8772F instead of IT8771E and IT8772E
respectively when the driver is loaded. This is a cosmetic only bug
but let's fix it.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2014-01-29 20:40:08 +01:00
Rudolf Marek c145d5c628 hwmon: (it87) Add support for the ITE IT8603E
Add support for IT8603E.

This closes bug #57861:
https://bugzilla.kernel.org/show_bug.cgi?id=57861

[JD: Fixes and clean-ups.]

Signed-off-by: Rudolf Marek <r.marek@assembler.cz>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2014-01-29 20:40:08 +01:00
Linus Torvalds 91466574be Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal management updates from Zhang Rui:
 "This time, the biggest change is the work of representing hardware
  thermal properties in device tree infrastructure.

  This work includes the introduction of a device tree bindings for
  describing the hardware thermal behavior and limits, and also a parser
  to read and interpret the data, and build thermal zones and thermal
  binding parameters.  It also contains three examples on how to use the
  new representation on sensor devices, using three different drivers to
  accomplish it.  One driver is in thermal subsystem, the TI SoC
  thermal, and the other two drivers are in hwmon subsystem.

  Actually, this would be the first step of the complete work because we
  still need to check other potential drivers to be converted and then
  validate the proposed API.  But the reason why I include it in this
  pull request is that, first, this change does not hurt any others
  without using this approach, second, the principle and concept of this
  change would not break after converting the remaining drivers.  BTW,
  as you can see, there are several points in this change that do not
  belong to thermal subsystem.  Because it has been suggested by Guenter
  R that in such cases, it is recommended to send the complete series
  via one single subsystem.

  Specifics:

   - representing hardware thermal properties in device tree
     infrastructure

   - fix a regression that the imx thermal driver breaks system suspend.

   - introduce ACPI INT3403 thermal driver to retrieve temperature data
     from the INT3403 ACPI device object present on some systems.

   - introduce debug statement for thermal core and step_wise governor.

   - assorted fixes and cleanups for thermal core, cpu cooling, exynos
     thrmal, intel powerclamp and imx thermal driver"

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (34 commits)
  thermal: remove const flag from .ops of imx thermal
  Thermal: update thermal zone device after setting emul_temp
  intel_powerclamp: Fix cstate counter detection.
  thermal: imx: add necessary clk operation
  Thermal cpu cooling: return error if no valid cpu frequency entry
  thermal: fix cpu_cooling max_level behavior
  thermal: rcar-thermal: Enable driver compilation with COMPILE_TEST
  thermal: debug: add debug statement for core and step_wise
  thermal: imx_thermal: add module device table
  drivers: thermal: Mark function as static in x86_pkg_temp_thermal.c
  thermal:samsung: fix compilation warning
  thermal: imx: correct suspend/resume flow
  thermal: exynos: fix error return code
  Thermal: ACPI INT3403 thermal driver
  MAINTAINERS: add thermal bindings entry in thermal domain
  arm: dts: make OMAP4460 bandgap node to belong to OCP
  arm: dts: make OMAP443x bandgap node to belong to OCP
  arm: dts: add cooling properties on omap5 cpu node
  arm: dts: add omap5 thermal data
  arm: dts: add omap5 CORE thermal data
  ...
2014-01-24 17:13:49 -08:00
Linus Torvalds 09da8dfa98 ACPI and power management updates for 3.14-rc1
- ACPI core changes to make it create a struct acpi_device object for every
    device represented in the ACPI tables during all namespace scans regardless
    of the current status of that device.  In accordance with this, ACPI hotplug
    operations will not delete those objects, unless the underlying ACPI tables
    go away.
 
  - On top of the above, new sysfs attribute for ACPI device objects allowing
    user space to check device status by triggering the execution of _STA for
    its ACPI object.  From Srinivas Pandruvada.
 
  - ACPI core hotplug changes reducing code duplication, integrating the
    PCI root hotplug with the core and reworking container hotplug.
 
  - ACPI core simplifications making it use ACPI_COMPANION() in the code
    "glueing" ACPI device objects to "physical" devices.
 
  - ACPICA update to upstream version 20131218.  This adds support for the
    DBG2 and PCCT tables to ACPICA, fixes some bugs and improves debug
    facilities.  From Bob Moore, Lv Zheng and Betty Dall.
 
  - Init code change to carry out the early ACPI initialization earlier.
    That should allow us to use ACPI during the timekeeping initialization
    and possibly to simplify the EFI initialization too.  From Chun-Yi Lee.
 
  - Clenups of the inclusions of ACPI headers in many places all over from
    Lv Zheng and Rashika Kheria (work in progress).
 
  - New helper for ACPI _DSM execution and rework of the code in drivers
    that uses _DSM to execute it via the new helper.  From Jiang Liu.
 
  - New Win8 OSI blacklist entries from Takashi Iwai.
 
  - Assorted ACPI fixes and cleanups from Al Stone, Emil Goode, Hanjun Guo,
    Lan Tianyu, Masanari Iida, Oliver Neukum, Prarit Bhargava, Rashika Kheria,
    Tang Chen, Zhang Rui.
 
  - intel_pstate driver updates, including proper Baytrail support, from
    Dirk Brandewie and intel_pstate documentation from Ramkumar Ramachandra.
 
  - Generic CPU boost ("turbo") support for cpufreq from Lukasz Majewski.
 
  - powernow-k6 cpufreq driver fixes from Mikulas Patocka.
 
  - cpufreq core fixes and cleanups from Viresh Kumar, Jane Li, Mark Brown.
 
  - Assorted cpufreq drivers fixes and cleanups from Anson Huang, John Tobias,
    Paul Bolle, Paul Walmsley, Sachin Kamat, Shawn Guo, Viresh Kumar.
 
  - cpuidle cleanups from Bartlomiej Zolnierkiewicz.
 
  - Support for hibernation APM events from Bin Shi.
 
  - Hibernation fix to avoid bringing up nonboot CPUs with ACPI EC disabled
    during thaw transitions from Bjørn Mork.
 
  - PM core fixes and cleanups from Ben Dooks, Leonardo Potenza, Ulf Hansson.
 
  - PNP subsystem fixes and cleanups from Dmitry Torokhov, Levente Kurusa,
    Rashika Kheria.
 
  - New tool for profiling system suspend from Todd E Brandt and a cpupower
    tool cleanup from One Thousand Gnomes.
 
 /
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABCAAGBQJS3a1eAAoJEILEb/54YlRxnTgP/iGawvgjKWm6Qqp7WSIvd5gQ
 zZ6q75C6Pc/W2fq1+OzVGnpCF8WYFy+nFDAXOvUHjIXuoxSwFcuW5l4aMckgl/0a
 TXEWe9MJrCHHRfDApfFacCJ44U02bjJAD5vTyL/hKA+IHeinq4WCSojryYC+8jU0
 cBrUIV0aNH8r5JR2WJNAyv/U29rXsDUOu0I4qTqZ4YaZT6AignMjtLXn1e9AH1Pn
 DPZphTIo/HMnb+kgBOjt4snMk+ahVO9eCOxh/hH8ecnWExw9WynXoU5Nsna0tSZs
 ssyHC7BYexD3oYsG8D52cFUpp4FCsJ0nFQNa2kw0LY+0FBNay43LySisKYHZPXEs
 2WpESDv+/t7yhtnrvM+TtA7aBheKm2XMWGFSu/aERLE17jIidOkXKH5Y7ryYLNf/
 uyRKxNS0NcZWZ0G+/wuY02jQYNkfYz3k/nTr8BAUItRBjdporGIRNEnR9gPzgCUC
 uQhjXWMPulqubr8xbyefPWHTEzU2nvbXwTUWGjrBxSy8zkyy5arfqizUj+VG6afT
 NsboANoMHa9b+xdzigSFdA3nbVK6xBjtU6Ywntk9TIpODKF5NgfARx0H+oSH+Zrj
 32bMzgZtHw/lAbYsnQ9OnTY6AEWQYt6NMuVbTiLXrMHhM3nWwfg/XoN4nZqs6jPo
 IYvE6WhQZU6L6fptGHFC
 =dRf6
 -----END PGP SIGNATURE-----

Merge tag 'pm+acpi-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI and power management updates from Rafael Wysocki:
 "As far as the number of commits goes, the top spot belongs to ACPI
  this time with cpufreq in the second position and a handful of PM
  core, PNP and cpuidle updates.  They are fixes and cleanups mostly, as
  usual, with a couple of new features in the mix.

  The most visible change is probably that we will create struct
  acpi_device objects (visible in sysfs) for all devices represented in
  the ACPI tables regardless of their status and there will be a new
  sysfs attribute under those objects allowing user space to check that
  status via _STA.

  Consequently, ACPI device eject or generally hot-removal will not
  delete those objects, unless the table containing the corresponding
  namespace nodes is unloaded, which is extremely rare.  Also ACPI
  container hotplug will be handled quite a bit differently and cpufreq
  will support CPU boost ("turbo") generically and not only in the
  acpi-cpufreq driver.

  Specifics:

   - ACPI core changes to make it create a struct acpi_device object for
     every device represented in the ACPI tables during all namespace
     scans regardless of the current status of that device.  In
     accordance with this, ACPI hotplug operations will not delete those
     objects, unless the underlying ACPI tables go away.

   - On top of the above, new sysfs attribute for ACPI device objects
     allowing user space to check device status by triggering the
     execution of _STA for its ACPI object.  From Srinivas Pandruvada.

   - ACPI core hotplug changes reducing code duplication, integrating
     the PCI root hotplug with the core and reworking container hotplug.

   - ACPI core simplifications making it use ACPI_COMPANION() in the
     code "glueing" ACPI device objects to "physical" devices.

   - ACPICA update to upstream version 20131218.  This adds support for
     the DBG2 and PCCT tables to ACPICA, fixes some bugs and improves
     debug facilities.  From Bob Moore, Lv Zheng and Betty Dall.

   - Init code change to carry out the early ACPI initialization
     earlier.  That should allow us to use ACPI during the timekeeping
     initialization and possibly to simplify the EFI initialization too.
     From Chun-Yi Lee.

   - Clenups of the inclusions of ACPI headers in many places all over
     from Lv Zheng and Rashika Kheria (work in progress).

   - New helper for ACPI _DSM execution and rework of the code in
     drivers that uses _DSM to execute it via the new helper.  From
     Jiang Liu.

   - New Win8 OSI blacklist entries from Takashi Iwai.

   - Assorted ACPI fixes and cleanups from Al Stone, Emil Goode, Hanjun
     Guo, Lan Tianyu, Masanari Iida, Oliver Neukum, Prarit Bhargava,
     Rashika Kheria, Tang Chen, Zhang Rui.

   - intel_pstate driver updates, including proper Baytrail support,
     from Dirk Brandewie and intel_pstate documentation from Ramkumar
     Ramachandra.

   - Generic CPU boost ("turbo") support for cpufreq from Lukasz
     Majewski.

   - powernow-k6 cpufreq driver fixes from Mikulas Patocka.

   - cpufreq core fixes and cleanups from Viresh Kumar, Jane Li, Mark
     Brown.

   - Assorted cpufreq drivers fixes and cleanups from Anson Huang, John
     Tobias, Paul Bolle, Paul Walmsley, Sachin Kamat, Shawn Guo, Viresh
     Kumar.

   - cpuidle cleanups from Bartlomiej Zolnierkiewicz.

   - Support for hibernation APM events from Bin Shi.

   - Hibernation fix to avoid bringing up nonboot CPUs with ACPI EC
     disabled during thaw transitions from Bjørn Mork.

   - PM core fixes and cleanups from Ben Dooks, Leonardo Potenza, Ulf
     Hansson.

   - PNP subsystem fixes and cleanups from Dmitry Torokhov, Levente
     Kurusa, Rashika Kheria.

   - New tool for profiling system suspend from Todd E Brandt and a
     cpupower tool cleanup from One Thousand Gnomes"

* tag 'pm+acpi-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (153 commits)
  thermal: exynos: boost: Automatic enable/disable of BOOST feature (at Exynos4412)
  cpufreq: exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ
  Documentation: cpufreq / boost: Update BOOST documentation
  cpufreq: exynos: Extend Exynos cpufreq driver to support boost
  cpufreq / boost: Kconfig: Support for software-managed BOOST
  acpi-cpufreq: Adjust the code to use the common boost attribute
  cpufreq: Add boost frequency support in core
  intel_pstate: Add trace point to report internal state.
  cpufreq: introduce cpufreq_generic_get() routine
  ARM: SA1100: Create dummy clk_get_rate() to avoid build failures
  cpufreq: stats: create sysfs entries when cpufreq_stats is a module
  cpufreq: stats: free table and remove sysfs entry in a single routine
  cpufreq: stats: remove hotplug notifiers
  cpufreq: stats: handle cpufreq_unregister_driver() and suspend/resume properly
  cpufreq: speedstep: remove unused speedstep_get_state
  platform: introduce OF style 'modalias' support for platform bus
  PM / tools: new tool for suspend/resume performance optimization
  ACPI: fix module autoloading for ACPI enumerated devices
  ACPI: add module autoloading support for ACPI enumerated devices
  ACPI: fix create_modalias() return value handling
  ...
2014-01-24 15:51:02 -08:00
Phil Pokorny d303b1b5fb hwmon: (k10temp) Add support for Kaveri CPUs
Add new PCI ID to support new model "Kaveri" family.

Signed-off-by: Philip Pokorny <ppokorny@penguincomputing.com>
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-01-14 21:36:54 -08:00
Guenter Roeck f5776cc3b5 hwmon: (nct6775) Re-enable logical device mapping for NCT6791 during resume
After a suspend/resume cycle, the NCT6791 is back to its original BIOS
programming. In this state, HWMON IO access may be locked.
Re-enable it during resume.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-01-14 21:36:53 -08:00
Guenter Roeck bf6ea084eb hwmon: (coretemp) Do not return -EAGAIN for low temperatures
Some Intel CPUs do not set the 'valid' bit in IA32_THERM_STATUS if the
temperature is too low to be measured. This condition will not change until
the CPU is hot enough for its temperature to be measured. Returning an error
in such conditions is not very useful. Drop checking the valid bit and just
return the reported temperature instead.

Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-01-14 21:36:52 -08:00
Anthony Olech c09088d934 hwmon: (da9052) Fix adc to voltage calculation
The ADC resolution of the PMIC is 10-bits, this means that the maximum
possible value is 1023 and not the 1024 as originally in the code.

Signed-off-by: Anthony Olech <anthony.olech.opensource@diasemi.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-01-14 21:36:31 -08:00
Guenter Roeck 9fb6c9c73b hwmon: (coretemp) Refine TjMax detection
Intel's turbostat code uses only 7 bits from MSR_IA32_TEMPERATURE_TARGET to
read TjMax, and also only accepts it if the reported temperature is at least
85 degrees C. Play safe and do the same.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-01-14 21:36:31 -08:00
Guenter Roeck 347c16cfde hwmon: (coretemp) Add PCI device ID for CE41x0 CPUs
Since we now have to use PCI IDs to detect CPU types anyway, use this mechanism
to detect CE41x0 CPUs. Advantage is that it only requires a single entry and
covers all variants of CE41x0, including those unknown to us.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-01-14 21:36:31 -08:00
Guenter Roeck 14513ee696 hwmon: (coretemp) Use PCI host bridge ID to identify CPU if necessary
Atom S12x0 CPUs are identified by the CPU host bridge ID. Add an override
table based on PCI IDs as well as code to detect it.

PCI access functions can now be called with PCI disabled, so unlike previous
attempts to use PCI IDs, the code no longer depends on it. If PCI is disabled,
the CPU will not be identified correctly. Since it is unlikely that anything
will work in this case, this is an acceptable limitation.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-01-14 21:36:30 -08:00
Jingoo Han cd9bb0564c hwmon: remove DEFINE_PCI_DEVICE_TABLE macro
Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro
is not preferred.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-01-14 21:36:30 -08:00
Jean Delvare 3f9aec7610 hwmon: (coretemp) Fix truncated name of alarm attributes
When the core number exceeds 9, the size of the buffer storing the
alarm attribute name is insufficient and the attribute name is
truncated. This causes libsensors to skip these attributes as the
truncated name is not recognized.

Reported-by: Andreas Hollmann <hollmann@in.tum.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-01-14 09:47:52 -08:00
Rafael J. Wysocki 98feb7cc61 Merge branch 'acpi-cleanup'
* acpi-cleanup: (22 commits)
  ACPI / tables: Return proper error codes from acpi_table_parse() and fix comment.
  ACPI / tables: Check if id is NULL in acpi_table_parse()
  ACPI / proc: Include appropriate header file in proc.c
  ACPI / EC: Remove unused functions and add prototype declaration in internal.h
  ACPI / dock: Include appropriate header file in dock.c
  ACPI / PCI: Include appropriate header file in pci_link.c
  ACPI / PCI: Include appropriate header file in pci_slot.c
  ACPI / EC: Mark the function acpi_ec_add_debugfs() as static in ec_sys.c
  ACPI / NVS: Include appropriate header file in nvs.c
  ACPI / OSL: Mark the function acpi_table_checksum() as static
  ACPI / processor: initialize a variable to silence compiler warning
  ACPI / processor: use ACPI_COMPANION() to get ACPI device
  ACPI: correct minor typos
  ACPI / sleep: Drop redundant acpi_disabled check
  ACPI / dock: Drop redundant acpi_disabled check
  ACPI / table: Replace '1' with specific error return values
  ACPI: remove trailing whitespace
  ACPI / IBFT: Fix incorrect <acpi/acpi.h> inclusion in iSCSI boot firmware module
  ACPI / i915: Fix incorrect <acpi/acpi.h> inclusions via <linux/acpi_io.h>
  SFI / ACPI: Fix warnings reported during builds with W=1
  ...

Conflicts:
	drivers/acpi/nvs.c
	drivers/hwmon/asus_atk0110.c
2014-01-12 23:44:09 +01:00
Linus Torvalds 86b581f6f1 hwmon fixes for 3.13-rc4
Fix HIH-6130 driver to work with BeagleBone
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJSqd02AAoJEMsfJm/On5mBrwoP/05UBS1HCf/yyX3FbnIOsjA6
 oMOH3SkuzVWFQmndqANZS/oxwwnO3WZ4ML25b0GEYjJeCqf/JpVLyalRMjWV1Xxz
 DqVRmd9yO9rrOuQ9CuSJqAqXzGnXNip16VIetArarcMtZrEUkkMqpY7ax8tGKr24
 Q0zIWpG8XO7hykeOetUuwOk9bKD+iFX04ttQFWmv8Mlv/FR//khMRMnMyP0kOP3D
 ZLtMoMi1vdsxMP5PZzgoijH5CgAgb2Eh+jilP2rLOh5R/IrZOyheGBtOYay5Rmg/
 e7JL3ODHNPnBsIAT27Fk98PLHBAIrCELg0N5k1OvvrmjhSL4GZCVlwyOUn0AngIG
 GQUWwvI7tdQgV3mftuIz3ueoHTEL+0Y9BISF9FX6DrXgq94Xrl3YnNzsTAvHQtun
 yoB8W780j7cRIvEpi5jNjhESR9J13fSDbawAMFTUWsbZLN7lwp1KlUV5OryysizR
 KIkoC9RGWbfl4tk5neD0bM9O3gpE7sctbRLPZkVahr1cslaXr0oP3zOQ1kAByWaI
 4Li/JklmanERz+meP1DDdJ1VOlfM/GpiGNx0j0RNX4MlDWaX8s24fYEIs//R0j0H
 QQ38YoO7OwVyscCn5HkAMTU3gn3evA4YAOgwAyyXUFMIwAQiMNTOJmsd6EAsKWpJ
 jKnT7vIlfELjop48xwXu
 =B6Bw
 -----END PGP SIGNATURE-----

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

Pull hwmon fix from Guenter Roeck:
 "Fix HIH-6130 driver to work with BeagleBone"

* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: HIH-6130: Support I2C bus drivers without I2C_FUNC_SMBUS_QUICK
2013-12-12 11:05:19 -08:00
Dan Carpenter 3806b45ba4 hwmon: Prevent some divide by zeros in FAN_TO_REG()
The "rpm * div" operations can overflow here, so this patch adds an
upper limit to rpm to prevent that.  Jean Delvare helped me with this
patch.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Roger Lucas <vt8231@hiddenengine.co.uk>
Cc: stable@vger.kernel.org
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2013-12-12 08:05:33 +01:00
Jean Delvare 33a7ab91d5 hwmon: (w83l768ng) Fix fan speed control range
The W83L786NG stores the fan speed on 4 bits while the sysfs interface
uses a 0-255 range. Thus the driver should scale the user input down
to map it to the device range, and scale up the value read from the
device before presenting it to the user. The reserved register nibble
should be left unchanged.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: stable@vger.kernel.org
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
2013-12-12 08:05:32 +01:00
Brian Carnes cf7559bc05 hwmon: (w83l786ng) Fix fan speed control mode setting and reporting
The wrong mask is used, which causes some fan speed control modes
(pwmX_enable) to be incorrectly reported, and some modes to be
impossible to set.

[JD: add subject and description.]

Signed-off-by: Brian Carnes <bmcarnes@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2013-12-12 08:05:32 +01:00
Guenter Roeck 3d489ac07e hwmon: (lm90) Unregister hwmon device if interrupt setup fails
Commit 109b1283fb (hwmon: (lm90) Add support to handle IRQ) introduced
interrupt support. Its error handling code fails to unregister the already
registered hwmon device.

Fixes: 109b1283fb
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2013-12-12 08:05:32 +01:00
José Miguel Gonçalves efabcc2123 hwmon: HIH-6130: Support I2C bus drivers without I2C_FUNC_SMBUS_QUICK
Some I2C bus drivers do not allow zero-length data transfers which are
required to start a measurement with the HIH6130/1 sensor. Nevertheless,
we can overcome this limitation by writing a zero dummy byte. This byte
is ignored by the sensor and was verified to be working with the OMAP
I2C bus driver in a BeagleBone board.

Signed-off-by: José Miguel Gonçalves <jose.goncalves@inov.pt>
[Guenter Roeck: Simplified complexity of write_length initialization]
Cc: stable@vger.kernel.org # v3.10+
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-12-11 13:37:30 -08:00
Lv Zheng 8b48463f89 ACPI: Clean up inclusions of ACPI header files
Replace direct inclusions of <acpi/acpi.h>, <acpi/acpi_bus.h> and
<acpi/acpi_drivers.h>, which are incorrect, with <linux/acpi.h>
inclusions and remove some inclusions of those files that aren't
necessary.

First of all, <acpi/acpi.h>, <acpi/acpi_bus.h> and <acpi/acpi_drivers.h>
should not be included directly from any files that are built for
CONFIG_ACPI unset, because that generally leads to build warnings about
undefined symbols in !CONFIG_ACPI builds.  For CONFIG_ACPI set,
<linux/acpi.h> includes those files and for CONFIG_ACPI unset it
provides stub ACPI symbols to be used in that case.

Second, there are ordering dependencies between those files that always
have to be met.  Namely, it is required that <acpi/acpi_bus.h> be included
prior to <acpi/acpi_drivers.h> so that the acpi_pci_root declarations the
latter depends on are always there.  And <acpi/acpi.h> which provides
basic ACPICA type declarations should always be included prior to any other
ACPI headers in CONFIG_ACPI builds.  That also is taken care of including
<linux/acpi.h> as appropriate.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com> (drivers/pci stuff)
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> (Xen stuff)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-12-07 01:03:14 +01:00
Eduardo Valentin 6a027523f3 hwmon: tmp102: expose to thermal fw via DT nodes
This patch adds to tmp102 temperature sensor the possibility
to expose itself as thermal zone device, registered on the
thermal framework.

The thermal zone is built only if a device tree node
describing a thermal zone for this sensor is present
inside the tmp102 DT node. Otherwise, the driver behavior
will be the same.

Note: This patch has also been reviewed by Jean D. He has
requested to perform a wider inspection of possible
users of thermal and hwmon interaction API. On the other
hand, the change on this patch is acceptable on first
step of overall code change.

Cc: Jean Delvare <khali@linux-fr.org>
Cc: lm-sensors@lm-sensors.org
Cc: linux-kernel@vger.kernel.org
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
2013-12-04 09:34:25 -04:00
Eduardo Valentin 22e731838b hwmon: lm75: expose to thermal fw via DT nodes
This patch adds to lm75 temperature sensor the possibility
to expose itself as thermal zone device, registered on the
thermal framework.

The thermal zone is built only if a device tree node
describing a thermal zone for this sensor is present
inside the lm75 DT node. Otherwise, the driver behavior
will be the same.

Note: This patch has also been reviewed by Jean D. He has
requested to perform a wider inspection of possible
users of thermal and hwmon interaction API. On the other
hand, the change on this patch is acceptable on first
step of overall code change.

Cc: Jean Delvare <khali@linux-fr.org>
Cc: lm-sensors@lm-sensors.org
Cc: linux-kernel@vger.kernel.org
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
2013-12-04 09:34:24 -04:00
Rafael J. Wysocki 2d304ba757 Merge branch 'acpica'
* acpica:
  ACPI: Clean up incorrect inclusions of ACPICA headers
  ACPICA: Update version to 20131115.
  ACPICA: Add support to delete all objects attached to the root namespace node.
  ACPICA: Delete all attached data objects during namespace node deletion.
  ACPICA: Resources: Fix loop termination for the get AML length function.
  ACPICA: Tests: Add CHECKSUM_ABORT protection for test utilities.
  ACPICA: Debug output: Do not emit function nesting level for kernel build.
2013-11-27 01:03:27 +01:00
Lv Zheng 91be099857 ACPI: Clean up incorrect inclusions of ACPICA headers
Header file <acpi/acpi.h> contains environemnt settings and architecture
specific implementation that should be included before any other ACPICA
headers in order to keep a consistent build environment for ACPICA users.
The following internal ACPICA header files should be included from
<acpi/acpi.h> and should not be included by other kernel files:
  <acpi/acpiosxf.h>
  <acpi/acpixf.h>

Clean up incorrect inclusions of these files from non-ACPICA source
files.

[rjw: Subject and changelog]
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-11-26 00:27:10 +01:00
Yijing Wang 3a4cbc1906 hwmon: (acpi_power_meter) Fix acpi_bus_get_device() return value check
Since acpi_bus_get_device() returns plain int and not acpi_status,
ACPI_FAILURE() should not be used for checking its return value.  Fix
that.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-11-20 08:31:01 -08:00
Guenter Roeck cc76dee17f hwmon: (nct6775) NCT6791 supports weight control only for CPUFAN
Unlike other chips supported by this driver, the NCT6791 only has a single
set of registers to configure weighted fan control. Enable it only for the
single channel supporting it.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-11-18 14:08:05 -08:00
Guenter Roeck d1a284b7ed hwmon: (nct6775) Monitor additional temperature registers
The number of SMIOVT registers on NCT6779 and NCT6791 is limited to 2.
As result, the driver may not report some of the temperatures used
for fan control. This can result in some of the pwmX_temp_sel or
pwm2_weight_temp_sel attributes to wrongly return 0.
Fortunately, the chip has registers to monitor those temperatures.
Add them to the list of temperatures to report.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-11-18 14:08:05 -08:00
Arnaud Ebalard c98d6c65e6 hwmon: (lm75) Add support for GMT G751 chip
This was tested on a NETGEAR ReadyNAS 2120 device (Marvell Armada XP
based board, via DT).

Signed-off-by: Arnaud Ebalard <arno@natisbad.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-11-18 14:08:05 -08:00
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
Guenter Roeck 19f053c840 hwmon: (acpi_power_meter) Use return value from acpi_bus_register_driver
acpi_bus_register_driver() returns a valid error code. Use it.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-13 16:16:26 -07:00
Guenter Roeck 83c97fe13e hwmon: (acpi_power_meter) Don't crash the kernel unnecessarily
acpi_power_meter crashes the kernel if it detects an unexpected event
or 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().

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-13 16:16:26 -07:00
Guenter Roeck c52ae3d279 hwmon: (gpio_fan) Use error value returned from get_fan_speed_index()
get_fan_speed_index() returns -EINVAL in case of errors, only to have it
ignored and replaced with -ENODEV. Make it return -ENODEV and use it.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-13 16:16:26 -07:00
Guenter Roeck bb34c0da64 hwmon: (adt7462) Use error value returned from find_trange_value()
find_trange_value() returns -ENODEV in case of errors, only to have it
ignored and replaced with -EINVAL. Make it return -EINVAL and use it.

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
Guenter Roeck af78fdf4a6 hwmon: (pmbus) Don't unnecessarily crash the kernel
pmbus code currently crashes the kernel if it detects an internal
implementation error. While the detected condition suggests that there
is a bug in the code, it is hardly fatal. Therefore, it should not
trigger a crash. Replace BUG() with WARN().

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-13 16:16:26 -07:00
Guenter Roeck ae02e7418f hwmon: (mc13783-adc) Increase size of name string
smatch complains about

mc13783_adc_probe() error: snprintf() chops off the last chars of
'id->name': 20 +vs 10

Use PLATFORM_NAME_SIZE instead of '10' as size when declaring
the name variable.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-13 16:16:26 -07:00
Guenter Roeck 45a5b3a183 hwmon: (nct6775) Check array index when accessing temp_offset
smatch complains about a potential out-of-bounds access to the
temp_offset array. That doesn't happen in practice, but it doesn't
hurt to add an explicit check either. This prevents potential problems
in the future (for example if the number of 'fixed' temperature
sensors is increased to add support for another chip).

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-13 16:16:25 -07:00
Guenter Roeck e8ab508c27 hwmon: (nct6775) Use return value from find_temp_source
smatch complains that we don't use the return value from find_temp_source().
Valid point, only find_temp_source() doesn't return a valid error code.
Have it return a valid error code and use it.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-13 16:16:25 -07:00
Guenter Roeck a039371353 hwmon: Remove unnecessary semicolons
Semicolons after closing } of conditional blocks are not needed
and can be removed.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
2013-10-13 16:16:25 -07:00
Henrik Rydberg 25f2bd7f5a hwmon: (applesmc) Always read until end of data
The crash reported and investigated in commit 5f4513 turned out to be
caused by a change to the read interface on newer (2012) SMCs.

Tests by Chris show that simply reading the data valid line is enough
for the problem to go away. Additional tests show that the newer SMCs
no longer wait for the number of requested bytes, but start sending
data right away.  Apparently the number of bytes to read is no longer
specified as before, but instead found out by reading until end of
data. Failure to read until end of data confuses the state machine,
which eventually causes the crash.

As a remedy, assuming bit0 is the read valid line, make sure there is
nothing more to read before leaving the read function.

Tested to resolve the original problem, and runtested on MBA3,1,
MBP4,1, MBP8,2, MBP10,1, MBP10,2. The patch seems to have no effect on
machines before 2012.

Tested-by: Chris Murphy <chris@cmurf.com>
Cc: stable@vger.kernel.org
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-09 09:48:55 -07:00
Lars-Peter Clausen 600ba98bff hwmon: (adt7310) Use spi_w8r16be() instead spi_w8r16()
Using spi_w8r16be() instead of spi_w8r16() in this driver makes a code a bit
shorter and cleaner.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-03 13:52:15 +01:00
Henrik Rydberg 5f45138643 hwmon: (applesmc) Check key count before proceeding
After reports from Chris and Josh Boyer of a rare crash in applesmc,
Guenter pointed at the initialization problem fixed below. The patch
has not been verified to fix the crash, but should be applied
regardless.

Reported-by: <jwboyer@fedoraproject.org>
Suggested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-09-26 03:48:43 -07:00
Jingoo Han 0b77f766f3 hwmon: (k10temp) remove unnecessary pci_set_drvdata()
The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-09-12 08:17:40 -07:00
Sachin Kamat 010a166a52 hwmon: (tmp421) Fix return value
Propagate return value obtained from i2c_smbus_read_byte_data()
instead of hardcoding.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Andre Prendel <andre.prendel@gmx.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-09-11 13:01:41 -07:00
Sachin Kamat 17a52100b0 hwmon: (amc6821) Remove redundant break
'break' after return or goto has no effect. Remove it.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: T. Mertelj <tomaz.mertelj@guest.arnes.si>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-09-11 13:01:40 -07:00
Sachin Kamat 3499e5b2e1 hwmon: (amc6821) Fix return value
Propagate return value obtained from i2c_smbus_read_byte_data()
instead of hardcoding.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: T. Mertelj <tomaz.mertelj@guest.arnes.si>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-09-11 13:01:40 -07:00
Sachin Kamat 12ca0b569e hwmon: (ibmaem) Fix return value
Propagate appropriate error code obtained from ipmi_create_user()
instead of hardcoding.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Darrick J. Wong <darrick.wong@oracle.com>
Acked-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-09-11 13:01:32 -07:00
Sachin Kamat 1a3abbd0b9 hwmon: (emc2103) Fix return value
kstrtol() returns appropriate error values. Use those instead of
hardcoding. Silences several sparse messages of following type:
"why not propagate 'result' from kstrtol() instead of (-22)?"

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Steve Glendinning <steve.glendinning@shawell.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-09-11 13:01:31 -07:00
Jingoo Han 8876dd78d9 hwmon: (ina2xx) Remove casting the return value which is a void pointer
Casting the return value which is a void pointer is redundant.
The conversion from void pointer to any other pointer type is
guaranteed by the C programming language.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-09-10 06:28:31 -07:00
Guenter Roeck 98128de30f hwmon: (hwmon-vid) Add __maybe_unused attribute to dummy variable
This gets rid of this warning:

drivers/hwmon/hwmon-vid.c: In function 'get_via_model_d_vrm':
drivers/hwmon/hwmon-vid.c:249:27: warning: variable 'dummy' set but not used
[-Wunused-but-set-variable]

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
2013-09-10 06:28:17 -07:00
Linus Torvalds 7b4022fa17 Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
Pull hwmon fixes from Jean Delvare.

* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  hwmon: (emc6w201) Do not declare enum variable
  hwmon: (w83792d) Update module author
2013-09-07 10:54:19 -07:00
Guenter Roeck 94e44413cd hwmon: (emc6w201) Do not declare enum variable
Fix the following smatch warning:

emc6w201.c:52:26: warning: symbol 'subfeature' was not declared.
Should it be static?

'enum { } subtype' declares an enum as (global) variable which we don't want.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2013-09-06 14:05:43 +02:00
Shane Huang f85b520510 hwmon: (w83792d) Update module author
w83792d was written by me in 2004, I'd like to update my first name
into my current one to keep consistent, and delete invalid address.

Signed-off-by: Shane Huang <shane.huang@amd.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2013-09-06 14:05:42 +02:00
Linus Torvalds 7e75224188 New driver for HTU21D (humidity sensor)
Add support for Fam16h (Kabini) to k10temp
 Add support for NCT6102D/6106D and NCT6791D to nct6775 driver
 Add support for ADS1115 to ads1015 driver
 Add support for hibernate to w83627ehf and nct6775 drivers
 Some minor cleanups
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJSJQNWAAoJEMsfJm/On5mBNN0P/izDVmmq1Q/7+7chD/qAjxPJ
 KiJ9J9ITJF+dKrdgvmw3zJ1jRb1Mjf1yYoy9c5GAHrDM+mLt52HQY8HNSujz9cQ+
 bIZj+RLYGvf/5DBbuYle9vZtTQN63NEjHiJYLQdJpfpVCTOKLdTJQTP55mTjtQln
 TIbHVcVxUYfJHAPDCHuFAhRhSL9bhoXhJzmU1i8xrlNl6rqFsMkKXJSozrgAaQ7r
 6s9edBObQHQSqcH/S1bURVvyYa2fmqCh+o9ixMpYo0yYNr1/6oifn4z5FuPEEfro
 rP1MbRfGYQsSDTomaOHYgZEON46FFTFE8AT0+1XOEsdkpOTRX81qqKDqTt17EE4f
 rCTWuBoFmkUyek56Qmw/Zaza+RNoHi+evvGPER6xyBNSq9On8uK83stZIB7JOLPg
 u8BaeZNvhfY3THlcuWJ3FyGGfNFvtbE5UyLDFSaVwz933NVVUnIAoQ8iKbTwyIu8
 WdO+unklarKEjKJxArsygBS4vuNhRPOPyFuO03lRtObbCndjJUcgTCbiPsRdWQ2t
 DGJkFfQ4scJ/LmLtJIKsGaulUAVyWrwfL/ZSWL84dZtX14zb98V6DSicCNg4SWiK
 jtZwN9YccwsBXr0t3VDWDsUfKHHgR+baAbWpgxGismgLhACwmf7tzYnEaSeALGMV
 +t9tAn/uTq8UeQfC3fjV
 =isg0
 -----END PGP SIGNATURE-----

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

Pull hwmon updates from Guenter Roeck:
 - new driver for HTU21D (humidity sensor)
 - add support for Fam16h (Kabini) to k10temp
 - add support for NCT6102D/6106D and NCT6791D to nct6775 driver
 - add support for ADS1115 to ads1015 driver
 - add support for hibernate to w83627ehf and nct6775 drivers
 - some minor cleanups

* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (htu21) Add Measurement Specialties HTU21D support
  hwmon: Change my email address.
  hwmon: (k10temp) Add support for Fam16h (Kabini)
  hwmon: (adt7462) ADT7462_REG_VOLT_MAX() should return 0
  hwmon: (ads1015) Add support for ADS1115
  hwmon: (w83627ehf) Add support for hibernate
  hwmon: (nct6775) Add support for hibernate
  hwmon: use dev_get_platdata()
  hwmon: (nct6775) Fix size of data->temp array
  hwmon: (nct6775) Avoid using device platform data outside probe function
  hwmon: (nct6775) Add support for NCT6791D
  hwmon: (nct6775) Add support for beep attributes
  hwmon: (nct6775) Add support for critical low/high temperature limits on NCT6106
  hwmon: (nct6775) Add support for NCT6102D/6106D
  hwmon: (nct6775) Support two SuperIO chips in the same system
  hwmon: (nct6775) Allocate attributes dynamically from templates
  hwmon: (coretemp) Atom CPUs don't support TjMax; no warning needed
2013-09-03 10:43:35 -07:00
Mark Brown f27a5fb424 Merge remote-tracking branch 'regulator/topic/optional' into regulator-next 2013-09-01 13:50:17 +01:00
William Markezana f060c658b8 hwmon: (htu21) Add Measurement Specialties HTU21D support
Signed-off-by: William Markezana <william.markezana@meas-spec.com>
[Guenter Roeck - minor formatting changes]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-29 09:09:12 -07:00
Darrick J. Wong 5407e05135 hwmon: Change my email address.
I've changed employers, so change the email addresses to match.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-27 08:28:01 -07:00
Wei Hu 30b146d1cb hwmon: (k10temp) Add support for Fam16h (Kabini)
The temperature reporting interface stays the same, so we just
add the PCI-ID to the list.

Verified on AMD Olive Hill.

Signed-off-by: Wei Hu <wei@aristanetworks.com>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Cc: stable@vger.kernel.org # 3.10+
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-27 08:28:01 -07:00
Dan Carpenter a4bf06d58f hwmon: (adt7462) ADT7462_REG_VOLT_MAX() should return 0
The callers never check for negative but they sometimes check for zero
returns:

	int reg = ADT7462_REG_VOLT_MAX(data, i);
        data->volt_max[i] =
		(reg ? i2c_smbus_read_byte_data(client, reg) : 0);

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-27 08:28:01 -07:00
Mark Brown 9e059bacec hwmon: (sht15) Use devm_regulator_get_optional()
Since the sht15 driver supports operation without an external vref
regulator the driver should use the new devm_regulator_get_optional() to
indicate that a stub regulator should not be provided.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Guenter Roeck <linux@roeck-us.net>
2013-08-19 10:47:15 +01:00
Evgeniy Dushistov 60c1f31fc5 hwmon: (ads1015) Add support for ADS1115
This patch adds support for ads1115 device to ads1015 driver.
Based on work of Emiliano Carnati <carnatiatebneuro.com>.
Tested on ARM CPU based board.

Signed-off-by: Evgeniy A. Dushistov <dushistov@mail.ru>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:40 -07:00
Harald Judt e3b20b3f58 hwmon: (w83627ehf) Add support for hibernate
Hibernation uses its own set of callback functions, even if the code
is the same as the code used for suspend/restore.

Signed-off-by: Harald Judt <h.judt@gmx.at>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:40 -07:00
Harald Judt 374d1f9835 hwmon: (nct6775) Add support for hibernate
Hibernation uses its own set of callback functions, even if the code
is the same as the code used for suspend/restore.

Signed-off-by: Harald Judt <h.judt@gmx.at>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:39 -07:00
Jingoo Han a8b3a3a53f hwmon: use dev_get_platdata()
Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:39 -07:00
Dan Carpenter f58876ac8c hwmon: (nct6775) Fix size of data->temp array
Smatch complains that we have a array overflow:

	drivers/hwmon/nct6775.c:1456 nct6775_update_device()
		error: buffer overflow 'data->temp' 4 <= 4

Guenter Roeck says that the array should have been made larger in
7cbbd6aee6 (Add support for critical low/high temperature limits on
NCT6106).  This patch does that.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:39 -07:00
Guenter Roeck df612d5fb7 hwmon: (nct6775) Avoid using device platform data outside probe function
Plan going forward is to attach all device attributes to the hwmon device and no
longer to the platform device. With that change, accessing platform data outside
the probe function will be more difficult. To avoid the problem, change code
to no longer rely on it.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:39 -07:00
David Bartley 578ab5f0e4 hwmon: (nct6775) Add support for NCT6791D
Signed-off-by: David Bartley <andareed@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:39 -07:00
Guenter Roeck 3084699304 hwmon: (nct6775) Add support for beep attributes
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:39 -07:00
Guenter Roeck b7a6135348 hwmon: (nct6775) Add support for critical low/high temperature limits on NCT6106
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:39 -07:00
Guenter Roeck 6c009501ff hwmon: (nct6775) Add support for NCT6102D/6106D
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:39 -07:00
Guenter Roeck 698a7c24a5 hwmon: (nct6775) Support two SuperIO chips in the same system
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:39 -07:00
Guenter Roeck f73cf632df hwmon: (nct6775) Allocate attributes dynamically from templates
Static attribute allocation is large and very repetitive.
Allocate attributes and attribute groups dynamically instead.
This reduces the size of the driver source by more than 600 lines,
and object size by more than 20k (more than 30%).

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:38 -07:00
Guenter Roeck 1c2faa2247 hwmon: (coretemp) Atom CPUs don't support TjMax; no warning needed
Display warning "Unable to read TjMax from CPU x" only if the CPU
is supposed to support it. This is not the case for the various Atom CPUs.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11 22:10:38 -07:00
Curt Brune 93d783bcca hwmon: (adt7470) Fix incorrect return code check
In adt7470_write_word_data(), which writes two bytes using
i2c_smbus_write_byte_data(), the return codes are incorrectly AND-ed
together when they should be OR-ed together.

The return code of i2c_smbus_write_byte_data() is zero for success.

The upshot is only the first byte was ever written to the hardware.
The 2nd byte was never written out.

I noticed that trying to set the fan speed limits was not working
correctly on my system.  Setting the fan speed limits is the only
code that uses adt7470_write_word_data().  After making the change
the limit settings work and the alarms work also.

Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-08 12:43:07 -07:00
Vivien Didelot 5c52add197 hwmon: (max6697) fix MAX6581 ideality
Without this patch, the values for ideality (register 0x4b) and ideality
selection mask (register 0x4c) are inverted.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Cc: stable@vger.kernel.org # 3.9+
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-03 07:04:50 -07:00
Linus Torvalds 5d88d15e93 Single patch to staticize a local variable
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJR5AarAAoJEMsfJm/On5mB8HoP/32EnbohT1wrfzYRCj/hbclM
 65V/5m547LBp/PjRwGV8sSHTp5wpXguEoAmSHjVCRg7BXErxDlFtSkUBEvRYP9vl
 v8A3cFkJa36m/VESAo/Fa/LP7dk/nGhTM6fKx2ReMbO/ZzcpKURBsBo5apsmXH5H
 0EIwvmD6XXPkUG4VPWJIFgQLKxHRvAag7Bb4qe60BgqSlRNzpyegltzNgb8qkDbE
 S+Ui2I8T7clHw/h3348pYFKuDP8pHzFr5bXCkjsFxaennXwkT7qcVAN43dbCVZym
 /7hmxTK8PFkU379pRieXwq2yLGPZEHGD9x6LxIouPfT8OyaiOaJDIHY8ggitNWA8
 jF4u+BC7KfbLp8+15iRCOIE7xpEOqRWKDfmIGVQesCk8LoDVrVkITlCf4U5imwQ+
 qsxuVg7khDXUA6x0qoWY1Z+sB7iGBAcKHosSwfzw4VKZPAzuK0PpZ0zbwMY/JBas
 kL4xep+uFtNiu3bufVr7Cn8WVk5LKi3no1slAspEhRilc52k00Ct8w17iGFvByJP
 zcYZZE8E4dRyhnbE8YqEeuXIL3Q+1AQ8slfL87lUCTkoU0fRVh/ZWcPabdnJVwgH
 t/3C6sHD6QxF/t2ijsMSGRsiL97cwcRcp9j2PvLn86lDGKaxQqiWyBld5Z8c/0JW
 xTiFlHZHqLFWn2rq5Dv0
 =xfk+
 -----END PGP SIGNATURE-----

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

Pull hwmon fix from Guenter Roeck:
 "Single patch to staticize a local variable"

* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (abx500) Staticize abx500_temp_attributes
2013-07-18 11:32:36 -07:00
Paul Gortmaker d23e2ae1aa hwmon: delete __cpuinit usage from all hwmon files
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications.  For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.

After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out.  Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.

This removes all the drivers/hwmon uses of the __cpuinit macros
from all C files.

[1] https://lkml.org/lkml/2013/5/20/589

Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: lm-sensors@lm-sensors.org
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2013-07-14 19:36:57 -04:00
Sachin Kamat 0b905d83c4 hwmon: (abx500) Staticize abx500_temp_attributes
abx500_temp_attributes is used only in this file. Make it static.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-07-14 16:24:25 -07:00
Jean Delvare 5b0620df9c hwmon: (lm63) Drop redundant safety on cache lifetime
time_after (as opposed to time_after_equal) already ensures that the
cache lifetime is at least as much as requested. There is no point in
manually adding another jiffy to that value, and this can confuse the
reader into wrong interpretation.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Imre Deak <imre.deak@intel.com>
2013-07-08 14:18:24 +02:00
Jean Delvare 78c2c2fe59 hwmon: (lm90) Drop redundant safety on cache lifetime
time_after (as opposed to time_after_equal) already ensures that the
cache lifetime is at least as much as requested. There is no point in
manually adding another jiffy to that value, and this can confuse the
reader into wrong interpretation.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Imre Deak <imre.deak@intel.com>
2013-07-08 14:18:24 +02:00
Linus Torvalds ddcf6600b1 New driver to support GMT G762/G763 pwm fan controllers
Add support for DS1631, DS1721, and DS1731 to ds1621 driver
 Remove detect function from ds1621 driver as unreliable
 Bug fixes in nct6775, iio_hwmon, and adm1021 drivers
 Remove redundant platform_set_drvdata in various drivers
 Add device tree support to ina2xx driver
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJR0I8LAAoJEMsfJm/On5mBPp8P+wedtxZpljmca+YnuBnZnnZN
 7HLFdGvbwOA+ThfYx7UhpyRgJ+D4ggB0jTiVCPHGUJzmwYjEVk5e9qZkIX/1fBIB
 Iun9TZdJPG+fYFkr8H91dnJcaeELog76yOvx3VRU1QYO11L1wx56oJ2b3a+lnIb5
 UNyovFhvJuZ4jDpzQNUGY5/CMScj2rtPiRPT5NC/3HoSmkXFuV1uw4nhn3C79ycR
 NoZFyjFi7J1hCTB7ExoHHSQBGdLFDXQiEZqNaQS4WXnW1jmiTsQl0rRLoP5KqUDU
 3NovVA557nOfOHAjB98nQrBM7Syn2jKYeZP+M5OR1iKIXxv5uUs/Ajmpnk5x2t1d
 Wf5uHW99SEDTn19U8icgOO4zLvNX0lSXHs+FC6hzKTpLp/FLVjP2uOYj9TcxtPzn
 pLAYsE5UIySH4ybJ0Jdf2pKA+8D2eAOVo1joFhaoz8qFjMNdSxBlf8/xOUsBaJoi
 dAQ/SmWc9z0Tk03Hxn1b/XVKHLbb3AIpPTe1PCK9bUBzLQyZp2UmBmSPHIVxdjO/
 zyRABp64pkoVMqomJPzujEgT2NaqSfr+wwLyUOPBtmaMM8N6aOUlRjrJyOHrSrmB
 3CTT23h8xp8lEgjezQ0jYlhNQPgpGmlu/yuFfL2GyqRw00clAkUem0BrstZg0EOD
 lepSJCaSpyqr3jfhIBwN
 =OdGw
 -----END PGP SIGNATURE-----

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

Pull hwmon updates from Guenter Roeck:
 - new driver to support GMT G762/G763 pwm fan controllers
 - add support for DS1631, DS1721, and DS1731 to ds1621 driver
 - remove detect function from ds1621 driver as unreliable
 - bug fixes in nct6775, iio_hwmon, and adm1021 drivers
 - remove redundant platform_set_drvdata in various drivers
 - add device tree support to ina2xx driver

* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (ds1621) Fix temperature rounding operations
  hwmon: (nct6775) Drop unsupported fan alarm attributes for NCT6775
  hwmon: (nct6775) Fix temperature alarm attributes
  Add support for GMT G762/G763 PWM fan controllers
  hwmon: (ina2xx) Add device tree support to pass the shunt resistor
  hwmon: (ds1621) Update documentation
  hwmon: (ds1621) Add DS1731 chip support to ds1621 driver
  hwmon: (iio_hwmon) add alias table
  hwmon: (adm1021) Do not create min sysfs attributes for LM84
  hwmon: (ds1621) Remove detect function
  hwmon: (ds1621) Add ds1631 chip support to ds1621 driver and documentation
  hwmon: (ds1621) Add ds1721 update interval sysfs attribute
  hwmon: (ds1621) Add ds1721 chip support
  hwmon: (w83627ehf) Remove redundant platform_set_drvdata()
  hwmon: (ntc_thermistor) Remove redundant platform_set_drvdata()
  hwmon: (i5k_amb) Remove redundant platform_set_drvdata()
  hwmon: (coretemp) Remove redundant platform_set_drvdata()
  hwmon: (abituguru3) Remove redundant platform_set_drvdata()
2013-07-03 19:56:35 -07:00
Kees Cook f170168b9a drivers: avoid parsing names as kthread_run() format strings
Calling kthread_run with a single name parameter causes it to be handled
as a format string. Many callers are passing potentially dynamic string
content, so use "%s" in those cases to avoid any potential accidents.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03 16:07:41 -07:00
Guenter Roeck a50d9a4d9a hwmon: (ds1621) Fix temperature rounding operations
Commit "hwmon: (ds1621) Add ds1721 chip support" broke rounding
for chips or configurations with less than 12 bit resolution.

Tested-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-06-28 06:43:55 -07:00
Guenter Roeck 41fa9a944f hwmon: (nct6775) Drop unsupported fan alarm attributes for NCT6775
NCT6775 does not support alarms for fans 4 and 5. Drop the attributes.

cc: stable@vger.kernel.org # 3.10+
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-06-27 10:31:43 -07:00
Guenter Roeck b1d2bff6a6 hwmon: (nct6775) Fix temperature alarm attributes
Driver displays wrong alarms for temperature attributes.

Turns out that temperature alarm bits are not fixed, but determined
by temperature source mapping. To fix the problem, walk through
the temperature sources to determine the correct alarm bit associated
with a given attribute.

Cc: stable@vger.kernel.org # 3.10+
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-06-27 10:31:43 -07:00
Arnaud Ebalard 594fbe713b Add support for GMT G762/G763 PWM fan controllers
GMT G762/763 fan speed PWM controller is connected directly to a fan
and performs closed-loop or open-loop control of the fan speed. Two
modes - PWM or DC - are supported by the chip. Introduced driver
provides various knobs to control the operations of the chip (via
sysfs interface). Specific characteristics of the system can be passed
either using board init code or via DT. Documentation for both the
driver and DT bindings are also provided.

Signed-off-by: Arnaud Ebalard <arno@natisbad.org>
Tested-by: Simon Guinot <simon.guinot@sequanux.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-06-27 10:31:42 -07:00
Tang Yuantian 31e7ad74f6 hwmon: (ina2xx) Add device tree support to pass the shunt resistor
Adding another way that is device tree to pass the shunt resistor
value to driver except for platform data.

Signed-off-by: Tang Yuantian <Yuantian.Tang@freescale.com>
[Guenter Roeck: Added missing of.h include]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-06-27 10:31:42 -07:00
Robert Coulson 260f81ffc1 hwmon: (ds1621) Add DS1731 chip support to ds1621 driver
These changes add DS1731 chip support to the ds1621 driver,
Kconfig, and documentation.

Signed-off-by: Robert Coulson <rob.coulson@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-06-27 10:30:43 -07:00
Sebastian Andrzej Siewior 2ec2819623 hwmon: (iio_hwmon) add alias table
This helps the kernel to find the right module once the device is
created.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-06-27 10:29:03 -07:00
Guenter Roeck 68146a5712 hwmon: (adm1021) Do not create min sysfs attributes for LM84
LM84 does not support minimum temperature registers.
Only create the respective sysfs attributes for other chips.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
2013-06-27 10:29:02 -07:00
Robert Coulson ed7c34e89d hwmon: (ds1621) Remove detect function
Due to a lack of device and vendor identification registers, the
Dallas/Maxim DS16xx devices cannot be uniquely detected, sometimes
resulting in false positives. Therefore, the detect function is
being removed in favor of explicit device instantiation.

Signed-off-by: Robert Coulson <rob.coulson@gmail.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-06-27 10:29:02 -07:00
Robert Coulson 79c1cc1c90 hwmon: (ds1621) Add ds1631 chip support to ds1621 driver and documentation
Add definitions, information, and code for ds1631 chip support
to the ds1621 driver.

Signed-off-by: Robert Coulson <rob.coulson@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-06-27 10:29:02 -07:00
Robert Coulson 3a8fe33155 hwmon: (ds1621) Add ds1721 update interval sysfs attribute
The ds1721 device can be configured for 9..12 bit resolutions;
add a sysfs attribute for userspace to configure this attribute.
The definition, description, details, and usage are shown in the
documentation and were crafted from an LM73 driver patch done by
Chris Verges & Guenter Roeck).

Signed-off-by: Robert Coulson <rob.coulson@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-06-27 10:29:01 -07:00
Robert Coulson cd6c8a4297 hwmon: (ds1621) Add ds1721 chip support
Update the ds1621 documentation, driver, and Kconfig with
ds1721 chip support.

Signed-off-by: Robert Coulson <rob.coulson@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-06-27 10:28:59 -07:00
Sachin Kamat cd275a5635 hwmon: (w83627ehf) Remove redundant platform_set_drvdata()
Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-06-21 10:05:24 -07:00
Sachin Kamat 3a2af25d84 hwmon: (ntc_thermistor) Remove redundant platform_set_drvdata()
Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-06-21 10:05:19 -07:00
Sachin Kamat 15d2f565f2 hwmon: (i5k_amb) Remove redundant platform_set_drvdata()
Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-06-21 10:05:13 -07:00
Sachin Kamat 807f730105 hwmon: (coretemp) Remove redundant platform_set_drvdata()
Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Rudolf Marek <r.marek@assembler.cz>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-06-21 10:05:08 -07:00
Sachin Kamat bb6067e980 hwmon: (abituguru3) Remove redundant platform_set_drvdata()
Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-06-21 10:05:03 -07:00
Guenter Roeck 591bfcfc33 hwmon: (adm1021) Strengthen chip detection for ADM1021, LM84 and MAX1617
On a system with both MAX1617 and JC42 sensors, JC42 sensors can be misdetected
as LM84. Strengthen detection sufficiently enough to avoid this misdetection.
Also improve detection for ADM1021.

Modeled after chip detection code in sensors-detect command.

Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Jean Delvare <khali@linux-fr.org>
2013-06-07 12:29:31 -07:00
Jean Delvare 4e2284d23b hwmon: (tmp401) Drop redundant safety on cache lifetime
time_after (as opposed to time_after_equal) already ensures that the
cache lifetime is at least as much as requested. There is no point in
manually adding another jiffy to that value, and this can confuse the
reader into wrong interpretation.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-05-19 08:19:29 -07:00
Wei Yongjun ecacb0b17c hwmon: fix error return code in abituguru_probe()
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-05-13 08:07:13 -07:00
Axel Lin 159c8cddd9 hwmon: (iio_hwmon) Fix null pointer dereference
This patch fixes the null pointer dereference in goto error_release_channels
path when allocate memory for st fails.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-05-13 06:43:14 -07:00
Guenter Roeck 169c05cd54 hwmon: (nct6775) Do not create non-existing attributes
Overtemperature and hysteresis registers only exist for primary
temperature registers, not for alternates, so do not assign
those registers when initializing alternates.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-05-11 22:55:07 -07:00
Axel Lin 4510d198f9 hwmon: (iio_hwmon) Fix missing iio_channel_release_all call if devm_kzalloc fail
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-05-11 22:55:07 -07:00
Linus Torvalds e72a5d1ceb Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
Pull hwmon update from Jean Delvare:
 "Only lm75 driver updates this time"

* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  hwmon: (lm75) Add support for the Dallas/Maxim DS7505
  hwmon: (lm75) Tune resolution and sample time per chip
  hwmon: (lm75) Prepare to support per-chip resolution and sample time
  hwmon: (lm75) Per-chip configuration register initialization
2013-05-04 13:44:38 -07:00
Al Viro 60b7bf4e61 more mode_t whack-a-mole...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-05-04 14:46:28 -04:00
Jean Delvare 3fbc81e3c0 hwmon: (lm75) Add support for the Dallas/Maxim DS7505
Basically it's the same as the original DS75 but much faster.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <linux@roeck-us.net>
2013-05-04 14:49:36 +02:00
Jean Delvare 0cd2c72d76 hwmon: (lm75) Tune resolution and sample time per chip
Most LM75-compatible chips can either sample much faster or with a
much better resolution than the original LM75 chip. So far the lm75
driver did not let the user take benefit of these improvements. Do it
now.

I decided to almost always configure the chip to use the best
resolution possible, which also means the longest sample time. The
only chips for which I didn't are the DS75, DS1775 and STDS75, because
they are really too slow in 12-bit mode (1.2 to 1.5 second worst case)
so I went for 11-bit mode as a more reasonable tradeoff. This choice is
dictated by the fact that the hwmon subsystem is meant for system
monitoring, it has never been supposed to be ultra-fast, and as a
matter of fact we do cache the sampled values in almost all drivers.

If anyone isn't pleased with these default settings, they can always
introduce a platform data structure or DT support for the lm75. That
being said, it seems nobody ever complained that the driver wouldn't
refresh the value faster than every 1.5 second, and the change made
it faster for all chips even in 12-bit mode, so I don't expect any
complaint.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <linux@roeck-us.net>
2013-05-04 14:49:36 +02:00
Jean Delvare 87d0621ae2 hwmon: (lm75) Prepare to support per-chip resolution and sample time
Prepare the lm75 driver to support per-chip resolution and sample
time. For now we only make the code generic enough to support it, but
we still use the same, unchanged resolution (9-bit) and sample time
(1.5 s) for all chips.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <linux@roeck-us.net>
2013-05-04 14:49:36 +02:00
Jean Delvare 8a5c5cc617 hwmon: (lm75) Per-chip configuration register initialization
There is no standard for the configuration register bits of LM75-like
chips. We shouldn't blindly clear bits setting the resolution as they
are either unused or used for something else on some of the supported
chips.

So, switch to per-chip configuration initialization. This will allow
for better tuning later, for example using more resolution bits when
available.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <linux@roeck-us.net>
2013-05-04 14:49:36 +02:00
Linus Torvalds 151173e8ce Highlights:
- OpenFirmware/DeviceTree support for the Power Supply core: the core now
   automatically populates supplied_from hierarchy from the device tree.
   With these patches chargers and batteries can now lookup each other
   without the board files support shim. Rhyland Klein at NVIDIA did the
   work;
 
 - New ST-Ericsson ABX500 hwmon driver. The driver is heavily using the
   AB85xx core and depends on some recent changes to it, so that is why the
   driver comes through the battery tree. It has an appropriate ack from
   the hwmon maintainer (i.e. Guenter Roeck). Martin Persson at ST-Ericsson
   and Hongbo Zhang at Linaro authored the driver;
 
 - Final bits to sync AB85xx ST-Ericsson changes into mainline. The changes
   touch mfd parts, but these were acked by the appropriate MFD maintainer
   (i.e. Samuel Ortiz). Lee Jones at Linaro did most of the work and lead
   the submission process.
 
 Minor changes, but still worth mentioning:
 
 - Battery temperature reporting fix for Nokia N900 phones;
 - Versatile Express poweroff driver moved into drivers/power/reset/.
 - Tree-wise: use devm_kzalloc() where appropriate;
 - Tree-wise: dev_pm_ops cleanups/fixes.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iQIcBAABAgAGBQJRf1BPAAoJEGgI9fZJve1bwyoP/3Gv+qStzbN7mUtIVEvH3EAe
 aVJwlODFzEZjk5xoiw7Dc8PuBE8O948hWOnQyCuUQ8+OfK6SyNIjexPYy3Z25a0F
 cX9JMj7rtPWHvxo2q/YuKwBPZoxj/JIPyxwUT7akwXoHAV059fvcy9R1DfFX2Qur
 hSP0NXTg+guvEpxGV4bC2l+LWZPmDFK9n0RsorttYaBvsiRDWl0c2TY2byofYlBw
 ++m/rI8Qgl8db8pKq/WDue62HtMt3kmZj6ZIgej3Wb0+GIRmYHMyPIyAkf82Wlw2
 g2sGNPT7cstrSNOozegzJ7UghJObcYDFf10NCgvFMNjmAT1dAwdneQHEWy6Ek7pT
 9X3e0LmaFqVbufFp4xFiLkMutsCLLTnGyXIbzs7RkTm3XBVIUqiDWtI6I6X44ohG
 6PJn8vUlufu7owXrqFpgSBar2U1vfoQdhInmz4hbQeff0qn2nX/BGNwhxYptZ549
 TudsI9WGzJ6fvYQ56zh6+BfiA0FmjhUiSKOtrXImrhxE6gUf3IOJyMQlkxLx5t8D
 uuhBmO0J6kDi2lqF6alOEo+UDefJj4mUJn2tnIdis90+lNQlSV02GEtiwFT1zt1z
 LFW0xshQkxZ4lMa28h35FB1/Z11ApUOe4Es+OKADDJhAnxdZzXcAwIRyPRRPgdsy
 jTnJno+Kxk9wXLcekxVE
 =5BdE
 -----END PGP SIGNATURE-----

Merge tag 'for-v3.10' of git://git.infradead.org/battery-2.6

Pull battery updates from Anton Vorontsov:
 "Highlights:

   - OpenFirmware/DeviceTree support for the Power Supply core: the core
     now automatically populates supplied_from hierarchy from the device
     tree.  With these patches chargers and batteries can now lookup
     each other without the board files support shim.  Rhyland Klein at
     NVIDIA did the work

   - New ST-Ericsson ABX500 hwmon driver.  The driver is heavily using
     the AB85xx core and depends on some recent changes to it, so that
     is why the driver comes through the battery tree.  It has an
     appropriate ack from the hwmon maintainer (i.e.  Guenter Roeck).
     Martin Persson at ST-Ericsson and Hongbo Zhang at Linaro authored
     the driver

   - Final bits to sync AB85xx ST-Ericsson changes into mainline.  The
     changes touch mfd parts, but these were acked by the appropriate
     MFD maintainer (ie Samuel Ortiz).  Lee Jones at Linaro did most of
     the work and lead the submission process.

  Minor changes, but still worth mentioning:

   - Battery temperature reporting fix for Nokia N900 phones
   - Versatile Express poweroff driver moved into drivers/power/reset/
   - Tree-wide: use devm_kzalloc() where appropriate
   - Tree-wide: dev_pm_ops cleanups/fixes"

* tag 'for-v3.10' of git://git.infradead.org/battery-2.6: (112 commits)
  pm2301-charger: Fix suspend/resume
  charger-manager: Use kmemdup instead of kzalloc + memcpy
  power_supply: Populate supplied_from hierarchy from the device tree
  power_supply: Add core support for supplied_from
  power_supply: Define Binding for power-supplies
  rx51_battery: Fix reporting temperature
  hwmon: Add ST-Ericsson ABX500 hwmon driver
  ab8500_bmdata: Export abx500_res_to_temp tables for hwmon
  ab8500_{bmdata,fg}: Add const attributes to some data arrays
  ab8500_bmdata: Eliminate CamelCase warning of some variables
  ab8500_btemp: Make ab8500_btemp_get* interfaces public
  goldfish_battery: Use resource_size()
  lp8788-charger: Use PAGE_SIZE for the sysfs read operation
  max8925_power: Use devm_kzalloc()
  da9030_battery: Use devm_kzalloc()
  da9052-battery: Use devm_kzalloc()
  ds2760_battery: Use devm_kzalloc()
  ds2780_battery: Use devm_kzalloc()
  gpio-charger: Use devm_kzalloc()
  isp1704_charger: Use devm_kzalloc()
  ...
2013-04-30 15:15:24 -07:00
Linus Torvalds fdc719b63a Staging driver tree update for 3.10-rc1
Here's the big staging driver tree update for 3.10-rc1
 
 This update contains loads of comedi driver cleanups and fixes in here,
 iio updates, android driver changes, and other various staging driver
 cleanups.
 
 Thanks to some drivers being removed, and the comedi driver cleanups, we
 have removed more code than we added:
  627 files changed, 65145 insertions(+), 76321 deletions(-)
 which is always nice to see.
 
 All of these have been in linux-next for a while.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iEYEABECAAYFAlF+nF8ACgkQMUfUDdst+ynlIwCfYm2pSkA0w1K56mftq1T0hpMH
 b9IAmwQlfEHSIKeAxqRO3RRrfLu5XD7L
 =Jnxr
 -----END PGP SIGNATURE-----

Merge tag 'staging-3.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging driver tree update from Greg Kroah-Hartman:
 "Here's the big staging driver tree update for 3.10-rc1

  This update contains loads of comedi driver cleanups and fixes in
  here, iio updates, android driver changes, and other various staging
  driver cleanups.

  Thanks to some drivers being removed, and the comedi driver cleanups,
  we have removed more code than we added:

   627 files changed, 65145 insertions(+), 76321 deletions(-)

  which is always nice to see.

  All of these have been in linux-next for a while."

* tag 'staging-3.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (940 commits)
  staging: comedi: ni_labpc: fix legacy driver build
  staging: comedi: das800: cleanup the cio-das802/16 fifo comments
  staging: comedi: das800: rename CamelCase vars in das800_ai_do_cmd()
  staging: comedi: das800: tidy up the private data
  staging: comedi: das800: tidy up das800_interrupt()
  staging: comedi: das800: tidy up das800_ai_insn_read()
  staging: comedi: das800: tidy up das800_di_insn_bits()
  staging: comedi: das800: tidy up das800_do_insn_bits()
  staging: comedi: das800: remove extra divisor calculation call
  staging: comedi: das800: rename {enable,disable}_das800
  staging: comedi: das800: tidy up subdevice init
  staging: comedi: das800: allow attaching without interrupt support
  staging: comedi: das800: interrupts are required for async command support
  staging: comedi: das800: tidy up das800_ai_do_cmdtest()
  staging: comedi: das800: remove 'volatile' on private data variables
  staging: comedi: das800: cleanup the boardinfo
  staging: comedi: das800: cleanup range table declarations
  staging: comedi: das800: introduce das800_ind_{write, read}()
  staging: comedi: das800: remove forward declarations
  staging: comedi: das800: move das800_set_frequency()
  ...
2013-04-29 11:34:17 -07:00
Guenter Roeck 6445e6600f hwmon: (nct6775) Fix coding style problems
Add space around binary operators (CodingStyle, chapter 3.1).

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-21 09:42:52 -07:00
Guenter Roeck 6d4b3621bb hwmon: (nct6775) Constify strings
nct6775_sio_names should be a constant pointer to an array of
constant strings.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-21 09:42:45 -07:00
Guenter Roeck 29dd3b64b9 hwmon: (tmp401) Add support for TMP432
TMP432 is similar to TMP431 with a second external temperature sensor.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
2013-04-21 08:56:48 -07:00
Guenter Roeck 0846e30dd4 hwmon: (tmp401) Add support for update_interval attribute
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
2013-04-21 08:27:38 -07:00
Guenter Roeck 8eb6d90fec hwmon: (tmp401) Reset valid flag when resetting temperature history
Cached data is no longer valid after resetting the temperature history.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
2013-04-21 08:27:28 -07:00
Guenter Roeck 14f2a6654d hwmon: (tmp401) Simplification and cleanup
Use two-dimensional array pointing to registers
Merge temperature and limit access functions into a single function
Return error codes from I2C reads
Use DIV_ROUND_CLOSEST for rounding operations and improve rounding

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
2013-04-21 08:26:41 -07:00
Hongbo Zhang 0bbb06ed56 hwmon: Add ST-Ericsson ABX500 hwmon driver
Each of ST-Ericsson X500 chip set series consists of both ABX500 and DBX500
chips. This is ABX500 hwmon driver, where the abx500.c is a common layer for
all ABX500s, and the ab8500.c is specific for AB8500 chip. Under this designed
structure, other chip specific files can be added simply using the same common
layer abx500.c.

Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-04-16 18:27:52 -07:00
Guenter Roeck b4e665c780 hwmon: (tmp401) Use sysfs_create_group / sysfs_remove_group
instead of creating and removing sysfs attribute files individually.

Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-14 04:47:06 -07:00