diff options
author | Hyunki Koo <hyunki00.koo@samsung.com> | 2021-06-14 17:02:58 +0900 |
---|---|---|
committer | Jone Chou <jonechou@google.com> | 2021-06-14 17:42:36 +0800 |
commit | 3c3e0f91dcc3bcebd50b5630b54783f7a570474a (patch) | |
tree | 9de2977da5adc0c27f32f5070e169a0af1165e43 | |
parent | 5e2854d46a6b197746470c72164dc565c6e89aa0 (diff) | |
download | reset-3c3e0f91dcc3bcebd50b5630b54783f7a570474a.tar.gz |
power: reset: gs201: fix power key detection
This patch detect power key with s2mpg12-power-keys
Bug: 190518323
Signed-off-by: Hyunki Koo <hyunki00.koo@samsung.com>
Signed-off-by: Jone Chou <jonechou@google.com>
Change-Id: I25afa2e0f1a5799ec5f7af3137da35b29eb254fd
-rw-r--r-- | exynos-gs201-reboot.c | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/exynos-gs201-reboot.c b/exynos-gs201-reboot.c index db18ee9..8059174 100644 --- a/exynos-gs201-reboot.c +++ b/exynos-gs201-reboot.c @@ -18,6 +18,7 @@ #include <linux/of_address.h> #include <linux/regmap.h> #include <linux/mfd/syscon.h> +#include <linux/mfd/samsung/s2mpg12.h> #include <linux/platform_device.h> #include <linux/reboot.h> #if IS_ENABLED(CONFIG_GS_ACPM) @@ -57,31 +58,11 @@ enum pon_reboot_mode { static void exynos_power_off(void) { u32 poweroff_try = 0; - int power_gpio = -1; - unsigned int keycode = 0; - struct device_node *np, *pp; int ret; - np = of_find_node_by_path("/gpio_keys"); - if (!np) - return; - - for_each_child_of_node(np, pp) { - if (!of_find_property(pp, "gpios", NULL)) - continue; - of_property_read_u32(pp, "linux,code", &keycode); - if (keycode == KEY_POWER) { - pr_info("%s: <%u>\n", __func__, keycode); - power_gpio = of_get_gpio(pp, 0); - break; - } - } - - of_node_put(np); - while (1) { /* wait for power button release */ - if (!gpio_is_valid(power_gpio) || gpio_get_value(power_gpio)) { + if ((poweroff_try) || (!pmic_read_pwrkey_status())) { #if IS_ENABLED(CONFIG_GS_ACPM) exynos_acpm_reboot(); #endif |