lynkco: Add TOF kernel driver

1.Modify the Kbuild and Makefile to solve compile error
2.Add VL53L3 kernel driver

Change-Id: Id1170fef31016c1657c98bb49452afd40892cf71
Signed-off-by: wangdp11 <wangdp11@motorola.com>
Reviewed-on: https://gerrit.mot.com/2495537
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Zhenxin Xi <xizx@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
wangdp11 2023-01-26 17:32:47 +08:00
commit 7dce7615b7
5 changed files with 30 additions and 7 deletions

View file

@ -3,8 +3,10 @@
#
EXTRA_CFLAGS += -Wall
EXTRA_CFLAGS += -I$(TOP)/motorola/kernel/modules/include
EXTRA_CFLAGS += -I$(TOP)/motorola/kernel/modules/drivers/input/misc/vl53L1/inc -I$(TOP)/motorola/kernel/modules/drivers/input/misc/vl53L1/ipp -I$(TOP)/motorola/kernel/modules/drivers/input/misc/vl53L1
EXTRA_CFLAGS += -I$(ANDROID_BUILD_TOP)/motorola/kernel/modules/include
EXTRA_CFLAGS += -I$(ANDROID_BUILD_TOP)/motorola/kernel/modules/drivers/input/misc/vl53L1/inc \
-I$(ANDROID_BUILD_TOP)/motorola/kernel/modules/drivers/input/misc/vl53L1/ipp \
-I$(ANDROID_BUILD_TOP)/motorola/kernel/modules/drivers/input/misc/vl53L1
# define this environment variable if you want to compile driver for an old
# kernel

View file

@ -1,10 +1,14 @@
KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
all: modules
all:
$(MAKE) -C $(KERNEL_SRC) M=$(shell pwd) modules $(KBUILD_OPTIONS)
modules:
$(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
%:
$(MAKE) -C $(KERNEL_SRC) M=$(M) $@ $(KBUILD_OPTIONS)
clean:
$(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean
rm -f *.o *.ko *.mod.c *.mod.o *~ .*.cmd Module.symvers
rm -rf .tmp_versions

View file

@ -39,6 +39,7 @@
#include <linux/workqueue.h>
#include <linux/miscdevice.h>
#include <linux/wait.h>
#include <linux/version.h>
#include "vl53l1_api.h"
@ -160,6 +161,13 @@ extern int stmvl53l1_enable_debug;
*/
#define IPP_LOG_TIMING 1
#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 5, 0)
struct timeval {
time64_t tv_sec; /* seconds */
long tv_usec; /* microseconds */
};
#endif
struct ipp_data_t {
struct ipp_work_t work;
struct ipp_work_t work_out;

View file

@ -180,7 +180,11 @@ static int insert_device(void)
ret = -EINVAL;
goto done;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)
stm_test_i2c_client = i2c_new_device(adapter, &info);
#else
stm_test_i2c_client = i2c_new_client_device(adapter, &info);
#endif
if (!stm_test_i2c_client)
ret = -EINVAL;

View file

@ -53,6 +53,7 @@
#include <linux/kthread.h>
#include <linux/jhash.h>
#include <linux/ctype.h>
#include <linux/version.h>
/*
* API includes
@ -4182,7 +4183,11 @@ static void stmvl53l1_input_push_data_multiobject(struct stmvl53l1_data *data)
//ABS_HAT0X - Time in Sec(32)
input_report_abs(input, ABS_HAT0X, tv.tv_sec);
#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 5, 0)
vl53l1_dbgmsg("ABS_HAT0X : %lld, %zu\n", tv.tv_sec, sizeof(tv.tv_sec));
#else
vl53l1_dbgmsg("ABS_HAT0X : %ld, %zu\n", tv.tv_sec, sizeof(tv.tv_sec));
#endif
//ABS_HAT0Y - Time in uSec(32)
//REVISIT : The following code may cause loss of data due to
//8 bytes to 32 bits conversion