pmic: rk8xx: print source on and off

It tells the reason why PMIC current powers on an last powers off,
this helps a lot for debugging when system suddenly power off or
restart due to unknown power supply cause.

Change-Id: Iec0c38dc1ac5745a9bc473848b5d617059b16faf
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
Joseph Chen 2018-08-30 14:49:17 +08:00
parent dc490422b6
commit 7623c170e8
2 changed files with 20 additions and 1 deletions

View File

@ -158,6 +158,7 @@ static int rk8xx_probe(struct udevice *dev)
int init_data_num = 0;
int ret = 0, i, show_variant;
uint8_t msb, lsb, id_msb, id_lsb;
uint8_t on_source = 0, off_source = 0;
/* read Chip variant */
if (device_is_compatible(dev, "rockchip,rk817") ||
@ -185,9 +186,13 @@ static int rk8xx_probe(struct udevice *dev)
case RK805_ID:
case RK816_ID:
case RK818_ID:
on_source = RK8XX_ON_SOURCE;
off_source = RK8XX_OFF_SOURCE;
break;
case RK809_ID:
case RK817_ID:
on_source = RK817_ON_SOURCE;
off_source = RK817_OFF_SOURCE;
#ifdef CONFIG_DM_CHARGE_DISPLAY
init_data = rk817_init_reg;
init_data_num = ARRAY_SIZE(rk817_init_reg);
@ -212,7 +217,16 @@ static int rk8xx_probe(struct udevice *dev)
pmic_reg_read(dev, init_data[i].reg));
}
printf("PMIC: RK%x\n", show_variant);
printf("PMIC: RK%x ", show_variant);
if (on_source && off_source) {
on_source = pmic_reg_read(dev, on_source);
off_source = pmic_reg_read(dev, off_source);
printf("(on=0x%02x, off=0x%02x)",
pmic_reg_read(dev, on_source),
pmic_reg_read(dev, off_source));
}
printf("\n");
return 0;
}

View File

@ -199,6 +199,11 @@ enum {
#define RK817_PMIC_SYS_CFG3 0xf4
#define RK817_GPIO_INT_CFG 0xfe
#define RK8XX_ON_SOURCE 0xae
#define RK8XX_OFF_SOURCE 0xaf
#define RK817_ON_SOURCE 0xf5
#define RK817_OFF_SOURCE 0xf6
struct reg_data {
u8 reg;
u8 val;