Skip to content

Commit 93cae38

Browse files
committed
mfd: tps65910: Add restart handler
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]>
1 parent 88de4b0 commit 93cae38

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

drivers/mfd/tps65910.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,18 @@ static void tps65910_power_off(void *data)
442442
DEVCTRL_DEV_OFF_MASK);
443443
}
444444

445+
static void tps65910_restart(struct restart_data *data)
446+
{
447+
struct i2c_client *tps65910_i2c_client = data->cb_data;
448+
struct tps65910 *tps65910;
449+
450+
tps65910 = dev_get_drvdata(&tps65910_i2c_client->dev);
451+
452+
regmap_update_bits(tps65910->regmap, TPS65910_DEVCTRL,
453+
DEVCTRL_DEV_OFF_RST_MASK | DEVCTRL_DEV_ON_MASK,
454+
DEVCTRL_DEV_OFF_RST_MASK);
455+
}
456+
445457
static int tps65910_i2c_probe(struct i2c_client *i2c,
446458
const struct i2c_device_id *id)
447459
{
@@ -517,6 +529,15 @@ static int tps65910_i2c_probe(struct i2c_client *i2c,
517529
"failed to register power-off handler: %d\n", ret);
518530
return ret;
519531
}
532+
533+
ret = devm_register_simple_restart_handler(&i2c->dev,
534+
tps65910_restart,
535+
i2c);
536+
if (ret) {
537+
dev_err(&i2c->dev,
538+
"failed to register restart handler: %d\n", ret);
539+
return ret;
540+
}
520541
}
521542

522543
ret = devm_mfd_add_devices(tps65910->dev, -1,

0 commit comments

Comments
 (0)