summaryrefslogtreecommitdiff
path: root/drivers/hwmon/pc87427.c
AgeCommit message (Collapse)Author
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174Thomas Gleixner
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 655 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070034.575739538@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-15hwmon: (pc87427) Use request_muxed_region for Super-IO accessesGuenter Roeck
Super-IO accesses may fail on a system with no or unmapped LPC bus. Also, other drivers may attempt to access the LPC bus at the same time, resulting in undefined behavior. Use request_muxed_region() to ensure that IO access on the requested address space is supported, and to ensure that access by multiple drivers is synchronized. Fixes: ba224e2c4f0a7 ("hwmon: New PC87427 hardware monitoring driver") Reported-by: Kefeng Wang <wangkefeng.wang@huawei.com> Reported-by: John Garry <john.garry@huawei.com> Cc: John Garry <john.garry@huawei.com> Acked-by: John Garry <john.garry@huawei.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-02-18hwmon: (pc87427) Use permission specific SENSOR[_DEVICE]_ATTR variantsGuenter Roeck
Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readability, and to reduce the chance of inconsistencies. Also replace any remaining S_<PERMS> in the driver with octal values. The conversion was done automatically with coccinelle. The semantic patches and the scripts used to generate this commit log are available at https://github.com/groeck/coccinelle-patches/hwmon/. This patch does not introduce functional changes. It was verified by compiling the old and new files and comparing text and data sizes. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-01-02hwmon: (pc87427) use permission-specific DEVICE_ATTR variantsJulia Lawall
Use DEVICE_ATTR_RO for read-only attributes. This simplifies the source code, improves readbility, and reduces the chance of inconsistencies. The conversion was done automatically using coccinelle. It was validated by compiling both the old and the new source code and comparing its text, data, and bss size. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> [groeck: Updated description] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-10-20hwmon: drop owner assignment from platform_driversWolfram Sang
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-05-21hwmon: (pc87427) remove unnecessary OOM messagesJingoo Han
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>
2014-01-29Update Jean Delvare's e-mail addressJean Delvare
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2013-08-11hwmon: use dev_get_platdata()Jingoo Han
Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07hwmon: Fix checkpatch warning 'quoted string split across lines'Guenter Roeck
Cc: Corentin Labbe <corentin.labbe@geomatys.fr> Cc: Mark M. Hoffman <mhoffman@lightlink.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Cc: Marc Hulsman <m.hulsman@tudelft.nl> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-11-28hwmon: remove use of __devexitBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28hwmon: remove use of __devinitBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28hwmon: remove use of __devexit_pBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-21hwmon: (pc87427) Convert to use devm_ functionsGuenter Roeck
Convert to use devm_ functions to reduce code size and simplify the code. Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-03-18hwmon: (pc87427) Fix multi-line commentsGuenter Roeck
Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-01-05hwmon: replaced strict_str* with kstr*Frans Meulenbroeks
replaced strict_strtol with kstrtol and replaced strict_strtuol with kstrtuol This satisfies checkpatch -f Compile tested only: no warnings or errors given Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-01-12hwmon: (pc87427) Use pr_fmt and pr_<level>Joe Perches
Added #define pr_fmt KBUILD_MODNAME ": " fmt Converted printks to pr_<level> Coalesced any long formats Removed prefixes from formats Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-08-14hwmon: (pc87427) Move sysfs file removal to a separate functionJean Delvare
The sysfs file removal code is the same in the probe error path and in the remove function, so move it to a separate function to avoid code duplication. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-08-14hwmon: (pc87427) Add temperature monitoring supportJean Delvare
Add support for the 6 temperature monitoring channels of the PC87427. Note that the sensors resolution can vary, and I couldn't find a way to figure it out, so we might have to compensate in user-space. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-08-14hwmon: (pc87427) Add support for the second logical deviceJean Delvare
The second logical device contains the voltage and temperature registers. We have to extend the driver to support a second logical device before we can add support for these features. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-08-14hwmon: (pc87427) Add support for manual fan speed controlJean Delvare
Add initial support for PWM outputs of the PC87427 Super-I/O chip. Only mode change and manual fan speed control are supported. Automatic mode configuration isn't supported, and won't be until at least one board is known, which makes uses of the PWM outputs. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-08-14hwmon: (pc87427) Minor style cleanupsJean Delvare
Follow the best practice of the day. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-08-14hwmon: (pc87427) Handle disabled fan inputs properlyJean Delvare
Most fan input pins of the PC87427 can have alternate functions. Update the driver to check the configuration register and only support fan inputs which are really used for fan monitoring. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2009-09-15hwmon: Use resource_sizeJulia Lawall
Use the function resource_size, which reduces the chance of introducing off-by-one errors in calculating the resource size. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @@ struct resource *res; @@ - (res->end - res->start) + 1 + resource_size(res) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-09-15hwmon: Include <linux/io.h> instead of <asm/io.h>H Hartley Sweeten
Drivers should be including <linux/io.h> instead of <asm/io.h>. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Nicolas Boichat <nicolas@boichat.ch> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Frank Seidel <frank@f-seidel.de> Acked-by: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-01-07hwmon: Check for ACPI resource conflictsJean Delvare
Check for ACPI resource conflicts in hwmon drivers. I've included all Super-I/O and PCI drivers. I've voluntarily left out: * Vendor-specific drivers: if they conflicted on any system, this would pretty much mean that they conflict on all systems, and we would know by now. * Legacy ISA drivers (lm78 and w83781d): they only support chips found on old designs were ACPI either wasn't supported or didn't deal with thermal management. * Drivers accessing the I/O resources indirectly (e.g. through SMBus): the checks are already done where they belong, i.e. in the bus drivers. Signed-off-by: Jean Delvare <jdelvare@suse.de> Acked-by: David Hubbard <david.c.hubbard@gmail.com>
2008-02-07hwmon: Let the user override the detected Super-I/O device IDJean Delvare
While it is possible to force SMBus-based hardware monitoring chip drivers to drive a not officially supported device, we do not have this possibility for Super-I/O-based drivers. That's unfortunate because sometimes newer chips are fully compatible and just forcing the driver to load would work. Instead of that we have to tell the users to recompile the kernel driver, which isn't an easy task for everyone. So, I propose that we add a module parameter to all Super-I/O based hardware monitoring drivers, letting advanced users force the driver to load on their machine. The user has to provide the device ID of a supposedly compatible device. This requires looking at the source code or a datasheet, so I am confident that users can't randomly force a driver without knowing what they are doing. Thus this should be relatively safe. As you can see from the code, the implementation is pretty simple and unintrusive. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Hans de Goede <j.w.r.degoede@hhs.nl> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2007-10-09hwmon: Convert from class_device to deviceTony Jones
Convert from class_device to device for hwmon_device_register/unregister Signed-off-by: Tony Jones <tonyj@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2007-07-19hwmon: Fix a potential race condition on unloadJean Delvare
Fix a potential race condition when some hardware monitoring platform drivers are being unloaded. I believe that the driver data pointer shouldn't be cleared before all the sysfs files are removed, otherwise a sysfs callback might attempt to dereference a NULL pointer. I'm not sure exactly what the driver core protects drivers against, so let's play it safe. While we're here, clear the driver data pointer when probe fails, so as to not leave an invalid pointer behind us. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2007-05-08hwmon: Request the I/O regions in platform driversJean Delvare
My understanding of the resource management in the Linux 2.6 device driver model is that the devices should declare their resources, and then when a driver attaches to a device, it should request the resources it will be using, so as to mark them busy. This is how the PCI and PNP subsystems work, you can clearly see the two levels of resources (declaration and request) in /proc/ioports for these devices. So I believe that our platform hardware monitoring drivers should follow the same logic. At the moment, we only declare the resources but we do not request them. This patch adds the I/O region request and release calls. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Juerg Haefliger <juergh@gmail.com>
2006-12-12hwmon: New PC87427 hardware monitoring driverJean Delvare
This is a new hardware monitoring driver for the National Semiconductor PC87427 Super-I/O chip. It only supports fan speed monitoring for now, while the chip can do much more. Thanks to Amir Habibi at Candelis for setting up a test system, and to Michael Kress for testing several iterations of this driver. Signed-off-by: Jean Delvare <khali@linux-fr.org>