mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
mfd: rk808: add on/off source dump
Show the reason of this power on and last shutdown. Change-Id: Id540433065859a0c3f4817ed66e295b7c6dfccb5 Signed-off-by: Joseph Chen <chenjh@rock-chips.com> Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
This commit is contained in:
@@ -812,10 +812,13 @@ static int rk808_probe(struct i2c_client *client,
|
||||
struct rk808 *rk808;
|
||||
const struct rk808_reg_data *pre_init_reg;
|
||||
const struct mfd_cell *cells;
|
||||
unsigned char pmic_id_msb, pmic_id_lsb;
|
||||
u8 on_source = 0, off_source = 0;
|
||||
unsigned int on, off;
|
||||
int msb, lsb;
|
||||
int nr_pre_init_regs;
|
||||
int nr_cells;
|
||||
int msb, lsb;
|
||||
unsigned char pmic_id_msb, pmic_id_lsb;
|
||||
|
||||
int ret;
|
||||
int i;
|
||||
void (*of_property_prepare_fn)(struct rk808 *rk808,
|
||||
@@ -861,6 +864,8 @@ static int rk808_probe(struct i2c_client *client,
|
||||
nr_pre_init_regs = ARRAY_SIZE(rk805_pre_init_reg);
|
||||
cells = rk805s;
|
||||
nr_cells = ARRAY_SIZE(rk805s);
|
||||
on_source = RK805_ON_SOURCE_REG;
|
||||
off_source = RK805_OFF_SOURCE_REG;
|
||||
break;
|
||||
case RK808_ID:
|
||||
rk808->regmap_cfg = &rk808_regmap_config;
|
||||
@@ -877,6 +882,8 @@ static int rk808_probe(struct i2c_client *client,
|
||||
nr_pre_init_regs = ARRAY_SIZE(rk818_pre_init_reg);
|
||||
cells = rk818s;
|
||||
nr_cells = ARRAY_SIZE(rk818s);
|
||||
on_source = RK818_ON_SOURCE_REG;
|
||||
off_source = RK818_OFF_SOURCE_REG;
|
||||
break;
|
||||
case RK809_ID:
|
||||
case RK817_ID:
|
||||
@@ -886,6 +893,8 @@ static int rk808_probe(struct i2c_client *client,
|
||||
nr_pre_init_regs = ARRAY_SIZE(rk817_pre_init_reg);
|
||||
cells = rk817s;
|
||||
nr_cells = ARRAY_SIZE(rk817s);
|
||||
on_source = RK817_ON_SOURCE_REG;
|
||||
off_source = RK817_OFF_SOURCE_REG;
|
||||
of_property_prepare_fn = rk817_of_property_prepare;
|
||||
pinctrl_init = rk817_pinctrl_init;
|
||||
break;
|
||||
@@ -904,6 +913,23 @@ static int rk808_probe(struct i2c_client *client,
|
||||
return PTR_ERR(rk808->regmap);
|
||||
}
|
||||
|
||||
if (on_source && off_source) {
|
||||
ret = regmap_read(rk808->regmap, on_source, &on);
|
||||
if (ret) {
|
||||
dev_err(&client->dev, "read 0x%x failed\n", on_source);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = regmap_read(rk808->regmap, off_source, &off);
|
||||
if (ret) {
|
||||
dev_err(&client->dev, "read 0x%x failed\n", off_source);
|
||||
return ret;
|
||||
}
|
||||
|
||||
dev_info(&client->dev, "source: on=0x%02x, off=0x%02x\n",
|
||||
on, off);
|
||||
}
|
||||
|
||||
if (!client->irq) {
|
||||
dev_err(&client->dev, "No interrupt support, no core IRQ\n");
|
||||
return -EINVAL;
|
||||
|
||||
Reference in New Issue
Block a user