[U-Boot] [PATCH 13/19] samsung: misc: power_key_pressed: add support to dm pmic framework

Simon Glass sjg at chromium.org
Fri Oct 10 05:37:58 CEST 2014


Hi,

On 8 October 2014 14:48, Przemyslaw Marczak <p.marczak at samsung.com> wrote:
> 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.marczak at 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 we are going to get pmics by name, perhaps we should have
uclass_get_device_by_name() instead? So long as the device has the
right name, this should work, and avoids adding another layer of
naming.

> +
> +       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
>

Regards,
Simon


More information about the U-Boot mailing list