From e56d9dfe53e379696362daa09afae89b5cdfba9b Mon Sep 17 00:00:00 2001 From: kalathik Date: Wed, 19 Aug 2020 20:24:39 +0530 Subject: [PATCH] Awinic: aw8695: Replace wakeup_source API with macro Use common mmi_wake_lock macros instead directly using kernel API, which is version specific. Change-Id: I02c75ae9d3290460a5ca8b1bb8165e67c14d2240 Signed-off-by: Kanagarathina Kalathi Reviewed-on: https://gerrit.mot.com/1727617 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Konstantin Makariev Submit-Approved: Jira Key --- drivers/misc/awinic/aw8695/aw8695.c | 15 +++++---------- drivers/misc/awinic/aw8695/aw8695.h | 1 + 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/misc/awinic/aw8695/aw8695.c b/drivers/misc/awinic/aw8695/aw8695.c index 74042e9c1fb2..6fb802510182 100644 --- a/drivers/misc/awinic/aw8695/aw8695.c +++ b/drivers/misc/awinic/aw8695/aw8695.c @@ -1884,7 +1884,7 @@ static void aw8695_vibrate(struct aw8695 *aw8695, int value) #endif aw8695_haptic_stop(aw8695); if (aw8695->index == 0x02) - __pm_relax(aw8695->ws); + PM_RELAX(aw8695->ws); seq = aw8695->seq[0]; pr_info("%s: value=%d, seq=%d, index=%x\n", __FUNCTION__, value, seq, aw8695->index); @@ -1900,7 +1900,7 @@ static void aw8695_vibrate(struct aw8695 *aw8695, int value) seq -= AW8695_SEQ_NO_RTP_REPEAT; value = AW8695_SEQ_NO_RTP_STOP; - __pm_wakeup_event(aw8695->ws, value + 100); + PM_WAKEUP_EVENT(aw8695->ws, value + 100); /* run ms timer */ hrtimer_cancel(&aw8695->timer); hrtimer_start(&aw8695->timer, @@ -1942,7 +1942,7 @@ static void aw8695_vibrate(struct aw8695 *aw8695, int value) /* wav index config */ aw8695->index = 0x02; aw8695_haptic_set_repeat_wav_seq(aw8695, aw8695->index); - __pm_wakeup_event(aw8695->ws, value + 100); + PM_WAKEUP_EVENT(aw8695->ws, value + 100); /* run ms timer */ hrtimer_cancel(&aw8695->timer); aw8695->state = 0x01; @@ -3294,12 +3294,7 @@ static int aw8695_vibrator_init(struct aw8695 *aw8695) INIT_WORK(&aw8695->rtp_work, aw8695_rtp_work_routine); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 110) || \ - (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 163) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0))) - aw8695->ws = wakeup_source_register(aw8695->dev, "vibrator"); -#else - aw8695->ws = wakeup_source_register("vibrator"); -#endif + PM_WAKEUP_REGISTER(aw8695->dev, aw8695->ws, "vibrator"); if (!aw8695->ws) return -ENOMEM; @@ -3832,7 +3827,7 @@ static int aw8695_i2c_remove(struct i2c_client *i2c) if (gpio_is_valid(aw8695->reset_gpio)) devm_gpio_free(&i2c->dev, aw8695->reset_gpio); - wakeup_source_unregister(aw8695->ws); + PM_WAKEUP_UNREGISTER(aw8695->ws); devm_kfree(&i2c->dev, aw8695); aw8695 = NULL; diff --git a/drivers/misc/awinic/aw8695/aw8695.h b/drivers/misc/awinic/aw8695/aw8695.h index b484530330a7..d8236f2559a7 100644 --- a/drivers/misc/awinic/aw8695/aw8695.h +++ b/drivers/misc/awinic/aw8695/aw8695.h @@ -26,6 +26,7 @@ #else #include #endif +#include /********************************************************* *