/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
/*
 * Copyright (c) 2021 MediaTek Inc.
 */
#ifndef _DRV_WS_TSF_H_
#define _DRV_WS_TSF_H_
//-------------------------------------------------------------------------------------------------
//  Include files
//-------------------------------------------------------------------------------------------------
#include <linux/module.h>
#include <linux/uaccess.h>
#include <linux/delay.h>
#include <linux/types.h>
#include <linux/time.h>

#include <linux/clk.h>
#include <linux/platform_device.h>

//-------------------------------------------------------------------------------------------------
// Define & data type
//-------------------------------------------------------------------------------------------------
#define WS_TSF_IOC_MAGIC                        't'
#define IOCTL_WS_TSF_GET_LATCH_MONOTONIC_RAW      _IOWR(WS_TSF_IOC_MAGIC, 0UL, unsigned long long)
#define IOCTL_WS_TSF_SET_TIME_MEASURE_GPIO      _IOWR(WS_TSF_IOC_MAGIC, 1UL, int)
#define IOCTL_WS_TSF_GET_GPIO_TIME      _IOWR(WS_TSF_IOC_MAGIC, 2UL, WS_GPIO_Params_t)
#define IOCTL_WS_TSF_SET_INTERRUPT_TYPE           _IOWR(WS_TSF_IOC_MAGIC, 3UL, int)
#define WS_TSF_IOCTL_MAXNR                        4ul

#define MTK_WS_TSF_INFO(fmt, args...)    pr_info("[INFO][WS TSF] %s:%d "\
	fmt, __func__, __LINE__, ##args)
#define MTK_WS_TSF_WARN(fmt, args...)    pr_info("[WARN][WS TSF] %s:%d "\
	fmt, __func__, __LINE__, ##args)
#define MTK_WS_TSF_ERR(fmt, args...)     pr_err("[ERR][WS TSF] %s:%d "\
	fmt, __func__, __LINE__, ##args)
#if defined(MTK_WS_TSF_DEBUG)
#define MTK_WS_TSF_DBG(fmt, args...)     pr_info("[INFO][WS TSF] %s:%d "\
	fmt, __func__, __LINE__, ##args)
#else
#define MTK_WS_TSF_DBG(fmt, args...)
#endif

#define MTK_WS_TSF_NODE           "mediatek.ws_tsf"

struct MTK_WS_TSF_Params {
	unsigned int gpio;
	struct timespec64 ts;
};

enum {
	TYPE_NONE,
	TYPE_WOW_INTERRUPT,
	TYPE_TSF_INTERRUPT,
};

#endif

