summaryrefslogtreecommitdiff
path: root/drivers/hwmon
AgeCommit message (Collapse)Author
2019-10-02hwmon: (nct7904) Add array fan_alarm and vsen_alarm to store the alarms in ↵amy.shih
nct7904_data struct. SMI# interrupt for fan and voltage is Two-Times Interrupt Mode. Fan or voltage exceeds high limit or going below low limit, it will causes an interrupt if the previous interrupt has been reset by reading all the interrupt Status Register. Thus, add the array fan_alarm and vsen_alarm to store the alarms for all of the fan and voltage sensors. Signed-off-by: amy.shih <amy.shih@advantech.com.tw> Link: https://lore.kernel.org/r/20190919030205.11440-1-Amy.Shih@advantech.com.tw Fixes: 486842db3b79 ("hwmon: (nct7904) Add extra sysfs support for fan, voltage and temperature.") Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-10-02hwmon: (nct7904) Fix the incorrect value of vsen_mask in nct7904_data structamy.shih
Voltage sensors overlap with external temperature sensors. Detect the multi-function of voltage, thermal diode and thermistor from register VT_ADC_MD_REG to set value of vsen_mask in nct7904_data struct. Signed-off-by: amy.shih <amy.shih@advantech.com.tw> Link: https://lore.kernel.org/r/20190918084801.9859-1-Amy.Shih@advantech.com.tw Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-22Merge tag 'mips_5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linuxLinus Torvalds
Pull MIPS updates from Paul Burton: "Main MIPS changes: - boot_mem_map is removed, providing a nice cleanup made possible by the recent removal of bootmem. - Some fixes to atomics, in general providing compiler barriers for smp_mb__{before,after}_atomic plus fixes specific to Loongson CPUs or MIPS32 systems using cmpxchg64(). - Conversion to the new generic VDSO infrastructure courtesy of Vincenzo Frascino. - Removal of undefined behavior in set_io_port_base(), fixing the behavior of some MIPS kernel configurations when built with recent clang versions. - Initial MIPS32 huge page support, functional on at least Ingenic SoCs. - pte_special() is now supported for some configurations, allowing among other things generic fast GUP to be used. - Miscellaneous fixes & cleanups. And platform specific changes: - Major improvements to Ingenic SoC support from Paul Cercueil, mostly enabled by the inclusion of the new TCU (timer-counter unit) drivers he's spent a very patient year or so working on. Plus some fixes for X1000 SoCs from Zhou Yanjie. - Netgear R6200 v1 systems are now supported by the bcm47xx platform. - DT updates for BMIPS, Lantiq & Microsemi Ocelot systems" * tag 'mips_5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: (89 commits) MIPS: Detect bad _PFN_SHIFT values MIPS: Disable pte_special() for MIPS32 with RiXi MIPS: ralink: deactivate PCI support for SOC_MT7621 mips: compat: vdso: Use legacy syscalls as fallback MIPS: Drop Loongson _CACHE_* definitions MIPS: tlbex: Remove cpu_has_local_ebase MIPS: tlbex: Simplify r3k check MIPS: Select R3k-style TLB in Kconfig MIPS: PCI: refactor ioc3 special handling mips: remove ioremap_cachable mips/atomic: Fix smp_mb__{before,after}_atomic() mips/atomic: Fix loongson_llsc_mb() wreckage mips/atomic: Fix cmpxchg64 barriers MIPS: Octeon: remove duplicated include from dma-octeon.c firmware: bcm47xx_nvram: Allow COMPILE_TEST firmware: bcm47xx_nvram: Correct size_t printf format MIPS: Treat Loongson Extensions as ASEs MIPS: Remove dev_err() usage after platform_get_irq() MIPS: dts: mscc: describe the PTP ready interrupt MIPS: dts: mscc: describe the PTP register range ...
2019-09-18Merge tag 'driver-core-5.4-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core updates from Greg Kroah-Hartman: "Here is the big driver core update for 5.4-rc1. There was a bit of a churn in here, with a number of core and OF platform patches being added to the tree, and then after much discussion and review and a day-long in-person meeting, they were decided to be reverted and a new set of patches is currently being reviewed on the mailing list. Other than that churn, there are two "persistent" branches in here that other trees will be pulling in as well during the merge window. One branch to add support for drivers to have the driver core automatically add sysfs attribute files when a driver is bound to a device so that the driver doesn't have to manually do it (and then clean it up, as it always gets it wrong). There's another branch in here for generic lookup helpers for the driver core that lots of busses are starting to use. That's the majority of the non-driver-core changes in this patch series. There's also some on-going debugfs file creation cleanup that has been slowly happening over the past few releases, with the goal to hopefully get that done sometime next year. All of these have been in linux-next for a while now with no reported issues" [ Note that the above-mentioned generic lookup helpers branch was already brought in by the LED merge (commit 4feaab05dc1e) that had shared it. Also note that that common branch introduced an i2c bug due to a bad conversion, which got fixed here. - Linus ] * tag 'driver-core-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (49 commits) coccinelle: platform_get_irq: Fix parse error driver-core: add include guard to linux/container.h sysfs: add BIN_ATTR_WO() macro driver core: platform: Export platform_get_irq_optional() hwmon: pwm-fan: Use platform_get_irq_optional() driver core: platform: Introduce platform_get_irq_optional() Revert "driver core: Add support for linking devices during device addition" Revert "driver core: Add edit_links() callback for drivers" Revert "of/platform: Add functional dependency link from DT bindings" Revert "driver core: Add sync_state driver/bus callback" Revert "of/platform: Pause/resume sync state during init and of_platform_populate()" Revert "of/platform: Create device links for all child-supplier depencencies" Revert "of/platform: Don't create device links for default busses" Revert "of/platform: Fix fn definitons for of_link_is_valid() and of_link_property()" Revert "of/platform: Fix device_links_supplier_sync_state_resume() warning" Revert "of/platform: Disable generic device linking code for PowerPC" devcoredump: fix typo in comment devcoredump: use memory_read_from_buffer of/platform: Disable generic device linking code for PowerPC device.h: Fix warnings for mismatched parameter names in comments ...
2019-09-17Merge tag 'docs-5.4' of git://git.lwn.net/linuxLinus Torvalds
Pull documentation updates from Jonathan Corbet: "It's a somewhat calmer cycle for docs this time, as the churn of the mass RST conversion is happily mostly behind us. - A new document on reproducible builds. - We finally got around to zapping the documentation for hardware support that was removed in 2004; one doesn't want to rush these things. - The usual assortment of fixes, typo corrections, etc" * tag 'docs-5.4' of git://git.lwn.net/linux: (67 commits) Documentation: kbuild: Add document about reproducible builds docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi] Documentation: Add "earlycon=sbi" to the admin guide doc:lock: remove reference to clever use of read-write lock devices.txt: improve entry for comedi (char major 98) docs: mtd: Update spi nor reference driver doc: arm64: fix grammar dtb placed in no attributes region Documentation: sysrq: don't recommend 'S' 'U' before 'B' mailmap: Update email address for Quentin Perret docs: ftrace: clarify when tracing is disabled by the trace file docs: process: fix broken link Documentation/arm/samsung-s3c24xx: Remove stray U+FEFF character to fix title Documentation/arm/sa1100/assabet: Fix 'make assabet_defconfig' command Documentation/arm/sa1100: Remove some obsolete documentation docs/zh_CN: update Chinese howto.rst for latexdocs making Documentation: virt: Fix broken reference to virt tree's index docs: Fix typo on pull requests guide kernel-doc: Allow anonymous enum Documentation: sphinx: Don't parse socket() as identifier reference Documentation: sphinx: Add missing comma to list of strings ...
2019-09-16Merge tag 'armsoc-drivers' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc Pull ARM SoC driver updates from Arnd Bergmann: "This contains driver changes that are tightly connected to SoC specific code. Aside from smaller cleanups and bug fixes, here is a list of the notable changes. New device drivers: - The Turris Mox router has a new "moxtet" bus driver for its on-board pluggable extension bus. The same platform also gains a firmware driver. - The Samsung Exynos family gains a new Chipid driver exporting using the soc device sysfs interface - A similar socinfo driver for Qualcomm Snapdragon chips. - A firmware driver for the NXP i.MX DSP IPC protocol using shared memory and a mailbox Other changes: - The i.MX reset controller driver now supports the NXP i.MX8MM chip - Amlogic SoC specific drivers gain support for the S905X3 and A311D chips - A rework of the TI Davinci framebuffer driver to allow important cleanups in the platform code - A couple of device drivers for removed ARM SoC platforms are removed. Most of the removals were picked up by other maintainers, this contains whatever was left" * tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (123 commits) bus: uniphier-system-bus: use devm_platform_ioremap_resource() soc: ti: ti_sci_pm_domains: Add support for exclusive and shared access dt-bindings: ti_sci_pm_domains: Add support for exclusive and shared access firmware: ti_sci: Allow for device shared and exclusive requests bus: imx-weim: remove incorrect __init annotations fbdev: remove w90x900/nuc900 platform drivers spi: remove w90x900 driver net: remove w90p910-ether driver net: remove ks8695 driver firmware: turris-mox-rwtm: Add sysfs documentation firmware: Add Turris Mox rWTM firmware driver dt-bindings: firmware: Document cznic,turris-mox-rwtm binding bus: moxtet: fix unsigned comparison to less than zero bus: moxtet: remove set but not used variable 'dummy' ARM: scoop: Use the right include dt-bindings: power: add Amlogic Everything-Else power domains bindings soc: amlogic: Add support for Everything-Else power domains controller fbdev: da8xx: use resource management for dma fbdev: da8xx-fb: drop a redundant if fbdev: da8xx-fb: use devm_platform_ioremap_resource() ...
2019-09-12hwmon: (nct7904) Fix incorrect SMI status register setting of LTD ↵amy.shih
temperature and fan. According to datasheet, the SMI status register setting of LTD temperature is SMI_STS3, and the SMI status register setting of fan is SMI_STS5 and SMI_STS6. Signed-off-by: amy.shih <amy.shih@advantech.com.tw> Link: https://lore.kernel.org/r/20190912113300.4714-1-Amy.Shih@advantech.com.tw Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-10hwmon: (shtc1) add support for the SHTC3 sensorDan Robertson
Add support for the Sensirion SHTC3 humidity and temperature sensor to the shtc1 module. Signed-off-by: Dan Robertson <dan@dlrobertson.com> Link: https://lore.kernel.org/r/20190905014554.21658-2-dan@dlrobertson.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-10hwmon: (shtc1) fix shtc1 and shtw1 id maskDan Robertson
Fix an error in the bitmaskfor the shtc1 and shtw1 bitmask used to retrieve the chip ID from the ID register. See section 5.7 of the shtw1 or shtc1 datasheet for details. Fixes: 1a539d372edd9832444e7a3daa710c444c014dc9 ("hwmon: add support for Sensirion SHTC1 sensor") Signed-off-by: Dan Robertson <dan@dlrobertson.com> Link: https://lore.kernel.org/r/20190905014554.21658-3-dan@dlrobertson.com [groeck: Reordered to be first in series and adjusted accordingly] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-04hwmon: (lm75) Aproximate sample times to data-sheet valuesIker Perez del Palomar Sustatxa
Current sample time values are over estimated, this patches applies values closer to the ones defined in the data-sheets. Signed-off-by: Iker Perez del Palomar Sustatxa <iker.perez@codethink.co.uk> [groeck: resolved conflicts; use default conversion times] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (w83793d) convert to use devm_i2c_new_dummy_deviceWolfram Sang
And simplify the error handling. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20190903181256.13450-4-wsa+renesas@sang-engineering.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (w83792d) convert to use devm_i2c_new_dummy_deviceWolfram Sang
And simplify the error handling. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20190903181256.13450-3-wsa+renesas@sang-engineering.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (w83791d) convert to use devm_i2c_new_dummy_deviceWolfram Sang
And simplify the error handling. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20190903181256.13450-2-wsa+renesas@sang-engineering.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (as370-hwmon) fix devm_platform_ioremap_resource.cocci warningskbuild test robot
Use devm_platform_ioremap_resource helper which wraps platform_get_resource() and devm_ioremap_resource() together. Generated by: scripts/coccinelle/api/devm_platform_ioremap_resource.cocci Fixes: 658e687b4218 ("hwmon: Add Synaptics AS370 PVT sensor driver") CC: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Signed-off-by: kbuild test robot <lkp@intel.com> Signed-off-by: Julia Lawall <julia.lawall@lip6.fr> Reviewed-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/alpine.DEB.2.21.1909030646180.3228@hadrien Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (lm75) Add support for writing sampling period on PCT2075Guenter Roeck
For PCT7027, the sampling period is configured using a dedicated register. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (lm75) Add support for writing conversion time for TMP112Guenter Roeck
TMP112 uses an uncommon method to write the conversion time: its configuration register is 16 bit wide, and the conversion time is configured in its second byte. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (lm75) Move updating the sample interval to its own functionGuenter Roeck
We'll need per-chip handling for updating the sample interval. To prepare for it, separate the code implementing it into its own function. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (lm75) Support configuring the sample time for various chipsGuenter Roeck
The conversion (sample) time is configurable for several chips supported by the lm75 driver. With the necessary infrastructure in place, enable this support for all chips using the configuration register for this purpose. DS1775: Conversion time: 187.5, 375, 750, 1500 ms Sensor resolution: 9, 10, 11, 12 bit DS75, STDS75: Conversion time: 150, 300, 600, 1200 ms Sensor resolution: 9, 10, 11, 12 bit DS7505: Conversion time: 25, 50, 100, 200 ms Sensor resolution: 9, 10, 11, 12 bit MCP980[0123]: Conversion time: 75, 150, 300, 600 ms Sensor resolution: 9, 10, 11, 12 bit TMP100, TMP101: Conversion time: 75, 150, 300, 600 ms Sensor resolution: 9, 10, 11, 12 bit TMP75, TMP105, TMP175, TMP275: Conversion time: 38, 75, 150, 300 ms Sensor resolution: 9, 10, 11, 12 bit While doing this, it became obvious that the masks and values to set the converion (sample) time is similar for all those chips, and that other chips with configurable sample times will need separate code anyway. For that reason, replace the sample_set_masks and sample_clr_mask configuration parameters with a single array and with a constant. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (nct7904) Fix incorrect temperature limitation register setting of LTD.amy.shih
According to kernel hwmon sysfs-interface documentation, temperature critical max value, typically greater than corresponding temp_max values. Thus, reads the LTD_HV_HL (LTD HIGH VALUE HIGH LIMITATION) and LTD_LV_HL (LTD LOW VALUE HIGH LIMITATION) for case hwmon_temp_crit and hwmon_temp_crit_hyst. Reads the LTD_HV_LL (HIGH VALUE LOW LIMITATION) and LTD_LV_LL (LOW VALUE LOW LIMITATION) for case hwmon_temp_max and hwmon_temp_max_hyst. Signed-off-by: amy.shih <amy.shih@advantech.com.tw> Link: https://lore.kernel.org/r/20850618155720.24857-1-Amy.Shih@advantech.com.tw Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: Add Synaptics AS370 PVT sensor driverJisheng Zhang
Add a new driver for Synaptics AS370 PVT sensors. Currently, only temperature is supported. Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20190827113259.4fb64a17@xhacker.debian Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03pmbus: (ibm-cffps) Add support for version 2 of the PSUEddie James
Version 2 of the PSU supports a second page of data and changes the format of the FW version. Use the devicetree binding to differentiate between the version the driver should use. Signed-off-by: Eddie James <eajames@linux.ibm.com> Link: https://lore.kernel.org/r/1567192263-15065-4-git-send-email-eajames@linux.ibm.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (iio_hwmon) Enable power exporting from IIOMichal Simek
There is no reason why power channel shouldn't be exported as is done for voltage, current, temperature and humidity. Power channel is available on iio ina226 driver. Sysfs IIO documentation for power attribute added by commit 7c6d5c7ee883 ("iio: Documentation: Add missing documentation for power attribute") is declaring that value is in mili-Watts but hwmon interface is expecting value in micro-Watts that's why there is a need for mili-Watts to micro-Watts conversion. Tested on Xilinx ZCU102 board. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Link: https://lore.kernel.org/r/db71f5ae87e4521a2856a1be5544de0b6cede575.1566483741.git.michal.simek@xilinx.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: pmbus: Add Inspur Power System power supply driverJohn Wang
Add the driver to monitor Inspur Power System power supplies with hwmon over pmbus. This driver adds sysfs attributes for additional power supply data, including vendor, model, part_number, serial number, firmware revision, hardware revision, and psu mode(active/standby). Signed-off-by: John Wang <wangzqbj@inspur.com> Reviewed-by: Joel Stanley <joel@jms.id.au> Link: https://lore.kernel.org/r/20190819091509.29276-1-wangzqbj@inspur.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon/ltc2990: Generalise DT to fwnode supportMax Staudt
ltc2990 will now use device_property_read_u32_array() instead of of_property_read_u32_array() - allowing the use of software nodes via fwnode_create_software_node(). This allows code using i2c_new_device() to specify a default measurement mode for the LTC2990 via fwnode_create_software_node(). Signed-off-by: Max Staudt <max@enpas.org> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> Link: https://lore.kernel.org/r/20190819121618.16557-2-max@enpas.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (raspberrypi) update MODULE_AUTHOR() email addressStefan Wahren
The email address listed in MODULE_AUTHOR() will be disabled in the near future. Replace it with my private one. Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Link: https://lore.kernel.org/r/1565720249-6549-2-git-send-email-wahrenst@gmx.net Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (lm75) Modularize lm75_write and make hwmon_chip writableIker Perez del Palomar Sustatxa
* Create two separate functions to write into hwmon_temp and hwmon_chip. * Call the functions from lm75_write. * Make hwm_chip writable if the chip supports more than one sample time. Signed-off-by: Iker Perez del Palomar Sustatxa <iker.perez@codethink.co.uk> Link: https://lore.kernel.org/r/20190808080246.8371-5-iker.perez@codethink.co.uk Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (lm75) Add new fields into lm75_params_Iker Perez del Palomar Sustatxa
The new fields are included to prepare the driver for next patch. The fields are: * *resolutions: Stores all the supported resolutions by the device. * num_sample_times: Stores the number of possible sample times. * *sample_times: Stores all the possible sample times to be set. * sample_set_masks: The set_masks for the possible sample times * sample_clr_mask: Clear mask to set the default sample time. Signed-off-by: Iker Perez del Palomar Sustatxa <iker.perez@codethink.co.uk> Link: https://lore.kernel.org/r/20190808080246.8371-4-iker.perez@codethink.co.uk [groeck: Minor structure documentation fixes] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (lm75) Create function from code to write into registersIker Perez del Palomar Sustatxa
Wrap the existing code to write configurations into registers in a function. Added error handling to the function. Signed-off-by: Iker Perez del Palomar Sustatxa <iker.perez@codethink.co.uk> Link: https://lore.kernel.org/r/20190808080246.8371-3-iker.perez@codethink.co.uk Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (lm75) Create structure to save all the configuration parameters.Iker Perez del Palomar Sustatxa
* Add to lm75_data kind field to store the kind of device the driver is working with. * Add an structure to store the configuration parameters of all the supported devices. * Delete resolution_limits from lm75_data and include them in the structure described above. * Add a pointer to the configuration parameters structure to be used as a reference to obtain the parameters. * Delete switch-case approach to get the device configuration parameters. * The structure is cleaner and easier to maintain. Signed-off-by: Iker Perez del Palomar Sustatxa <iker.perez@codethink.co.uk> Link: https://lore.kernel.org/r/20190808080246.8371-2-iker.perez@codethink.co.uk Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (nct7904) Add extra sysfs support for fan, voltage and temperature.amy.shih
NCT-7904D also supports reading of channel limitation registers as well as SMI status registers for fan, voltage and temperature monitoring. It also supports reading the temperature sensor type (thermal diode, thermistor, AMD SB-TSI or Intel PECI). Add the following sysfs nodes: -fan[1-*]_min -fan[1-*]_alarm -in[1-*]_min -in[1-*]_max -in[1-*]_alarm -temp[1-*]_max -temp[1-*]_max_hyst -temp[1-*]_emergency -temp[1-*]_emergency_hyst -temp[1-*]_alarm -temp[1-*]_type Signed-off-by: Amy Shih <amy.shih@advantech.com.tw> Link: https://lore.kernel.org/r/20190807013842.24451-1-Amy.Shih@advantech.com.tw [groeck: Clarified description] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: w83795: Fan control option isn't that dangerousJean Delvare
I have been using SENSORS_W83795_FANCTRL for several years and never had any problem. When the driver was added, I had not tested that part of the driver yet so I wanted to be super cautious, but time has shown that it works just fine. In the long run I even believe that we should drop the option and enable the feature unconditionally. It doesn't do anything until the user explicitly starts twiddling with sysfs attributes anyway. Signed-off-by: Jean Delvare <jdelvare@suse.de> Link: https://lore.kernel.org/r/20190806102123.3118bcc5@endymion Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (npcm750-pwm-fan) Remove dev_err() usage after platform_get_irq()Stephen Boyd
We don't need dev_err() messages when platform_get_irq() fails now that platform_get_irq() prints an error message itself when something goes wrong. Let's remove these prints with a simple semantic patch. // <smpl> @@ expression ret; struct platform_device *E; @@ ret = ( platform_get_irq(E, ...) | platform_get_irq_byname(E, ...) ); if ( \( ret < 0 \| ret <= 0 \) ) { ( -if (ret != -EPROBE_DEFER) -{ ... -dev_err(...); -... } | ... -dev_err(...); ) ... } // </smpl> While we're here, remove braces on if statements that only have one statement (manually). Cc: Jean Delvare <jdelvare@suse.com> Cc: Guenter Roeck <linux@roeck-us.net> Cc: linux-hwmon@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> [groeck: Dropped jz4740-hwmon.c (driver is being removed)] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (acpi_power_meter) Change log level for 'unsafe software power cap'Wang Shenran
At boot time, the acpi_power_meter driver logs the following error level message: "Ignoring unsafe software power cap". Having read about it from a few sources, it seems that the error message can be quite misleading. While the message can imply that Linux is ignoring the fact that the system is operating in potentially dangerous conditions, the truth is the driver found an ACPI_PMC object that supports software power capping. The driver simply decides not to use it, perhaps because it doesn't support the object. The best solution is probably changing the log level from error to warning. All sources I have found, regarding the error, have downplayed its significance. There is not much of a reason for it to be on error level, while causing potential confusions or misinterpretations. Signed-off-by: Wang Shenran <shenran268@gmail.com> Link: https://lore.kernel.org/r/20190724080110.6952-1-shenran268@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (nct6775) Integrate new model nct6116Björn Gerhart
Add support for NCT6116D to nct6775 driver. Signed-off-by: Bjoern Gerhart <gerhart@posteo.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (adt7475) Convert to use hwmon_device_register_with_groups()Grant McEwan
hwmon_device_register() is a deprecated function and produces a warning. Converting the driver to use the hwmon_device_register_with_groups() instead. Signed-off-by: Grant McEwan <grant.mcewan@alliedtelesis.co.nz> Link: https://lore.kernel.org/r/20190721225530.28799-2-grant.mcewan@alliedtelesis.co.nz Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (w83781d) convert to i2c_new_dummy_deviceWolfram Sang
Move from i2c_new_dummy() to i2c_new_dummy_device(), so we now get an ERRPTR which we use in error handling. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20190722172611.3797-4-wsa+renesas@sang-engineering.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (smm665) convert to i2c_new_dummy_deviceWolfram Sang
Move from i2c_new_dummy() to i2c_new_dummy_device(), so we now get an ERRPTR which we use in error handling. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20190722172611.3797-3-wsa+renesas@sang-engineering.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (asb100) convert to i2c_new_dummy_deviceWolfram Sang
Move from i2c_new_dummy() to i2c_new_dummy_device(), so we now get an ERRPTR which we use in error handling. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20190722172611.3797-2-wsa+renesas@sang-engineering.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (k10temp) Add support for AMD family 17h, model 70h CPUsMarcel Bocu
It would seem like model 70h is behaving in the same way as model 30h, so let's just add the new F3 PCI ID to the list of compatible devices. Unlike previous Ryzen/Threadripper, Ryzen gen 3 processors do not need temperature offsets anymore. This has been reported in the press and verified on my Ryzen 3700X by checking that the idle temperature reported by k10temp is matching the temperature reported by the firmware. Vicki Pfau sent an identical patch after I checked that no-one had written this patch. I would have been happy about dropping my patch but unlike for his patch series, I had already Cc:ed the x86 people and they already reviewed the changes. Since Vicki has not answered to any email after his initial series, let's assume she is on vacation and let's avoid duplication of reviews from the maintainers and merge my series. To acknowledge Vicki's anteriority, I added her S-o-b to the patch. v2, suggested by Guenter Roeck and Brian Woods: - rename from 71h to 70h Signed-off-by: Vicki Pfau <vi@endrift.com> Signed-off-by: Marcel Bocu <marcel.p.bocu@gmail.com> Tested-by: Marcel Bocu <marcel.p.bocu@gmail.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: x86@kernel.org Cc: "Woods, Brian" <Brian.Woods@amd.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Jean Delvare <jdelvare@suse.com> Cc: Guenter Roeck <linux@roeck-us.net> Cc: linux-hwmon@vger.kernel.org Link: https://lore.kernel.org/r/20190722174653.2391-1-marcel.p.bocu@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (k8temp) update to use new hwmon registration APIRobert Karszniewicz
Removes: - hwmon_dev from k8temp_data struct, as that is now passed to callbacks, anyway. - other k8temp_data struct fields, too. - k8temp_update_device() Also reduces binary size: text data bss dec hex filename 4139 1448 0 5587 15d3 drivers/hwmon/k8temp.ko.bak 3103 1220 0 4323 10e3 drivers/hwmon/k8temp.ko Signed-off-by: Robert Karszniewicz <avoidr@firemail.cc> Signed-off-by: Robert Karszniewicz <avoidr@riseup.net> Link: https://lore.kernel.org/r/20190721120051.28064-1-avoidr@riseup.net Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (pmbus/max31785) Remove a useless #defineChristophe JAILLET
There is a typo in MAX37185_NUM_FAN_PAGES. To be consistent, it should be MAX31785_NUM_FAN_PAGES (1 and 7 switched). At line 24, we already have: #define MAX31785_NR_FAN_PAGES 6 and MAX37185_NUM_FAN_PAGES seems to be unused. It is likely that it is only a typo and/or a left-over. So, axe it. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/20190721101553.20911-1-christophe.jaillet@wanadoo.fr Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: (lm75) add support for PCT2075Daniel Mack
The NXP PCT2075 is largely compatible with other chips already supported by the LM75 driver. It uses an 11-bit resolution and defaults to 100 ms sampling period. The datasheet is here: https://www.nxp.com/docs/en/data-sheet/PCT2075.pdf Signed-off-by: Daniel Mack <daniel@zonque.org> Link: https://lore.kernel.org/r/20190711124504.7580-2-daniel@zonque.org [groeck: Documentation update] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03hwmon: Remove ads1015 driverGuenter Roeck
A driver for ADS1015 with more functionality is available in the iio subsystem. Remove the hwmon driver as duplicate. If the chip is used for hardware monitoring, the iio->hwmon bridge should be used. Cc: Dirk Eibach <eibach@gdsys.de> Link: https://lore.kernel.org/r/1562004758-13025-1-git-send-email-linux@roeck-us.net Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-08-31hwmon (coretemp) Fix a memory leak bugWenwen Wang
In coretemp_init(), 'zone_devices' is allocated through kcalloc(). However, it is not deallocated in the following execution if platform_driver_register() fails, leading to a memory leak. To fix this issue, introduce the 'outzone' label to free 'zone_devices' before returning the error. Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu> Link: https://lore.kernel.org/r/1566248402-6538-1-git-send-email-wenwen@cs.uga.edu Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-08-31hwmon: (lm75) Fix write operations for negative temperaturesGuenter Roeck
Writes into limit registers fail if the temperature written is negative. The regmap write operation checks the value range, regmap_write accepts an unsigned int as parameter, and the temperature value passed to regmap_write is kept in a variable declared as long. Negative values are converted large unsigned integers, which fails the range check. Fix by type casting the temperature to u16 when calling regmap_write(). Cc: Iker Perez del Palomar Sustatxa <iker.perez@codethink.co.uk> Fixes: e65365fed87f ("hwmon: (lm75) Convert to use regmap") Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-08-31hwmon: pmbus: ucd9000: remove unneeded includeBartosz Golaszewski
Build bot reports the following build issue after commit 9091373ab7ea ("gpio: remove less important #ifdef around declarations): In file included from drivers/hwmon/pmbus/ucd9000.c:19:0: >> include/linux/gpio/driver.h:576:1: error: redefinition of 'gpiochip_add_pin_range' gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, ^~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/hwmon/pmbus/ucd9000.c:18:0: include/linux/gpio.h:245:1: note: previous definition of 'gpiochip_add_pin_range' was here gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, ^~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/hwmon/pmbus/ucd9000.c:19:0: >> include/linux/gpio/driver.h:583:1: error: redefinition of 'gpiochip_add_pingroup_range' gpiochip_add_pingroup_range(struct gpio_chip *chip, ^~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/hwmon/pmbus/ucd9000.c:18:0: include/linux/gpio.h:254:1: note: previous definition of 'gpiochip_add_pingroup_range' was here gpiochip_add_pingroup_range(struct gpio_chip *chip, ^~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/hwmon/pmbus/ucd9000.c:19:0: >> include/linux/gpio/driver.h:591:1: error: redefinition of 'gpiochip_remove_pin_ranges' gpiochip_remove_pin_ranges(struct gpio_chip *chip) ^~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/hwmon/pmbus/ucd9000.c:18:0: include/linux/gpio.h:263:1: note: previous definition of 'gpiochip_remove_pin_ranges' was here gpiochip_remove_pin_ranges(struct gpio_chip *chip) This is caused by conflicting defines from linux/gpio.h and linux/gpio/driver.h. Drivers should not include both the legacy and the new API headers. This driver doesn't even use linux/gpio.h so remove it. Reported-by: kbuild test robot <lkp@intel.com> Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Link: https://lore.kernel.org/r/20190808080144.6183-1-brgl@bgdev.pl Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-08-28hwmon: pwm-fan: Use platform_get_irq_optional()Thierry Reding
The PWM fan interrupt is optional, so we don't want an error message in the kernel log if it wasn't specified. Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Stephen Boyd <swboyd@chromium.org> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://lore.kernel.org/r/20190828083411.2496-2-thierry.reding@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-12firmware: arm_scmi: Drop async flag in sensor_ops->reading_getSudeep Holla
SENSOR_DESCRIPTION_GET provides attributes to indicate if the sensor supports asynchronous read. Ideally we should be able to read that flag and use asynchronous reads for any sensors with that attribute set. In order to add that support, let's drop the async flag passed to sensor_ops->reading_get and dynamically switch between sync and async flags based on the attributes as provided by the firmware. Cc: linux-hwmon@vger.kernel.org Acked-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2019-08-07hwmon: (lm75) Fixup tmp75b clr_maskIker Perez del Palomar Sustatxa
The configuration register of the tmp75b sensor is 16bit long, however the first byte is reserved, so there is not no need to take care of it. Because the order of the bytes is little endian and it is only necessary to write one byte, the desired bits must be shifted into a 8 bit range. Fixes: 39abe9d88b30 ("hwmon: (lm75) Add support for TMP75B") Cc: stable@vger.kernel.org Signed-off-by: Iker Perez del Palomar Sustatxa <iker.perez@codethink.co.uk> Link: https://lore.kernel.org/r/20190801075324.4638-1-iker.perez@codethink.co.uk Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-08-07hwmon: (nct7802) Fix wrong detection of in4 presenceGuenter Roeck
The code to detect if in4 is present is wrong; if in4 is not present, the in4_input sysfs attribute is still present. In detail: - Ihen RTD3_MD=11 (VSEN3 present), everything is as expected (no bug). - If we have RTD3_MD!=11 (no VSEN3), we unexpectedly have a in4_input file under /sys and the "sensors" command displays in4_input. But as expected, we have no in4_min, in4_max, in4_alarm, in4_beep. Fix is_visible function to detect and report in4_input visibility as expected. Reported-by: Gilles Buloz <Gilles.Buloz@kontron.com> Cc: Gilles Buloz <Gilles.Buloz@kontron.com> Cc: stable@vger.kernel.org Fixes: 3434f37835804 ("hwmon: Driver for Nuvoton NCT7802Y") Signed-off-by: Guenter Roeck <linux@roeck-us.net>