mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 09:12:07 +00:00
hwmon: (pmbus/crps) Add Intel CRPS185 power supply
Add the driver to monitor Intel common redundant power supply (crps185) with hwmon over pmbus. Signed-off-by: Ninad Palsule <ninad@linux.ibm.com> Link: https://lore.kernel.org/r/20241217173537.192331-3-ninad@linux.ibm.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
parent
18e930f981
commit
de076198d1
97
Documentation/hwmon/crps.rst
Normal file
97
Documentation/hwmon/crps.rst
Normal file
@ -0,0 +1,97 @@
|
||||
.. SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
Kernel driver crps
|
||||
==================
|
||||
|
||||
Supported chips:
|
||||
|
||||
* Intel CRPS185
|
||||
|
||||
Prefix: 'crps185'
|
||||
|
||||
Addresses scanned: -
|
||||
|
||||
Datasheet: Only available under NDA.
|
||||
|
||||
Authors:
|
||||
Ninad Palsule <ninad@linux.ibm.com>
|
||||
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
This driver implements support for Intel Common Redundant Power supply with
|
||||
PMBus support.
|
||||
|
||||
The driver is a client driver to the core PMBus driver.
|
||||
Please see Documentation/hwmon/pmbus.rst for details on PMBus client drivers.
|
||||
|
||||
|
||||
Usage Notes
|
||||
-----------
|
||||
|
||||
This driver does not auto-detect devices. You will have to instantiate the
|
||||
devices explicitly. Please see Documentation/i2c/instantiating-devices.rst for
|
||||
details.
|
||||
|
||||
|
||||
Sysfs entries
|
||||
-------------
|
||||
|
||||
======================= ======================================================
|
||||
curr1_label "iin"
|
||||
curr1_input Measured input current
|
||||
curr1_max Maximum input current
|
||||
curr1_max_alarm Input maximum current high alarm
|
||||
curr1_crit Critial high input current
|
||||
curr1_crit_alarm Input critical current high alarm
|
||||
curr1_rated_max Maximum rated input current
|
||||
|
||||
curr2_label "iout1"
|
||||
curr2_input Measured output current
|
||||
curr2_max Maximum output current
|
||||
curr2_max_alarm Output maximum current high alarm
|
||||
curr2_crit Critial high output current
|
||||
curr2_crit_alarm Output critical current high alarm
|
||||
curr2_rated_max Maximum rated output current
|
||||
|
||||
in1_label "vin"
|
||||
in1_input Measured input voltage
|
||||
in1_crit Critical input over voltage
|
||||
in1_crit_alarm Critical input over voltage alarm
|
||||
in1_max Maximum input over voltage
|
||||
in1_max_alarm Maximum input over voltage alarm
|
||||
in1_rated_min Minimum rated input voltage
|
||||
in1_rated_max Maximum rated input voltage
|
||||
|
||||
in2_label "vout1"
|
||||
in2_input Measured input voltage
|
||||
in2_crit Critical input over voltage
|
||||
in2_crit_alarm Critical input over voltage alarm
|
||||
in2_lcrit Critical input under voltage fault
|
||||
in2_lcrit_alarm Critical input under voltage fault alarm
|
||||
in2_max Maximum input over voltage
|
||||
in2_max_alarm Maximum input over voltage alarm
|
||||
in2_min Minimum input under voltage warning
|
||||
in2_min_alarm Minimum input under voltage warning alarm
|
||||
in2_rated_min Minimum rated input voltage
|
||||
in2_rated_max Maximum rated input voltage
|
||||
|
||||
power1_label "pin"
|
||||
power1_input Measured input power
|
||||
power1_alarm Input power high alarm
|
||||
power1_max Maximum input power
|
||||
power1_rated_max Maximum rated input power
|
||||
|
||||
temp[1-2]_input Measured temperature
|
||||
temp[1-2]_crit Critical temperature
|
||||
temp[1-2]_crit_alarm Critical temperature alarm
|
||||
temp[1-2]_max Maximum temperature
|
||||
temp[1-2]_max_alarm Maximum temperature alarm
|
||||
temp[1-2]_rated_max Maximum rated temperature
|
||||
|
||||
fan1_alarm Fan 1 warning.
|
||||
fan1_fault Fan 1 fault.
|
||||
fan1_input Fan 1 speed in RPM.
|
||||
fan1_target Fan 1 target.
|
||||
======================= ======================================================
|
@ -58,6 +58,7 @@ Hardware Monitoring Kernel Drivers
|
||||
corsair-cpro
|
||||
corsair-psu
|
||||
cros_ec_hwmon
|
||||
crps
|
||||
da9052
|
||||
da9055
|
||||
dell-smm-hwmon
|
||||
|
@ -6064,6 +6064,13 @@ L: linux-input@vger.kernel.org
|
||||
S: Maintained
|
||||
F: drivers/hid/hid-creative-sb0540.c
|
||||
|
||||
INTEL CRPS COMMON REDUNDANT PSU DRIVER
|
||||
M: Ninad Palsule <ninad@linux.ibm.com>
|
||||
L: linux-hwmon@vger.kernel.org
|
||||
S: Maintained
|
||||
F: Documentation/hwmon/crps.rst
|
||||
F: drivers/hwmon/pmbus/crps.c
|
||||
|
||||
CRYPTO API
|
||||
M: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
M: "David S. Miller" <davem@davemloft.net>
|
||||
|
@ -85,6 +85,15 @@ config SENSORS_BPA_RS600
|
||||
This driver can also be built as a module. If so, the module will
|
||||
be called bpa-rs600.
|
||||
|
||||
config SENSORS_CRPS
|
||||
tristate "Intel Common Redundant Power Supply"
|
||||
help
|
||||
If you say yes here you get hardware monitoring support for the Intel
|
||||
Common Redundant Power Supply.
|
||||
|
||||
This driver can also be built as a module. If so, the module will
|
||||
be called crps.
|
||||
|
||||
config SENSORS_DELTA_AHE50DC_FAN
|
||||
tristate "Delta AHE-50DC fan control module"
|
||||
help
|
||||
|
@ -62,3 +62,4 @@ obj-$(CONFIG_SENSORS_XDPE122) += xdpe12284.o
|
||||
obj-$(CONFIG_SENSORS_XDPE152) += xdpe152c4.o
|
||||
obj-$(CONFIG_SENSORS_ZL6100) += zl6100.o
|
||||
obj-$(CONFIG_SENSORS_PIM4328) += pim4328.o
|
||||
obj-$(CONFIG_SENSORS_CRPS) += crps.o
|
||||
|
74
drivers/hwmon/pmbus/crps.c
Normal file
74
drivers/hwmon/pmbus/crps.c
Normal file
@ -0,0 +1,74 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright 2024 IBM Corp.
|
||||
*/
|
||||
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/pmbus.h>
|
||||
|
||||
#include "pmbus.h"
|
||||
|
||||
static const struct i2c_device_id crps_id[] = {
|
||||
{ "intel_crps185" },
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, crps_id);
|
||||
|
||||
static struct pmbus_driver_info crps_info = {
|
||||
.pages = 1,
|
||||
/* PSU uses default linear data format. */
|
||||
.func[0] = PMBUS_HAVE_PIN | PMBUS_HAVE_IOUT |
|
||||
PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_IIN |
|
||||
PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT |
|
||||
PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
|
||||
PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 |
|
||||
PMBUS_HAVE_STATUS_TEMP |
|
||||
PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12,
|
||||
};
|
||||
|
||||
static int crps_probe(struct i2c_client *client)
|
||||
{
|
||||
int rc;
|
||||
struct device *dev = &client->dev;
|
||||
char buf[I2C_SMBUS_BLOCK_MAX + 2] = { 0 };
|
||||
|
||||
rc = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, buf);
|
||||
if (rc < 0)
|
||||
return dev_err_probe(dev, rc, "Failed to read PMBUS_MFR_MODEL\n");
|
||||
|
||||
if (rc != 7 || strncmp(buf, "03NK260", 7)) {
|
||||
buf[rc] = '\0';
|
||||
return dev_err_probe(dev, -ENODEV, "Model '%s' not supported\n", buf);
|
||||
}
|
||||
|
||||
rc = pmbus_do_probe(client, &crps_info);
|
||||
if (rc)
|
||||
return dev_err_probe(dev, rc, "Failed to probe\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id crps_of_match[] = {
|
||||
{
|
||||
.compatible = "intel,crps185",
|
||||
},
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, crps_of_match);
|
||||
|
||||
static struct i2c_driver crps_driver = {
|
||||
.driver = {
|
||||
.name = "crps",
|
||||
.of_match_table = crps_of_match,
|
||||
},
|
||||
.probe = crps_probe,
|
||||
.id_table = crps_id,
|
||||
};
|
||||
|
||||
module_i2c_driver(crps_driver);
|
||||
|
||||
MODULE_AUTHOR("Ninad Palsule");
|
||||
MODULE_DESCRIPTION("PMBus driver for Intel Common Redundant power supplies");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_IMPORT_NS("PMBUS");
|
Loading…
Reference in New Issue
Block a user