diff mbox series

[14/26] power: pca9450: add a new parameter for power_pca9450_init

Message ID 20210319075718.14181-15-peng.fan@oss.nxp.com
State Accepted
Commit 4eeb9fe84742af67c775afd5055b672b0639a244
Delegated to: Stefano Babic
Headers show
Series imx: update for i.MX8M | expand

Commit Message

Peng Fan (OSS) March 19, 2021, 7:57 a.m. UTC
From: Peng Fan <peng.fan@nxp.com>

Currently PCA9450 might have address 0x25 or 0x35, so let user
choose the address.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 board/freescale/imx8mp_evk/spl.c  | 2 +-
 board/phytec/phycore_imx8mp/spl.c | 2 +-
 drivers/power/pmic/pmic_pca9450.c | 4 ++--
 include/power/pca9450.h           | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

Comments

Jaehoon Chung March 21, 2021, 10:41 p.m. UTC | #1
On 3/19/21 4:57 PM, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> Currently PCA9450 might have address 0x25 or 0x35, so let user
> choose the address.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> ---
>  board/freescale/imx8mp_evk/spl.c  | 2 +-
>  board/phytec/phycore_imx8mp/spl.c | 2 +-
>  drivers/power/pmic/pmic_pca9450.c | 4 ++--
>  include/power/pca9450.h           | 2 +-
>  4 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/board/freescale/imx8mp_evk/spl.c b/board/freescale/imx8mp_evk/spl.c
> index 6ccf5ac8fa..a7564e9b1a 100644
> --- a/board/freescale/imx8mp_evk/spl.c
> +++ b/board/freescale/imx8mp_evk/spl.c
> @@ -70,7 +70,7 @@ int power_init_board(void)
>  	struct pmic *p;
>  	int ret;
>  
> -	ret = power_pca9450_init(I2C_PMIC);
> +	ret = power_pca9450_init(I2C_PMIC, 0x25);
>  	if (ret)
>  		printf("power init failed");
>  	p = pmic_get("PCA9450");
> diff --git a/board/phytec/phycore_imx8mp/spl.c b/board/phytec/phycore_imx8mp/spl.c
> index eefdd7fdda..f9fa8d1e12 100644
> --- a/board/phytec/phycore_imx8mp/spl.c
> +++ b/board/phytec/phycore_imx8mp/spl.c
> @@ -53,7 +53,7 @@ int power_init_board(void)
>  	struct pmic *p;
>  	int ret;
>  
> -	ret = power_pca9450_init(0);
> +	ret = power_pca9450_init(0, 0x25);
>  	if (ret)
>  		printf("power init failed");
>  	p = pmic_get("PCA9450");
> diff --git a/drivers/power/pmic/pmic_pca9450.c b/drivers/power/pmic/pmic_pca9450.c
> index d4f27428bd..8c4d0a9230 100644
> --- a/drivers/power/pmic/pmic_pca9450.c
> +++ b/drivers/power/pmic/pmic_pca9450.c
> @@ -11,7 +11,7 @@
>  
>  static const char pca9450_name[] = "PCA9450";
>  
> -int power_pca9450_init(unsigned char bus)
> +int power_pca9450_init(unsigned char bus, unsigned char addr)
>  {
>  	struct pmic *p = pmic_alloc();
>  
> @@ -23,7 +23,7 @@ int power_pca9450_init(unsigned char bus)
>  	p->name = pca9450_name;
>  	p->interface = PMIC_I2C;
>  	p->number_of_regs = PCA9450_REG_NUM;
> -	p->hw.i2c.addr = 0x25;
> +	p->hw.i2c.addr = addr;
>  	p->hw.i2c.tx_num = 1;
>  	p->bus = bus;
>  
> diff --git a/include/power/pca9450.h b/include/power/pca9450.h
> index 5a9a697d62..27703bb1f9 100644
> --- a/include/power/pca9450.h
> +++ b/include/power/pca9450.h
> @@ -54,6 +54,6 @@ enum {
>  	PCA9450_REG_NUM,
>  };
>  
> -int power_pca9450_init(unsigned char bus);
> +int power_pca9450_init(unsigned char bus, unsigned char addr);
>  
>  #endif
>
diff mbox series

Patch

diff --git a/board/freescale/imx8mp_evk/spl.c b/board/freescale/imx8mp_evk/spl.c
index 6ccf5ac8fa..a7564e9b1a 100644
--- a/board/freescale/imx8mp_evk/spl.c
+++ b/board/freescale/imx8mp_evk/spl.c
@@ -70,7 +70,7 @@  int power_init_board(void)
 	struct pmic *p;
 	int ret;
 
-	ret = power_pca9450_init(I2C_PMIC);
+	ret = power_pca9450_init(I2C_PMIC, 0x25);
 	if (ret)
 		printf("power init failed");
 	p = pmic_get("PCA9450");
diff --git a/board/phytec/phycore_imx8mp/spl.c b/board/phytec/phycore_imx8mp/spl.c
index eefdd7fdda..f9fa8d1e12 100644
--- a/board/phytec/phycore_imx8mp/spl.c
+++ b/board/phytec/phycore_imx8mp/spl.c
@@ -53,7 +53,7 @@  int power_init_board(void)
 	struct pmic *p;
 	int ret;
 
-	ret = power_pca9450_init(0);
+	ret = power_pca9450_init(0, 0x25);
 	if (ret)
 		printf("power init failed");
 	p = pmic_get("PCA9450");
diff --git a/drivers/power/pmic/pmic_pca9450.c b/drivers/power/pmic/pmic_pca9450.c
index d4f27428bd..8c4d0a9230 100644
--- a/drivers/power/pmic/pmic_pca9450.c
+++ b/drivers/power/pmic/pmic_pca9450.c
@@ -11,7 +11,7 @@ 
 
 static const char pca9450_name[] = "PCA9450";
 
-int power_pca9450_init(unsigned char bus)
+int power_pca9450_init(unsigned char bus, unsigned char addr)
 {
 	struct pmic *p = pmic_alloc();
 
@@ -23,7 +23,7 @@  int power_pca9450_init(unsigned char bus)
 	p->name = pca9450_name;
 	p->interface = PMIC_I2C;
 	p->number_of_regs = PCA9450_REG_NUM;
-	p->hw.i2c.addr = 0x25;
+	p->hw.i2c.addr = addr;
 	p->hw.i2c.tx_num = 1;
 	p->bus = bus;
 
diff --git a/include/power/pca9450.h b/include/power/pca9450.h
index 5a9a697d62..27703bb1f9 100644
--- a/include/power/pca9450.h
+++ b/include/power/pca9450.h
@@ -54,6 +54,6 @@  enum {
 	PCA9450_REG_NUM,
 };
 
-int power_pca9450_init(unsigned char bus);
+int power_pca9450_init(unsigned char bus, unsigned char addr);
 
 #endif