diff mbox series

[v2,4/4] i2c/busses/i2c-icy: Add platform_data for LTC2990

Message ID 20190812235237.21797-4-max@enpas.org (mailing list archive)
State Changes Requested
Headers show
Series [v2,1/4] i2c/busses: Add i2c-icy for I2C on m68k/Amiga | expand

Commit Message

Max Staudt Aug. 12, 2019, 11:52 p.m. UTC
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 <max@enpas.org>
---
 drivers/i2c/busses/i2c-icy.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

Comments

Geert Uytterhoeven Aug. 13, 2019, 7:04 a.m. UTC | #1
Hi Max,

On Tue, Aug 13, 2019 at 1:54 AM Max Staudt <max@enpas.org> wrote:
> 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 <max@enpas.org>

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>

However, I would merge patches 2/4 and 4/4, and move the result
after patch 3.

Gr{oetje,eeting}s,

                        Geert
diff mbox series

Patch

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,