-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
diff --git a/debian/build/build_amd64_none_amd64/.config b/debian/build/build_amd64_none_amd64/.config | ||
index 6b6aea9..14e32cb 100644 | ||
--- a/debian/build/build_amd64_none_amd64/.config | ||
+++ b/debian/build/build_amd64_none_amd64/.config | ||
@@ -6820,3 +6821,4 @@ CONFIG_FONT_SUPPORT=y | ||
# CONFIG_FONTS is not set | ||
CONFIG_FONT_8x8=y | ||
CONFIG_FONT_8x16=y | ||
+CONFIG_SENSORS_DPS1900=m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig | ||
index 510f055..f8ca77e 100644 | ||
--- a/drivers/hwmon/pmbus/Kconfig | ||
+++ b/drivers/hwmon/pmbus/Kconfig | ||
@@ -131,4 +131,14 @@ config SENSORS_ZL6100 | ||
This driver can also be built as a module. If so, the module will | ||
be called zl6100. | ||
|
||
+config SENSORS_DPS1900 | ||
+ tristate "Delta DPS1900" | ||
+ default n | ||
+ help | ||
+ If you say yes here you get hardware monitoring support for Delta | ||
+ DPS1900. | ||
+ | ||
+ This driver can also be built as a module. If so, the module will | ||
+ be called dps1900. | ||
+ | ||
endif # PMBUS | ||
diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile | ||
index be70828..8276d89 100644 | ||
--- a/drivers/hwmon/pmbus/Makefile | ||
+++ b/drivers/hwmon/pmbus/Makefile | ||
@@ -14,3 +14,4 @@ obj-$(CONFIG_SENSORS_MAX8688) += max8688.o | ||
obj-$(CONFIG_SENSORS_UCD9000) += ucd9000.o | ||
obj-$(CONFIG_SENSORS_UCD9200) += ucd9200.o | ||
obj-$(CONFIG_SENSORS_ZL6100) += zl6100.o | ||
+obj-$(CONFIG_SENSORS_DPS1900) += dps1900.o | ||
diff --git a/drivers/hwmon/pmbus/dps1900.c b/drivers/hwmon/pmbus/dps1900.c | ||
new file mode 100644 | ||
index 0000000..8f90c04 | ||
--- /dev/null | ||
+++ b/drivers/hwmon/pmbus/dps1900.c | ||
@@ -0,0 +1,70 @@ | ||
+#include <linux/kernel.h> | ||
+#include <linux/module.h> | ||
+#include <linux/init.h> | ||
+#include <linux/err.h> | ||
+#include <linux/i2c.h> | ||
+#include <linux/slab.h> | ||
+#include <linux/i2c/pmbus.h> | ||
+#include "pmbus.h" | ||
+ | ||
+static int dps1900_read_word_data(struct i2c_client *client, int page, int reg) | ||
+{ | ||
+ if (reg >= PMBUS_VIRT_BASE || | ||
+ reg == PMBUS_OT_WARN_LIMIT || | ||
+ reg == PMBUS_OT_FAULT_LIMIT || | ||
+ reg == PMBUS_UT_WARN_LIMIT || | ||
+ reg == PMBUS_UT_FAULT_LIMIT || | ||
+ reg == PMBUS_VIN_OV_FAULT_LIMIT || | ||
+ reg == PMBUS_VIN_OV_WARN_LIMIT || | ||
+ reg == PMBUS_VIN_UV_WARN_LIMIT || | ||
+ reg == PMBUS_VIN_UV_FAULT_LIMIT || | ||
+ reg == PMBUS_VOUT_UV_WARN_LIMIT || | ||
+ reg == PMBUS_VOUT_OV_WARN_LIMIT || | ||
+ reg == PMBUS_POUT_OP_FAULT_LIMIT || | ||
+ reg == PMBUS_POUT_OP_WARN_LIMIT || | ||
+ reg == PMBUS_PIN_OP_WARN_LIMIT || | ||
+ reg == PMBUS_IIN_OC_FAULT_LIMIT || | ||
+ reg == PMBUS_IOUT_UC_FAULT_LIMIT || | ||
+ reg == PMBUS_POUT_MAX) | ||
+ return -ENXIO; | ||
+ return pmbus_read_word_data(client, page, reg); | ||
+} | ||
+ | ||
+static struct pmbus_driver_info dps1900_info = { | ||
+ .pages = 1, | ||
+ .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT | ||
+ | PMBUS_HAVE_IIN | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | ||
+ | PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12 | ||
+ | PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 | PMBUS_HAVE_STATUS_TEMP | ||
+ | PMBUS_HAVE_STATUS_INPUT, | ||
+ .read_word_data = dps1900_read_word_data, | ||
+}; | ||
+ | ||
+static int dps1900_probe(struct i2c_client *client, | ||
+ const struct i2c_device_id *id) | ||
+{ | ||
+ return pmbus_do_probe(client, id, &dps1900_info); | ||
+} | ||
+ | ||
+static const struct i2c_device_id dps1900_id[] = { | ||
+ {"dps1900", 0}, | ||
+ {} | ||
+}; | ||
+ | ||
+MODULE_DEVICE_TABLE(i2c, dps1900_id); | ||
+ | ||
+/* This is the driver that will be inserted */ | ||
+static struct i2c_driver dps1900_driver = { | ||
+ .driver = { | ||
+ .name = "dps1900", | ||
+ }, | ||
+ .probe = dps1900_probe, | ||
+ .remove = pmbus_do_remove, | ||
+ .id_table = dps1900_id, | ||
+}; | ||
+ | ||
+module_i2c_driver(dps1900_driver); | ||
+ | ||
+MODULE_AUTHOR("Arista Networks"); | ||
+MODULE_DESCRIPTION("PMBus driver for Delta DPS1900"); | ||
+MODULE_LICENSE("GPL"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters