pmic: Ensure wakeup_source API is compatible for all kernels

Updated wakeup_source API's need to be used for kernel_versions > 4.19.
Ensure to retain old wakeup_source API's for kernel_versions < 4.19.

Change-Id: Idfbdadf5a63d3d87a7598df40d8bc47756c7a453
Reviewed-on: https://gerrit.mot.com/1681801
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Ling Jin <lingjin@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
amarenr 2020-07-14 15:31:40 +05:30 • committed by a7301c
commit d28dcc304c
2 changed files with 10 additions and 0 deletions

View file

@ -52,6 +52,7 @@
#include <linux/limits.h>
#include <linux/thermal.h>
#include <linux/mutex.h>
#include <linux/version.h>
#define CHIP_ID_REG 0x0000
#define HW_VER_REG 0x0002
@ -2942,7 +2943,11 @@ static int p938x_charger_probe(struct i2c_client *client,
mutex_init(&chip->disconnect_lock);
mutex_init(&chip->txmode_lock);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 110))
chip->wls_wake_source = wakeup_source_register(chip->dev, "p938x wireless charger");
#else
chip->wls_wake_source = wakeup_source_register("p938x wireless charger");
#endif
if (!chip->wls_wake_source) {
p938x_err(chip, "failed to allocate wakeup source\n");

View file

@ -26,6 +26,7 @@
#include <linux/ipc_logging.h>
#include <linux/debugfs.h>
#include <linux/string.h>
#include <linux/version.h>
#define MODULE_LOG "SMBMMI"
@ -4122,7 +4123,11 @@ static int smb_mmi_probe(struct platform_device *pdev)
INIT_DELAYED_WORK(&chip->heartbeat_work, mmi_heartbeat_work);
INIT_DELAYED_WORK(&chip->weakcharger_work, mmi_weakcharger_work);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 110))
chip->smb_mmi_hb_wake_source = wakeup_source_register(chip->dev, "smb_mmi_hb_wake");
#else
chip->smb_mmi_hb_wake_source = wakeup_source_register("smb_mmi_hb_wake");
#endif
if (!chip->smb_mmi_hb_wake_source) {
mmi_err(chip, "failed to allocate wakeup source\n");
return -ENOMEM;