Commit 64b08df4 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull hwmon updates from Guenter Roeck:

 - New drivers for Infineon PXE1610 and IRPS5401

 - Minor improvements, cleanup, and fixes in several drivers

* tag 'hwmon-for-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (33 commits)
  hwmon: (ina3221) Add of_node_put() before return
  hwmon: (gpio-fan) fix sysfs notifications and udev events for gpio-fan alarms
  hwmon: (gpio-fan) move fan_alarm_init after devm_hwmon_device_register_with_groups
  hwmon: (lm90) Introduce function to update configuration register
  hwmon: (lm90) Cache configuration register value
  hwmon: (lm90) Fix max6658 sporadic wrong temperature reading
  hwmon: (nct7904) Changes comments in probe function.
  hwmon: (nct7904) Add error handling in probe function.
  hwmon: Convert remaining drivers to use SPDX identifier
  hwmon: (max6650) Fix unused variable warning
  hwmon: (pmbus/adm1275) Fix power sampling support
  hwmon: (lm90) simplify getting the adapter of a client
  hwmon: (asus_atk0110) no need to check return value of debugfs_create functions
  hwmon: (max6650) Fix minor formatting issues
  hwmon: (max6650) Improve error handling in max6650_update_device
  hwmon: (max6650) Read non-volatile registers only once
  hwmon: (max6650) Convert to use devm_hwmon_device_register_with_info
  hwmon: (max6650) Simplify alarm handling
  hwmon: (max6650) Cache alarm_en register
  hwmon: (max6650) Declare valid as boolean
  ...
parents c079512a 9f754657
Loading
Loading
Loading
Loading
+90 −0
Original line number Original line Diff line number Diff line
Kernel driver pxe1610
=====================

Supported chips:
  * Infineon PXE1610
    Prefix: 'pxe1610'
    Addresses scanned: -
    Datasheet: Datasheet is not publicly available.

  * Infineon PXE1110
    Prefix: 'pxe1110'
    Addresses scanned: -
    Datasheet: Datasheet is not publicly available.

  * Infineon PXM1310
    Prefix: 'pxm1310'
    Addresses scanned: -
    Datasheet: Datasheet is not publicly available.

Author: Vijay Khemka <vijaykhemka@fb.com>


Description
-----------

PXE1610/PXE1110 are Multi-rail/Multiphase Digital Controllers
and compliant to
	-- Intel VR13 DC-DC converter specifications.
	-- Intel SVID protocol.
Used for Vcore power regulation for Intel VR13 based microprocessors
	-- Servers, Workstations, and High-end desktops

PXM1310 is a Multi-rail Controller and it is compliant to
	-- Intel VR13 DC-DC converter specifications.
	-- Intel SVID protocol.
Used for DDR3/DDR4 Memory power regulation for Intel VR13 and
IMVP8 based systems


Usage Notes
-----------

This driver does not probe for PMBus devices. You will have
to instantiate devices explicitly.

Example: the following commands will load the driver for an PXE1610
at address 0x70 on I2C bus #4:

# modprobe pxe1610
# echo pxe1610 0x70 > /sys/bus/i2c/devices/i2c-4/new_device

It can also be instantiated by declaring in device tree


Sysfs attributes
----------------

curr1_label		"iin"
curr1_input		Measured input current
curr1_alarm		Current high alarm

curr[2-4]_label		"iout[1-3]"
curr[2-4]_input		Measured output current
curr[2-4]_crit		Critical maximum current
curr[2-4]_crit_alarm	Current critical high alarm

in1_label		"vin"
in1_input		Measured input voltage
in1_crit		Critical maximum input voltage
in1_crit_alarm		Input voltage critical high alarm

in[2-4]_label		"vout[1-3]"
in[2-4]_input		Measured output voltage
in[2-4]_lcrit		Critical minimum output voltage
in[2-4]_lcrit_alarm	Output voltage critical low alarm
in[2-4]_crit		Critical maximum output voltage
in[2-4]_crit_alarm	Output voltage critical high alarm

power1_label		"pin"
power1_input		Measured input power
power1_alarm		Input power high alarm

power[2-4]_label	"pout[1-3]"
power[2-4]_input	Measured output power

temp[1-3]_input		Measured temperature
temp[1-3]_crit		Critical high temperature
temp[1-3]_crit_alarm	Chip temperature critical high alarm
temp[1-3]_max		Maximum temperature
temp[1-3]_max_alarm	Chip temperature high alarm
+0 −10
Original line number Original line Diff line number Diff line
@@ -10,16 +10,6 @@
 * Very rare chip please let me know if you use it
 * Very rare chip please let me know if you use it
 *
 *
 * http://www.analog.com/UploadedFiles/Data_Sheets/ADM1029.pdf
 * http://www.analog.com/UploadedFiles/Data_Sheets/ADM1029.pdf
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation version 2 of the License
 *
 * 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.
 */
 */


