Loading Documentation/devicetree/bindings/power/reset/msm-vm-poweroff.txt 0 → 100644 +13 −0 Original line number Diff line number Diff line MSM VM Restart Driver A restart driver to trigger memdump on msm virtual machine. Required Properties: -compatible: "qcom,vm-restart" Example: vm_restart: restart { compatible = "qcom,vm-restart"; status = "ok"; }; arch/arm64/boot/dts/qcom/sa8155-vm.dtsi +18 −0 Original line number Diff line number Diff line Loading @@ -452,6 +452,24 @@ qca,bt-reset-gpio = <&tlmm 172 0>; /* BT_EN */ status = "ok"; }; wdog: qcom,wdt@17c10000{ compatible = "qcom,msm-watchdog"; reg = <0x17c10000 0x1000>; reg-names = "wdt-base"; interrupts = <0 0 0>, <0 1 0>; qcom,bark-time = <11000>; qcom,pet-time = <9360>; qcom,ipi-ping; qcom,wakeup-enable; qcom,scandump-sizes = <0x10100 0x10100 0x10100 0x10100 0x18100 0x18100 0x18100 0x18100>; }; vm_restart: restart { compatible = "qcom,vm-restart"; status = "ok"; }; }; #include "sm8150-pinctrl.dtsi" Loading drivers/power/reset/Kconfig +9 −0 Original line number Diff line number Diff line Loading @@ -134,6 +134,15 @@ config POWER_RESET_QCOM Say Y here if you have a Qualcomm Tecnologies, Inc. board and wish to enable restart driver. config POWER_RESET_QCOM_VM bool "Qualcomm Technologies, Inc. MSM VM power-off driver" depends on QTI_GVM help Power off and restart support for Qualcomm Technologies, Inc. virtual machine. This driver supports virtual machine power down and restart. Say Y here if you have a MSM virtual machine and wish to enable restart driver. config QCOM_DLOAD_MODE bool "Qualcomm Technologies, Inc. download mode" depends on POWER_RESET_QCOM Loading drivers/power/reset/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ obj-$(CONFIG_POWER_RESET_HISI) += hisi-reboot.o obj-$(CONFIG_POWER_RESET_IMX) += imx-snvs-poweroff.o obj-$(CONFIG_POWER_RESET_PIIX4_POWEROFF) += piix4-poweroff.o obj-$(CONFIG_POWER_RESET_QCOM) += msm-poweroff.o obj-$(CONFIG_POWER_RESET_QCOM_VM) += msm-vm-poweroff.o obj-$(CONFIG_POWER_RESET_LTC2952) += ltc2952-poweroff.o obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o obj-$(CONFIG_POWER_RESET_RESTART) += restart-poweroff.o Loading drivers/power/reset/msm-vm-poweroff.c 0 → 100644 +79 −0 Original line number Diff line number Diff line /* Copyright (c) 2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include <linux/io.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/module.h> #include <linux/reboot.h> #include <linux/pm.h> #include <linux/delay.h> #include <linux/of_address.h> #include <asm/system_misc.h> #include <soc/qcom/watchdog.h> static int in_panic; static void (*old_pm_restart)(enum reboot_mode reboot_mode, const char *cmd); static int panic_prep_restart(struct notifier_block *this, unsigned long event, void *ptr) { in_panic = 1; return NOTIFY_DONE; } static struct notifier_block panic_blk = { .notifier_call = panic_prep_restart, }; static void do_vm_restart(enum reboot_mode reboot_mode, const char *cmd) { pr_notice("Going down for vm restart now\n"); if (in_panic) msm_trigger_wdog_bite(); if (old_pm_restart) old_pm_restart(reboot_mode, cmd); } static int vm_restart_probe(struct platform_device *pdev) { atomic_notifier_chain_register(&panic_notifier_list, &panic_blk); old_pm_restart = arm_pm_restart; arm_pm_restart = do_vm_restart; return 0; } static const struct of_device_id of_vm_restart_match[] = { { .compatible = "qcom,vm-restart", }, {}, }; MODULE_DEVICE_TABLE(of, of_vm_restart_match); static struct platform_driver vm_restart_driver = { .probe = vm_restart_probe, .driver = { .name = "msm-vm-restart", .of_match_table = of_match_ptr(of_vm_restart_match), }, }; static int __init vm_restart_init(void) { return platform_driver_register(&vm_restart_driver); } pure_initcall(vm_restart_init); Loading
Documentation/devicetree/bindings/power/reset/msm-vm-poweroff.txt 0 → 100644 +13 −0 Original line number Diff line number Diff line MSM VM Restart Driver A restart driver to trigger memdump on msm virtual machine. Required Properties: -compatible: "qcom,vm-restart" Example: vm_restart: restart { compatible = "qcom,vm-restart"; status = "ok"; };
arch/arm64/boot/dts/qcom/sa8155-vm.dtsi +18 −0 Original line number Diff line number Diff line Loading @@ -452,6 +452,24 @@ qca,bt-reset-gpio = <&tlmm 172 0>; /* BT_EN */ status = "ok"; }; wdog: qcom,wdt@17c10000{ compatible = "qcom,msm-watchdog"; reg = <0x17c10000 0x1000>; reg-names = "wdt-base"; interrupts = <0 0 0>, <0 1 0>; qcom,bark-time = <11000>; qcom,pet-time = <9360>; qcom,ipi-ping; qcom,wakeup-enable; qcom,scandump-sizes = <0x10100 0x10100 0x10100 0x10100 0x18100 0x18100 0x18100 0x18100>; }; vm_restart: restart { compatible = "qcom,vm-restart"; status = "ok"; }; }; #include "sm8150-pinctrl.dtsi" Loading
drivers/power/reset/Kconfig +9 −0 Original line number Diff line number Diff line Loading @@ -134,6 +134,15 @@ config POWER_RESET_QCOM Say Y here if you have a Qualcomm Tecnologies, Inc. board and wish to enable restart driver. config POWER_RESET_QCOM_VM bool "Qualcomm Technologies, Inc. MSM VM power-off driver" depends on QTI_GVM help Power off and restart support for Qualcomm Technologies, Inc. virtual machine. This driver supports virtual machine power down and restart. Say Y here if you have a MSM virtual machine and wish to enable restart driver. config QCOM_DLOAD_MODE bool "Qualcomm Technologies, Inc. download mode" depends on POWER_RESET_QCOM Loading
drivers/power/reset/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ obj-$(CONFIG_POWER_RESET_HISI) += hisi-reboot.o obj-$(CONFIG_POWER_RESET_IMX) += imx-snvs-poweroff.o obj-$(CONFIG_POWER_RESET_PIIX4_POWEROFF) += piix4-poweroff.o obj-$(CONFIG_POWER_RESET_QCOM) += msm-poweroff.o obj-$(CONFIG_POWER_RESET_QCOM_VM) += msm-vm-poweroff.o obj-$(CONFIG_POWER_RESET_LTC2952) += ltc2952-poweroff.o obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o obj-$(CONFIG_POWER_RESET_RESTART) += restart-poweroff.o Loading
drivers/power/reset/msm-vm-poweroff.c 0 → 100644 +79 −0 Original line number Diff line number Diff line /* Copyright (c) 2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include <linux/io.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/module.h> #include <linux/reboot.h> #include <linux/pm.h> #include <linux/delay.h> #include <linux/of_address.h> #include <asm/system_misc.h> #include <soc/qcom/watchdog.h> static int in_panic; static void (*old_pm_restart)(enum reboot_mode reboot_mode, const char *cmd); static int panic_prep_restart(struct notifier_block *this, unsigned long event, void *ptr) { in_panic = 1; return NOTIFY_DONE; } static struct notifier_block panic_blk = { .notifier_call = panic_prep_restart, }; static void do_vm_restart(enum reboot_mode reboot_mode, const char *cmd) { pr_notice("Going down for vm restart now\n"); if (in_panic) msm_trigger_wdog_bite(); if (old_pm_restart) old_pm_restart(reboot_mode, cmd); } static int vm_restart_probe(struct platform_device *pdev) { atomic_notifier_chain_register(&panic_notifier_list, &panic_blk); old_pm_restart = arm_pm_restart; arm_pm_restart = do_vm_restart; return 0; } static const struct of_device_id of_vm_restart_match[] = { { .compatible = "qcom,vm-restart", }, {}, }; MODULE_DEVICE_TABLE(of, of_vm_restart_match); static struct platform_driver vm_restart_driver = { .probe = vm_restart_probe, .driver = { .name = "msm-vm-restart", .of_match_table = of_match_ptr(of_vm_restart_match), }, }; static int __init vm_restart_init(void) { return platform_driver_register(&vm_restart_driver); } pure_initcall(vm_restart_init);