Patchwork [U-Boot,V2,1/6] exynos: Use common pmic_reg_update() definition

login
register
mail settings
Submitter Leela Krishna Amudala
Date Oct. 7, 2013, 7:26 a.m.
Message ID <1381130784-14752-2-git-send-email-l.krishna@samsung.com>
Download mbox | patch
Permalink /patch/280941/
State Changes Requested
Delegated to: Minkyu Kang
Headers show

Comments

Leela Krishna Amudala - Oct. 7, 2013, 7:26 a.m.
This function is used by different Exynos platforms, put it in the
common file.

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Signed-off-by: Leela Krishna Amudala <l.krishna@samsung.com>
Reviewed-by: Doug Anderson <dianders@google.com>
---
 board/samsung/common/board.c |   19 -------------------
 drivers/power/power_core.c   |   19 +++++++++++++++++++
 include/power/pmic.h         |    1 +
 3 files changed, 20 insertions(+), 19 deletions(-)
Simon Glass - Oct. 8, 2013, 5:50 p.m.
On Mon, Oct 7, 2013 at 1:26 AM, Leela Krishna Amudala <l.krishna@samsung.com
> wrote:

> This function is used by different Exynos platforms, put it in the
> common file.
>
> Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
> Signed-off-by: Leela Krishna Amudala <l.krishna@samsung.com>
> Reviewed-by: Doug Anderson <dianders@google.com>
>

Acked-by: Simon Glass <sjg@chromium.org>

(I'd suggest adding a full comment to pmic_reg_update() if you end up
re-issuing this)


