[PATCH v2 2/4] i2c/busses/i2c-icy: Add LTC2990 present on 2019 board revision

From: Max Staudt
Date: Mon Aug 12 2019 - 19:53:23 EST


Since the 2019 a1k.org community re-print of these PCBs sports an
LTC2990 hwmon chip as an example use case, let this driver autoprobe
for that as well. If it is present, modprobing ltc2990 is sufficient.

Signed-off-by: Max Staudt <max@xxxxxxxxx>
---
drivers/i2c/busses/i2c-icy.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

diff --git a/drivers/i2c/busses/i2c-icy.c b/drivers/i2c/busses/i2c-icy.c
index 7910f035b..8125683c5 100644
--- a/drivers/i2c/busses/i2c-icy.c
+++ b/drivers/i2c/busses/i2c-icy.c
@@ -59,6 +59,7 @@ struct icy_i2c {

void __iomem *reg_s0;
void __iomem *reg_s1;
+ struct i2c_client *client_ltc2990;
};


@@ -105,6 +106,13 @@ static void icy_pcf_waitforpin(void *data)
/*
* Main i2c-icy part
*/
+static struct i2c_board_info icy_ltc2990_info = {
+ I2C_BOARD_INFO("ltc2990", 0x4c),
+};
+
+static unsigned short const icy_ltc2990_addresses[] = {0x4c, I2C_CLIENT_END};
+
+
static int icy_probe(struct zorro_dev *z,
const struct zorro_device_id *ent)
{
@@ -153,6 +161,18 @@ static int icy_probe(struct zorro_dev *z,
dev_info(&z->dev, "ICY I2C controller at %#x, IRQ not implemented\n",
z->resource.start);

+ /*
+ * The 2019 a1k.org PCBs have an LTC2990 at 0x4c, so start
+ * it automatically once ltc2990 is modprobed.
+ *
+ * in0 is the voltage of the internal 5V power supply.
+ * temp1 is the temperature inside the chip.
+ */
+ i2c->client_ltc2990 = i2c_new_probed_device(&i2c->adapter,
+ &icy_ltc2990_info,
+ icy_ltc2990_addresses,
+ NULL);
+
return 0;
}

@@ -160,6 +180,8 @@ static void icy_remove(struct zorro_dev *z)
{
struct icy_i2c *i2c = dev_get_drvdata(&z->dev);

+ i2c_unregister_device(i2c->client_ltc2990);
+
i2c_del_adapter(&i2c->adapter);
}

--
2.11.0