]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/glsdk-u-boot.git/commitdiff
palmas: use palmas_i2c_[read|write]_u8
authorNishanth Menon <nm@ti.com>
Tue, 26 Mar 2013 05:20:57 +0000 (05:20 +0000)
committerTom Rini <trini@ti.com>
Fri, 10 May 2013 12:25:55 +0000 (08:25 -0400)
commit 21144298 (power: twl6035: add palmas PMIC support)
introduced twl6035_i2c_[read|write]_u8
Then, commit dd23e59d (omap5: pbias ldo9 turn on)
introduced palmas_[read|write]_u8 for precisely the same access
function. TWL6035 belongs to the palmas family, so instead of having
an twl6035 API, we could use an generic palmas API instead.

To stay consistent with the function naming of twl4030,6030 accessors,
we use palmas_i2c_[read|write]_u8

Cc: Balaji T K <balajitk@ti.com>
Cc: Sricharan R <r.sricharan@ti.com>
Reported-by: Ruchika Kharwar <ruchika@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
drivers/power/palmas.c
include/palmas.h

index 489a7a9fe296502716c86b43c74758f64a24c16f..09c832d8b6ef1cef4b4e83b1548c1d5cb63b6645 100644 (file)
 #include <config.h>
 #include <palmas.h>
 
 #include <config.h>
 #include <palmas.h>
 
-/* Functions to read and write from TWL6030 */
-int twl6035_i2c_write_u8(u8 chip_no, u8 val, u8 reg)
-{
-       return i2c_write(chip_no, reg, 1, &val, 1);
-}
-
-int twl6035_i2c_read_u8(u8 chip_no, u8 *val, u8 reg)
-{
-       return i2c_read(chip_no, reg, 1, val, 1);
-}
-
-/* To align with i2c mw/mr address, reg, val command syntax */
-static inline int palmas_write_u8(u8 chip_no, u8 reg, u8 val)
-{
-       return i2c_write(chip_no, reg, 1, &val, 1);
-}
-
-static inline int palmas_read_u8(u8 chip_no, u8 reg, u8 *val)
-{
-       return i2c_read(chip_no, reg, 1, val, 1);
-}
-
 void palmas_init_settings(void)
 {
        return;
 void palmas_init_settings(void)
 {
        return;
@@ -57,7 +35,7 @@ int palmas_mmc1_poweron_ldo(void)
        /* set LDO9 TWL6035 to 3V */
        val = 0x2b; /* (3 -.9)*28 +1 */
 
        /* set LDO9 TWL6035 to 3V */
        val = 0x2b; /* (3 -.9)*28 +1 */
 
-       if (palmas_write_u8(0x48, LDO9_VOLTAGE, val)) {
+       if (palmas_i2c_write_u8(0x48, LDO9_VOLTAGE, val)) {
                printf("twl6035: could not set LDO9 voltage.\n");
                return 1;
        }
                printf("twl6035: could not set LDO9 voltage.\n");
                return 1;
        }
@@ -65,7 +43,7 @@ int palmas_mmc1_poweron_ldo(void)
        /* TURN ON LDO9 */
        val = LDO_ON | LDO_MODE_SLEEP | LDO_MODE_ACTIVE;
 
        /* TURN ON LDO9 */
        val = LDO_ON | LDO_MODE_SLEEP | LDO_MODE_ACTIVE;
 
-       if (palmas_write_u8(0x48, LDO9_CTRL, val)) {
+       if (palmas_i2c_write_u8(0x48, LDO9_CTRL, val)) {
                printf("twl6035: could not turn on LDO9.\n");
                return 1;
        }
                printf("twl6035: could not turn on LDO9.\n");
                return 1;
        }
index 305092e1ceed88d97a666bbb14e70c68f0015f67..e629fbf9988dacc88215a24d1518352c6647dcfd 100644 (file)
 #define LDO_MODE_SLEEP         (1 << 2)
 #define LDO_MODE_ACTIVE                (1 << 0)
 
 #define LDO_MODE_SLEEP         (1 << 2)
 #define LDO_MODE_ACTIVE                (1 << 0)
 
-int twl6035_i2c_write_u8(u8 chip_no, u8 val, u8 reg);
-int twl6035_i2c_read_u8(u8 chip_no, u8 *val, u8 reg);
+/*
+ * Functions to read and write from TPS659038/TWL6035/TWL6037
+ * or other Palmas family of TI PMICs
+ */
+static inline int palmas_i2c_write_u8(u8 chip_no, u8 reg, u8 val)
+{
+       return i2c_write(chip_no, reg, 1, &val, 1);
+}
+
+static inline int palmas_i2c_read_u8(u8 chip_no, u8 reg, u8 *val)
+{
+       return i2c_read(chip_no, reg, 1, val, 1);
+}
+
 void palmas_init_settings(void);
 int palmas_mmc1_poweron_ldo(void);
 void palmas_init_settings(void);
 int palmas_mmc1_poweron_ldo(void);