In case of two pmic frameworks availability - enable support of both,
since the new pmic framework is not fully finished and some boards still
supports only the old framework.

Signed-off-by: Przemyslaw Marczak <p.marc...@samsung.com>
---
 board/samsung/common/misc.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 4538ac7..94308a9 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -93,12 +93,13 @@ void set_board_info(void)
 }
 #endif /* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG */
 
-#ifdef CONFIG_LCD_MENU
+#if defined(CONFIG_LCD_MENU)
 static int power_key_pressed(u32 reg)
 {
+       unsigned status;
+       unsigned mask;
+#if defined(CONFIG_POWER)
        struct pmic *pmic;
-       u32 status;
-       u32 mask;
 
        pmic = pmic_get(KEY_PWR_PMIC_NAME);
        if (!pmic) {
@@ -108,7 +109,21 @@ static int power_key_pressed(u32 reg)
 
        if (pmic_probe(pmic))
                return 0;
+#elif defined(CONFIG_DM_PMIC)
+       struct udevice *pmic;
 
+       pmic = pmic_get_by_name(UCLASS_PMIC, KEY_PWR_PMIC_NAME);
+
+       if (!pmic) {
+               printf("%s: Not found\n", KEY_PWR_PMIC_NAME);
+               return 0;
+       }
+
+       if (pmic_probe(pmic, NULL))
+               return 0;
+#else
+#error one of: CONFIG_DM_PMIC or CONFIG_POWER must be defined!
+#endif
        if (reg == KEY_PWR_STATUS_REG)
                mask = KEY_PWR_STATUS_MASK;
        else
-- 
1.9.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to