Commit 58c54168 authored by Adam Wujek's avatar Adam Wujek

sw/patches/linux: add monimod fantray driver

Signed-off-by: 's avatarAdam Wujek <dev_public@wujek.eu>
parent 91be669f
......@@ -2289,6 +2289,7 @@ CONFIG_SENSORS_MAX6639=y
# CONFIG_SENSORS_MAX6650 is not set
# CONFIG_SENSORS_MAX6697 is not set
# CONFIG_SENSORS_MAX31790 is not set
CONFIG_SENSORS_MONIMOD=y
# CONFIG_SENSORS_MCP3021 is not set
# CONFIG_SENSORS_TC654 is not set
# CONFIG_SENSORS_ADCXX is not set
......
From c5c1ba0f92e16b2c948e7bb5a896b7ab93802a04 Mon Sep 17 00:00:00 2001
From: Adam Wujek <dev_public@wujek.eu>
Date: Tue, 21 Dec 2021 02:07:46 +0100
Subject: [PATCH] hwmon: (pmbus) Add monimod fantray driver
Add support for monimod fantray.
Signed-off-by: Adam Wujek <dev_public@wujek.eu>
---
drivers/hwmon/pmbus/Kconfig | 9 +++++
drivers/hwmon/pmbus/Makefile | 1 +
drivers/hwmon/pmbus/monimod.c | 67 +++++++++++++++++++++++++++++++++++
3 files changed, 77 insertions(+)
create mode 100644 drivers/hwmon/pmbus/monimod.c
diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
index d364786b8c67..034cc22a8824 100644
--- a/drivers/hwmon/pmbus/Kconfig
+++ b/drivers/hwmon/pmbus/Kconfig
@@ -163,6 +163,15 @@ config SENSORS_MAX8688
This driver can also be built as a module. If so, the module will
be called max8688.
+config SENSORS_MONIMOD
+ tristate "Monimod Fantray"
+ help
+ If you say yes here you get hardware monitoring support for the
+ monimod fantray unit.
+
+ This driver can also be built as a module. If so, the module will
+ be called monimod.
+
config SENSORS_TPS40422
tristate "TI TPS40422"
default n
diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile
index 10fb78c7341e..46a42d0e9f69 100644
--- a/drivers/hwmon/pmbus/Makefile
+++ b/drivers/hwmon/pmbus/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_SENSORS_MAX20751) += max20751.o
obj-$(CONFIG_SENSORS_MAX31785) += max31785.o
obj-$(CONFIG_SENSORS_MAX34440) += max34440.o
obj-$(CONFIG_SENSORS_MAX8688) += max8688.o
+obj-$(CONFIG_SENSORS_MONIMOD) += monimod.o
obj-$(CONFIG_SENSORS_TPS40422) += tps40422.o
obj-$(CONFIG_SENSORS_TPS53679) += tps53679.o
obj-$(CONFIG_SENSORS_TPS544) += tps544.o
diff --git a/drivers/hwmon/pmbus/monimod.c b/drivers/hwmon/pmbus/monimod.c
new file mode 100644
index 000000000000..fb3674492936
--- /dev/null
+++ b/drivers/hwmon/pmbus/monimod.c
@@ -0,0 +1,67 @@
+/*
+ * Hardware monitoring driver for Monimod FANTRAY
+ *
+ * Author: Adam Wujek
+ * Copyright (c) 2021 CERN
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include "pmbus.h"
+
+#define MONIMOD_FUNC_0 (PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT | \
+ PMBUS_HAVE_TEMP | \
+ PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12 | \
+ PMBUS_HAVE_FAN34 | PMBUS_HAVE_STATUS_FAN34)
+#define MONIMOD_FUNC_1 (PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT)
+#define MONIMOD_FUNC_2 (PMBUS_HAVE_IOUT)
+
+static struct pmbus_driver_info monimod_info = {
+ .pages = 3,
+ .func[0] = MONIMOD_FUNC_0,
+ .func[1] = MONIMOD_FUNC_1,
+ .func[2] = MONIMOD_FUNC_2,
+ .format[PSC_VOLTAGE_OUT] = linear,
+};
+
+static int monimod_probe(struct i2c_client *client,
+ const struct i2c_device_id *id)
+{
+ return pmbus_do_probe(client, id, &monimod_info);
+}
+
+static const struct i2c_device_id monimod_id[] = {
+ {"monimod", 0},
+ {}
+};
+
+MODULE_DEVICE_TABLE(i2c, monimod_id);
+
+/* This is the driver that will be inserted */
+static struct i2c_driver monimod_driver = {
+ .driver = {
+ .name = "monimod",
+ },
+ .probe = monimod_probe,
+ .remove = pmbus_do_remove,
+ .id_table = monimod_id,
+};
+
+module_i2c_driver(monimod_driver);
+
+MODULE_AUTHOR("Adam Wujek");
+MODULE_DESCRIPTION("PMBus driver for monimod");
+MODULE_LICENSE("GPL");
--
2.17.1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment