Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c59e1ed authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'hwmon-for-linus-v4.10' of...

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

Pull hwmon updates from Guenter Roeck:

 - new drivers for TMP108 and TC654

 - hwmon core code cleanup

 - coretemp driver cleanup

 - fix overflow issues in several drivers

 - minor fixes, cleanups and enhancements in various drivers

* tag 'hwmon-for-linus-v4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (41 commits)
  hwmon: (g762) Fix overflows and crash seen when writing limit attributes
  hwmon: (emcw201) Fix overflows seen when writing into limit attributes
  hwmon: (emc2103) Fix overflows seen when temperature limit attributes
  hwmon: (lm85) Fix overflows seen when writing voltage limit attributes
  hwmon: (lm87) Fix overflow seen when writing voltage limit attributes
  hwmon: (nct7802) Fix overflows seen when writing into limit attributes
  hwmon: (adt7470) Fix overflows seen when writing into limit attributes
  hwmon: (adt7462) Fix overflows seen when writing into limit attributes
  hwmon: (adm1026) Fix overflows seen when writing into limit attributes
  hwmon: (adm1025) Fix overflows seen when writing voltage limits
  hwmon: (via-cputemp) Convert to hotplug state machine
  devicetree: hwmon: Add documentation for TMP108 driver.
  hwmon: Add Texas Instruments TMP108 temperature sensor driver.
  hwmon: (core) Simplify sysfs attribute name allocation
  hwmon: (core) Rename groups parameter in API to extra_groups
  hwmon: (core) Explain why at least two attribute groups are allocated
  hwmon: (core) Make is_visible callback truly mandatory
  hwmon: (core) Deprecate hwmon_device_register()
  hwmon: (core) Clarify use of chip attributes
  hwmon: (core) Add support for string attributes to new API
  ...
parents bb3dd056 4fccd4a1
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
mcp3021 properties

Required properties:
- compatible: Must be one of the following:
	- "microchip,mcp3021" for mcp3021
	- "microchip,mcp3221" for mcp3221
- reg: I2C address

Optional properties:

- reference-voltage-microvolt
	Reference voltage in microvolt (uV)

Example:

mcp3021@4d {
	compatible = "microchip,mcp3021";
	reg = <0x4d>;

	reference-voltage-microvolt = <4500000>; /* 4.5 V */
};
+14 −0
Original line number Diff line number Diff line
TMP108 temperature sensor
-------------------------

This device supports I2C only.

Requires node properties:
- compatible : "ti,tmp108"
- reg : the I2C address of the device. This is 0x48, 0x49, 0x4a, or 0x4b.

Example:
	tmp108@48 {
		compatible = "ti,tmp108";
		reg = <0x48>;
	};
+2 −0
Original line number Diff line number Diff line
@@ -124,6 +124,8 @@ microchip,mcp4662-502 Microchip 8-bit Dual I2C Digital Potentiometer with NV Mem
microchip,mcp4662-103	Microchip 8-bit Dual I2C Digital Potentiometer with NV Memory (10k)
microchip,mcp4662-503	Microchip 8-bit Dual I2C Digital Potentiometer with NV Memory (50k)
microchip,mcp4662-104	Microchip 8-bit Dual I2C Digital Potentiometer with NV Memory (100k)
microchip,tc654		PWM Fan Speed Controller With Fan Fault Detection
microchip,tc655		PWM Fan Speed Controller With Fan Fault Detection
miramems,da226		MiraMEMS DA226 2-axis 14-bit digital accelerometer
miramems,da280		MiraMEMS DA280 3-axis 14-bit digital accelerometer
miramems,da311		MiraMEMS DA311 3-axis 12-bit digital accelerometer
+26 −32
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ Each hardware monitoring driver must #include <linux/hwmon.h> and, in most
cases, <linux/hwmon-sysfs.h>. linux/hwmon.h declares the following
register/unregister functions:

struct device *hwmon_device_register(struct device *dev);
struct device *
hwmon_device_register_with_groups(struct device *dev, const char *name,
				  void *drvdata,
@@ -38,36 +37,31 @@ struct device *
hwmon_device_register_with_info(struct device *dev,
				const char *name, void *drvdata,
				const struct hwmon_chip_info *info,
				const struct attribute_group **groups);
				const struct attribute_group **extra_groups);

struct device *
devm_hwmon_device_register_with_info(struct device *dev,
				const char *name,
				void *drvdata,
				const struct hwmon_chip_info *info,
				     const struct attribute_group **groups);
				const struct attribute_group **extra_groups);

void hwmon_device_unregister(struct device *dev);
void devm_hwmon_device_unregister(struct device *dev);

hwmon_device_register registers a hardware monitoring device. The parameter
of this function is a pointer to the parent device.
This function returns a pointer to the newly created hardware monitoring device
or PTR_ERR for failure. If this registration function is used, hardware
monitoring sysfs attributes are expected to have been created and attached to
the parent device prior to calling hwmon_device_register. A name attribute must
have been created by the caller.

