power: pmic: Let PFUZE3000 see all 256 registers
authorTrent Piepho <tpiepho@impinj.com>
Wed, 25 Apr 2018 17:06:00 +0000 (10:06 -0700)
committerStefano Babic <sbabic@denx.de>
Wed, 27 Jun 2018 07:47:46 +0000 (09:47 +0200)
The PFUZE3000 uses registers addresses up to 0xff.

The DM pfuze100 driver supports both pfuze100 and pfuze3000.  Allow it
to use the device type to return the correct number of registers.

Also rename the too generic PMIC_NUM_OF_REGS enumeration value for
pfuze3000 to match the other "PFUZE3000_" prefixed enumerations and the
pfuze100 enumeration value PFUZE100_NUM_OF_REGS.

Cc: Peng Fan <Peng.Fan@freescale.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
drivers/power/pmic/pfuze100.c
drivers/power/pmic/pmic_pfuze3000.c
include/power/pfuze3000_pmic.h

index 4670a84560ebab526b4c4689f87f172021b5226b..8a5a8996b432879fcf3acb58611706bd2c693ed4 100644 (file)
@@ -12,6 +12,7 @@
 #include <power/pmic.h>
 #include <power/regulator.h>
 #include <power/pfuze100_pmic.h>
+#include <power/pfuze3000_pmic.h>
 
 static const struct pmic_child_info pmic_children_info[] = {
        /* sw[x], swbst */
@@ -23,7 +24,7 @@ static const struct pmic_child_info pmic_children_info[] = {
 
 static int pfuze100_reg_count(struct udevice *dev)
 {
-       return PFUZE100_NUM_OF_REGS;
+       return dev->driver_data == PFUZE3000 ? PFUZE3000_NUM_OF_REGS : PFUZE100_NUM_OF_REGS;
 }
 
 static int pfuze100_write(struct udevice *dev, uint reg, const uint8_t *buff,
index f2a51fe4a49a9b567d835cb41a25d154768faacd..1077fa5e9d9869bcefd90311037a1a8d7c5a96b2 100644 (file)
@@ -22,7 +22,7 @@ int power_pfuze3000_init(unsigned char bus)
 
        p->name = name;
        p->interface = PMIC_I2C;
-       p->number_of_regs = PMIC_NUM_OF_REGS;
+       p->number_of_regs = PFUZE3000_NUM_OF_REGS;
        p->hw.i2c.addr = CONFIG_POWER_PFUZE3000_I2C_ADDR;
        p->hw.i2c.tx_num = 1;
        p->bus = bus;
index 87ea7cad466f0b865a9dc2b1d5f61bde5accd28c..b836d67fb62ecf66dcf04d60d60321140f24ec2a 100644 (file)
@@ -69,7 +69,7 @@ enum {
        PFUZE3000_VLDO3CTL      = 0x70,
        PFUZE3000_VLD4CTL       = 0x71,
 
-       PMIC_NUM_OF_REGS        = 0x7F,
+       PFUZE3000_NUM_OF_REGS   = 0x100,
 };
 
 int power_pfuze3000_init(unsigned char bus);