This enables the three additional inputs available on the 2019 a1k.org
reprint of the ICY board:

  in1 will be the voltage of the 5V rail, divided by 2.
  in2 will be the voltage of the 12V rail, divided by 4.
  temp3 will be measured using a PCB loop next the chip.

Signed-off-by: Max Staudt <m...@enpas.org>
---
 drivers/i2c/busses/i2c-icy.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-icy.c b/drivers/i2c/busses/i2c-icy.c
index 8125683c5..6ad9910a0 100644
--- a/drivers/i2c/busses/i2c-icy.c
+++ b/drivers/i2c/busses/i2c-icy.c
@@ -42,6 +42,7 @@
 
 #include <linux/i2c.h>
 #include <linux/i2c-algo-pcf.h>
+#include <linux/platform_data/ltc2990.h>
 
 #include <asm/amigaints.h>
 #include <linux/zorro.h>
@@ -106,8 +107,21 @@ static void icy_pcf_waitforpin(void *data)
 /*
  * Main i2c-icy part
  */
+static struct ltc2990_platform_data icy_ltc2990_platform_data = {
+       /*
+        * Additional sensors exposed by this platform data:
+        *
+        * in1 will be the voltage of the 5V rail, divided by 2.
+        * in2 will be the voltage of the 12V rail, divided by 4.
+        * temp3 will be measured using a PCB loop next the chip.
+        */
+       .meas_mode = {0, 3},
+};
+
 static struct i2c_board_info icy_ltc2990_info = {
-       I2C_BOARD_INFO("ltc2990", 0x4c),
+       .type           = "ltc2990",
+       .addr           = 0x4c,
+       .platform_data  = &icy_ltc2990_platform_data,
 };
 
 static unsigned short const icy_ltc2990_addresses[] = {0x4c, I2C_CLIENT_END};
@@ -167,6 +181,8 @@ static int icy_probe(struct zorro_dev *z,
         *
         * in0 is the voltage of the internal 5V power supply.
         * temp1 is the temperature inside the chip.
+        *
+        * See platform data above for in1, in2, temp3.
         */
        i2c->client_ltc2990 = i2c_new_probed_device(&i2c->adapter,
                                                    &icy_ltc2990_info,
-- 
2.11.0

Reply via email to