pm88x_irq_exit(chip);
}
-void pm88x_power_off(void)
+static int pm88x_power_off(struct pm88x_chip *chip)
{
- pr_info("powers off the system.");
- /* TODO: implement later */
-
- for (;;)
- cpu_relax();
+ return regmap_update_bits(chip->base_regmap,
+ PM88X_MISC_CONFIG1, PM88X_SW_PDOWN, PM88X_SW_PDOWN);
}
-int pm88x_reboot_notifier_callback(struct notifier_block *this,
- unsigned long code, void *unused)
+int pm88x_power_off_handler(struct sys_off_data *data)
{
- struct pm88x_chip *chip =
- container_of(this, struct pm88x_chip, reboot_notifier);
-
- switch (code) {
- case SYS_HALT:
- case SYS_POWER_OFF:
- dev_info(chip->dev, "system is down.\n");
- break;
- case SYS_RESTART:
- default:
- dev_info(chip->dev, "system will reboot.\n");
- break;
- }
-
- return 0;
-}
+ pm88x_power_off(data->cb_data);
+ return NOTIFY_DONE;
+}
\ No newline at end of file
goto err_apply_patch;
}
- pm_power_off = pm88x_power_off;
-
- chip->reboot_notifier.notifier_call = pm88x_reboot_notifier_callback;
- register_reboot_notifier(&(chip->reboot_notifier));
+ ret = devm_register_power_off_handler(chip->dev,
+ pm88x_power_off_handler, chip);
+ if (ret) {
+ dev_err(chip->dev, "failed to register power-off handler: %d\n", ret);
+ return ret;
+ }
return 0;
int pm88x_stepping_fixup(struct pm88x_chip *chip);
int pm88x_apply_board_fixup(struct pm88x_chip *chip, struct device_node *np);
-struct pm88x_chip *pm88x_get_chip(void);
-void pm88x_set_chip(struct pm88x_chip *chip);
-void pm88x_power_off(void);
-int pm88x_reboot_notifier_callback(struct notifier_block *nb,
- unsigned long code, void *unused);
+int pm88x_power_off_handler(struct sys_off_data *data);
#endif /* __LINUX_MFD_88PM88X_H */