]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
dm: i2c: Add a function to find out the chip offset length
authorSimon Glass <sjg@chromium.org>
Mon, 4 May 2015 17:30:58 +0000 (11:30 -0600)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 8 Sep 2015 20:39:39 +0000 (22:39 +0200)
We can currently set this but there is no API function to get it. Add one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Heiko Schocher<hs@denx.de>
drivers/i2c/i2c-uclass.c
include/i2c.h

index b8eb2d613f2fb33a896d35668e4605b0bd15c4b9..eaba965fa31a64c999e31339e07c0acfbaf0fc84 100644 (file)
@@ -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);
index 1e259861b7869efd7a327d1725f333af6fcb30a1..ddfebc4107f638d68f0d0296d335fd67c9f6120d 100644 (file)
@@ -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
  *