Commit graph

2804 commits

Author SHA1 Message Date
Peter Hung dcd956fc0b hwmon: (f71882fg) Fix f81866a temp/beep setting
The temperature value of Fintek F81866 is the same with
f71882fg. It located with 0x6c + 2*(nr), others located
with 0x6c + 2*(nr+1). We change the rule in f71882fg_probe(),
If type = f71858fg/f8000/f81866a. the temp_start will set to 0,
others are 1.

The F81866 over-temperature beep setting is not the same with
f71882fg too. They are using the same address 63H, but F81866 is
using bit 0/1/2 & 4/5/6, others are using bit 1/2/3 & 5/6/7,
So we copy from fxxxx_temp_beep_attr[] to f81866_temp_beep_attr
and change bit setting.

Signed-off-by: Peter Hung <hpeter+linux_kernel@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-09 13:44:26 -07:00
Peter Hung 2725fe2b74 hwmon: (f71882fg) Add support for F81866 and F71868
Add New Fintek SuperIO F81866(0x1010) & F71868(0x1106)
with H/W Monitor functions.

We increased F71882FG_MAX_INS from 9 to 10 to read
F71868 10 voltage sets.

Signed-off-by: Peter Hung <hpeter+linux_kernel@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-09 13:44:25 -07:00
Constantine Shulyupin 876420e05a hwmon: (nct7802) Add pwm mode attributes
Introduced: show_pwm_mode, pwm1_mode, pwm2_mode, pwm2_mode

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-09 13:44:25 -07:00
Constantine Shulyupin ea33597c6f hwmon: (nct7802) Add pwm control
Added fan output control registers.
Modes of operation are PWM (default) and DC.

Introduced show_pwm, store_pwm, nct7802_pwm_attrs, nct7802_pwm_group.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-09 13:44:25 -07:00
Constantine Shulyupin fcdc5739dc hwmon: (nct7802) add temperature sensor type attribute
Sensor type:
3 diode (current mode), MD=1
4 thermistor, MD=2

Reference:
Nuvoton Hardware Monitoring IC NCT7802Y
7.2.32 Mode Selection Register
Location : Index 22h

Signed-off-by: Constantine Shulyupin <const@MakeLinux.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-09 13:44:25 -07:00
Javier Martinez Canillas de66b38097 hwmon: (g762) Export OF module alias information
The I2C core always reports the MODALIAS uevent as "i2c:<client name"
regardless if the driver was matched using the I2C id_table or the
of_match_table. So technically there's no need for a driver to export
the OF table since currently it's not used.

In fact, the I2C device ID table is mandatory for I2C drivers since
a i2c_device_id is passed to the driver's probe function even if the
I2C core used the OF table to match the driver.

And since the I2C core uses different tables, OF-only drivers needs to
have duplicated data that has to be kept in sync and also the dev node
compatible manufacturer prefix is stripped when reporting the MODALIAS.

To avoid the above, the I2C core behavior may be changed in the future
to not require an I2C device table for OF-only drivers and report the
OF module alias. So, it's better to also export the OF table to prevent
breaking module autoloading if that happens.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-05 08:31:59 -07:00
Javier Martinez Canillas 1252be9ce0 hwmon: (nct7904) Export I2C module alias information
The I2C core always reports the MODALIAS uevent as "i2c:<client name"
regardless if the driver was matched using the I2C id_table or the
of_match_table. So the driver needs to export the I2C table and this
be built into the module or udev won't have the necessary information
to auto load the correct module when the device is added.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Cc: stable@vger.kernel.org # v4.1+
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-05 08:31:59 -07:00
Pali Rohár a4b45b25f1 hwmon: (dell-smm) Blacklist Dell Studio XPS 8100
CPU fan speed going up and down on Dell Studio XPS 8100 for
unknown reasons. Without further debugging on the affected
machine, it is not possible to find the problem.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=100121
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Tested-by: Jan C Peters <jcpeters89@gmail.com>
Cc: stable@vger.kernel.org # v4.0+, will need backport
[groeck: cleaned up description, comments]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-05 08:31:59 -07:00
Sascha Hauer 17e8351a77 thermal: consistently use int for temperatures
The thermal code uses int, long and unsigned long for temperatures
in different places.

Using an unsigned type limits the thermal framework to positive
temperatures without need. Also several drivers currently will report
temperatures near UINT_MAX for temperatures below 0°C. This will probably
immediately shut the machine down due to overtemperature if started below
0°C.

'long' is 64bit on several architectures. This is not needed since INT_MAX °mC
is above the melting point of all known materials.

Consistently use a plain 'int' for temperatures throughout the thermal code and
the drivers. This only changes the places in the drivers where the temperature
is passed around as pointer, when drivers internally use another type this is
not changed.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
Reviewed-by: Darren Hart <dvhart@linux.intel.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Peter Feuerer <peter@piie.net>
Cc: Punit Agrawal <punit.agrawal@arm.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Jean Delvare <jdelvare@suse.de>
Cc: Peter Feuerer <peter@piie.net>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-acpi@vger.kernel.org
Cc: platform-driver-x86@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-omap@vger.kernel.org
Cc: linux-samsung-soc@vger.kernel.org
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Darren Hart <dvhart@infradead.org>
Cc: lm-sensors@lm-sensors.org
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2015-08-03 23:15:50 +08:00
Guenter Roeck 9200bc4c28 hwmon: (nct7802) Fix integer overflow seen when writing voltage limits
Writing a large value into a voltage limit attribute can result
in an overflow due to an auto-conversion from unsigned long to
unsigned int.

Cc: Constantine Shulyupin <const@MakeLinux.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Cc: stable@vger.kernel.org # v4.1+
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-07-29 20:06:50 -07:00
Guenter Roeck 0d6aaffc3a hwmon: (nct7904) Rename pwm attributes to match hwmon ABI
pwm attributes have well defined names, which should be used.

Cc: Vadim V. Vlasov <vvlasov@dev.rtsoft.ru>
Cc: stable@vger.kernel.org #v4.1+
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-07-29 20:06:46 -07:00
Fabian Frederick ffe3df5353 hwmon: (w83627ehf) Use swap() in w82627ehf_swap_tempreg()
Use kernel.h macro definition.

Thanks to Julia Lawall for Coccinelle scripting support.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
2015-07-03 14:39:06 +02:00
Roger Lucas f617f7310c hwmon: (w83792d) Additional PWM outputs support
Add pwm[4-7] and the associated pwm[4-7]_mode attributes.

Signed-off-by: Roger Lucas <vt8231@hiddenengine.co.uk>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
2015-07-03 14:39:05 +02:00
Stevens, Nick 347d7e45bd hwmon: (mcp3021) Fix broken output scaling
The mcp3021 scaling code is dividing the VDD (full-scale) value in
millivolts by the A2D resolution to obtain the scaling factor. When VDD
is 3300mV (the standard value) and the resolution is 12-bit (4096
divisions), the result is a scale factor of 3300/4096, which is always
one.  Effectively, the raw A2D reading is always being returned because
no scaling is applied.

This patch fixes the issue and simplifies the register-to-volts
calculation, removing the unneeded "output_scale" struct member.

Signed-off-by: Nick Stevens <Nick.Stevens@digi.com>
Cc: stable@vger.kernel.org # v3.10+
[Guenter Roeck: Dropped unnecessary value check]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-07-01 13:56:27 -07:00
Constantine Shulyupin 56172d81a9 hwmon: (nct7802) fix visibility of temp3
Excerpt from datasheet:
7.2.32 Mode Selection Register
RTD3_MD : 00=Closed , 01=Reserved , 10=Thermistor mode , 11=Voltage sense

Show temp3 only in Thermistor mode

Cc: stable@vger.kernel.org # v3.19+
Signed-off-by: Constantine Shulyupin <const@MakeLinux.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-07-01 13:56:27 -07:00
Gabriele Mazzotta 9026cae1c6 hwmon: (dell-smm-hwmon) Use a valid name attribute
As per Documentation/hwmon/sysfs-interface, hwmon name attributes must
not include '-', so replace 'dell-smm' with 'dell_smm'.

Fixes: 039ae58503 ("hwmon: Allow to compile dell-smm-hwmon driver without /proc/i8k")
Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-07-01 13:56:27 -07:00
Linus Torvalds d87823813f Char/Misc driver patches for 4.2-rc1
Here's the big char/misc driver pull request for 4.2-rc1.
 
 Lots of mei, extcon, coresight, uio, mic, and other driver updates in
 here.  Full details in the shortlog.  All of these have been in
 linux-next for some time with no reported problems.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlWNn0gACgkQMUfUDdst+ykCCQCgvdF4F2+Hy9+RATdk22ak1uq1
 JDMAoJTf4oyaIEdaiOKfEIWg9MasS42B
 =H5wD
 -----END PGP SIGNATURE-----

Merge tag 'char-misc-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc driver updates from Greg KH:
 "Here's the big char/misc driver pull request for 4.2-rc1.

  Lots of mei, extcon, coresight, uio, mic, and other driver updates in
  here.  Full details in the shortlog.  All of these have been in
  linux-next for some time with no reported problems"