> ---
>  board/samsung/common/board.c |   19 -------------------
>  drivers/power/power_core.c   |   19 +++++++++++++++++++
>  include/power/pmic.h         |    1 +
>  3 files changed, 20 insertions(+), 19 deletions(-)
>
> diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
> index ce85ddb..87ca9de 100644
> --- a/board/samsung/common/board.c
> +++ b/board/samsung/common/board.c
> @@ -152,25 +152,6 @@ static int board_init_cros_ec_devices(const void
> *blob)
>
>  #if defined(CONFIG_POWER)
>  #ifdef CONFIG_POWER_MAX77686
> -static int pmic_reg_update(struct pmic *p, int reg, uint regval)
> -{
> -       u32 val;
> -       int ret = 0;
> -
> -       ret = pmic_reg_read(p, reg, &val);
> -       if (ret) {
> -               debug("%s: PMIC %d register read failed\n", __func__, reg);
> -               return -1;
> -       }
> -       val |= regval;
> -       ret = pmic_reg_write(p, reg, val);
> -       if (ret) {
> -               debug("%s: PMIC %d register write failed\n", __func__,
> reg);
> -               return -1;
> -       }
> -       return 0;
> -}
> -
>  static int max77686_init(void)
>  {
>         struct pmic *p;
> diff --git a/drivers/power/power_core.c b/drivers/power/power_core.c
> index d79971b..2bef594 100644
> --- a/drivers/power/power_core.c
> +++ b/drivers/power/power_core.c
> @@ -205,6 +205,25 @@ int do_pmic(cmd_tbl_t *cmdtp, int flag, int argc,
> char * const argv[])
>         return CMD_RET_SUCCESS;
>  }
>
> +int pmic_reg_update(struct pmic *p, int reg, uint regval)
> +{
> +       u32 val;
> +       int ret = 0;
> +
> +       ret = pmic_reg_read(p, reg, &val);
> +       if (ret) {
> +               debug("%s: PMIC %d register read failed\n", __func__, reg);
> +               return -1;
> +       }
> +       val |= regval;
> +       ret = pmic_reg_write(p, reg, val);
> +       if (ret) {
> +               debug("%s: PMIC %d register write failed\n", __func__,
> reg);
> +               return -1;
> +       }
> +       return 0;
> +}
> +
>  U_BOOT_CMD(
>         pmic,   CONFIG_SYS_MAXARGS, 1, do_pmic,
>         "PMIC",
> diff --git a/include/power/pmic.h b/include/power/pmic.h
> index 0e7aa31..d17dbdc 100644
> --- a/include/power/pmic.h
> +++ b/include/power/pmic.h
> @@ -83,6 +83,7 @@ int pmic_probe(struct pmic *p);
>  int pmic_reg_read(struct pmic *p, u32 reg, u32 *val);
>  int pmic_reg_write(struct pmic *p, u32 reg, u32 val);
>  int pmic_set_output(struct pmic *p, u32 reg, int ldo, int on);
> +int pmic_reg_update(struct pmic *p, int reg, uint regval);
>
>  #define pmic_i2c_addr (p->hw.i2c.addr)
>  #define pmic_i2c_tx_num (p->hw.i2c.tx_num)
> --
> 1.7.10.4
>
>
Ɓukasz Majewski - Oct. 9, 2013, 5:48 a.m.
Hi Leela,

> This function is used by different Exynos platforms, put it in the
> common file.
> 
> Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
> Signed-off-by: Leela Krishna Amudala <l.krishna@samsung.com>
> Reviewed-by: Doug Anderson <dianders@google.com>
> ---
>  board/samsung/common/board.c |   19 -------------------
>  drivers/power/power_core.c   |   19 +++++++++++++++++++
>  include/power/pmic.h         |    1 +
>  3 files changed, 20 insertions(+), 19 deletions(-)

Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>

Patch

diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
index ce85ddb..87ca9de 100644
--- a/board/samsung/common/board.c
+++ b/board/samsung/common/board.c
@@ -152,25 +152,6 @@  static int board_init_cros_ec_devices(const void *blob)
 
 #if defined(CONFIG_POWER)
 #ifdef CONFIG_POWER_MAX77686
-static int pmic_reg_update(struct pmic *p, int reg, uint regval)
-{
-	u32 val;
-	int ret = 0;
-
-	ret = pmic_reg_read(p, reg, &val);
-	if (ret) {
-		debug("%s: PMIC %d register read failed\n", __func__, reg);
-		return -1;
-	}
-	val |= regval;
-	ret = pmic_reg_write(p, reg, val);
-	if (ret) {
-		debug("%s: PMIC %d register write failed\n", __func__, reg);
-		return -1;
-	}
-	return 0;
-}
-
 static int max77686_init(void)
 {
 	struct pmic *p;
diff --git a/drivers/power/power_core.c b/drivers/power/power_core.c
index d79971b..2bef594 100644
--- a/drivers/power/power_core.c
+++ b/drivers/power/power_core.c
@@ -205,6 +205,25 @@  int do_pmic(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	return CMD_RET_SUCCESS;
 }
 
+int pmic_reg_update(struct pmic *p, int reg, uint regval)
+{
+	u32 val;
+	int ret = 0;
+
+	ret = pmic_reg_read(p, reg, &val);
+	if (ret) {
+		debug("%s: PMIC %d register read failed\n", __func__, reg);
+		return -1;
+	}
+	val |= regval;
+	ret = pmic_reg_write(p, reg, val);
+	if (ret) {
+		debug("%s: PMIC %d register write failed\n", __func__, reg);
+		return -1;
+	}
+	return 0;
+}
+
 U_BOOT_CMD(
 	pmic,	CONFIG_SYS_MAXARGS, 1, do_pmic,
 	"PMIC",
diff --git a/include/power/pmic.h b/include/power/pmic.h
index 0e7aa31..d17dbdc 100644
--- a/include/power/pmic.h
+++ b/include/power/pmic.h
@@ -83,6 +83,7 @@  int pmic_probe(struct pmic *p);
 int pmic_reg_read(struct pmic *p, u32 reg, u32 *val);
 int pmic_reg_write(struct pmic *p, u32 reg, u32 val);
 int pmic_set_output(struct pmic *p, u32 reg, int ldo, int on);
+int pmic_reg_update(struct pmic *p, int reg, uint regval);
 
 #define pmic_i2c_addr (p->hw.i2c.addr)
 #define pmic_i2c_tx_num (p->hw.i2c.tx_num)