summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorSebastian Reichel <sre@debian.org>2014-03-16 05:43:28 +0400
committerLee Jones <lee.jones@linaro.org>2014-03-18 12:15:34 +0400
commit204dfd63a07ec4785fc786ff3511d85eb1346b7b (patch)
tree410977b6ccee57bb4dbbad698c579126d27c9f94 /include/linux
parent99be0245c8869cbd7b9c0ab3f093f41c60362f91 (diff)
downloadlinux-204dfd63a07ec4785fc786ff3511d85eb1346b7b.tar.xz
mfd: twl-core: Add twl_i2c_read/write_u16
Add a simple twl_i2c_read/write_u16 wrapper over the twl_i2c_read/write, which is similar to the twl_i2c_read/write_u8 wrapper. Signed-off-by: Sebastian Reichel <sre@debian.org> Acked-by: Jonathan Cameron <jic23@kernel.org> Tested-by: Marek Belisko <marek@goldelico.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/i2c/twl.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index ade1c06d4ceb..d2b16704624c 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -195,6 +195,18 @@ static inline int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg) {
return twl_i2c_read(mod_no, val, reg, 1);
}
+static inline int twl_i2c_write_u16(u8 mod_no, u16 val, u8 reg) {
+ val = cpu_to_le16(val);
+ return twl_i2c_write(mod_no, (u8*) &val, reg, 2);
+}
+
+static inline int twl_i2c_read_u16(u8 mod_no, u16 *val, u8 reg) {
+ int ret;
+ ret = twl_i2c_read(mod_no, (u8*) val, reg, 2);
+ *val = le16_to_cpu(*val);
+ return ret;
+}
+
int twl_get_type(void);
int twl_get_version(void);
int twl_get_hfclk_rate(void);