Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 204dfd63 authored by Sebastian Reichel's avatar Sebastian Reichel Committed by Lee Jones
Browse files

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: default avatarSebastian Reichel <sre@debian.org>
Acked-by: default avatarJonathan Cameron <jic23@kernel.org>
Tested-by: default avatarMarek Belisko <marek@goldelico.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 99be0245
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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);