palmas: Add support for powering different ldos
authorLokesh Vutla <lokeshvutla@ti.com>
Mon, 21 Aug 2017 07:20:50 +0000 (12:50 +0530)
committerTom Rini <trini@konsulko.com>
Mon, 11 Sep 2017 20:19:37 +0000 (16:19 -0400)
It is not necessary that ldo1 is used to power on mmc.
So, add support for passing ldo registers for powering on mmc.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
arch/arm/mach-omap2/omap5/hwinit.c
board/ti/dra7xx/evm.c
drivers/power/palmas.c
include/palmas.h

index cb2a5ab7eaa01fcb26bf89ca019e9ec1f0dcb059..85d3518e943876f6fb7f3c2a086a46e625c81db7 100644 (file)
@@ -457,7 +457,7 @@ void v7_arch_cp15_set_acr(u32 acr, u32 cpu_midr, u32 cpu_rev_comb,
 #if defined(CONFIG_PALMAS_POWER)
 __weak void board_mmc_poweron_ldo(uint voltage)
 {
-       palmas_mmc1_poweron_ldo(voltage);
+       palmas_mmc1_poweron_ldo(LDO1_VOLTAGE, LDO1_CTRL, voltage);
 }
 
 void vmmc_pbias_config(uint voltage)
index 6767fd217925c569afbc9c59fa1b6d4826b5a587..1c0a1eb05216f862e9125cf702160a9fb08f48a1 100644 (file)
@@ -720,7 +720,7 @@ void board_mmc_poweron_ldo(uint voltage)
                        voltage = 0xa;
                lp873x_mmc1_poweron_ldo(voltage);
        } else {
-               palmas_mmc1_poweron_ldo(voltage);
+               palmas_mmc1_poweron_ldo(LDO1_VOLTAGE, LDO1_CTRL, voltage);
        }
 }
 #endif
index 4e9895987cbf011d25a71d0137082716c1cac700..ddf777c26b16da15e6a08615d2a5724dfb347e6c 100644 (file)
@@ -42,24 +42,21 @@ int lp873x_mmc1_poweron_ldo(uint voltage)
 }
 #endif
 
-int palmas_mmc1_poweron_ldo(uint voltage)
+int palmas_mmc1_poweron_ldo(uint ldo_volt, uint ldo_ctrl, uint voltage)
 {
        u8 val = 0;
 
 #if defined(CONFIG_DRA7XX)
        int ret;
-       /*
-        * Currently valid for the dra7xx_evm board:
-        * Set TPS659038 LDO1 to 3.0 V or 1.8V
-        */
-       ret = palmas_i2c_write_u8(TPS65903X_CHIP_P1, LDO1_VOLTAGE, voltage);
+
+       ret = palmas_i2c_write_u8(TPS65903X_CHIP_P1, ldo_volt, voltage);
        if (ret) {
                printf("tps65903x: could not set LDO1 voltage.\n");
                return ret;
        }
        /* TURN ON LDO1 */
        val = RSC_MODE_SLEEP | RSC_MODE_ACTIVE;
-       ret = palmas_i2c_write_u8(TPS65903X_CHIP_P1, LDO1_CTRL, val);
+       ret = palmas_i2c_write_u8(TPS65903X_CHIP_P1, ldo_ctrl, val);
        if (ret) {
                printf("tps65903x: could not turn on LDO1.\n");
                return ret;
index d676617344cf122e34a52e30c16f9bf3e40c0f0c..404c2b3ca7bcc79efa8190dfb4ae353048849b4e 100644 (file)
@@ -129,7 +129,7 @@ static inline int palmas_i2c_read_u8(u8 chip_no, u8 reg, u8 *val)
 }
 
 void palmas_init_settings(void);
-int palmas_mmc1_poweron_ldo(uint voltage);
+int palmas_mmc1_poweron_ldo(uint ldo_volt, uint ldo_ctrl, uint voltage);
 int lp873x_mmc1_poweron_ldo(uint voltage);
 int twl603x_mmc1_set_ldo9(u8 vsel);
 int twl603x_audio_power(u8 on);