aw8695: Fix compilation error of aw8695 for android R

To include the header file, change $(TOP) to $(ANDROID_BUILD_TOP);
Add function do_gettimeofday();

Change-Id: I6e6db974bf11f5bfd294702e48a32cd7facf5c48
Signed-off-by: yangjq <yangjq@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1893925
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Zhenxin Xi <xizx@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
yangjq 2021-03-05 16:40:14 +08:00 • committed by Jianqi Yang
commit f730d9613d
3 changed files with 11 additions and 5 deletions

View file

@ -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

View file

@ -30,6 +30,7 @@
#include <linux/pm_qos.h>
#include <linux/syscalls.h>
#include <linux/power_supply.h>
#include <linux/mmi_kernel_common.h>
#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);

View file

@ -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