aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2013-01-16 08:53:59 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2013-02-13 18:22:52 -0500
commitfbc6ae363e5e589a28135c051a2ff835e6236d5f (patch)
treeed083a4ba2d43d03c040410f5198bd3786b91402
parentac7bc5a953c38c32513d1825decf336c4909ce3b (diff)
mfd: twl-core: Move twl_i2c_read/write_u8 to header as inline function
twl_i2c_read/write_u8 become as a simple wrapper over the twl_i2c_read/write. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/mfd/twl-core.c28
-rw-r--r--include/linux/i2c/twl.h17
2 files changed, 11 insertions, 34 deletions
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 9661204fb159..557f9ee5ec18 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -379,34 +379,6 @@ int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
379} 379}
380EXPORT_SYMBOL(twl_i2c_read); 380EXPORT_SYMBOL(twl_i2c_read);
381 381
382/**
383 * twl_i2c_write_u8 - Writes a 8 bit register in TWL4030/TWL5030/TWL60X0
384 * @mod_no: module number
385 * @value: the value to be written 8 bit
386 * @reg: register address (just offset will do)
387 *
388 * Returns result of operation - 0 is success
389 */
390int twl_i2c_write_u8(u8 mod_no, u8 value, u8 reg)
391{
392 return twl_i2c_write(mod_no, &value, reg, 1);
393}
394EXPORT_SYMBOL(twl_i2c_write_u8);
395
396/**
397 * twl_i2c_read_u8 - Reads a 8 bit register from TWL4030/TWL5030/TWL60X0
398 * @mod_no: module number
399 * @value: the value read 8 bit
400 * @reg: register address (just offset will do)
401 *
402 * Returns result of operation - 0 is success
403 */
404int twl_i2c_read_u8(u8 mod_no, u8 *value, u8 reg)
405{
406 return twl_i2c_read(mod_no, value, reg, 1);
407}
408EXPORT_SYMBOL(twl_i2c_read_u8);
409
410/*----------------------------------------------------------------------*/ 382/*----------------------------------------------------------------------*/
411 383
412/** 384/**
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index e441fd8e7c86..488debbef895 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -175,17 +175,22 @@ TWL_CLASS_IS(4030, TWL4030_CLASS_ID)
175TWL_CLASS_IS(6030, TWL6030_CLASS_ID) 175TWL_CLASS_IS(6030, TWL6030_CLASS_ID)
176 176
177/* 177/*
178 * Read and write single 8-bit registers
179 */
180int twl_i2c_write_u8(u8 mod_no, u8 val, u8 reg);
181int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg);
182
183/*
184 * Read and write several 8-bit registers at once. 178 * Read and write several 8-bit registers at once.
185 */ 179 */
186int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); 180int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
187int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); 181int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
188 182
183/*
184 * Read and write single 8-bit registers
185 */
186static inline int twl_i2c_write_u8(u8 mod_no, u8 val, u8 reg) {
187 return twl_i2c_write(mod_no, &val, reg, 1);
188}
189
190static inline int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg) {
191 return twl_i2c_read(mod_no, val, reg, 1);
192}
193
189int twl_get_type(void); 194int twl_get_type(void);
190int twl_get_version(void); 195int twl_get_version(void);
191int twl_get_hfclk_rate(void); 196int twl_get_hfclk_rate(void);