* tag 'char-misc-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (176 commits)
  mei: me: wait for power gating exit confirmation
  mei: reset flow control on the last client disconnection
  MAINTAINERS: mei: add mei_cl_bus.h to maintained file list
  misc: sram: sort and clean up included headers
  misc: sram: move reserved block logic out of probe function
  misc: sram: add private struct device and virt_base members
  misc: sram: report correct SRAM pool size
  misc: sram: bump error message level on unclean driver unbinding
  misc: sram: fix device node reference leak on error
  misc: sram: fix enabled clock leak on error path
  misc: mic: Fix reported static checker warning
  misc: mic: Fix randconfig build error by including errno.h
  uio: pruss: Drop depends on ARCH_DAVINCI_DA850 from config
  uio: pruss: Add CONFIG_HAS_IOMEM dependence
  uio: pruss: Include <linux/sizes.h>
  extcon: Redefine the unique id of supported external connectors without 'enum extcon' type
  char:xilinx_hwicap:buffer_icap - change 1/0 to true/false for bool type variable in function buffer_icap_set_configuration().
  Drivers: hv: vmbus: Allocate ring buffer memory in NUMA aware fashion
  parport: check exclusive access before register
  w1: use correct lock on error in w1_seq_show()
  ...
2015-06-26 14:51:15 -07:00
Linus Torvalds 234a56c80a hwmon changes for v4.2
- New driver for Microchip TC74
 - Support for ncpXXwf104 added to ntc_thermistor driver
 - Minor cleanup
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJViAvaAAoJEMsfJm/On5mBr2UP/jAuFjcIwyEeTIRaDjSyqPCm
 y/wEGGIBhXg3VEbOnGLz7lrJvnZiQ4Ma7dPrY9QJmaY2l0mPmDLcc6iwQ0vl+pnS
 uCP2g5q5w0C8uvaqHvY6oN75uMgS6TpJBfnHKtGVE1xf7+HmQ/tLHOIP/DTXBWjs
 p/f0AQiwfjt2nepaI+Lemqasw3rLtgO6Ne2w3gDK//g35elgBcdCst+xPv9o5YdW
 SBoyde6OzBVmqOgf2svzlWwK/hLTEUYVBSTMs1UpzJE/M6HWaPoAbjLkuDNWMwE7
 V1HhV6kwpuf+WHyJbPDV0rQLseKpDHQGFGwb3pu7f7oVmOKlKBrymesiHooit+9i
 s23wzB5Kezikyskcd4rC2CWBIyd6r43ngkuyJYyOfqKEkYmBuhQIpfkdtc4wFPce
 TTWdUOBOFAvhKRMYXMTgPvVkBuCkp/6LI/8UIj08LdMStQwkg0Ehg6xZha6UWZQf
 0cUPoTiUjfiuWlYr3g2siTSKMOQXX4eOU8ywloelr8NORQexk9d3Bihl8B/npRcm
 prriEUVrriNGFgwEpwK4DrdKhMUAZnjV3ZUGtD43XXmSHkNfmdBCOQqW5NO9t03l
 /JLtc3tnaMNmv7TeOiAxhxQWUppFq5JRfJ6DO33yl5Ij98M9rL9rmDa2tz6+nVy1
 67ufV9zu4cRYkMIqQVrQ
 =ZKHZ
 -----END PGP SIGNATURE-----

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

Pull hwmon updates from Guenter Roeck:

 - new driver for Microchip TC74

 - support for ncpXXwf104 added to ntc_thermistor driver

 - minor cleanup

* tag 'hwmon-for-linus-v4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: add driver for Microchip TC74
  hwmon: (ntc_thermistor) Improve precision of resistance calculation
  hwmon: (ntc_thermistor) fix iio raw to microvolts conversion
  hwmon: (atxp1) Drop auto-detection
  hwmon: (atxp1) Drop FSF mailing address
  hwmon: Allow compile test of GPIO consumers if !GPIOLIB
  hwmon: (sht15) Constify platform_device_id
  hwmon: (max197) Constify platform_device_id
  hwmon: (ntc_thermistor) Add support for ncpXXwf104
2015-06-23 13:39:56 -07:00
Maciej S. Szmigiero 761c1770f2 hwmon: add driver for Microchip TC74
Add hwmon driver for the Microchip TC74.

The TC74 is a single-input 8-bit I2C temperature sensor,
with +-2 degrees centigrade accuracy.

Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-06-21 22:54:53 -07:00
Chris Lesiak f6725ae2f1 hwmon: (ntc_thermistor) Improve precision of resistance calculation
The function get_ohm_of_thermistor has both the measured voltage and the
pullup voltage available in microvolts.  But it was promptly converting
both to millivolts before using them to calculate the thermistor
resistance.  That conversion unnecessarily hurt the precision of the
calculation.

For example, take the ncpXXwb473 connected to 5000 mV and pulled down
through a 47000 ohm resistor.  At 25 C, the resistance of the thermistor
is 47000 ohms.  The measured voltage will be 2500 mV.  If we measure
instead 2501 mV, then the calculated resistance will be 46962 ohms --
a difference of 38 ohms.  So the precision of the resistance estimate
could be increased by 38X by doing the calculations in microvolts.

Signed-off-by: Chris Lesiak <chris.lesiak@licor.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-06-03 15:25:53 -07:00
Chris Lesiak 0315253b19 hwmon: (ntc_thermistor) fix iio raw to microvolts conversion
The function ntc_adc_iio_read was assuming both a 12 bit ADC and that
pullup_uv is the same as the ADC reference voltage.  If either
assumption is false, then the result is incorrect.

Attempt to use iio_convert_raw_to_processed to convert the raw value to
microvolts.  It will fail for iio channels that don't support support
IIO_CHAN_INFO_SCALE; in that case fall back to the assumptions.

Signed-off-by: Chris Lesiak <chris.lesiak@licor.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-06-02 06:53:50 -07:00
Ingo Molnar f407a82586 Merge branch 'linus' into sched/core, to resolve conflict
Conflicts:
	arch/sparc/include/asm/topology_64.h

Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-06-02 08:05:42 +02:00
Guenter Roeck e892b75ff5 hwmon: (atxp1) Drop auto-detection
Auto-detection for this chip is highly unreliable, and one of its
I2C addresses can also be used by EEPROMs, increasing the risk for
false positives even more. Drop auto-detection entirely to remove
the risk.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-31 22:58:36 -07:00
Guenter Roeck ea33a5e771 hwmon: (atxp1) Drop FSF mailing address
The FSF mailing address may change and does not provide any real value.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-31 22:58:36 -07:00
Geert Uytterhoeven 1376e2c3d7 hwmon: Allow compile test of GPIO consumers if !GPIOLIB
The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is
not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer
functionality only, can still be compiled if GPIOLIB is not enabled.

Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where
appropriate.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Jean Delvare <jdelvare@suse.de>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: lm-sensors@lm-sensors.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-31 22:58:36 -07:00
Krzysztof Kozlowski 9c40723e72 hwmon: (sht15) Constify platform_device_id
The platform_device_id is not modified by the driver and core uses it as
const.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-31 22:58:36 -07:00
Krzysztof Kozlowski 9c2cbcec85 hwmon: (max197) Constify platform_device_id
The platform_device_id is not modified by the driver and core uses it as
const.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-31 22:58:36 -07:00
Beomho Seo 887ee43477 hwmon: (ntc_thermistor) Add support for ncpXXwf104
This patch adds support for the ntc thermistor NCPXXWF104 series.

Cc: Jean Delvare <jdelvare@suse.de>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-31 22:58:36 -07:00
Guenter Roeck c7bd6dc320 hwmon: (nct6683) Add missing sysfs attribute initialization
The following error message is seen when loading the nct6683 driver
with DEBUG_LOCK_ALLOC enabled.

BUG: key ffff88040b2f0030 not in .data!
------------[ cut here ]------------
WARNING: CPU: 0 PID: 186 at kernel/locking/lockdep.c:2988
				lockdep_init_map+0x469/0x630()
DEBUG_LOCKS_WARN_ON(1)

Caused by a missing call to sysfs_attr_init() when initializing
sysfs attributes.

Reported-by: Alexey Orishko <alexey.orishko@gmail.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Cc: stable@vger.kernel.org # v3.18+
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-29 17:47:42 -07:00
Guenter Roeck 1b63bf6172 hwmon: (nct6775) Add missing sysfs attribute initialization
The following error message is seen when loading the nct6775 driver
with DEBUG_LOCK_ALLOC enabled.

BUG: key ffff88040b2f0030 not in .data!
------------[ cut here ]------------
WARNING: CPU: 0 PID: 186 at kernel/locking/lockdep.c:2988
				lockdep_init_map+0x469/0x630()
DEBUG_LOCKS_WARN_ON(1)

Caused by a missing call to sysfs_attr_init() when initializing
sysfs attributes.

Reported-by: Alexey Orishko <alexey.orishko@gmail.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Cc: stable@vger.kernel.org # v3.12+
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-29 17:47:33 -07:00
Guenter Roeck 9aecac04d8 hwmon: (tmp401) Do not auto-detect chip on I2C address 0x37
I2C address 0x37 may be used by EEPROMs, which can result in false
positives. Do not attempt to detect a chip at this address.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Cc: stable@vger.kernel.org # v4.0+
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-29 13:37:06 -07:00
Bartosz Golaszewski 19a34eea4f coretemp: Replace cpu_sibling_mask() with topology_sibling_cpumask()
The former duplicates the functionality of the latter but is
neither documented nor arch-independent.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Cc: Benoit Cousson <bcousson@baylibre.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Jean Delvare <jdelvare@suse.de>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Drokin <oleg.drokin@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Link: http://lkml.kernel.org/r/1432645896-12588-4-git-send-email-bgolaszewski@baylibre.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-05-27 15:22:15 +02:00
Chris Lesiak adba657533 hwmon: (ntc_thermistor) Ensure iio channel is of type IIO_VOLTAGE
When configured via device tree, the associated iio device needs to be
measuring voltage for the conversion to resistance to be correct.
Return -EINVAL if that is not the case.

