Skip to content

Commit

Permalink
mfd: tps65910: Add restart handler
Browse files Browse the repository at this point in the history
Add restart handler to reset hardware properly on system reboot.

Tested-by: Svyatoslav Ryhel <[email protected]> # ASUS TF201
Tested-by: Maxim Schwalm <[email protected]> # ASUS TF700T
Signed-off-by: Dmitry Osipenko <[email protected]>
  • Loading branch information
digetx committed Dec 12, 2021
1 parent 88de4b0 commit 93cae38
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions drivers/mfd/tps65910.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,18 @@ static void tps65910_power_off(void *data)
DEVCTRL_DEV_OFF_MASK);
}

static void tps65910_restart(struct restart_data *data)
{
struct i2c_client *tps65910_i2c_client = data->cb_data;
struct tps65910 *tps65910;

tps65910 = dev_get_drvdata(&tps65910_i2c_client->dev);

regmap_update_bits(tps65910->regmap, TPS65910_DEVCTRL,
DEVCTRL_DEV_OFF_RST_MASK | DEVCTRL_DEV_ON_MASK,
DEVCTRL_DEV_OFF_RST_MASK);
}

static int tps65910_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
Expand Down Expand Up @@ -517,6 +529,15 @@ static int tps65910_i2c_probe(struct i2c_client *i2c,
"failed to register power-off handler: %d\n", ret);
return ret;
}

ret = devm_register_simple_restart_handler(&i2c->dev,
tps65910_restart,
i2c);
if (ret) {
dev_err(&i2c->dev,
"failed to register restart handler: %d\n", ret);
return ret;
}
}

ret = devm_mfd_add_devices(tps65910->dev, -1,
Expand Down

0 comments on commit 93cae38

Please sign in to comment.