diff --git a/drivers/misc/awinic/aw8695/Kbuild b/drivers/misc/awinic/aw8695/Kbuild index ab4dcc4d9338..2bcfcaf433be 100644 --- a/drivers/misc/awinic/aw8695/Kbuild +++ b/drivers/misc/awinic/aw8695/Kbuild @@ -4,6 +4,6 @@ ifneq ($(filter m y,$(CONFIG_AF_NOISE_ELIMINATION)),) endif EXTRA_CFLAGS += -Wall -EXTRA_CFLAGS += -I$(TOP)/motorola/kernel/modules/include +EXTRA_CFLAGS += -I$(ANDROID_BUILD_TOP)/motorola/kernel/modules/include obj-m += aw8695.o diff --git a/drivers/misc/awinic/aw8695/aw8695.c b/drivers/misc/awinic/aw8695/aw8695.c index 4bdcfec08edb..27043fe2c44c 100644 --- a/drivers/misc/awinic/aw8695/aw8695.c +++ b/drivers/misc/awinic/aw8695/aw8695.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "aw8695.h" #include "aw8695_reg.h" #include "aw8695_config.h" @@ -584,9 +585,14 @@ static int aw8695_haptic_play_go(struct aw8695 *aw8695, bool flag) pr_debug("%s enter\n", __func__); if (!flag) { - do_gettimeofday(&aw8695->current_time); + GET_TIME_OF_DAY(&aw8695->current_time); aw8695->interval_us = (aw8695->current_time.tv_sec - aw8695->pre_enter_time.tv_sec) * 1000000 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) + + (aw8695->current_time.tv_nsec - aw8695->pre_enter_time.tv_nsec) / 1000; +#else + (aw8695->current_time.tv_usec - aw8695->pre_enter_time.tv_usec); +#endif + if (aw8695->interval_us < 2000) { pr_info("aw8695->interval_us t=%u\n", aw8695->interval_us); mdelay(2); @@ -595,7 +601,7 @@ static int aw8695_haptic_play_go(struct aw8695 *aw8695, bool flag) if(flag == true) { aw8695_i2c_write_bits(aw8695, AW8695_REG_GO, AW8695_BIT_GO_MASK, AW8695_BIT_GO_ENABLE); - do_gettimeofday(&aw8695->pre_enter_time); + GET_TIME_OF_DAY(&aw8695->pre_enter_time); } else { aw8695_i2c_write_bits(aw8695, AW8695_REG_GO, AW8695_BIT_GO_MASK, AW8695_BIT_GO_DISABLE); diff --git a/drivers/misc/awinic/aw8695/aw8695.h b/drivers/misc/awinic/aw8695/aw8695.h index d8236f2559a7..4e1a92a11633 100644 --- a/drivers/misc/awinic/aw8695/aw8695.h +++ b/drivers/misc/awinic/aw8695/aw8695.h @@ -270,8 +270,8 @@ struct aw8695 { struct work_struct vibrator_work; struct work_struct rtp_work; struct delayed_work ram_work; - struct timeval current_time; - struct timeval pre_enter_time; + struct TIME_TYPE current_time; + struct TIME_TYPE pre_enter_time; #ifdef TIMED_OUTPUT struct timed_output_dev to_dev; #else