From: Simon Glass Date: Mon, 4 May 2015 17:30:58 +0000 (-0600) Subject: dm: i2c: Add a function to find out the chip offset length X-Git-Tag: v2015.07-rc2~224 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=01501804fdab0c80e31d1aa221d8afb79d436e52;p=oweals%2Fu-boot.git dm: i2c: Add a function to find out the chip offset length We can currently set this but there is no API function to get it. Add one. Signed-off-by: Simon Glass Reviewed-by: Joe Hershberger Acked-by: Heiko Schocher --- diff --git a/drivers/i2c/i2c-uclass.c b/drivers/i2c/i2c-uclass.c index b8eb2d613f..eaba965fa3 100644 --- a/drivers/i2c/i2c-uclass.c +++ b/drivers/i2c/i2c-uclass.c @@ -415,6 +415,13 @@ int i2c_set_chip_offset_len(struct udevice *dev, uint offset_len) return 0; } +int i2c_get_chip_offset_len(struct udevice *dev) +{ + struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + + return chip->offset_len; +} + int i2c_deblock(struct udevice *bus) { struct dm_i2c_ops *ops = i2c_get_ops(bus); diff --git a/include/i2c.h b/include/i2c.h index 1e259861b7..ddfebc4107 100644 --- a/include/i2c.h +++ b/include/i2c.h @@ -193,8 +193,15 @@ int i2c_get_chip_flags(struct udevice *dev, uint *flagsp); * * @offset_len: New offset length value (typically 1 or 2) */ - int i2c_set_chip_offset_len(struct udevice *dev, uint offset_len); + +/** + * i2c_get_offset_len() - get the offset length for a chip + * + * @return: Current offset length value (typically 1 or 2) + */ +int i2c_get_chip_offset_len(struct udevice *dev); + /** * i2c_deblock() - recover a bus that is in an unknown state *