diff options
author | Trent Piepho <tpiepho@kymetacorp.com> | 2015-11-19 19:57:30 +0000 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-11-20 08:43:42 +0100 |
commit | b097f7b9100a812d61c904d1211686e08fb00bd2 (patch) | |
tree | 59f5df91f2ca8ad6cbd3b0aee56fd5509cbf09df /drivers/i2c | |
parent | 4aa3a0347cc3e8e615bc6ed2d67c38d45ed07e01 (diff) | |
download | barebox-b097f7b9100a812d61c904d1211686e08fb00bd2.tar.gz barebox-b097f7b9100a812d61c904d1211686e08fb00bd2.tar.xz |
i2c: core: Add client I2C address to devinfo
Useful bit of information. Example:
barebox:/ devinfo dummy0
Bus: i2c
Address: 0x52
Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/i2c.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c index 9ed96da248..fa2c0cd136 100644 --- a/drivers/i2c/i2c.c +++ b/drivers/i2c/i2c.c @@ -358,6 +358,14 @@ int i2c_recover_bus(struct i2c_adapter *adap) return adap->bus_recovery_info->recover_bus(adap); } +static void i2c_info(struct device_d *dev) +{ + const struct i2c_client *client = to_i2c_client(dev); + + printf(" Address: 0x%02x\n", client->addr); + return; +} + /** * i2c_new_device - instantiate one new I2C device * @@ -396,6 +404,7 @@ static struct i2c_client *i2c_new_device(struct i2c_adapter *adapter, free(client); return NULL; } + client->dev.info = i2c_info; return client; } |