#include <linux/module.h>
#include <linux/module.h>
+3 −20
Original line number Original line Diff line number Diff line
@@ -789,33 +789,16 @@ static const struct file_operations atk_debugfs_ggrp_fops = {
static void atk_debugfs_init(struct atk_data *data)
static void atk_debugfs_init(struct atk_data *data)
{
{
	struct dentry *d;
	struct dentry *d;
	struct dentry *f;


	data->debugfs.id = 0;
	data->debugfs.id = 0;


	d = debugfs_create_dir("asus_atk0110", NULL);
	d = debugfs_create_dir("asus_atk0110", NULL);
	if (!d || IS_ERR(d))
		return;


	f = debugfs_create_x32("id", 0600, d, &data->debugfs.id);
	debugfs_create_x32("id", 0600, d, &data->debugfs.id);
	if (!f || IS_ERR(f))
	debugfs_create_file_unsafe("gitm", 0400, d, data, &atk_debugfs_gitm);
		goto cleanup;
	debugfs_create_file("ggrp", 0400, d, data, &atk_debugfs_ggrp_fops);

	f = debugfs_create_file_unsafe("gitm", 0400, d, data,
				       &atk_debugfs_gitm);
	if (!f || IS_ERR(f))
		goto cleanup;

	f = debugfs_create_file("ggrp", 0400, d, data,
				&atk_debugfs_ggrp_fops);
	if (!f || IS_ERR(f))
		goto cleanup;


	data->debugfs.root = d;
	data->debugfs.root = d;

	return;
cleanup:
	debugfs_remove_recursive(d);
}
}


static void atk_debugfs_cleanup(struct atk_data *data)
static void atk_debugfs_cleanup(struct atk_data *data)
+12 −10
Original line number Original line Diff line number Diff line
@@ -54,8 +54,8 @@ static void fan_alarm_notify(struct work_struct *ws)
	struct gpio_fan_data *fan_data =
	struct gpio_fan_data *fan_data =
		container_of(ws, struct gpio_fan_data, alarm_work);
		container_of(ws, struct gpio_fan_data, alarm_work);


	sysfs_notify(&fan_data->dev->kobj, NULL, "fan1_alarm");
	sysfs_notify(&fan_data->hwmon_dev->kobj, NULL, "fan1_alarm");
	kobject_uevent(&fan_data->dev->kobj, KOBJ_CHANGE);
	kobject_uevent(&fan_data->hwmon_dev->kobj, KOBJ_CHANGE);
}
}


static irqreturn_t fan_alarm_irq_handler(int irq, void *dev_id)
static irqreturn_t fan_alarm_irq_handler(int irq, void *dev_id)
@@ -510,13 +510,6 @@ static int gpio_fan_probe(struct platform_device *pdev)
	platform_set_drvdata(pdev, fan_data);
	platform_set_drvdata(pdev, fan_data);
	mutex_init(&fan_data->lock);
	mutex_init(&fan_data->lock);


	/* Configure alarm GPIO if available. */
	if (fan_data->alarm_gpio) {
		err = fan_alarm_init(fan_data);
		if (err)
			return err;
	}

	/* Configure control GPIOs if available. */
	/* Configure control GPIOs if available. */
	if (fan_data->gpios && fan_data->num_gpios > 0) {
	if (fan_data->gpios && fan_data->num_gpios > 0) {
		if (!fan_data->speed || fan_data->num_speed <= 1)
		if (!fan_data->speed || fan_data->num_speed <= 1)
@@ -524,7 +517,9 @@ static int gpio_fan_probe(struct platform_device *pdev)
		err = fan_ctrl_init(fan_data);
		err = fan_ctrl_init(fan_data);
		if (err)
		if (err)
			return err;
			return err;
		devm_add_action_or_reset(dev, gpio_fan_stop, fan_data);
		err = devm_add_action_or_reset(dev, gpio_fan_stop, fan_data);
		if (err)
			return err;
	}
	}


	/* Make this driver part of hwmon class. */
	/* Make this driver part of hwmon class. */
@@ -535,6 +530,13 @@ static int gpio_fan_probe(struct platform_device *pdev)
	if (IS_ERR(fan_data->hwmon_dev))
	if (IS_ERR(fan_data->hwmon_dev))
		return PTR_ERR(fan_data->hwmon_dev);
		return PTR_ERR(fan_data->hwmon_dev);


	/* Configure alarm GPIO if available. */
	if (fan_data->alarm_gpio) {
		err = fan_alarm_init(fan_data);
		if (err)
			return err;
	}

	/* Optional cooling device register for Device tree platforms */
	/* Optional cooling device register for Device tree platforms */
	fan_data->cdev = devm_thermal_of_cooling_device_register(dev, np,
	fan_data->cdev = devm_thermal_of_cooling_device_register(dev, np,
				"gpio-fan", fan_data, &gpio_fan_cool_ops);
				"gpio-fan", fan_data, &gpio_fan_cool_ops);
+6 −0
Original line number Original line Diff line number Diff line
@@ -651,6 +651,12 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
								hwdev, j);
								hwdev, j);
					if (err) {
					if (err) {
						device_unregister(hdev);
						device_unregister(hdev);
						/*
						 * Don't worry about hwdev;
						 * hwmon_dev_release(), called
						 * from device_unregister(),
						 * will free it.
						 */
						goto ida_remove;
						goto ida_remove;
					}
					}
				}
				}
Loading