Signed-off-by: Chris Lesiak <chris.lesiak@licor.com>
Cc: stable@vger.kernel.org # 3.10+
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-26 17:22:49 -07:00
Pali Rohár 039ae58503 hwmon: Allow to compile dell-smm-hwmon driver without /proc/i8k
This patch splits CONFIG_I8K compile option to SENSORS_DELL_SMM and CONFIG_I8K.
Option SENSORS_DELL_SMM is now used to enable compilation of dell-smm-hwmon
driver and old CONFIG_I8K option to enable /proc/i8k interface in driver.

So this change allows to compile dell-smm-hwmon driver without legacy /proc/i8k
interface which is needed only for old Dell Inspirion models or for userspace
i8kutils package.

For backward compatibility when CONFIG_I8K is enabled then also SENSORS_DELL_SMM
is enabled and so driver dell-smm-hwmon (with /proc/i8k) is compiled.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-24 12:48:12 -07:00
Pali Rohár a5afba16c6 hwmon: Rename i8k driver to dell-smm-hwmon and move it to hwmon tree
This commit moves i8k driver to hwmon tree under name dell-smm-hwmon which is
better name then abbreviation i8k. For backward compatibility is added macro
MODULE_ALIAS("i8k") so modprobe will load driver also old name i8k. CONFIG_I8K
compile option was not changed.

This commit also adds me as maintainer of this new dell-smm-hwmon driver and
remove Guenter Roeck from list who is implicit maintainer all hwmon drivers.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-24 12:48:12 -07:00
Bartosz Golaszewski cdb1dc3f1c hwmon: (w83795) use find_closest_descending() in pwm_freq_to_reg()
Replace the loop iterating over pwm_freq_cksel0 with a call to
find_closest_descending().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-04-17 09:03:55 -04:00
Bartosz Golaszewski 0f3721c51e hwmon: (lm85) use find_closest() in x_TO_REG() functions
Replace RANGE_TO_REG() and FREQ_TO_REG() implementations with
calls to find_closest().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-04-17 09:03:55 -04:00
Bartosz Golaszewski d38df34e3f hwmon: (ina2xx) replace ina226_avg_bits() with find_closest()
Use find_closest() to locate the closest average in ina226_avg_tab.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-04-17 09:03:54 -04:00
Anand Moon f354169e0f hwmon: (pwm-fan) Update the duty cycle inorder to control the pwm-fan
pwm_config() must be called with a duty cycle of 0 prior to calling
pwm_disable() to ensure that the pwm signal is set to low.

Reported-by: Markus Reichl <m.reichl@fivetechno.de>
Tested-by: Markus Reichl <m.reichl@fivetechno.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
Reviewed-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-12 15:59:11 -07:00
Guenter Roeck f83a9cb622 hwmon: (it87) Use feature macros on sio_data
Feature macros work on sio_data as well, so use them there.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-09 06:39:11 -07:00
Guenter Roeck 8416915c16 hwmon: (ibmpowernv) Fix build error seen for some configurations
Fix
drivers/hwmon/ibmpowernv.c: In function 'get_logical_cpu':
drivers/hwmon/ibmpowernv.c:121:3:
	error: implicit declaration of function 'get_hard_smp_processor_id'

seen for some configurations, possibly if SMP is not configured.

Fixes: 3df2f59f0a ("hwmon: (ibmpowernv) pretty print labels")
Cc: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-08 21:03:39 -07:00
Nishanth Menon e76ea26142 hwmon: (gpio-fan) Move the thermal registration after registration is complete
Thermal framework may already be ready and cooling policies might
already be functional when we are attempting to register gpio fan as
a cooling device. This can be reproduced by changing probe order in
which registration of various modules are done in a system. In such
a case, kernel generates an oops since the data structures are not
completely populated with the wrong assumption that thermal framework
is not yet ready. Fix this by reordering the thermal framework
registration to occur after hwmon registration of the fan is complete.

