Commit graph

2701 commits

Author SHA1 Message Date
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
Aravind Gopalakrishnan 961a23788c hwmon: (fam15h_power) Make actual power reporting conditional
power1_input should only be reported for Fam15h, Models 00h-0fh
So, introduce a is_visible function to take care of this.

As suggested by Guenter here:
http://marc.info/?l=linux-kernel&m=141038145616437&w=2

Suggested-by: Guenter Roeck <linux@roeck-us.net>
Fixes: 22e32f4f57 ('x86,AMD: Power driver support for AMD's family 16h processors')
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
Robert Coulson 39c627a084 hwmon: (ds1621) Update zbits after conversion rate change
After the conversion rate is changed, the zbits are not updated,
but should be, since they are used later in the set_temp function.

Fixes: a50d9a4d9a ("hwmon: (ds1621) Fix temperature rounding operations")
Reported-by: Murat Ilsever <murat.ilsever@gmail.com>
Signed-off-by: Robert Coulson <rob.coulson@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-08-28 11:18:47 -07:00
Linus Torvalds 82f05a08e2 Several bug fixes in various drivers, plus a minor cleanup
in the tmp103 driver.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJT58gRAAoJEMsfJm/On5mBYtcP/11hy4O5Y/yysdHLYrp1NTrF
 kMAhdtwLop2s7QfiLupfENTzxdJ53UoLHmM0hVb+UFUmIOEQ8JKvFY9j833cooJY
 KJpW3Bn7CH4i2e2h7JkaVnnZa9Mb7zqyWBlt6Ag3ei/2yNELUEUedgca2wW8127u
 8Lm0lGQyXoN1A1sywrHbVnxNLDevCjz/1MnwwQdrn6BWO3ARacwebOuT3i8aet+j
 +HyG3HEYEiLw7wAh3leXJ7Hmz1a81fpXabZMdSRDOJq8e6RQ3x2qTr03lQpwtPnA
 xhItL5QGvx8hfmslHJUMgok2/YEMEpyF9eD3pHHtJeJV4tUxOwiEvQv1OV2Mzvse
 x9DpEgcgx2VJ4KeYcjxkIHOd4wsbKJBVvYhVtbk0l3KjUXEF1Tkl3OcZcTDnz+gO
 2oPNIOtr6Np7co5LCvd+KTJag9ClBOeKkvDd7KCZLgPfIxzvpKlU7W1+BegNcrCs
 042r4WI+oN/bFRvcYrqVzCPAbaDzOZ2XN4dwayEDwBYxXXZZw0NOYlgy6w/XMbpY
 H+t+g+hV5a+Z2ggOQFprftc3NdXAj3vhlDIRaas94XuKupp3eYokfbaQEJ76azXU
 Ah81XjCG+cEyK6S/AU6NA5hWhWF+rakE7lssfRRSNJIWEcFsHt02yDUC9EZeO722
 760ekS5yZ3aEKpfMkOW2
 =4Y5M
 -----END PGP SIGNATURE-----

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

Pull hwmon fixes from Guenter Roeck:
 "Several bug fixes in various drivers, plus a minor cleanup in the
  tmp103 driver"

* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (tmp103) Remove duplicate test for I2C_FUNC_SMBUS_BYTE_DATA functionality
  hwmon: (w83793) Fix vrm write operation
  hwmon: (w83791d) Fix vrm write operation
  hwmon: (w83627hf) Fix vrm write operation
  hwmon: (vt1211) Fix vrm write operation
  hwmon: (pc87360) Fix vrm write operation
  hwmon: (lm87) Fix vrm write operation
  hwmon: (asb100) Fix vrm write operation
  hwmon: (adm1026) Fix vrm write operation
  hwmon: (adm1025) Fix vrm write operation
  hwmon: (hih6130) Fix missing hih6130->write_length setting
  hwmon: (dme1737) Prevent overflow problem when writing large limits
  hwmon: (emc6w201) Fix temperature limit range
  hwmon: (ads1015) Fix out-of-bounds array access
  hwmon: (lm92) Prevent overflow problem when writing large limits
2014-08-14 09:55:13 -06:00