summaryrefslogtreecommitdiffstats
path: root/include/i2c.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-04-20 12:37:14 -0600
committerSimon Glass <sjg@chromium.org>2015-05-05 20:58:19 -0600
commitba3864f8037f58dd1f46cad3b76adc0a84bd33b3 (patch)
treec635c755acd3922067cba3c1ca98a100ec5059fe /include/i2c.h
parent1bde67b1f492cbb0177241a56af59f706d45fccf (diff)
downloadtalos-obmc-uboot-ba3864f8037f58dd1f46cad3b76adc0a84bd33b3.tar.gz
talos-obmc-uboot-ba3864f8037f58dd1f46cad3b76adc0a84bd33b3.zip
dm: i2c: Add functions to read and write a register
Add driver model versions of the legacy functions to read and write a single byte register. These are a useful shortcut in many cases. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'include/i2c.h')
-rw-r--r--include/i2c.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/i2c.h b/include/i2c.h
index 6fd73fae4c..d794057f4b 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -124,6 +124,27 @@ int dm_i2c_probe(struct udevice *bus, uint chip_addr, uint chip_flags,
struct udevice **devp);
/**
+ * dm_i2c_reg_read() - Read a value from an I2C register
+ *
+ * This reads a single value from the given address in an I2C chip
+ *
+ * @addr: Address to read from
+ * @return value read, or -ve on error
+ */
+int dm_i2c_reg_read(struct udevice *dev, uint offset);
+
+/**
+ * dm_i2c_reg_write() - Write a value to an I2C register
+ *
+ * This writes a single value to the given address in an I2C chip
+ *
+ * @addr: Address to write to
+ * @val: Value to write (normally a byte)
+ * @return 0 on success, -ve on error
+ */
+int dm_i2c_reg_write(struct udevice *dev, uint offset, unsigned int val);
+
+/**
* dm_i2c_set_bus_speed() - set the speed of a bus
*
* @bus: Bus to adjust
OpenPOWER on IntegriCloud