Example kernel oops:
[  149.005828] Unable to handle kernel NULL pointer dereference at virtual address 0000008c
[  149.014369] pgd = ecf48000
[  149.017204] [0000008c] *pgd=ac065831, *pte=00000000, *ppte=00000000
[  149.023820] Internal error: Oops: 17 [#1] SMP ARM
[  149.028745] Modules linked in: gpio_fan(+) cpufreq_dt ipv6 evdev leds_gpio led_class omap_wdt phy_omap_usb2 rtc_palmas palmas_pwrbutton tmp102 ti_soc_thermal dwc3_omap thermal_sys extcon rtc_omap rtc_ds1307 hwmon
[  149.048629] CPU: 1 PID: 1183 Comm: modprobe Not tainted 4.0.0-rc7-next-20150407-00002-g7a82da074c99 #3
[  149.058383] Hardware name: Generic DRA74X (Flattened Device Tree)
[  149.064763] task: edec1240 ti: ec0e0000 task.ti: ec0e0000
[  149.070421] PC is at dev_driver_string+0x0/0x38
[  149.075165] LR is at __dev_printk+0x24/0x70
[  149.079540] pc : [<c03d6cd0>]    lr : [<c03d72c4>]    psr: 20000013
[  149.079540] sp : ec0e1c28  ip : edec1240  fp : 00000000
[  149.091568] r10: edf3eee0  r9 : 00000000  r8 : ffffffff
[  149.097040] r7 : edf3eea0  r6 : 00000034  r5 : 00000010  r4 : ec0e1c44
[  149.103871] r3 : ec0e1c4c  r2 : ec0e1c44  r1 : c079d800  r0 : 00000010
[  149.110709] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[  149.118182] Control: 10c5387d  Table: acf4806a  DAC: 00000015
[  149.124198] Process modprobe (pid: 1183, stack limit = 0xec0e0218)
[  149.130673] Stack: (0xec0e1c28 to 0xec0e2000)
[  149.135235] 1c20:                   60000013 c05e2ae0 00000000 edf3ec00 ec934a10 c03d73d4
...
[  149.392230] 1fe0: befe1888 befe1878 00019418 b6ea08f0 80000010 00000003 00000000 00000000
[  149.400798] [<c03d6cd0>] (dev_driver_string) from [<c03d72c4>] (__dev_printk+0x24/0x70)
[  149.409193] [<c03d72c4>] (__dev_printk) from [<c03d73d4>] (dev_warn+0x34/0x48)
[  149.416767] [<c03d73d4>] (dev_warn) from [<bf0f54fc>] (get_fan_speed_index+0x94/0xa4 [gpio_fan])
[  149.425980] [<bf0f54fc>] (get_fan_speed_index [gpio_fan]) from [<bf0f5524>] (gpio_fan_get_cur_state+0x18/0x30 [gpio_fan])
[  149.437476] [<bf0f5524>] (gpio_fan_get_cur_state [gpio_fan]) from [<bf02767c>] (thermal_zone_trip_update+0xe8/0x2a4 [thermal_sys])
[  149.449794] [<bf02767c>] (thermal_zone_trip_update [thermal_sys]) from [<bf027844>] (step_wise_throttle+0xc/0x74 [thermal_sys])
[  149.461832] [<bf027844>] (step_wise_throttle [thermal_sys]) from [<bf024ff4>] (handle_thermal_trip+0x5c/0x188 [thermal_sys])
[  149.473603] [<bf024ff4>] (handle_thermal_trip [thermal_sys]) from [<bf0256c4>] (thermal_zone_device_update+0x94/0x108 [thermal_sys])
[  149.486104] [<bf0256c4>] (thermal_zone_device_update [thermal_sys]) from [<bf026470>] (__thermal_cooling_device_register+0x2e8/0x374 [thermal_sys])
[  149.499956] [<bf026470>] (__thermal_cooling_device_register [thermal_sys]) from [<bf0f58e4>] (gpio_fan_probe+0x350/0x4d0 [gpio_fan])
[  149.512438] [<bf0f58e4>] (gpio_fan_probe [gpio_fan]) from [<c03db8a0>] (platform_drv_probe+0x48/0x98)
[  149.522109] [<c03db8a0>] (platform_drv_probe) from [<c03da30c>] (driver_probe_device+0x1b0/0x26c)
[  149.531399] [<c03da30c>] (driver_probe_device) from [<c03da45c>] (__driver_attach+0x94/0x98)
[  149.540238] [<c03da45c>] (__driver_attach) from [<c03d8bb0>] (bus_for_each_dev+0x54/0x88)
[  149.548814] [<c03d8bb0>] (bus_for_each_dev) from [<c03d9a34>] (bus_add_driver+0xdc/0x1d4)
[  149.557381] [<c03d9a34>] (bus_add_driver) from [<c03dac30>] (driver_register+0x78/0xf4)
[  149.565765] [<c03dac30>] (driver_register) from [<c0009784>] (do_one_initcall+0x80/0x1d8)
[  149.574340] [<c0009784>] (do_one_initcall) from [<c00c2278>] (do_init_module+0x5c/0x1b8)
[  149.582833] [<c00c2278>] (do_init_module) from [<c00c3bbc>] (load_module+0x1720/0x1dcc)
[  149.591212] [<c00c3bbc>] (load_module) from [<c00c43d0>] (SyS_finit_module+0x68/0x6c)
[  149.599418] [<c00c43d0>] (SyS_finit_module) from [<c000f3c0>] (ret_fast_syscall+0x0/0x4c)
[  149.607994] Code: 15830000 e1a00006 e28dd008 e8bd8070 (e590307c)

Cc: Eduardo Valentin <edubezval@gmail.com>
Fixes: b5cf88e46b ("(gpio-fan): Add thermal control hooks")
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-08 20:34:43 -07:00
Cédric Le Goater 3df2f59f0a hwmon: (ibmpowernv) pretty print labels
The new OPAL device tree adds a few properties which can be used to add
extra information on the sensor label.

In the case of a cpu core sensor, the firmware exposes the physical
identifier of the core in the "ibm,pir" property. The driver
translates this identifier in a linux cpu number and prints out a
range corresponding to the hardware threads of the core (as they
share the same sensor).

The numbering gives a hint on the localization of the core in the
system (which socket, which chip).

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-08 10:34:20 -07:00
Cédric Le Goater 2bcd3787b9 hwmon: (ibmpowernv) add a label attribute
Currently, sensors are only identified by their type and index.

The new OPAL device tree can expose extra properties to identify
some sensors by their name or location. This patch adds the creation
of a new hwmon *_label attribute when such properties are detected.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-08 10:34:20 -07:00
Cédric Le Goater 14681637ab hwmon: (ibmpowernv) add support for the new device tree
The new OPAL device tree for sensors has a different layout and uses new
property names, for the type and for the handler used to capture the
sensor data.

This patch modifies the ibmpowernv driver to support such a tree in a
way preserving compatibility with older OPAL firmwares.

This is achieved by changing the error path of the routine parsing
an OPAL node name. The node is simply considered being from the new
device tree layout and fallback values are used.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-08 10:34:20 -07:00
Cédric Le Goater 9e4f74b119 hwmon: (ibmpowernv) add a helper routine create_hwmon_attr
This should shorten a bit the code necessary to create a hmwon attribute.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-08 10:34:19 -07:00
Guenter Roeck fa3f70d628 hwmon: (it87) Add support for 6th fan of IT8620E
IT8620E supports up to 6 fan tachometers.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-05 06:01:00 -07:00
Guenter Roeck 3ba9d977a9 hwmon: (it87) Add support for IT8620E
IT8620E is mostly compatible to IT7828F. Add generic support for it.

IT8620E supports up to 6 fan tachometers and 6 pwm controls.
Support for the 6th tachometer and for the additional pwm controls
are addded in separate patches.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-05 06:01:00 -07:00
Guenter Roeck 4ee07157d6 hwmon: (it87) Add support for IT8790E
IT8790E is a super-IO chip with three fan tachometers. It is mostly
compatible to IT8728F, but only supports three fan tachometers
instead of five.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-05 06:00:59 -07:00
Guenter Roeck 7f5726c39a hwmon: (it87) Introduce feature flag to reflect internal in7 sensor
On some chips, in7 is always an internal voltage sensor. Introduce
feature flag to reflect this condition to simplify adding support
for new chips.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-05 06:00:52 -07:00
Guenter Roeck faf392fb84 hwmon: (it87) Introduce configuration field for chip suffix
ITE chips may have 'E', 'F', or both 'E' and 'F' suffixes.
Introduce suffic configuration to the it87_devices structure
to simplify adding new chips.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-05 06:00:51 -07:00
Guenter Roeck f56c9c0aa6 hwmon: (it87) Fix PWM frequency display for chips with newer PWM control
On chips with newer PWM control, the PWM frequency divider is 256
instead of 128. Since the base PWM frequency remained the same, the actual
PWM frequency is half of what it used to be with the older PWM control
mechanism.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-05 06:00:42 -07:00
Guenter Roeck 1696d1deb0 hwmon: (it87) Fix pwm sysfs attribute removal
Detection if a pwm channel is supported was wrong on removal,
causing the code to try removing non-existing sysfs attributes.
That didn't matter much because sysfs attribute removal of non-existing
files fails silently, and because the wrong evaluation always returned
false, but should nevertheless be fixed.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-30 08:12:16 -07:00
Cédric Le Goater fcaf57b67d hwmon: (ibmpowernv) do not use the OPAL index for hwmon attribute names
The current OPAL firmware exposes the different sensors of an IBM Power
system using node names such as :

	sensors/amb-temp#1-data
	sensors/amb-temp#1-thrs
	cooling-fan#1-data
	cooling-fan#1-faulted
	cooling-fan#1-thrs
	cooling-fan#2-data
	...

The ibmpowernv driver, when loaded, parses these names to extract the
sensor index and the sensor attribute name. Unfortunately, this scheme
makes it difficult to add sensors with a different layout (specially of
the same type, like temperature) as the sensor index calculated in OPAL
is directly used in the hwmon sysfs interface.

What this patch does is add a independent hwmon index for each sensor.
The increment of the hwmon index (temp, fan, power, etc.) is kept per
sensor type in the sensor_group table. The sensor_data table is used
to store the association of the hwmon and OPAL indexes, as we need to
have the same hwmon index for different attributes of a same sensor.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-20 08:25:14 -07:00
Cédric Le Goater f9f54f16bf hwmon: (ibmpowernv) change create_hwmon_attr_name() prototype
It simplifies the creation of the hwmon attributes and will help when
support for a new device tree layout is added. The patch also changes
the name of the routine to parse_opal_node_name().

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-20 08:25:12 -07:00
Cédric Le Goater ccc9ac6cc9 hwmon: (ibmpowernv) add a convert_opal_attr_name() routine
It simplifies the create_hwmon_attr_name() routine and it clearly isolates
the conversion done between the OPAL node names and hwmon attributes names.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-20 08:25:11 -07:00
Cédric Le Goater c4ad472064 hwmon: (ibmpowernv) add a get_sensor_type() routine
It will help in adding different compatible properties, coming from a
new device tree layout for example.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-20 08:25:10 -07:00
Cédric Le Goater 96124610e9 hwmon: (ibmpowernv) replace AMBIENT_TEMP by TEMP
Ambient is too restrictive as there can be other temperature channels :
core, memory, etc.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-20 08:23:26 -07:00
Fabian Frederick d720acace4 hwmon: (pwm-fan, vexpress) Constify of_device_id array
of_device_id is always used as const.
(See driver.of_match_table and open firmware functions)

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-16 13:00:32 -07:00
Guenter Roeck 25cdd99deb hwmon: (nct6775) Enable auxiliary fan monitoring on ASRock Z77 Pro4-M
Auxiliary fan monitoring is not enabled on ASRock Z77 Pro4-M
with BIOS version 2.00 if booted in UEFI Ultra-FastBoot mode.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-15 08:54:18 -07:00
Guenter Roeck d2a14ea51a hwmon: (nct6775) Restore hardware monitoring logical device status on resume
After a suspend/resume cycle it is not guaranteed that the hardware monitoring
device is still enabled. Ensure that this is the case after resume.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-15 08:54:12 -07:00
Guenter Roeck 48e9318256 hwmon: (nct6775) Convert to use SIMPLE_DEV_PM_OPS
Get rid of #ifdef CONFIG_PM by using SIMPLE_DEV_PM_OPS and declaring suspend
and resume functions with __maybe_unused.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-15 08:54:05 -07:00
Randy Dunlap f6906edeac hwmon: (gpio-fan) Fix build with CONFIG_THERMAL=m and SENSORS_GPIO_FAN=y
Fix build error when CONFIG_THERMAL=m and SENSORS_GPIO_FAN=y
by preventing that combination.

Fixes these build errors:

drivers/built-in.o: In function `gpio_fan_remove':
gpio-fan.c:(.text+0x21e97e): undefined reference to `thermal_cooling_device_unregister'
drivers/built-in.o: In function `gpio_fan_probe':
gpio-fan.c:(.text+0x21efbc): undefined reference to `thermal_cooling_device_register'

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc:	Jean Delvare <jdelvare@suse.de>
Cc:	Guenter Roeck <linux@roeck-us.net>
Cc:	lm-sensors@lm-sensors.org
Cc:	Simon Guinot <sguinot@lacie.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-10 19:13:15 -07:00
Randy Dunlap 18fd303fea hwmon: (pwm-fan) Fix build when THERMAL=m
Fix build errors when CONFIG_THERMAL=m and SENSORS_PWM_FAN=y
by restricting SENSORS_PWM_FAN to 'm' when THERMAL=m.

drivers/built-in.o: In function `pwm_fan_remove':
pwm-fan.c:(.text+0x22ba58): undefined reference to `thermal_cooling_device_unregister'
drivers/built-in.o: In function `pwm_fan_probe':
pwm-fan.c:(.text+0x22bebb): undefined reference to `thermal_of_cooling_device_register'
pwm-fan.c:(.text+0x22bf11): undefined reference to `thermal_cdev_update'

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09 09:59:36 -07:00
Guenter Roeck de52b049d6 hwmon: (pwm-fan) Declare pwm_fan_of_get_cooling_data static
Address the following sparse warnings.

drivers/hwmon/pwm-fan.c:176:5: warning:
	symbol 'pwm_fan_of_get_cooling_data' was not declared. Should it be static?
drivers/hwmon/pwm-fan.c:176:5: warning:
	no previous prototype for 'pwm_fan_of_get_cooling_data'

pwm_fan_of_get_cooling_data is only used in the pwm-fan driver and thus should
be declared static.

Cc: Lukasz Majewski <l.majewski@samsung.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09 09:59:36 -07:00
Nishanth Menon b5cf88e46b (gpio-fan): Add thermal control hooks
Allow gpio-fan to be used as thermal cooling device for platforms that
use GPIO maps to control fans.

As part of this change, we make the shutdown and remove logic the same
as well.

Signed-off-by: Nishanth Menon <nm@ti.com>
Acked-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09 09:59:36 -07:00
Lukasz Majewski b6bddec019 hwmon: (pwm-fan) Add support for using PWM FAN as a cooling device
The PWM FAN device can now be used as a thermal cooling device.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Acked-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09 09:59:36 -07:00
Lukasz Majewski 2e5219c771 hwmon: (pwm-fan) Read PWM FAN configuration from device tree
This patch provides code for reading PWM FAN configuration data via
device tree. The pwm-fan can work with full speed when configuration
is not provided. However, errors are propagated when wrong DT bindings
are found.
Additionally the struct pwm_fan_ctx has been extended.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09 09:59:36 -07:00
Lukasz Majewski cb85ca332f hwmon: (pwm-fan) Extract __set_pwm() function to only modify PWM duty cycle
It was necessary to decouple code handling writing to sysfs from the one
responsible for setting PWM of the fan.
Due to that, new __set_pwm() method was extracted, which is responsible for
only setting new PWM duty cycle.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09 09:59:36 -07:00
Simon Guinot 73ef85f42d hwmon: (gpio-fan) allow to use alarm support alone from DT
On some boards, such as the LaCie 2Big Network v2 or 2Big NAS (based on
Marvell Kirkwood SoCs), an I2C fan controller is used but the alarm
signal is wired to a separate GPIO. Unfortunately, the gpio-fan driver
can't be used to handle GPIO alarm alone from DT: an error is returned
if the "gpios" DT property is missing.

This patch allows to use the gpio-fan driver even if the "alarm-gpios"
DT property is defined alone.

Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09 09:59:36 -07:00
Guenter Roeck 6552f327ca hwmon: (nct7904) Strengthen detect function
The bank register has five unused bits. Verify that those bits are zero
to strengthen the detect function.

Cc: Vadim V. Vlasov <vvlasov@dev.rtsoft.ru>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
2015-03-09 09:59:36 -07:00
Vadim V. Vlasov 9c947d25c9 hwmon: Add Nuvoton NCT7904 hwmon driver
The NCT7904D is a hardware monitor supporting up to 20 voltage sensors,
internal temperature sensor, Intel PECI and AMD SB-TSI CPU temperature
interface, up to 12 fan tachometer inputs, up to 4 fan control channels
with SmartFan.

Signed-off-by: Vadim V. Vlasov <vvlasov@dev.rtsoft.ru>
[Guenter Roeck: Fixed whitespace errors, dropped redundant comment]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09 09:59:36 -07:00
Guenter Roeck e8433b42b6 hwmon: (it87) No need to skip fan4 for IT8603
IT8603 only supports three fans, so it is not necessary to skip fan4.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09 09:59:36 -07:00
Thomas Lorblanches a0c1424acb hwmon: (it87) Add support for IT8786E
IT8786E is mostly compatible with IT8771 / IT8772.
Parameters determined by testing various combinations.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Thomas Lorblanches <zlika_ese@hotmail.com>
[Guenter Roeck: merged from github, addressed review comments]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09 09:59:36 -07:00
Guenter Roeck 32dd7c409d hwmon: (it87) Add feature flag for VID support
Newer chips don't typically support VID inputs or control.
Add a feature flag for VID support to simplify adding support for
new chips.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09 09:59:36 -07:00
Guenter Roeck 9faf28ca4b hwmon: (it87) Add feature flags for fans count and 16-bit fan configuration
Fans 4-5 are not supported on all chips and revisions. Also, 16-bit fan
counters are always enabled on some chips. Provide feature flags to
simplify adding support for new chips.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09 09:59:35 -07:00
Guenter Roeck fd044868e8 hwmon: (it87) Don't configure 16 bit fan counters it not necessary
On IT8728F, IT8771E, and IT8772E, fans counters are always 16 bit
and don't need to be configured for it.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09 09:59:35 -07:00
Guenter Roeck 0ea2f1db8e hwmon: (jc42) Add support for additional IDT temperature sensors
TS3000GB0 has a new device ID (0x2913). Since IDT's datasheets suggest
that the upper 8 bit of the device ID reflect the chip ID and the lower
8 bit reflect the version number, modify the code to accept all chips
with ID 0x29xx.

Also add support for TS3001 and TSE2004.

Some of the datasheets for older chips are no longer available from
the IDT web site, so replace explicit links in the documentation with
a generic note.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09 09:59:35 -07:00
Guenter Roeck 7bc32d298b hwmon: (it87) Add support for IT8781F
IT8781F is mostly compatible to IT8782F. Major difference is that it only
supports four instead of six UART channels, and therefore does not share
the uart6 pins.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09 09:59:35 -07:00
Rasmus Villemoes a0fc74d42d hwmon: (ibmpex) Allow format string checking
The only difference between the three power_sensor_name_templates is
whether there is a suffix of "", "_lowest" or "_highest". We might as
well pull those into an array and use a literal format string,
allowing gcc to do type checking of the arguments to
sprintf. Incidentially, the same three suffixes are used in the
temp_sensor_name_templates case, so we end up eliminating one static
array.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
[Guenter Roeck: Fixed line length over 80 characters]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09 09:59:35 -07:00
Rasmus Villemoes 1055b5f904 hwmon: (coretemp) Allow format checking
By extracting the only part that differs we can allow static checking
of the format string, and possibly save a little .rodata.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
[Guenter Roeck: continuation line alignment]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09 09:59:35 -07:00
Axel Lin d9ef72cd1c hwmon: (ads7828) Check return value of devm_regmap_init_i2c
devm_regmap_init_i2c() can fail, thus add return value checking.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-02-22 20:10:30 -08:00
Linus Torvalds b11a278397 Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kconfig updates from Michal Marek:
 "Yann E Morin was supposed to take over kconfig maintainership, but
  this hasn't happened.  So I'm sending a few kconfig patches that I
  collected:

   - Fix for missing va_end in kconfig
   - merge_config.sh displays used if given too few arguments
   - s/boolean/bool/ in Kconfig files for consistency, with the plan to
     only support bool in the future"

* 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
  kconfig: use va_end to match corresponding va_start
  merge_config.sh: Display usage if given too few arguments
  kconfig: use bool instead of boolean for type definition attributes
2015-02-19 10:36:45 -08:00
Grygorii Strashko dd378b1bca hwmon: (tmp102) add hibernation callbacks
Setting a dev_pm_ops suspend/resume pair but not a set of
hibernation functions means those pm functions will not be
called upon hibernation.
Fix this by using SIMPLE_DEV_PM_OPS, which appropriately
assigns the suspend and hibernation handlers and move
mp102_suspend/tmp102_resume under CONFIG_PM_SLEEP to avoid
build warnings.

Signed-off-by: Grygorii Strashko <Grygorii.Strashko@linaro.org>
[groeck: Declare tmp102_dev_pm_ops as static variable]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-02-03 12:17:12 -08:00
Guenter Roeck 7f444bf0a2 hwmon: (ads2828) Only keep data in device data structure if needed
The variables diff_input, ext_vref, and vref_mv are only used in the probe
function and therefore don't need to be kept in the device data structure.

Reviewed-and-Tested-by: Robert Rosengren <robert.rosengren@axis.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-02-02 08:20:06 -08:00
Guenter Roeck bea0bab0fc hwmon: (ads2828) Convert to use regmap
Simplify code and reduce code size by using regmap to access i2c registers.

Reviewed-and-Tested-by: Robert Rosengren <robert.rosengren@axis.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-02-02 08:19:58 -08:00
Jean Delvare 9130880a1c hwmon: (jc42) Allow negative hysteresis temperatures
The driver supports negative high and critical limits, it can return
negative hysteresis values, so there is no good reason to not let the
user write negative hysteresis values.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-01-25 21:24:00 -08:00
Rasmus Villemoes 2c3b1189fd hwmon: (adc128d818) Do proper sign extension
data->temp[index] has type s16. Because of C's promotion rules,
(data->temp[index] << 7) >> 7 is exactly the same as
data->temp[index]. The intention was to use bit 8 as a sign bit, so do
that using the existing API.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-01-25 21:24:00 -08:00
Rasmus Villemoes 984faa1fb9 hwmon: (ad7314) Do proper sign extension
The comment above (data << 2) >> 2 explains what the intention is: To
use bit 13 of the 14-bit value data as the sign bit. However, this
doesn't work due to C's promotion rules. data has type s16, but data
<< 2 has type int. To get sign extension, that expression would have
to be cast back to an s16 before being shifted (at which point C's
promotion rules would then kick in again and promote the left operand
to int). As it stands, both expressions are no-ops for any value of
data.

Avoid these subtleties by using the existing API for
this. sign_extend32 works equally well for 8 and 16 bit types.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-01-25 21:23:59 -08:00
Asaf Vertz a14c70729c hwmon: (abx500) Fix format string warnings
Fixed the following warnings (reported by cppcheck):
[drivers/hwmon/abx500.c:224]: (warning) %ld in format string (no. 1)
requires 'long' but the argument type is 'unsigned long'.
[drivers/hwmon/abx500.c:233]: (warning) %ld in format string (no. 1)
requires 'long' but the argument type is 'unsigned long'.
[drivers/hwmon/abx500.c:242]: (warning) %ld in format string (no. 1)
requires 'long' but the argument type is 'unsigned long'.

Signed-off-by: Asaf Vertz <asaf.vertz@tandemg.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-01-25 21:23:59 -08:00
Guenter Roeck e2c26f058e hwmon: (jc42) Fix integer overflow when writing hysteresis value
Subtracting an unsigned long from a signed value causes an overflow with large
values. Use clamp_val() to reduce the number range prior to subtracting it
from the temperature limit.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
2015-01-25 21:23:59 -08:00
Guenter Roeck 3a05633b04 hwmon: (jc42) Fix integer overflow
Mixed use of long and int caused an integer overflow when writing large limits.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
2015-01-25 21:23:59 -08:00
Guenter Roeck bca6a1ada0 hwmon: (jc42) Use sign_extend32 for sign extension
Despite the name, sign_extend32 works just fine for 16 bit variables,
so it is safe to use.

Cc: Martin Kepplinger <martink@posteo.de>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-01-25 21:23:59 -08:00
Kevin Hilman add513be1c hwmon: (ina2xx) Add ina231 compatible string
Add support for "ina231" as compatible string, and update
Documentation and Kconfig accordingly.

Tested with the Exynos5422-based odroid-xu3 board which has on-board
INA231 sensors.

Signed-off-by: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-01-25 21:23:59 -08:00
Bartosz Golaszewski b721fe2a3a hwmon: (ina2xx) use DIV_ROUND_CLOSEST() to avoid rounding errors
Use DIV_ROUND_CLOSEST() when dealing with the calibration values to make the
calculations less error prone.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-01-25 21:23:59 -08:00
Bartosz Golaszewski 71eb7c4c7e hwmon: (ina2xx) remove an unnecessary dev_get_drvdata() result check
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-01-25 21:23:59 -08:00
Bartosz Golaszewski 72a87a47a8 hwmon: (ina2xx) implement update_interval attribute for ina226
This attribute allows to configure the update interval of ina226. Although
the bus and shunt voltage conversion times remain hardcoded to 1.1 ms, we can
now modify said interval by changing the averaging rate.

While we're at it - add an additional variable to ina2xx_data, which holds
the current configuration settings - this way we'll be able to restore the
configuration in case of an unexpected chip reset.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-01-25 21:23:59 -08:00
Bartosz Golaszewski 8a5fc79513 hwmon: (ina2xx) make shunt resistance configurable at run-time
The shunt resistance can only be set via platform_data or device tree. This
isn't suitable for devices in which the shunt resistance can change/isn't
known at boot-time.

Add a sysfs attribute that allows to read and set the shunt resistance.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-01-25 21:23:59 -08:00
Bartosz Golaszewski e794704000 hwmon: (ina2xx) don't accept shunt values greater than the calibration factor
Shunt resistance values greater than the chip's calibration factor make no
sense since the actual value written to the register equals:

	<calibration factor> / <shunt>

Bail-out from ina2xx_probe() if the configured value is greater than the
calibration factor.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-01-25 21:23:59 -08:00
Bartosz Golaszewski f4fe902717 hwmon: (ina2xx) remove a stray new line
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-01-25 21:23:59 -08:00
Bartosz Golaszewski 509416a8e7 hwmon: (ina2xx) reinitialize the chip in case it's been reset
Chips from the ina family don't like to be uninitialized. In case the power
is cut-off and restored again the calibration register will be reset
to 0 and both the power and current registers will remain at 0.

Check the calibration register in ina2xx_update_device() and reinitialize
the chip if needed.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-01-25 21:23:58 -08:00
Krzysztof Kozlowski 3c535bca9a hwmon: (nct7802) Constify struct regmap_config
The regmap_config struct may be const because it is not modified by the
driver and regmap_init() accepts pointer to const.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-01-25 21:23:58 -08:00
Axel Lin 86c725e3c5 hwmon: (i5500_temp) Convert to use ATTRIBUTE_GROUPS macro
Use ATTRIBUTE_GROUPS macro to simplify the code a bit.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
2015-01-24 14:16:22 +01:00
Axel Lin aef64d0d38 hwmon: (i5500_temp) Convert to module_pci_driver
Use module_pci_driver to simplify the code a bit.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
2015-01-24 14:16:22 +01:00
Jean Delvare e3d982034d hwmon: (i5500_temp) Don't bind to disabled sensors
On many motherboards, for an unknown reason, the thermal sensor seems
to be disabled and will return a constant temperature value of 36.5
degrees Celsius. Don't bind to the device in that case, so that we
don't report this bogus value to userspace.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Romain Dolbeau <romain@dolbeau.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
2015-01-24 14:16:21 +01:00
Jean Delvare b8d48ce951 hwmon: (i5500_temp) Convert to devm_hwmon_device_register_with_groups
Use devm_hwmon_device_register_with_groups() to simplify the code a
bit.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Romain Dolbeau <romain@dolbeau.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
2015-01-24 14:16:21 +01:00
Jean Delvare ada072816b hwmon: (i5500_temp) New driver for the Intel 5500/5520/X58 chipsets
The Intel 5500, 5520 and X58 chipsets embed a digital thermal sensor.
This new driver supports it.

Note that on many boards the sensor seems to be disabled and reports
the minimum value (36.5 degrees Celsius) all the time.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Tested-by: Romain Dolbeau <romain@dolbeau.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
2015-01-24 14:16:21 +01:00
Christoph Jaeger 6341e62b21 kconfig: use bool instead of boolean for type definition attributes
Support for keyword 'boolean' will be dropped later on.

No functional change.

Reference: http://lkml.kernel.org/r/cover.1418003065.git.cj@linux.com
Signed-off-by: Christoph Jaeger <cj@linux.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-01-07 13:08:04 +01:00
Linus Torvalds 2efda9042d Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal management update from Zhang Rui:
 "Summary:

   - of-thermal extension to allow drivers to register and use its
     functionality in a better way, without exploiting thermal core.
     From Lukasz Majewski.

   - Fix a bug in intel_soc_dts_thermal driver which calls a sleep
     function in interrupt handler.  From Maurice Petallo.

   - add a thermal UAPI header file for exporting the thermal generic
     netlink information to user-space.  From Florian Fainelli.

   - First round of refactoring in Exynos driver.  Bartlomiej and Lukasz
     are attempting to make it lean and easier to understand.

   - New thermal driver for Rockchip (rk3288), with support for DT
     thermal.  From Caesar Wang.

   - New thermal driver for Nvidia, Tegra124 SOCTHERM driver, with
     support for DT thermal.  From Mikko Perttunen.

   - New cooling device, based on common clock framework.  From Eduardo
     Valentin.

   - a couple of small fixes in thermal core framework.  From Srinivas
     Pandruvada, Javi Merino, Luis Henriques.

   - Dropping Armada A375-Z1 SoC thermal support as the chip is not in
     the market, armada folks decided to drop its support.

   - a couple of small fixes and cleanups in int340x thermal driver"

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (58 commits)
  thermal: provide an UAPI header file
  Thermal/int340x: Clear the error value of the last acpi_bus_get_device() call
  thermal/powerclamp: add id for braswell cpu
  thermal: Intel SoC DTS: Don't do thermal zone update inside spin_lock
  Thermal: fix platform_no_drv_owner.cocci warnings
  Thermal/int340x: avoid unnecessary pointer casting
  thermal: int3403: Delete a check before thermal_zone_device_unregister()
  thermal/int3400: export uuids
  thermal: of: Extend current of-thermal.c code to allow setting emulated temp
  thermal: of: Extend of-thermal to export table of trip points
  thermal: of: Rename struct __thermal_trip to struct thermal_trip
  thermal: of: Extend of-thermal.c to provide check if trip point is valid
  thermal: of: Extend of-thermal.c to provide number of trip points
  thermal: Fix error path in thermal_init()
  thermal: lock the thermal zone when switching governors
  thermal: core: ignore invalid trip temperature
  thermal: armada: Remove support for A375-Z1 SoC
  thermal: rockchip: add driver for thermal
  dt-bindings: document Rockchip thermal
  thermal: exynos: remove exynos_tmu_data.h include
  ...
2014-12-17 10:16:27 -08:00
Linus Torvalds e6b5be2be4 Driver core patches for 3.19-rc1
Here's the set of driver core patches for 3.19-rc1.
 
 They are dominated by the removal of the .owner field in platform
 drivers.  They touch a lot of files, but they are "simple" changes, just
 removing a line in a structure.
 
 Other than that, a few minor driver core and debugfs changes.  There are
 some ath9k patches coming in through this tree that have been acked by
 the wireless maintainers as they relied on the debugfs changes.
 
 Everything has been in linux-next for a while.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlSOD20ACgkQMUfUDdst+ylLPACg2QrW1oHhdTMT9WI8jihlHVRM
 53kAoLeteByQ3iVwWurwwseRPiWa8+MI
 =OVRS
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core update from Greg KH:
 "Here's the set of driver core patches for 3.19-rc1.

  They are dominated by the removal of the .owner field in platform
  drivers.  They touch a lot of files, but they are "simple" changes,
  just removing a line in a structure.

  Other than that, a few minor driver core and debugfs changes.  There
  are some ath9k patches coming in through this tree that have been
  acked by the wireless maintainers as they relied on the debugfs
  changes.

  Everything has been in linux-next for a while"

* tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits)
  Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries"
  fs: debugfs: add forward declaration for struct device type
  firmware class: Deletion of an unnecessary check before the function call "vunmap"
  firmware loader: fix hung task warning dump
  devcoredump: provide a one-way disable function
  device: Add dev_<level>_once variants
  ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries
  ath: use seq_file api for ath9k debugfs files
  debugfs: add helper function to create device related seq_file
  drivers/base: cacheinfo: remove noisy error boot message
  Revert "core: platform: add warning if driver has no owner"
  drivers: base: support cpu cache information interface to userspace via sysfs
  drivers: base: add cpu_device_create to support per-cpu devices
  topology: replace custom attribute macros with standard DEVICE_ATTR*
  cpumask: factor out show_cpumap into separate helper function
  driver core: Fix unbalanced device reference in drivers_probe
  driver core: fix race with userland in device_add()
  sysfs/kernfs: make read requests on pre-alloc files use the buffer.
  sysfs/kernfs: allow attributes to request write buffer be pre-allocated.
  fs: sysfs: return EGBIG on write if offset is larger than file size
  ...
2014-12-14 16:10:09 -08:00
Zhang Rui 9c1e4550b5 Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal into eduardo-soc-thermal 2014-12-09 11:37:35 +08:00
Guenter Roeck 907a6d5824 hwmon: (tmp401) Detect TMP435 on all addresses it supports
TMP435 supports a range of I2C addresses, not just 0x4c.

Cc: Patrick Titiano <ptitiano@baylibre.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-12-08 06:48:37 -08:00
Guenter Roeck 4ad40cc568 hwmon: (lm75) Strengthen detect function
A chip returning 0x00 in all registers is erroneously detected
as LM75. Check hysteresis and temperature limit registers and
abort if both are 0 to reduce the likelyhood for this to happen.

Reviewed-by: Rob Coulson <rob.coulson@gmail.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-12-05 10:18:02 -08:00
Nishanth Menon b95579cd87 hwmon: (gpio-fan) Add a shutdown handler to poweroff the fans
Poweroff the fans when shutting down the system. Else,
echo '1' > /sys/class/hwmon/hwmon0/fan1_target; poweroff leaves the
fan running if the System power off does not drive the gpio expander
which might control the fan power supply.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-12-04 11:04:14 -08:00
Nishanth Menon 52a95c1185 hwmon: (gpio-fan) Allow usage of gpio operations that may sleep
Certain I2C based GPIO expanders could be used in sleepable context,
this results in:
[  115.890569] ------------[ cut here ]------------
[  115.895422] WARNING: CPU: 0 PID: 1115 at drivers/gpio/gpiolib.c:1370 gpiod_set_raw_value+0x40/0x4c()
[  115.905024] Modules linked in:
[  115.908229] CPU: 0 PID: 1115 Comm: sh Tainted: G        W      3.18.0-rc7-next-20141203-dirty #1
[  115.917461] Hardware name: Generic DRA74X (Flattened Device Tree)
[  115.923876] [<c0015368>] (unwind_backtrace) from [<c00119f4>] (show_stack+0x10/0x14)
[  115.932013] [<c00119f4>] (show_stack) from [<c05b78e8>] (dump_stack+0x78/0x94)
[  115.939594] [<c05b78e8>] (dump_stack) from [<c003de28>] (warn_slowpath_common+0x7c/0xb4)
[  115.948094] [<c003de28>] (warn_slowpath_common) from [<c003de7c>] (warn_slowpath_null+0x1c/0x24)
[  115.957315] [<c003de7c>] (warn_slowpath_null) from [<c03461e8>] (gpiod_set_raw_value+0x40/0x4c)
[  115.966457] [<c03461e8>] (gpiod_set_raw_value) from [<c04866f4>] (set_fan_speed+0x4c/0x64)
[  115.975145] [<c04866f4>] (set_fan_speed) from [<c04868a8>] (set_rpm+0x98/0xac)
[  115.982742] [<c04868a8>] (set_rpm) from [<c039fb4c>] (dev_attr_store+0x18/0x24)
[  115.990426] [<c039fb4c>] (dev_attr_store) from [<c01b0a28>] (sysfs_kf_write+0x4c/0x50)
[  115.998742] [<c01b0a28>] (sysfs_kf_write) from [<c01afe1c>] (kernfs_fop_write+0xbc/0x19c)
[  116.007333] [<c01afe1c>] (kernfs_fop_write) from [<c0148cc4>] (vfs_write+0xb0/0x1a0)
[  116.015461] [<c0148cc4>] (vfs_write) from [<c0148fbc>] (SyS_write+0x44/0x84)
[  116.022881] [<c0148fbc>] (SyS_write) from [<c000e5c0>] (ret_fast_syscall+0x0/0x48)
[  116.030833] ---[ end trace 3a0b636123acab82 ]---

So, switch over to sleepable GPIO operations as there is no mandatory
need for non-sleepable gpio operations in the fan driver.

This allows the fan driver to be used with i2c based gpio expanders such
as palmas_gpio.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-12-04 11:04:11 -08:00
Bartosz Golaszewski 90652efeba hwmon: (tmp401) Bail out from tmp401_probe() in case of write errors
The return value of i2c_smbus_read_byte_data() is checked in
tmp401_init_client(), but only a warning is printed and the device is
registered anyway. This leads to devices being registered even if they
cannot be physically detected.

Bail out from probe in case of write errors and notify the user.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-12-04 11:00:44 -08:00
Patrick Titiano 06adbaec2a hwmon: (tmp401) Add support for TI TMP435
Signed-off-by: Patrick Titiano <ptitiano@baylibre.com>
[Bartosz Golaszewski: prepared for submission, code review fixes]
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
[Guenter Roeck: Merged two patches into one]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-12-04 10:59:42 -08:00
Guenter Roeck dfcd4c53be hwmon: (lm95234) Add support for LM95233
LM95233 is similar to LM95234, but it only supports two
instead of four external temperature sensors.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-12-02 06:11:53 -08:00
Guenter Roeck 162a8dfe73 hwmon: (lm95245) Add support for LM95235
LM95235 is register compatible to LM95245.

Also update link to LM95245 data sheet, and drop the link to the
datasheet from the driver source to simplify code maintenance.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-12-02 03:44:18 -08:00
Bartosz Golaszewski f975b3399c hwmon: (ina2xx) bail-out from ina2xx_probe() in case of configuration errors
The return value of i2c_smbus_write_word_swapped() isn't checked in
ina2xx_probe(). This leads to devices being registered even if they cannot
be physically detected (e.g. device is not powered-up at boot-time).

Even after restoring power to such device, it is left unconfigured as the
configuration has never been actually written to the register.

Error out in case of write errors in probe and notify the user.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
[Guenter Roeck: Fixed multi-line comment style]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-11-30 20:13:14 -08:00
Guenter Roeck 9cd892bcbe hwmon: (nct6775) Add blank lines after declarations
checkpatch complains about
	WARNING: Missing a blank line after declarations

Add missing blank lines. Also reorder variables length-wise where appropriate
if a function header is touched anyway.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-11-30 20:13:14 -08:00
Guenter Roeck 8aefb93f09 hwmon: (nct6775) Add support for NCT6792D
NCT6792D is similar to NCT6791D. Only beep control and temperature
monitoring registers are different.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-11-30 20:13:13 -08:00
Michael Thalmeier 799fc60214 hwmon: (lm75) Add support for the NXP LM75B
It is basically a faster lm75 with improved (11 bit) resolution.

Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-11-30 20:13:13 -08:00
Guenter Roeck 3434f37835 hwmon: Driver for Nuvoton NCT7802Y
NCT7802Y is an I2C based hardware monitoring chip from Nuvoton.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-11-30 20:13:13 -08:00
Axel Lin 3bdec670df hwmon: (ibmpowernv) Convert to module_platform_driver
Use module_platform_driver to simplify the code a bit.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-11-30 20:13:13 -08:00
Neelesh Gupta 8de303bae4 hwmon: (ibmpowernv) Use platform 'id_table' to probe the device
The current driver probe() function assumes the sensor device to be
always present and gets executed every time if the driver is loaded,
but the appropriate hardware could not be present.

So, move the platform device creation as part of platform init code
and use the 'id_table' to check if the device is present or not.

Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-11-30 20:13:13 -08:00
Guenter Roeck 61bb53bcbd hwmon: (iio_hwmon) Add support for humidity sensors
The iio subsystem supports humidity sensors, so it makes sense
to support it in the iio-hwmon bridge as well.

Cc: Jonathan Cameron <jic23@kernel.org>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-11-30 20:13:13 -08:00
Alan Tull 77aa358580 hwmon: (ltc2978) Add regulator support
Add simple on/off regulator support for ltc2978 and
other pmbus parts supported by the ltc2978 driver.

Signed-off-by: Alan Tull <atull@opensource.altera.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-11-30 20:13:13 -08:00
Alan Tull ddbb4db4ce hwmon: (pmbus) Add regulator support
Add support for simple on/off control of each channel.

To add regulator support, the pmbus part driver needs to add
regulator_desc information and number of regulators to its
pmbus_driver_info struct.

regulator_desc can be declared using default macro for a
regulator (PMBUS_REGULATOR) that is in pmbus.h

The regulator_init_data can be initialized from either
platform data or the device tree.

Signed-off-by: Alan Tull <atull@opensource.altera.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-11-30 20:13:13 -08:00
Alan Tull 11c119986f hwmon: (pmbus) add helpers for byte write and read modify write
Add two helper functions:
 * pmbus_write_byte_data  = paged byte write
 * pmbus_update_byte_data = paged byte read/modify/write

Signed-off-by: Alan Tull <atull@opensource.altera.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-11-30 20:13:13 -08:00
Eduardo Valentin 2251aef64a thermal: of: improve of-thermal sensor registration API
Different drivers request API extensions in of-thermal. For this reason,
additional callbacks are required to fit the new drivers needs.

The current API implementation expects the registering sensor driver
to provide a get_temp and get_trend callbacks as function parameters.
As the amount of callbacks is growing, this patch changes the existing
implementation to use a .ops field to hold all the of thermal callbacks
to sensor drivers.

This patch also changes the existing of-thermal users to fit the new
API design. No functional change is introduced in this patch.

Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: devicetree@vger.kernel.org
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Jean Delvare <jdelvare@suse.de>
Cc: linux-kernel@vger.kernel.org
Cc: linux-pm@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
Cc: lm-sensors@lm-sensors.org
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Mikko Perttunen <mikko.perttunen@kapsi.fi>
Reviewed-by: Mikko Perttunen <mikko.perttunen@kapsi.fi>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-11-20 10:44:54 -04:00
Arnaud Ebalard 6b19b66013 hwmon: (g762) fix call to devm_hwmon_device_register_with_groups()
g762_remove() needs to first call hwmon_device_unregister() and then
g762_of_clock_disable(). For that reason, it is not possible to
convert it to devm_hwmon_device_register_with_groups() and the
the non device managed version must be used.

This is correctly stated in commit message for 398e16db62 ("hwmon:
(g762) Convert to hwmon_device_register_with_groups") but the
associated changes do in fact introduce a call to the device managed
version of the function.

This patch fixes that typo by switching to the non devm_ version.

Fixes: 398e16db62 ("hwmon: (g762) Convert to hwmon_device_register_with_groups")
Cc: stable@vger.kernel.org (3.17+)
Signed-off-by: Arnaud Ebalard <arno@natisbad.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-11-19 14:06:47 -08:00
Aravind Gopalakrishnan 0bd5294158 hwmon: (fam15h_power) Fix NB device ID for F16h M30h
F3 device ID is wrongly included in fam15h_power_id_table
for F16h M30h. It should be F4 device ID. Fix this.

Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-11-11 10:39:45 -08:00
Kamil Debski 48b9d5b4f4 hwmon: (pwm-fan) Fix suspend/resume behavior
The state of a PWM output is not clearly defined after resume. Some PWM
drivers do not restore the duty cycle upon resume, thus it is necessary to
manually restore the correct value.

Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-11-11 10:39:45 -08:00
Michael Ellerman aab18da44f hwmon: (ibmpowernv) Quieten when probing finds no device
Because we build kernels with drivers built in for many platforms, it's
normal for the ibmpowernv driver to be loaded on systems that don't have
the appropriate hardware.

Currently the driver spams the log with:

  ibmpowernv ibmpowernv.0: Opal node 'sensors' not found
  ibmpowernv: Platfrom driver probe failed

But there is no error, this machine is not a powernv and doesn't have
the hardware. So change the sensors message to dev_dbg(), and only print
an error about the probe failing if it's not ENODEV.

Also fix the spelling of "Platfrom" and print the actual error value.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-11-11 10:39:45 -08:00
Greg Kroah-Hartman a8a93c6f99 Merge branch 'platform/remove_owner' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux into driver-core-next
Remove all .owner fields from platform drivers
2014-11-03 19:53:56 -08:00
Wolfram Sang 2a1ed07718 hwmon: drop owner assignment from platform_drivers
A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-10-20 16:20:36 +02:00
Johannes Thumshirn 3d5960472d hwmon: (menf21bmc) Include linux/err.h
Include linux/err.h to get the definitions for IS_ERR() PTR_ERR() and
ERR_PTR() used in the driver.

This fixes compilation on powerpc targets.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-10-19 18:41:18 -07:00
Guenter Roeck 3afb57fa72 hwmon: (ab8500) Call kernel_power_off instead of pm_power_off
Drivers should not call pm_power_off directly; it is not guaranteed
to be non-NULL. Call kernel_power_off instead.

Cc: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-10-03 08:19:02 -07:00
Guenter Roeck 7ad8966f4f Immutable branch between MFD, HWMON, LEDs and Watchdog for v3.18
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJUItc7AAoJEFGvii+H/HdhxTEP/A0Gg35acsBa8JPWUGuTcGTi
 GHDdnDh1sJtJWadKhs+JV9tOX80YY/5OaHr0TKXcb0eAZopqG4G4yyJXmju+rkFn
 sp4nQ4QzM8gNzmVpo6K45xdZw913QQbVcwDThnZwq1xMHVvMT2TFZ+PQLXZ2e2kN
 HRs65Ftw9geNlZ6cLSXPa+fmhbhC90izXRYB/+eSv9LfxJkARVBtRwVkjLnbe52h
 V7gm/sqcdLs4S0Iauv3qPCjmNCtLWjzJsjq+umiEmmwRvWXGHcLWxCSbmrMsi075
 VmMTY1G+ys2OaNo4wpMEx3s2+Cg/dxyMKfuJn3Zz+Wk196v4UaQWFKBfH8IcjcuJ
 zKy9RntFZ6Esut/PeaMlk7nlgkSXOEbQZFcMDhn8LFwL8LzVDUIMtmcIEsfwHfme
 SWGt6lYUkeSC0yxdylYtIvAKVhkSInkg0z7YiChB0eHflBgWsNn4r8v5iGk9yAXu
 keR9sQlXKS2gFbMtZ8e+VgNVqPmapJx+1E1F5/JbjVpiQG+fzsleHi9UF91pyLJL
 IGZM51l2FEMBMuKSNEUy+mcLX4Y/63iEg3fGvv5nX52A0MVrL47ADDJSEoaZoUpg
 Yz3AW/+yYKi5cmcZ7sUirrCHawvfIYGeR1jZjYaIk8lAeqjFHTDzayIXUoOoQfN7
 vi+fRCxYLA/Z/Rnfylmt
 =keMM
 -----END PGP SIGNATURE-----

Merge tag 'mfd-hwmon-leds-watchdog-v3.18' into hwmon-next

Immutable branch between MFD, HWMON, LEDs and Watchdog for v3.18
2014-09-24 09:25:06 -07:00
Andreas Werner 964356938f hwmon: (menf21bmc) Introduce MEN14F021P00 BMC HWMON driver
Added driver to support the 14F021P00 BMC Hardware Monitoring.
The BMC is a Board Management Controller including monitoring of the
board voltages.

Signed-off-by: Andreas Werner <andreas.werner@men.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-09-24 15:36:33 +01:00
Jonghwa Lee c08860ffe5 hwmon: (ntc_thermistor) Add ntc thermistor to thermal subsystem as a sensor.
To get more comprehensive and integrated thermal management, it adds ntc
thermistor to thermal framework as a thermal sensor. It's governed thermal
susbsystem only if it is described in DT node. Otherwise, it just notifies
temperature to userspace via sysfs as it used to be.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-09-22 11:14:52 -07:00
Axel Lin 9b993e3661 hwmon: (smsc47b397) Convert to devm_hwmon_device_register_with_groups
Use ATTRIBUTE_GROUPS macro and devm_hwmon_device_register_with_groups() to
simplify the code a bit.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-09-22 11:14:52 -07:00
Guenter Roeck 3e3e102251 hwmon: (k10temp) Convert to devm_hwmon_device_register_with_groups
Use devm_hwmon_device_register_with_groups() to simplify the code
and reduce code size.

Cc: Clemens Ladisch <clemens@ladisch.de>
Tested-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-09-22 11:14:52 -07:00
Aravind Gopalakrishnan f89ce2706d hwmon: (k10temp) Add support for F15h M60h
This patch adds temperature monitoring support for F15h M60h processor.
 - Add new pci device id for the relevant processor
 - The functionality of REG_REPORTED_TEMPERATURE is moved to
   D0F0xBC_xD820_0CA4 [Reported Temperature Control]
   - So, use this to get CUR_TEMP value
   - Since we need an indirect register access, protect this with
     a mutex lock
 - Add Kconfig, Doc entries to indicate support for this processor.

Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>
Acked-by: Borislav Petkov <bp@suse.de>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
[Guenter Roeck: Declare new mutex and function static]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-09-22 11:14:52 -07:00
Axel Lin 4222eb5f2b hwmon: (da9052) Convert to devm_hwmon_device_register_with_groups
Use ATTRIBUTE_GROUPS macro and devm_hwmon_device_register_with_groups() to
simplify the code a bit.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-09-22 11:14:52 -07:00
Axel Lin e7d275e761 hwmon: (da9055) Convert to devm_hwmon_device_register_with_groups
Use ATTRIBUTE_GROUPS macro and devm_hwmon_device_register_with_groups() to
simplify the code a bit.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-09-22 11:14:51 -07:00
Axel Lin 8e35762fd5 hwmon: (ads1015) Use of_property_read_u32 at appropriate places
Simplify the code a bit and also improve readability.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-09-22 11:14:51 -07:00
sundarjdev 4e66cd13ff hwmon: (tmp103) Fix resource leak bug in tmp103 temperature sensor driver
tmp103 temperature sensor driver registers with the hwmon framework by calling
hwmon_device_register_with_groups but does not have a .remove method to call
hwmon_device_unregister to unregister from the framework when the device is no
longer needed. Fix this by calling devm_hwmon_device_register_with_groups.

Signed-off-by: Sundar J Dev <sundarjayakumardev@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-09-22 11:11:48 -07:00
Aravind Gopalakrishnan 0a0039ad54 hwmon: (fam15h_power) Add support for two more processors
Fam16h,M30h(Mullins) and Fam15hM30h(Kaveri) processors can
report 'power_crit' value. So, adding their respective device ids.

Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-09-16 21:16:26 -07:00