Use devm_hwmon_device_register_with_groups instead of
the old-style manual attributes and hwmon device registration.
Also, unroll the attribute group macros for better code
readability.
Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Move atxp1_id and atxp1_driver to proper place to avoid forward declaration.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Add support for Sensirion SHTC1 and compatible temperature and humidity
sensors.
Signed-off-by: Tomas Pop <tomas.pop@sensirion.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
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: Per Dalén <per.dalen@appeartv.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Generic detection leads to too many false positives, so drop it. FWIW
sensors-detect does not have such generic detection. If the user wants
to force the driver to bind to a not yet supported chip, he/she can
still do so using sysfs attribute new_device.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
All devices supported by ina2xx are bidirectional and report the
measured shunt voltage and power values as a signed 16 bit, but the
current driver implementation caches all registers as u16, leading
to an incorrect sign extension when reporting to userspace in
ina2xx_get_value().
This patch fixes the problem by casting the signed registers to s16.
Tested on an INA219.
Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
Cc: stable@vger.kernel.org # 3.10+
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
New chip support to existing drivers:
Add support for STTS2004 and AT30TSE004 to jc42 driver
Add support for EMC1402/EMC1412/EMC1422 to emc1403 driver
Other notable changes:
Document hwmon kernel API
Convert jc42, lm70, lm75, lm77, lm83, lm92, max1619, tmp421,
and tmp102 drivers to use new hwmon API functions
Replace function macros in lm80, lm92, and jc42 drivers with
real code
Convert emc1403 driver to use regmap, add support for additional
attributes, and add device IDs for EMC1412, EMC1413, and EMC1414
Various additional cleanup and minor bug fixes in several drivers
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAABAgAGBQJTjUZbAAoJEMsfJm/On5mBnY4P/A15UCpfNzNa/tYzHUYtb0/Y
7yI6fEWhgSegiWuWl3I7jOJrz+uU2emrIdOVW1ci8Y7WNjoL+TWYTlvvwf0OYwMz
k7duMcNWcIOzBAm+swyaKvPQjoLcxtKYn+pSCxb1dzVkjzpelnjHctBNnfbvrNQt
FCMs+t2azIZGkgNf9G1U/uV702/vKKYWrBc69/EB3osDxSRLKvM2sPqnScxmBR6q
oohZ5pxbpDhO0gXc9s7AprUFf4puMEWw6eul3QPMzBAgZqh44iOv+yNvJk6pjG5L
FwWkand4U2BVMGY3+dnBCeA8fsYq9owPCK8WN+5NI1W+CLMnKQFHK4iOEDbiaSHH
PsgGrFnj5ArVxcmPKUQ3l2nWQcwXUvuBTxRmc707HNLt93y2JrdIncdSnhNR5PVk
nlUNwTXCqfQmv0aY/yTDIzrgYfXXxhngaw59kEZXBPyO7rH7IcXZw6sq/scn8+G3
Nd8lHLaFOAZwZVNU1hUWkow88t/NwkW/CZ2c2796pjsjAuJfBS1P+C4hkkUQ7+QB
SavLg8S9E+Ienxacx2tZs8OdcAXsvlrHMeM0TTiWLbKPosDz3FbwbPeqlCpcVQAY
kSPIXA+l1Dps0v8Yf6pdJCL1eX1jyzdfA+YKMT0aCPALTQYEPQXAE4Nced+qCZ52
1vm6eTqDAf1KQfOmxxxT
=dytt
-----END PGP SIGNATURE-----
Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging into next
Pull hwmon updates from Guenter Roeck:
"New driver for NCT6683D
New chip support to existing drivers:
- add support for STTS2004 and AT30TSE004 to jc42 driver
- add support for EMC1402/EMC1412/EMC1422 to emc1403 driver
Other notable changes:
- document hwmon kernel API
- convert jc42, lm70, lm75, lm77, lm83, lm92, max1619, tmp421, and
tmp102 drivers to use new hwmon API functions
- replace function macros in lm80, lm92, and jc42 drivers with real
code
- convert emc1403 driver to use regmap, add support for additional
attributes, and add device IDs for EMC1412, EMC1413, and EMC1414
- various additional cleanup and minor bug fixes in several drivers"
* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (60 commits)
hwmon: (nct6775) Fix probe unwind paths to properly unregister platform devices
hwmon: (nct6683) Fix probe unwind paths to properly unregister platform devices
hwmon: (ultra45_env) Introduce managed version of kzalloc
hwmon: Driver for NCT6683D
hwmon: (lm80) Rearrange code to avoid forward declarations
hwmon: (lm80) Convert fan display function macros into functions
hwmon: (lm80) Convert voltage display function macros into functions
hwmon: (lm80) Convert temperature display function macros into functions
hwmon: (lm80) Normalize all temperature values to 16 bit
hwmon: (lm80) Simplify TEMP_FROM_REG
hwmon: (lm83) Convert to use devm_hwmon_device_register_with_groups
hwmon: (lm83) Rearange code to avoid forward declarations
hwmon: (lm83) Drop FSF address
hwmon: (max1619) Convert to use devm_hwmon_device_register_with_groups
hwmon: (max1619) Drop function macros
hwmon: (max1619) Rearrange code to avoid forward declarations
hwmon: (max1619) Drop FSF address
hwmon: (max1619) Fix critical alarm display
hwmon: (jc42) Add support for STTS2004 and AT30TSE004
hwmon: (jc42) Convert function macros into functions
...
Cleanups for 3.16. Among these are:
- A bunch of misc cleanups for Broadcom platforms, mostly housekeeping
- Enabling Common Clock Framework on the older s3c24xx Samsung chipsets
- Cleanup of the Versatile Express system controller code, moving it to syscon
- Power management cleanups for OMAP platforms
+ a handful of other cleanups across the place
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
iQIcBAABAgAGBQJTjMwHAAoJEIwa5zzehBx3MjMP/iELgDsqbNE2wxF9Fb5EEnoe
S11q1QIvVrMVdMcKFN5HfW7f+xNso6+4SwXW0cRrJokGvaqRE758WZWuZq0QBUeS
RYMhfpqmI6pTTJUyy6i6OyXhuRqu8rQ1NPEAatYrKzmtwFX1H4t25f1YtZWhBcK8
ONi45FHeH1OKGGpjpT63uhWEzLk+LZI2MtgxmWoFcemf7guX6vEPJVuVRi8eqLoS
9vl1cAkweYgGhjvQFcSXENaguV50dZlLc9C41dJk9KVvJfRt7o+/cRbG5YpGvnp5
Liu+OWM72w0BkgNk6wDN4kaPX5UGLF8QX11JlvDRCJ2FcPtM4NBG/C9TqLMfkKDR
Ze+ITiXh6NjefdTZWJaM4vzsd6vFws8EYAP24IWFlZ451bNLVN1lzlgqluPNoKmj
CAsFPZhY/x5X9a8VLZ72ohx3N17T/iMsOlbiWtnlfqDcL6N0IoLG1YkFFeQIKEAH
mpobWus8Myq1miWqSaeXh5wOqUVQmYR0I8jNoTfte1nBYSaIGhtMixoQhM6Zw50C
dgSh4p7qhrZUOnYmkPqFXr7NCJ9n3RD10Xu8d/3IIp0u9RJ5Kx6NCEg9adq22jZQ
XGrr/vH0sM8MzpKmfTMi5t2Cx5kP2G+O3enq0hQi4x3Cb4o8vwWQlMgydTd+xBjj
aLo3WTTw0h6nTuKkZL2p
=wuX4
-----END PGP SIGNATURE-----
Merge tag 'cleanup-for-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc into next
Pull ARM SoC cleanups from Olof Johansson:
"Cleanups for 3.16. Among these are:
- a bunch of misc cleanups for Broadcom platforms, mostly
housekeeping
- enabling Common Clock Framework on the older s3c24xx Samsung
chipsets
- cleanup of the Versatile Express system controller code, moving it
to syscon
- power management cleanups for OMAP platforms
plus a handful of other cleanups across the place"
* tag 'cleanup-for-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (87 commits)
ARM: kconfig: allow PCI support to be selected with ARCH_MULTIPLATFORM
clk: samsung: fix build error
ARM: vexpress: refine dependencies for new code
clk: samsung: clk-s3c2410-dlck: do not use PNAME macro as it declares __initdata
cpufreq: exynos: Fix the compile error
ARM: S3C24XX: move debug-macro.S into the common space
ARM: S3C24XX: use generic DEBUG_UART_PHY/_VIRT in debug macro
ARM: S3C24XX: trim down debug uart handling
ARM: compressed/head.S: remove s3c24xx special case
ARM: EXYNOS: Remove unnecessary inclusion of cpu.h
ARM: EXYNOS: Migrate Exynos specific macros from plat to mach
ARM: EXYNOS: Remove exynos_subsys registration
ARM: EXYNOS: Remove duplicate lines in Makefile
ARM: EXYNOS: use v7_exit_coherency_flush macro for cache disabling
ARM: OMAP4: PRCM: remove references to cm-regbits-44xx.h from PRCM core files
ARM: OMAP3/4: PRM: add support of late_init call to prm_ll_ops
ARM: OMAP3/OMAP4: PRM: add prm_features flags and add IO wakeup under it
ARM: OMAP3/4: PRM: provide io chain reconfig function through irq setup
ARM: OMAP2+: PRM: remove unnecessary cpu_is_XXX calls from prm_init / exit
ARM: OMAP2+: PRCM: cleanup some header includes
...
The mapping from OF device IDs to platform device IDs is wrong.
TYPE_NCPXXWB473 is 0, TYPE_NCPXXWL333 is 1, so
ntc_thermistor_id[TYPE_NCPXXWB473] is { "ncp15wb473", TYPE_NCPXXWB473 }
while
ntc_thermistor_id[TYPE_NCPXXWL333] is { "ncp18wb473", TYPE_NCPXXWB473 }.
So the name is wrong for all but the "ntc,ncp15wb473" entry, and the
type is wrong for the "ntc,ncp15wl333" entry.
So map the entries by index, it is neither elegant nor robust but at
least it is correct.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Fixes: 9e8269de hwmon: (ntc_thermistor) Add DT with IIO support to NTC thermistor driver
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Cc: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Cc: Doug Anderson <dianders@chromium.org>
In commit 9e8269de, support was added for ntc_thermistor devices being
declared in the device tree and implemented on top of IIO. With that
change, a dependency was added to the ntc_thermistor driver:
depends on (!OF && !IIO) || (OF && IIO)
This construct has the drawback that the driver can no longer be
selected when OF is set and IIO isn't, nor when IIO is set and OF is
not. This is a regression for the original users of the driver.
As the new code depends on IIO and is useless without OF, include it
only if both are enabled, and set the dependencies accordingly. This
is clearer, more simple and more correct.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Fixes: 9e8269de hwmon: (ntc_thermistor) Add DT with IIO support to NTC thermistor driver
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Cc: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Cc: Doug Anderson <dianders@chromium.org>
Call platform_device_unregister() rather than platform_device_put() to
unregister successfully registered platform devices.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Call platform_device_unregister() rather than platform_device_put() to
unregister successfully registered platform devices.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This patch moves data allocated using kzalloc to managed data allocated
using devm_kzalloc and cleans now unnecessary kfrees in probe and remove
functions. Also, the unnecessary label out_free is removed.
The following Coccinelle semantic patch was used for making the change:
@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
.probe = probefn,
.remove = removefn,
};
@prb@
identifier platform.probefn, pdev;
expression e, e1, e2;
@@
probefn(struct platform_device *pdev, ...) {
<+...
- e = kzalloc(e1, e2)
+ e = devm_kzalloc(&pdev->dev, e1, e2)
...
?-kfree(e);
...+>
}
@rem depends on prb@
identifier platform.removefn;
expression e;
@@
removefn(...) {
<...
- kfree(e);
...>
}
Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Convert fan display function macros into functions to reduce
code size and improve code readability.
Code size reduction is about 200 bytes on x86_64.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Convert voltage display function macros into functions to reduce
code size and improve code readability.
Code size reduction is about 600 bytes on x86_64.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Convert temperature display function macros into functions to reduce
code size and improve code readability.
Code size reduction is about 2k on x86_64.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
TEMP_FROM_REG gets 12 bits of temperature data in the upper 12 bit
of a signed 16 bit parameter, with the integer part (including sign)
in the upper 8 bit and the remainder in bit 4..7. The lower 4 bit of
the 16 bit data is always 0. We can use that information to convert
the temperature directly into display data (1/1000th of degree C).
Note that the stored temperature data is not shifted right as the
comment claimed, so remove that misleading comment.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Use devm_hwmon_device_register_with_groups API to attach attributes
to hwmon device, simplify code, and reduce code size.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Use devm_hwmon_device_register_with_groups API to attach attributes
to hwmon device, simplify code, and reduce code size.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Function macros make the code larger and difficult ro read.
Drop them and reduce code size (on x86_64) by ~1800 bytes.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Forward declarations are unnecessary and easy to avoid, so rearrange
code and drop them.
No functional change.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
The overtemperature status bit, which is used to display critical alarm status,
matches the output of the OVERT signal 1:1. If that signal is active-low, the
bit will read 1 if there is no alarm. It is therefore necessary to reverse
the bit in this case.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Also fix links to datasheets for other supported sensors from
ST Microelectronics, and add links to several Atmel datasheets.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
EMC1412, EMC1413, and EMC1414 are fully compatible to EMC1402, EMC1403,
and EMC1404, and even report the same chip ID. Add to device ID table
to enable instantiation with correct chip names.
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Writing the hysteresis limit returned -ERANGE if the written hysteresis
was too high or too low. Relax error check and adjust the hysteresis
value to its valid range.
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
All chips in this chip series only support a single hysteresis value. Having
multiple writable hysteresis attributes is therefore confusing, since a single
write affects all hysteresis temperatures. Make all but one (temp1_crit_hyst)
read-only.
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Alarm and fault status register on EMC1402, EMC1412, and EMC1422 is reported
in a different register than with other chips. Add support for it.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Add support for emc1402/emc1412/emc1422 temperature monitoring chips.
This line of sensors only has 2 temperature channels (internal and external)
in comparison to the emc14x3 (3 channels) and emc14x4 (4 channels).
Signed-off-by: Josef Gajdusek <atx@atx.name>
[Guenter Roeck: ordered i2c address list, updated description/headline]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Make of_device_id array const, because all OF functions
handle it as const.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Make of_device_id array const, because all OF functions
handle it as const.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Make of_device_id array const, because all OF functions
handle it as const.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
The site-specific OOM messages are unnecessary, because they
duplicate the MM subsystem generic OOM message.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
The site-specific OOM messages are unnecessary, because they
duplicate the MM subsystem generic OOM message.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
The site-specific OOM messages are unnecessary, because they
duplicate the MM subsystem generic OOM message.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
The site-specific OOM messages are unnecessary, because they
duplicate the MM subsystem generic OOM message.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
The site-specific OOM messages are unnecessary, because they
duplicate the MM subsystem generic OOM message.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>