From 8d8bba0caf0864c24e4dda669fe05badd45396ea Mon Sep 17 00:00:00 2001 From: Deni Date: Sat, 30 Jun 2018 00:11:41 +0100 Subject: [PATCH] Support Delta DPS1900 (#49) --- patch/config-arista-dps1900.patch | 9 +++ patch/driver-hwmon-pmbus-dps1900.patch | 104 +++++++++++++++++++++++++ patch/series | 2 + 3 files changed, 115 insertions(+) create mode 100644 patch/config-arista-dps1900.patch create mode 100644 patch/driver-hwmon-pmbus-dps1900.patch diff --git a/patch/config-arista-dps1900.patch b/patch/config-arista-dps1900.patch new file mode 100644 index 000000000000..fdbe745d0144 --- /dev/null +++ b/patch/config-arista-dps1900.patch @@ -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 diff --git a/patch/driver-hwmon-pmbus-dps1900.patch b/patch/driver-hwmon-pmbus-dps1900.patch new file mode 100644 index 000000000000..03e10e6025b0 --- /dev/null +++ b/patch/driver-hwmon-pmbus-dps1900.patch @@ -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 ++#include ++#include ++#include ++#include ++#include ++#include ++#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"); diff --git a/patch/series b/patch/series index c1a949a162a1..ba9311eb23a1 100644 --- a/patch/series +++ b/patch/series @@ -28,6 +28,8 @@ driver-pca954x-i2c-mux-force-deselect-on-exit-flag.patch linux-3.19-mmc-sdhci-Add-a-quirk-for-AMD-SDHC-transfer-mode-reg.patch linux-3.19-mmc-sdhci-pci-enable-the-clear-transfer-mode-registe.patch linux-3.19-mmc-sdhci-pci-enable-sdhci-doesn-t-support-hs200-qui.patch +driver-hwmon-pmbus-dps1900.patch +config-arista-dps1900.patch rtnetlink-catch-EOPNOTSUPP-errors.patch bridge-per-port-multicast-broadcast-flood-flags.patch driver-support-tun-config-carrier-enable.patch