diff options
-rw-r--r-- | drivers/power/palmas.c | 26 | ||||
-rw-r--r-- | include/palmas.h | 16 |
2 files changed, 16 insertions, 26 deletions
diff --git a/drivers/power/palmas.c b/drivers/power/palmas.c index 489a7a9fe2..09c832d8b6 100644 --- a/drivers/power/palmas.c +++ b/drivers/power/palmas.c | |||
@@ -23,28 +23,6 @@ | |||
23 | #include <config.h> | 23 | #include <config.h> |
24 | #include <palmas.h> | 24 | #include <palmas.h> |
25 | 25 | ||
26 | /* Functions to read and write from TWL6030 */ | ||
27 | int twl6035_i2c_write_u8(u8 chip_no, u8 val, u8 reg) | ||
28 | { | ||
29 | return i2c_write(chip_no, reg, 1, &val, 1); | ||
30 | } | ||
31 | |||
32 | int twl6035_i2c_read_u8(u8 chip_no, u8 *val, u8 reg) | ||
33 | { | ||
34 | return i2c_read(chip_no, reg, 1, val, 1); | ||
35 | } | ||
36 | |||
37 | /* To align with i2c mw/mr address, reg, val command syntax */ | ||
38 | static inline int palmas_write_u8(u8 chip_no, u8 reg, u8 val) | ||
39 | { | ||
40 | return i2c_write(chip_no, reg, 1, &val, 1); | ||
41 | } | ||
42 | |||
43 | static inline int palmas_read_u8(u8 chip_no, u8 reg, u8 *val) | ||
44 | { | ||
45 | return i2c_read(chip_no, reg, 1, val, 1); | ||
46 | } | ||
47 | |||
48 | void palmas_init_settings(void) | 26 | void palmas_init_settings(void) |
49 | { | 27 | { |
50 | return; | 28 | return; |
@@ -57,7 +35,7 @@ int palmas_mmc1_poweron_ldo(void) | |||
57 | /* set LDO9 TWL6035 to 3V */ | 35 | /* set LDO9 TWL6035 to 3V */ |
58 | val = 0x2b; /* (3 -.9)*28 +1 */ | 36 | val = 0x2b; /* (3 -.9)*28 +1 */ |
59 | 37 | ||
60 | if (palmas_write_u8(0x48, LDO9_VOLTAGE, val)) { | 38 | if (palmas_i2c_write_u8(0x48, LDO9_VOLTAGE, val)) { |
61 | printf("twl6035: could not set LDO9 voltage.\n"); | 39 | printf("twl6035: could not set LDO9 voltage.\n"); |
62 | return 1; | 40 | return 1; |
63 | } | 41 | } |
@@ -65,7 +43,7 @@ int palmas_mmc1_poweron_ldo(void) | |||
65 | /* TURN ON LDO9 */ | 43 | /* TURN ON LDO9 */ |
66 | val = LDO_ON | LDO_MODE_SLEEP | LDO_MODE_ACTIVE; | 44 | val = LDO_ON | LDO_MODE_SLEEP | LDO_MODE_ACTIVE; |
67 | 45 | ||
68 | if (palmas_write_u8(0x48, LDO9_CTRL, val)) { | 46 | if (palmas_i2c_write_u8(0x48, LDO9_CTRL, val)) { |
69 | printf("twl6035: could not turn on LDO9.\n"); | 47 | printf("twl6035: could not turn on LDO9.\n"); |
70 | return 1; | 48 | return 1; |
71 | } | 49 | } |
diff --git a/include/palmas.h b/include/palmas.h index 305092e1ce..e629fbf998 100644 --- a/include/palmas.h +++ b/include/palmas.h | |||
@@ -36,7 +36,19 @@ | |||
36 | #define LDO_MODE_SLEEP (1 << 2) | 36 | #define LDO_MODE_SLEEP (1 << 2) |
37 | #define LDO_MODE_ACTIVE (1 << 0) | 37 | #define LDO_MODE_ACTIVE (1 << 0) |
38 | 38 | ||
39 | int twl6035_i2c_write_u8(u8 chip_no, u8 val, u8 reg); | 39 | /* |
40 | int twl6035_i2c_read_u8(u8 chip_no, u8 *val, u8 reg); | 40 | * Functions to read and write from TPS659038/TWL6035/TWL6037 |
41 | * or other Palmas family of TI PMICs | ||
42 | */ | ||
43 | static inline int palmas_i2c_write_u8(u8 chip_no, u8 reg, u8 val) | ||
44 | { | ||
45 | return i2c_write(chip_no, reg, 1, &val, 1); | ||
46 | } | ||
47 | |||
48 | static inline int palmas_i2c_read_u8(u8 chip_no, u8 reg, u8 *val) | ||
49 | { | ||
50 | return i2c_read(chip_no, reg, 1, val, 1); | ||
51 | } | ||
52 | |||
41 | void palmas_init_settings(void); | 53 | void palmas_init_settings(void); |
42 | int palmas_mmc1_poweron_ldo(void); | 54 | int palmas_mmc1_poweron_ldo(void); |