qpnp_power_on_mmi: support with 5.15

work with kernel 5.15 version

Change-Id: Iebe3ae748388b645e96923a9fce50b9821a9dc4f
Signed-off-by: zhaoxp3 <zhaoxp3@motorola.com>
Reviewed-on: https://gerrit.mot.com/2766500
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Wang Wang <wangwang1@lenovo.com>
Submit-Approved: Jira Key
This commit is contained in:
zhaoxp3 2023-10-13 14:05:34 +08:00 • committed by Xiangpo Zhao
commit 7b4f1f5bce
2 changed files with 19 additions and 3 deletions

View file

@ -1,10 +1,10 @@
KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
all:
$(MAKE) -C $(KERNEL_SRC) M=$(shell pwd) modules $(KBUILD_OPTIONS)
$(MAKE) -C $(KERNEL_SRC) M=$(M) modules $(KBUILD_OPTIONS)
modules_install:
$(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(shell pwd) modules_install
$(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(M) modules_install
clean:
$(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean
$(MAKE) -C $(KERNEL_SRC) M=$(M) clean

View file

@ -35,6 +35,9 @@
#include <linux/reboot.h>
#include <linux/uaccess.h>
#include <linux/version.h>
#if KERNEL_VERSION(5, 15, 0) <= LINUX_VERSION_CODE
#include <linux/sysrq.h>
#endif
#define RESET_EXTRA_RESET_KUNPOW_REASON BIT(9)
@ -94,6 +97,7 @@ static unsigned int get_boot_seq(void)
return boot_seq;
}
#if KERNEL_VERSION(5, 15, 0) > LINUX_VERSION_CODE
static int print_blocked_tasks(void)
{
mm_segment_t fs;
@ -143,6 +147,14 @@ static int print_blocked_tasks(void)
return rc;
}
#else
static int print_blocked_tasks(void)
{
handle_sysrq('7');
handle_sysrq('w');
return 0;
}
#endif
static void kpd_bark_work_func(struct work_struct *work)
{
@ -159,7 +171,11 @@ static void kpd_bark_work_func(struct work_struct *work)
qpnp_pon_store_extra_reset_info(RESET_EXTRA_RESET_KUNPOW_REASON,
mmi_kungpow_check() ? 0 : RESET_EXTRA_RESET_KUNPOW_REASON);
qpnp_pon_system_pwr_off(PON_POWER_OFF_HARD_RESET);
#if KERNEL_VERSION(5, 15, 0) > LINUX_VERSION_CODE
kernel_halt();
#else
kernel_power_off();
#endif
}
}