From: Domenico Andreoli Proof of concept: tps65910 as provider of reset hooks. Cc: Russell King Cc: Arnd Bergmann Cc: Olof Johansson Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Domenico Andreoli --- drivers/mfd/Kconfig | 1 + drivers/mfd/tps65910.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) Index: b/drivers/mfd/Kconfig =================================================================== --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -769,6 +769,7 @@ config TPS65010 tristate "TI TPS6501x Power Management chips" depends on I2C && GPIOLIB default y if MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_OSK + select MACHINE_RESET help If you say yes here you get support for the TPS6501x series of Power Management chips. These include voltage regulators, Index: b/drivers/mfd/tps65910.c =================================================================== --- a/drivers/mfd/tps65910.c +++ b/drivers/mfd/tps65910.c @@ -26,6 +26,7 @@ #include #include #include +#include static struct resource rtc_resources[] = { { @@ -438,12 +439,9 @@ struct tps65910_board *tps65910_parse_dt } #endif -static struct i2c_client *tps65910_i2c_client; -static void tps65910_power_off(void) +static void tps65910_power_off(void *dev) { - struct tps65910 *tps65910; - - tps65910 = dev_get_drvdata(&tps65910_i2c_client->dev); + struct tps65910 *tps65910 = dev_get_drvdata(dev); if (tps65910_reg_set_bits(tps65910, TPS65910_DEVCTRL, DEVCTRL_PWR_OFF_MASK) < 0) @@ -501,9 +499,11 @@ static int tps65910_i2c_probe(struct i2c tps65910_ck32k_init(tps65910, pmic_plat_data); tps65910_sleepinit(tps65910, pmic_plat_data); - if (pmic_plat_data->pm_off && !pm_power_off) { - tps65910_i2c_client = i2c; - pm_power_off = tps65910_power_off; + if (pmic_plat_data->pm_off) { + struct reset_hook hook; + reset_hook_init(&hook); + hook.power_off = tps65910_power_off; + set_machine_reset(RESET_POWER_OFF, &hook, &i2c->dev); } ret = mfd_add_devices(tps65910->dev, -1,