hwmon_device_register_with_groups is similar to hwmon_device_register. However,
it has additional parameters. The name parameter is a pointer to the hwmon
device name. The registration function wil create a name sysfs attribute
pointing to this name. The drvdata parameter is the pointer to the local
driver data.  hwmon_device_register_with_groups will attach this pointer
to the newly allocated hwmon device. The pointer can be retrieved by the driver
using dev_get_drvdata() on the hwmon device pointer. The groups parameter is
hwmon_device_register_with_groups registers a hardware monitoring device.
The first parameter of this function is a pointer to the parent device.
The name parameter is a pointer to the hwmon device name. The registration
function wil create a name sysfs attribute pointing to this name.
The drvdata parameter is the pointer to the local driver data.
hwmon_device_register_with_groups will attach this pointer to the newly
allocated hwmon device. The pointer can be retrieved by the driver using
dev_get_drvdata() on the hwmon device pointer. The groups parameter is
a pointer to a list of sysfs attribute groups. The list must be NULL terminated.
hwmon_device_register_with_groups creates the hwmon device with name attribute
as well as all sysfs attributes attached to the hwmon device.
This function returns a pointer to the newly created hardware monitoring device
or PTR_ERR for failure.

devm_hwmon_device_register_with_groups is similar to
hwmon_device_register_with_groups. However, it is device managed, meaning the
@@ -87,13 +81,13 @@ hwmon_device_unregister deregisters a registered hardware monitoring device.
The parameter of this function is the pointer to the registered hardware
monitoring device structure. This function must be called from the driver
remove function if the hardware monitoring device was registered with
hwmon_device_register, hwmon_device_register_with_groups, or
hwmon_device_register_with_info.
hwmon_device_register_with_groups or hwmon_device_register_with_info.

devm_hwmon_device_unregister does not normally have to be called. It is only
needed for error handling, and only needed if the driver probe fails after
the call to devm_hwmon_device_register_with_groups and if the automatic
(device managed) removal would be too late.
the call to devm_hwmon_device_register_with_groups or
hwmon_device_register_with_info and if the automatic (device managed)
removal would be too late.

Using devm_hwmon_device_register_with_info()
--------------------------------------------
@@ -106,9 +100,9 @@ const char *name Device name
void *drvdata		Driver private data
const struct hwmon_chip_info *info
			Pointer to chip description.
const struct attribute_group **groups
			Null-terminated list of additional sysfs attribute
			groups.
const struct attribute_group **extra_groups
			Null-terminated list of additional non-standard
			sysfs attribute groups.

This function returns a pointer to the created hardware monitoring device
on success and a negative error code for failure.
@@ -160,7 +154,7 @@ It contains following fields:
* type: The hardware monitoring sensor type.
  Supported sensor types are
  * hwmon_chip		A virtual sensor type, used to describe attributes
			which apply to the entire chip.
  *			which are not bound to a specific input or output
  * hwmon_temp		Temperature sensor
  * hwmon_in		Voltage sensor
  * hwmon_curr		Current sensor
@@ -293,9 +287,9 @@ Driver-provided sysfs attributes

If the hardware monitoring device is registered with
hwmon_device_register_with_info or devm_hwmon_device_register_with_info,
it is most likely not necessary to provide sysfs attributes. Only non-standard
sysfs attributes need to be provided when one of those registration functions
is used.
it is most likely not necessary to provide sysfs attributes. Only additional
non-standard sysfs attributes need to be provided when one of those registration
functions is used.

The header file linux/hwmon-sysfs.h provides a number of useful macros to
declare and use hardware monitoring sysfs attributes.
+31 −0
Original line number Diff line number Diff line
Kernel driver tc654
===================

Supported chips:
  * Microship TC654 and TC655
    Prefix: 'tc654'
    Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/20001734C.pdf

Authors:
        Chris Packham <chris.packham@alliedtelesis.co.nz>
        Masahiko Iwamoto <iwamoto@allied-telesis.co.jp>

Description
-----------
This driver implements support for the Microchip TC654 and TC655.

The TC654 uses the 2-wire interface compatible with the SMBUS 2.0
specification. The TC654 has two (2) inputs for measuring fan RPM and
one (1) PWM output which can be used for fan control.

Configuration Notes
-------------------
Ordinarily the pwm1_mode ABI is used for controlling the pwm output
mode.  However, for this chip the output is always pwm, and the
pwm1_mode determines if the pwm output is controlled via the pwm1 value
or via the Vin analog input.


Setting pwm1_mode to 1 will cause the pwm output to be driven based on
the pwm1 value. Setting pwm1_mode to 0 will cause the pwm output to be
driven based on the Vin input.
Loading