Add samsung specific changes
This commit is contained in:
114
include/linux/input/qpnp-power-on.h
Normal file
114
include/linux/input/qpnp-power-on.h
Normal file
@@ -0,0 +1,114 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2012-2015, 2017-2019, 2021 The Linux Foundation.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef QPNP_PON_H
|
||||
#define QPNP_PON_H
|
||||
|
||||
#include <dt-bindings/input/qcom,qpnp-power-on.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
/**
|
||||
* enum pon_trigger_source: List of PON trigger sources
|
||||
* %PON_SMPL: PON triggered by Sudden Momentary Power Loss (SMPL)
|
||||
* %PON_RTC: PON triggered by real-time clock (RTC) alarm
|
||||
* %PON_DC_CHG: PON triggered by insertion of DC charger
|
||||
* %PON_USB_CHG: PON triggered by insertion of USB
|
||||
* %PON_PON1: PON triggered by other PMIC (multi-PMIC option)
|
||||
* %PON_CBLPWR_N: PON triggered by power-cable insertion
|
||||
* %PON_KPDPWR_N: PON triggered by long press of the power-key
|
||||
*/
|
||||
enum pon_trigger_source {
|
||||
PON_SMPL = 1,
|
||||
PON_RTC,
|
||||
PON_DC_CHG,
|
||||
PON_USB_CHG,
|
||||
PON_PON1,
|
||||
PON_CBLPWR_N,
|
||||
PON_KPDPWR_N,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum pon_power_off_type: Possible power off actions to perform
|
||||
* %PON_POWER_OFF_RESERVED: Reserved, not used
|
||||
* %PON_POWER_OFF_WARM_RESET: Reset the MSM but not all PMIC peripherals
|
||||
* %PON_POWER_OFF_SHUTDOWN: Shutdown the MSM and PMIC completely
|
||||
* %PON_POWER_OFF_HARD_RESET: Reset the MSM and all PMIC peripherals
|
||||
* %PON_POWER_OFF_MAX_TYPE: Reserved, not used
|
||||
*/
|
||||
enum pon_power_off_type {
|
||||
PON_POWER_OFF_RESERVED = 0x00,
|
||||
PON_POWER_OFF_WARM_RESET = PON_POWER_OFF_TYPE_WARM_RESET,
|
||||
PON_POWER_OFF_SHUTDOWN = PON_POWER_OFF_TYPE_SHUTDOWN,
|
||||
PON_POWER_OFF_HARD_RESET = PON_POWER_OFF_TYPE_HARD_RESET,
|
||||
PON_POWER_OFF_MAX_TYPE = 0x10,
|
||||
};
|
||||
|
||||
enum pon_restart_reason {
|
||||
PON_RESTART_REASON_UNKNOWN = 0x00,
|
||||
PON_RESTART_REASON_RECOVERY = 0x01,
|
||||
PON_RESTART_REASON_BOOTLOADER = 0x02,
|
||||
PON_RESTART_REASON_RTC = 0x03,
|
||||
PON_RESTART_REASON_DMVERITY_CORRUPTED = 0x04,
|
||||
PON_RESTART_REASON_DMVERITY_ENFORCE = 0x05,
|
||||
PON_RESTART_REASON_KEYS_CLEAR = 0x06,
|
||||
PON_RESTART_REASON_SILENT = 0x0a,
|
||||
PON_RESTART_REASON_NON_SILENT = 0x0b,
|
||||
PON_RESTART_REASON_FORCED_SILENT = 0x0c,
|
||||
PON_RESTART_REASON_FORCED_NON_SILENT = 0x0d,
|
||||
};
|
||||
|
||||
#if IS_ENABLED(CONFIG_INPUT_QPNP_POWER_ON)
|
||||
int qpnp_pon_system_pwr_off(enum pon_power_off_type type);
|
||||
int qpnp_pon_is_warm_reset(void);
|
||||
int qpnp_pon_trigger_config(enum pon_trigger_source pon_src, bool enable);
|
||||
int qpnp_pon_wd_config(bool enable);
|
||||
int qpnp_pon_set_restart_reason(enum pon_restart_reason reason);
|
||||
bool qpnp_pon_check_hard_reset_stored(void);
|
||||
int qpnp_pon_modem_pwr_off(enum pon_power_off_type type);
|
||||
|
||||
#else
|
||||
|
||||
static int qpnp_pon_system_pwr_off(enum pon_power_off_type type)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline int qpnp_pon_is_warm_reset(void)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline int qpnp_pon_trigger_config(enum pon_trigger_source pon_src,
|
||||
bool enable)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
int qpnp_pon_wd_config(bool enable)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline int qpnp_pon_set_restart_reason(enum pon_restart_reason reason)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline bool qpnp_pon_check_hard_reset_stored(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline int qpnp_pon_modem_pwr_off(enum pon_power_off_type type)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
167
include/linux/input/sec_cmd.h
Normal file
167
include/linux/input/sec_cmd.h
Normal file
@@ -0,0 +1,167 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0
|
||||
* Copyright (C) 2022 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef _SEC_CMD_H_
|
||||
#define _SEC_CMD_H_
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/stat.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/sched/clock.h>
|
||||
#include <linux/uaccess.h>
|
||||
#if IS_ENABLED(CONFIG_DRV_SAMSUNG)
|
||||
#include <linux/sec_class.h>
|
||||
#endif
|
||||
|
||||
#if !IS_ENABLED(CONFIG_SEC_FACTORY)
|
||||
#define USE_SEC_CMD_QUEUE
|
||||
#include <linux/kfifo.h>
|
||||
#endif
|
||||
|
||||
#define SEC_CLASS_DEVT_TSP 10
|
||||
#define SEC_CLASS_DEVT_TKEY 11
|
||||
#define SEC_CLASS_DEVT_WACOM 12
|
||||
#define SEC_CLASS_DEVT_SIDEKEY 13
|
||||
#define SEC_CLASS_DEV_NAME_TSP "tsp"
|
||||
#define SEC_CLASS_DEV_NAME_TKEY "sec_touchkey"
|
||||
#define SEC_CLASS_DEV_NAME_WACOM "sec_epen"
|
||||
#define SEC_CLASS_DEV_NAME_SIDEKEY "sec_sidekey"
|
||||
|
||||
#define SEC_CLASS_DEVT_TSP1 15
|
||||
#define SEC_CLASS_DEVT_TSP2 16
|
||||
#define SEC_CLASS_DEV_NAME_TSP1 "tsp1"
|
||||
#define SEC_CLASS_DEV_NAME_TSP2 "tsp2"
|
||||
|
||||
#define SEC_CMD(name, func) .cmd_name = name, .cmd_func = func
|
||||
#define SEC_CMD_H(name, func) .cmd_name = name, .cmd_func = func, .cmd_log = 1
|
||||
#define SEC_CMD_V2(name, func, force_func, use_cases, wait_result) \
|
||||
.cmd_name = name, .cmd_func = func, .cmd_func_forced = force_func, \
|
||||
.cmd_use_cases = use_cases, .wait_read_result = wait_result
|
||||
#define SEC_CMD_V2_H(name, func, force_func, use_cases, wait_result) \
|
||||
.cmd_name = name, .cmd_func = func, .cmd_func_forced = force_func, \
|
||||
.cmd_use_cases = use_cases, .wait_read_result = wait_result, .cmd_log = 1
|
||||
|
||||
#define SEC_CMD_BUF_SIZE (4096 - 1)
|
||||
#define SEC_CMD_STR_LEN 256
|
||||
#define SEC_CMD_RESULT_STR_LEN (4096 - 1)
|
||||
#define SEC_CMD_RESULT_STR_LEN_EXPAND (SEC_CMD_RESULT_STR_LEN * 6)
|
||||
#define SEC_CMD_PARAM_NUM 8
|
||||
|
||||
#define WAIT_RESULT true
|
||||
#define EXIT_RESULT false
|
||||
|
||||
struct sec_cmd {
|
||||
struct list_head list;
|
||||
const char *cmd_name;
|
||||
void (*cmd_func)(void *device_data);
|
||||
int (*cmd_func_forced)(void *device_data);
|
||||
/*
|
||||
* cmd_use_cases using as below
|
||||
* 1 : call function, 0 : no call
|
||||
* first bit(1<<0) CHECK_POWEROFF
|
||||
* second bit(1<<1) CHECK_LPMODE
|
||||
* third bit(1<<2) CHECK_POWERON
|
||||
*/
|
||||
int cmd_use_cases;
|
||||
bool wait_read_result;
|
||||
int cmd_log;
|
||||
bool not_support_cmds;
|
||||
};
|
||||
|
||||
enum sec_cmd_status_uevent_type {
|
||||
STATUS_TYPE_WET = 0,
|
||||
STATUS_TYPE_NOISE,
|
||||
STATUS_TYPE_FREQ,
|
||||
};
|
||||
|
||||
enum SEC_CMD_STATUS {
|
||||
SEC_CMD_STATUS_WAITING = 0,
|
||||
SEC_CMD_STATUS_RUNNING, // = 1
|
||||
SEC_CMD_STATUS_OK, // = 2
|
||||
SEC_CMD_STATUS_FAIL, // = 3
|
||||
SEC_CMD_STATUS_EXPAND, // = 4
|
||||
SEC_CMD_STATUS_NOT_APPLICABLE, // = 5
|
||||
};
|
||||
|
||||
#define INPUT_CMD_RESULT_NOT_EXIT 0
|
||||
#define INPUT_CMD_RESULT_NEED_EXIT 1
|
||||
|
||||
#define input_cmd_result(cmd_state_parm, need_exit) \
|
||||
({ \
|
||||
if (need_exit == INPUT_CMD_RESULT_NEED_EXIT) { \
|
||||
if (cmd_state_parm == SEC_CMD_STATUS_OK) \
|
||||
snprintf(buff, sizeof(buff), "OK"); \
|
||||
else if (cmd_state_parm == SEC_CMD_STATUS_FAIL) \
|
||||
snprintf(buff, sizeof(buff), "NG"); \
|
||||
else if (cmd_state_parm == SEC_CMD_STATUS_NOT_APPLICABLE) \
|
||||
snprintf(buff, sizeof(buff), "NA"); \
|
||||
} \
|
||||
sec_cmd_set_cmd_result(sec, buff, strnlen(buff, sizeof(buff))); \
|
||||
sec->cmd_state = cmd_state_parm; \
|
||||
if (need_exit == INPUT_CMD_RESULT_NEED_EXIT) \
|
||||
sec_cmd_set_cmd_exit(sec); \
|
||||
input_info(true, ptsp, "%s: %s\n", __func__, buff); \
|
||||
})
|
||||
|
||||
#ifdef USE_SEC_CMD_QUEUE
|
||||
#define SEC_CMD_MAX_QUEUE 10
|
||||
|
||||
struct command {
|
||||
char cmd[SEC_CMD_STR_LEN];
|
||||
};
|
||||
#endif
|
||||
|
||||
struct sec_cmd_data {
|
||||
struct device *fac_dev;
|
||||
struct device *dev;
|
||||
struct list_head cmd_list_head;
|
||||
u8 cmd_state;
|
||||
char cmd[SEC_CMD_STR_LEN];
|
||||
int cmd_param[SEC_CMD_PARAM_NUM];
|
||||
char *cmd_result;
|
||||
int cmd_result_expand;
|
||||
int cmd_result_expand_count;
|
||||
int cmd_buffer_size;
|
||||
atomic_t cmd_is_running;
|
||||
struct mutex cmd_lock;
|
||||
struct mutex fs_lock;
|
||||
struct mutex io_lock;
|
||||
#ifdef USE_SEC_CMD_QUEUE
|
||||
struct kfifo cmd_queue;
|
||||
struct mutex fifo_lock;
|
||||
struct delayed_work cmd_work;
|
||||
struct mutex wait_lock;
|
||||
struct completion cmd_result_done;
|
||||
#endif
|
||||
bool wait_cmd_result_done;
|
||||
int item_count;
|
||||
char cmd_result_all[SEC_CMD_RESULT_STR_LEN];
|
||||
u8 cmd_all_factory_state;
|
||||
struct attribute_group *vendor_attr_group;
|
||||
};
|
||||
|
||||
void sec_cmd_set_cmd_exit(struct sec_cmd_data *data);
|
||||
void sec_cmd_set_default_result(struct sec_cmd_data *data);
|
||||
void sec_cmd_set_cmd_result(struct sec_cmd_data *data, char *buff, int len);
|
||||
void sec_cmd_set_cmd_result_all(struct sec_cmd_data *data, char *buff, int len, char *item);
|
||||
int sec_cmd_init(struct sec_cmd_data *data, struct device *dev, struct sec_cmd *cmds,
|
||||
int len, int devt, struct attribute_group *vendor_attr_group);
|
||||
int sec_cmd_init_without_platdata(struct sec_cmd_data *data, struct sec_cmd *cmds,
|
||||
int len, int devt, struct attribute_group *vendor_attr_group);
|
||||
void sec_cmd_exit(struct sec_cmd_data *data, int devt);
|
||||
void sec_cmd_send_event_to_user(struct sec_cmd_data *data, char *test, char *result);
|
||||
void sec_cmd_send_status_uevent(struct sec_cmd_data *data, enum sec_cmd_status_uevent_type type, int value);
|
||||
void sec_cmd_send_gesture_uevent(struct sec_cmd_data *data, int type, int x, int y);
|
||||
void sec_cmd_io_clear_firmware_data(struct sec_cmd_data *data);
|
||||
int sec_cmd_io_init(struct sec_cmd_data *data, int devt);
|
||||
|
||||
#endif /* _SEC_CMD_H_ */
|
1017
include/linux/input/sec_input.h
Normal file
1017
include/linux/input/sec_input.h
Normal file
File diff suppressed because it is too large
Load Diff
49
include/linux/input/sec_input_kunit_dummy.h
Normal file
49
include/linux/input/sec_input_kunit_dummy.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef __SEC_INPUT_KUNIT_MOCK_DUMMY_H__
|
||||
#define __SEC_INPUT_KUNIT_MOCK_DUMMY_H__
|
||||
|
||||
#define REAL_ID(func_name) __real__##func_name
|
||||
#define INVOKE_ID(func_name) __invoke__##func_name
|
||||
#define RETURNS(return_type) return_type
|
||||
#define __mockable
|
||||
#define __mockable_alias(id) __alias(id)
|
||||
#define __visible_for_testing static
|
||||
|
||||
#ifndef PARAMS
|
||||
#define PARAMS(args...) args
|
||||
#endif
|
||||
|
||||
#define KUNIT_EXPECT_STRNE(test, left, right) EXPECT_STRNE((struct test *)test, (left), (right))
|
||||
#define EXPECT_STRNE(test, left, right) do { \
|
||||
struct test_stream *__stream = EXPECT_START(test); \
|
||||
typeof(left) __left = (left); \
|
||||
typeof(right) __right = (right); \
|
||||
\
|
||||
__stream->add(__stream, "Expected " #left " != " #right ", but\n"); \
|
||||
__stream->add(__stream, "\t\t%s == %s\n", #left, __left); \
|
||||
__stream->add(__stream, "\t\t%s == %s\n", #right, __right); \
|
||||
\
|
||||
EXPECT_END(test, strcmp(left, right), __stream); \
|
||||
} while (0)
|
||||
|
||||
#define DECLARE_REDIRECT_MOCKABLE(name, return_type, param_types...) \
|
||||
return_type name(param_types)
|
||||
|
||||
#define DEFINE_INVOKABLE(name, return_type, RETURN_ASSIGN, param_types...)
|
||||
|
||||
#define DEFINE_REDIRECT_MOCKABLE_COMMON(name, \
|
||||
return_type, \
|
||||
RETURN_ASSIGN, \
|
||||
param_types...) \
|
||||
return_type REAL_ID(name)(param_types); \
|
||||
return_type name(param_types) __mockable_alias(REAL_ID(name)); \
|
||||
DEFINE_INVOKABLE(name, return_type, RETURN_ASSIGN, param_types);
|
||||
|
||||
#define ASSIGN() *retval =
|
||||
|
||||
#define DEFINE_REDIRECT_MOCKABLE(name, return_type, param_types...) \
|
||||
DEFINE_REDIRECT_MOCKABLE_COMMON(name, \
|
||||
return_type, \
|
||||
ASSIGN, \
|
||||
param_types)
|
||||
|
||||
#endif /* __SEC_INPUT_KUNIT_MOCK_DUMMY_H__ */
|
73
include/linux/input/sec_input_multi_dev.h
Normal file
73
include/linux/input/sec_input_multi_dev.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* drivers/input/sec_input/sec_input_multi_dev.h
|
||||
*
|
||||
* Core file for Samsung input device driver for multi device
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef _SEC_INPUT_MULTI_DEV_H_
|
||||
#define _SEC_INPUT_MULTI_DEV_H_
|
||||
|
||||
#include "sec_input.h"
|
||||
|
||||
#define MULTI_DEV_DEBUG_INFO_SIZE 256
|
||||
|
||||
#define MULTI_DEV_NONE 0
|
||||
#define MULTI_DEV_MAIN 1
|
||||
#define MULTI_DEV_SUB 2
|
||||
#define FOLD_STATUS_FOLDING 1
|
||||
#define FOLD_STATUS_UNFOLDING 0
|
||||
#define GET_DEV_COUNT(mdev) ((mdev == NULL) ? MULTI_DEV_NONE : mdev->device_count)
|
||||
#define IS_FOLD(x) (x == MULTI_DEV_MAIN || x == MULTI_DEV_SUB)
|
||||
#define IS_FOLD_DEV(mdev) IS_FOLD(GET_DEV_COUNT(mdev))
|
||||
#define IS_NOT_FOLD(x) !IS_FOLD(x)
|
||||
#define IS_NOT_FOLD_DEV(mdev) IS_NOT_FOLD(GET_DEV_COUNT(mdev))
|
||||
#define GET_FOLD_STR(x) (x == MULTI_DEV_MAIN ? "MAIN" : x == MULTI_DEV_SUB ? "SUB" : "NONE")
|
||||
#define GET_SEC_CLASS_DEVT_TSP(mdev) (GET_DEV_COUNT(mdev) == MULTI_DEV_MAIN ? SEC_CLASS_DEVT_TSP1 \
|
||||
: GET_DEV_COUNT(mdev) == MULTI_DEV_SUB ? SEC_CLASS_DEVT_TSP2 \
|
||||
: SEC_CLASS_DEVT_TSP)
|
||||
#if IS_ENABLED(CONFIG_SEC_ABC)
|
||||
#define GET_INT_ABC_TYPE(mdev) (GET_DEV_COUNT(mdev) == MULTI_DEV_SUB ? SEC_ABC_SEND_EVENT_TYPE_SUB \
|
||||
: SEC_ABC_SEND_EVENT_TYPE)
|
||||
#endif
|
||||
|
||||
struct sec_input_multi_device {
|
||||
struct device *dev;
|
||||
|
||||
int device_count;
|
||||
const char *name;
|
||||
|
||||
bool device_ready;
|
||||
|
||||
int flip_status;
|
||||
int flip_status_current;
|
||||
int change_flip_status;
|
||||
|
||||
unsigned int flip_mismatch_count;
|
||||
|
||||
struct delayed_work switching_work;
|
||||
};
|
||||
|
||||
#if IS_ENABLED(CONFIG_SEC_INPUT_MULTI_DEVICE)
|
||||
bool sec_input_need_fold_off(struct sec_input_multi_device *mdev);
|
||||
void sec_input_set_fold_state(struct sec_input_multi_device *mdev, int state);
|
||||
void sec_input_multi_device_ready(struct sec_input_multi_device *mdev);
|
||||
|
||||
void sec_input_multi_device_create(struct device *dev);
|
||||
void sec_input_multi_device_remove(struct sec_input_multi_device *mdev);
|
||||
void sec_input_get_multi_device_debug_info(struct sec_input_multi_device *mdev,
|
||||
char *buf, ssize_t size);
|
||||
#else
|
||||
static inline bool sec_input_need_fold_off(struct sec_input_multi_device *mdev) { return false; }
|
||||
static inline void sec_input_set_fold_state(struct sec_input_multi_device *mdev, int state) {}
|
||||
static inline void sec_input_multi_device_ready(struct sec_input_multi_device *mdev) {}
|
||||
|
||||
static inline void sec_input_multi_device_create(struct device *dev) {}
|
||||
static inline void sec_input_multi_device_remove(struct sec_input_multi_device *mdev) {}
|
||||
static inline void sec_input_get_multi_device_debug_info(struct sec_input_multi_device *mdev,
|
||||
char *buf, ssize_t size) { return; }
|
||||
#endif
|
||||
#endif
|
71
include/linux/input/sec_input_rawdata.h
Normal file
71
include/linux/input/sec_input_rawdata.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0
|
||||
* Copyright (C) 2022 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
//#ifndef _SEC_INPUT_RAWDATA_H_
|
||||
//#define _SEC_INPUT_RAWDATA_H_
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/stat.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/sysfs.h>
|
||||
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
#define IOCTL_SIZE 4096
|
||||
#define POSTFIX_BYTE_LENGTH (1 * 2)
|
||||
#define PREFIX_BYTE_LENGTH (4 * 2)
|
||||
#define RAW_VEC_NUM 3
|
||||
|
||||
#define IOCTL_TSP_MAP_READ _IOR(0, 0, struct raw_data)
|
||||
#define IOCTL_TSP_MAP_WRITE _IOW(0, 0, struct raw_data)
|
||||
#define IOCTL_TSP_MAP_WRITE_TEST_1 _IOW('T', 1, struct raw_data)
|
||||
|
||||
struct raw_data {
|
||||
int num;
|
||||
u8 data[IOCTL_SIZE];
|
||||
};
|
||||
|
||||
struct sec_input_rawdata_device {
|
||||
struct device *dev;
|
||||
struct device *fac_dev;
|
||||
int num;
|
||||
int rawdata_len;
|
||||
u8 *raw_u8;
|
||||
u8 *rawdata_pool[3];
|
||||
struct mutex lock;
|
||||
int raw_write_index;
|
||||
int raw_read_index;
|
||||
};
|
||||
|
||||
#if IS_ENABLED(CONFIG_SEC_INPUT_RAWDATA)
|
||||
void sec_input_rawdata_copy_to_user(s16 *data, int len, int press);
|
||||
int sec_input_rawdata_buffer_alloc(void);
|
||||
int sec_input_rawdata_init(struct device *dev, struct device *fac_dev);
|
||||
#else
|
||||
static inline void sec_input_rawdata_copy_to_user(s16 *data, int len, int press)
|
||||
{
|
||||
|
||||
}
|
||||
static inline int sec_input_rawdata_buffer_alloc(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int sec_input_rawdata_init(struct device *dev, struct device *fac_dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
//#endif
|
97
include/linux/input/sec_secure_touch.h
Normal file
97
include/linux/input/sec_secure_touch.h
Normal file
@@ -0,0 +1,97 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0
|
||||
* Copyright (C) 2022 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef _SEC_SECURE_TOUCH_H_
|
||||
#define _SEC_SECURE_TOUCH_H_
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/stat.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/sysfs.h>
|
||||
//#if defined(CONFIG_SEC_SYSFS)
|
||||
//#include <linux/sec_sysfs.h>
|
||||
#if IS_ENABLED(CONFIG_DRV_SAMSUNG)
|
||||
#include <linux/sec_class.h>
|
||||
#endif
|
||||
//#else
|
||||
//extern struct class *sec_class;
|
||||
//#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_HALL_NOTIFIER)
|
||||
#include <linux/hall/hall_ic_notifier.h>
|
||||
#endif
|
||||
#if IS_ENABLED(CONFIG_SUPPORT_SENSOR_FOLD)
|
||||
#include <linux/sensor/sensors_core.h>
|
||||
#endif
|
||||
|
||||
#define SECURE_TOUCH_DEVICE_FIRST 1
|
||||
#define SECURE_TOUCH_DEVICE_SECOND 2
|
||||
|
||||
/*
|
||||
* folder open = main screen = 0
|
||||
* folder close = sub screen = 1
|
||||
*/
|
||||
#define SECURE_TOUCH_MAIN_DEV 0
|
||||
#define SECURE_TOUCH_SUB_DEV 1
|
||||
|
||||
#define SECURE_TOUCH_FOLDER_OPEN 0
|
||||
#define SECURE_TOUCH_FOLDER_CLOSE 1
|
||||
|
||||
#define SECURE_TOUCH_DEV_NAME "ss_touch"
|
||||
|
||||
struct sec_touch_driver {
|
||||
struct list_head list;
|
||||
struct device *dev;
|
||||
int drv_number;
|
||||
int (*enable)(void *drv_data);
|
||||
int (*disable)(void *drv_data);
|
||||
int (*status)(void *drv_data);
|
||||
int (*irq_handle)(void *drv_data);
|
||||
void *drv_data;
|
||||
struct kobject *kobj;
|
||||
int enabled;
|
||||
int registered;
|
||||
int is_running;
|
||||
};
|
||||
|
||||
struct sec_secure_touch {
|
||||
struct list_head list_head;
|
||||
int secure_enabled;
|
||||
void *data;
|
||||
struct platform_device *pdev;
|
||||
struct device *device;
|
||||
#if IS_ENABLED(CONFIG_SEC_INPUT_MULTI_DEVICE)
|
||||
struct delayed_work folder_work;
|
||||
#endif
|
||||
int hall_ic;
|
||||
struct mutex lock;
|
||||
struct notifier_block nb;
|
||||
struct notifier_block nb_ssh;
|
||||
struct sec_touch_driver touch_driver[2];
|
||||
int device_number;
|
||||
int current_device;
|
||||
};
|
||||
|
||||
int sec_secure_touch_set_device(struct sec_secure_touch *data, int dev_num);
|
||||
void sec_secure_touch_sysfs_notify(struct sec_secure_touch *data);
|
||||
struct sec_touch_driver *sec_secure_touch_register(void *drv_data, struct device *dev, int dev_num, struct kobject *kobj);
|
||||
void sec_secure_touch_unregister(int dev_num);
|
||||
|
||||
int sec_secure_touch_init(void);
|
||||
void sec_secure_touch_exit(void);
|
||||
|
||||
extern void hall_ic_register_notify(struct notifier_block *nb);
|
||||
extern void hall_ic_unregister_notify(struct notifier_block *nb);
|
||||
#endif
|
118
include/linux/input/sec_tclm_v2.h
Normal file
118
include/linux/input/sec_tclm_v2.h
Normal file
@@ -0,0 +1,118 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0
|
||||
* Copyright (C) 2022 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef _SEC_TCLM_H_
|
||||
#define _SEC_TCLM_H_
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/spi/spi.h>
|
||||
|
||||
/* TCLM_CONCEPT - start */
|
||||
#define TCLM_LEVEL_NONE 0x00
|
||||
#define TCLM_LEVEL_CLEAR_NV 0x01
|
||||
#define TCLM_LEVEL_LOCKDOWN 0x02
|
||||
#define TCLM_LEVEL_EVERYTIME 0x05
|
||||
#define TCLM_LEVEL_NOT_SUPPORT 0xFF
|
||||
|
||||
#define CAL_HISTORY_QUEUE_MAX 10
|
||||
#define CAL_HISTORY_QUEUE_SHORT_DISPLAY 3
|
||||
|
||||
#define TCLM_AMBIENT_CAL 0
|
||||
#define TCLM_OFFSET_CAL_SDC 1
|
||||
#define TCLM_OFFSET_CAL_SEC 2
|
||||
|
||||
#define SEC_TCLM_NVM_OFFSET 1
|
||||
#define SEC_TCLM_NVM_OFFSET_LENGTH 4
|
||||
/* [0]: tclm_level, [1] afe_base_high, [2] afe_base_low = 3byte */
|
||||
|
||||
#define SEC_CAL_PASS 1
|
||||
|
||||
enum tclm_offset {
|
||||
SEC_TCLM_NVM_OFFSET_IC_FIRMWARE_VER = 1,
|
||||
SEC_TCLM_NVM_ALL_DATA = 2,
|
||||
SEC_TCLM_NVM_TEST = 3,
|
||||
};
|
||||
|
||||
#define CAL_POS_CMD(full_name, short_name) .f_name = full_name, .s_name = short_name
|
||||
|
||||
enum tclm_root {
|
||||
CALPOSITION_NONE = 0,
|
||||
CALPOSITION_INITIAL = 1,
|
||||
CALPOSITION_FACTORY = 2,
|
||||
CALPOSITION_OUTSIDE = 3,
|
||||
CALPOSITION_LCIA = 4,
|
||||
CALPOSITION_SVCCENTER = 5,
|
||||
CALPOSITION_ABNORMAL = 6,
|
||||
CALPOSITION_FIRMUP = 7,
|
||||
CALPOSITION_SPECOUT = 8,
|
||||
CALPOSITION_TUNEUP = 9,
|
||||
CALPOSITION_EVERYTIME = 10,
|
||||
CALPOSITION_TESTMODE = 11,
|
||||
CALPOSITION_UNDEFINE = 12,
|
||||
CALPOSITION_MAX = 16,
|
||||
};
|
||||
|
||||
enum tclm_result {
|
||||
TCLM_RESULT_DONE = 0,
|
||||
TCLM_RESULT_ABNORMAL = 1,
|
||||
TCLM_RESULT_CAL_DONE = 2,
|
||||
};
|
||||
|
||||
struct sec_cal_position {
|
||||
const char *f_name;
|
||||
const char s_name;
|
||||
};
|
||||
|
||||
struct sec_tclm_nvdata {
|
||||
u8 cal_count;
|
||||
u16 tune_fix_ver;
|
||||
u8 cal_position;
|
||||
u8 cal_pos_hist_cnt;
|
||||
u8 cal_pos_hist_lastp;
|
||||
u8 cal_pos_hist_queue[2 * CAL_HISTORY_QUEUE_MAX];
|
||||
u8 cal_fail_flag; /* pass : 1 fail : etc */
|
||||
u8 cal_fail_cnt; /* history cnt */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* TCLM_CONCEPT - end */
|
||||
struct sec_tclm_data {
|
||||
int tclm_level;
|
||||
int afe_base;
|
||||
bool external_factory;
|
||||
u8 root_of_calibration;
|
||||
struct sec_cal_position *tclm_string;
|
||||
u8 cal_pos_hist_last3[2 * CAL_HISTORY_QUEUE_SHORT_DISPLAY + 1]; /* 7 */
|
||||
|
||||
struct device *dev;
|
||||
int (*tclm_read)(struct device *dev, int address);
|
||||
int (*tclm_write)(struct device *dev, int address);
|
||||
int (*tclm_execute_force_calibration)(struct device *dev, int cal_mode);
|
||||
void (*tclm_parse_dt)(struct device *dev, struct sec_tclm_data *tdata);
|
||||
|
||||
struct sec_tclm_nvdata nvdata;
|
||||
u8 tclm[SEC_TCLM_NVM_OFFSET_LENGTH];
|
||||
bool support_tclm_test;
|
||||
};
|
||||
|
||||
void sec_tclm_case(struct sec_tclm_data *data, int tclm_case);
|
||||
int sec_tclm_get_nvm_all(struct sec_tclm_data *data);
|
||||
void sec_tclm_position_history(struct sec_tclm_data *data);
|
||||
void sec_tclm_root_of_cal(struct sec_tclm_data *data, int pos);
|
||||
void sec_tclm_debug_info(struct sec_tclm_data *data);
|
||||
void sec_tclm_reposition_history(struct sec_tclm_data *data);
|
||||
int sec_execute_tclm_package(struct sec_tclm_data *data, int factory_mode);
|
||||
int sec_tclm_check_cal_case(struct sec_tclm_data *data);
|
||||
void sec_tclm_initialize(struct sec_tclm_data *data);
|
||||
int tclm_test_command(struct sec_tclm_data *data, int test_case, int cmd_param1, int cmd_param2, char *buff);
|
||||
int sec_tclm_test_on_probe(struct sec_tclm_data *data);
|
||||
|
||||
#endif
|
125
include/linux/input/sec_trusted_touch.h
Normal file
125
include/linux/input/sec_trusted_touch.h
Normal file
@@ -0,0 +1,125 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* drivers/input/sec_input/sec_trusted_touch.h
|
||||
*
|
||||
* Core file for Samsung input device driver for multi device
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef _SEC_TRUSTED_TOUCH_H_
|
||||
#define _SEC_TRUSTED_TOUCH_H_
|
||||
|
||||
#include "sec_input.h"
|
||||
#if IS_ENABLED(CONFIG_INPUT_SEC_TRUSTED_TOUCH)
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/pinctrl/qcom-pinctrl.h>
|
||||
#include <linux/gunyah/gh_msgq.h>
|
||||
#include <linux/gunyah/gh_rm_drv.h>
|
||||
#include <linux/gunyah/gh_irq_lend.h>
|
||||
#include <linux/gunyah/gh_mem_notifier.h>
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/sort.h>
|
||||
|
||||
#define TRUSTED_TOUCH_MEM_LABEL 0x7
|
||||
enum trusted_touch_mode_config {
|
||||
TRUSTED_TOUCH_VM_MODE,
|
||||
TRUSTED_TOUCH_MODE_NONE
|
||||
};
|
||||
|
||||
enum trusted_touch_pvm_states {
|
||||
TRUSTED_TOUCH_PVM_INIT,
|
||||
PVM_I2C_RESOURCE_ACQUIRED,
|
||||
PVM_INTERRUPT_DISABLED,
|
||||
PVM_IOMEM_LENT,
|
||||
PVM_IOMEM_LENT_NOTIFIED,
|
||||
PVM_IRQ_LENT,
|
||||
PVM_IRQ_LENT_NOTIFIED,
|
||||
PVM_IOMEM_RELEASE_NOTIFIED,
|
||||
PVM_IRQ_RELEASE_NOTIFIED,
|
||||
PVM_ALL_RESOURCES_RELEASE_NOTIFIED,
|
||||
PVM_IRQ_RECLAIMED,
|
||||
PVM_IOMEM_RECLAIMED,
|
||||
PVM_INTERRUPT_ENABLED,
|
||||
PVM_I2C_RESOURCE_RELEASED,
|
||||
TRUSTED_TOUCH_PVM_STATE_MAX
|
||||
};
|
||||
|
||||
enum trusted_touch_tvm_states {
|
||||
TRUSTED_TOUCH_TVM_INIT,
|
||||
TVM_IOMEM_LENT_NOTIFIED,
|
||||
TVM_IRQ_LENT_NOTIFIED,
|
||||
TVM_ALL_RESOURCES_LENT_NOTIFIED,
|
||||
TVM_IOMEM_ACCEPTED,
|
||||
TVM_I2C_SESSION_ACQUIRED,
|
||||
TVM_IRQ_ACCEPTED,
|
||||
TVM_INTERRUPT_ENABLED,
|
||||
TVM_INTERRUPT_DISABLED,
|
||||
TVM_IRQ_RELEASED,
|
||||
TVM_I2C_SESSION_RELEASED,
|
||||
TVM_IOMEM_RELEASED,
|
||||
TRUSTED_TOUCH_TVM_STATE_MAX
|
||||
};
|
||||
|
||||
#define TOUCH_INTR_GPIO_BASE 0xF12E000
|
||||
#define TOUCH_INTR_GPIO_SIZE 0x1000
|
||||
#define TOUCH_INTR_GPIO_OFFSET 0x8
|
||||
|
||||
#define TRUSTED_TOUCH_EVENT_LEND_FAILURE -1
|
||||
#define TRUSTED_TOUCH_EVENT_LEND_NOTIFICATION_FAILURE -2
|
||||
#define TRUSTED_TOUCH_EVENT_ACCEPT_FAILURE -3
|
||||
#define TRUSTED_TOUCH_EVENT_FUNCTIONAL_FAILURE -4
|
||||
#define TRUSTED_TOUCH_EVENT_RELEASE_FAILURE -5
|
||||
#define TRUSTED_TOUCH_EVENT_RECLAIM_FAILURE -6
|
||||
#define TRUSTED_TOUCH_EVENT_I2C_FAILURE -7
|
||||
#define TRUSTED_TOUCH_EVENT_NOTIFICATIONS_PENDING 5
|
||||
|
||||
struct trusted_touch_vm_info {
|
||||
enum gh_irq_label irq_label;
|
||||
enum gh_mem_notifier_tag mem_tag;
|
||||
enum gh_vm_names vm_name;
|
||||
const char *trusted_touch_type;
|
||||
u32 hw_irq;
|
||||
gh_memparcel_handle_t vm_mem_handle;
|
||||
u32 *iomem_bases;
|
||||
u32 *iomem_sizes;
|
||||
u32 iomem_list_size;
|
||||
void *mem_cookie;
|
||||
atomic_t vm_state;
|
||||
};
|
||||
|
||||
struct sec_trusted_touch {
|
||||
struct device *dev;
|
||||
struct trusted_touch_vm_info *vm_info;
|
||||
struct mutex clk_io_ctrl_mutex;
|
||||
struct mutex transition_lock;
|
||||
const char *touch_environment;
|
||||
struct completion trusted_touch_powerdown;
|
||||
struct clk *core_clk;
|
||||
struct clk *iface_clk;
|
||||
atomic_t trusted_touch_initialized;
|
||||
atomic_t trusted_touch_enabled;
|
||||
atomic_t trusted_touch_transition;
|
||||
atomic_t trusted_touch_event;
|
||||
atomic_t trusted_touch_abort_status;
|
||||
atomic_t delayed_vm_probe_pending;
|
||||
atomic_t trusted_touch_mode;
|
||||
int (*pre_func)(struct device *dev, int mode);
|
||||
int (*post_func)(struct device *dev, int mode);
|
||||
};
|
||||
int sec_trusted_touch_init(struct device *dev);
|
||||
#else
|
||||
static inline int sec_trusted_touch_init(struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
29
include/linux/input/sec_tsp_dumpkey.h
Normal file
29
include/linux/input/sec_tsp_dumpkey.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0
|
||||
* Copyright (C) 2022 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __SEC_TSP_DUMPKEY_H__
|
||||
#define __SEC_TSP_DUMPKEY_H__
|
||||
|
||||
#define NUM_DEVICES 3
|
||||
|
||||
struct sec_tsp_dumpkey_param {
|
||||
unsigned int keycode;
|
||||
int down;
|
||||
};
|
||||
|
||||
struct tsp_dump_callbacks {
|
||||
void (*inform_dump)(struct device *dev);
|
||||
struct device *ptsp;
|
||||
};
|
||||
|
||||
void sec_input_dumpkey_register(int dev_id, void (*callback)(struct device *dev), struct device *dev);
|
||||
void sec_input_dumpkey_unregister(int dev_id);
|
||||
|
||||
int sec_tsp_dumpkey_init(void);
|
||||
void sec_tsp_dumpkey_exit(void);
|
||||
#endif /* __SEC_TSP_DUMPKEY_H__ */
|
50
include/linux/input/sec_tsp_log.h
Normal file
50
include/linux/input/sec_tsp_log.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0
|
||||
* Copyright (C) 2022 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
#ifndef _SEC_TSP_LOG_H_
|
||||
#define _SEC_TSP_LOG_H_
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/tick.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/sched/clock.h>
|
||||
|
||||
#define SEC_TSP_LOG_BUF_SIZE (256 * 1024) /* 256 KB */
|
||||
#define SEC_TSP_FAIL_HIST_BUF_SIZE (50 * 1024) /* 50 KB */
|
||||
#if IS_ENABLED(CONFIG_SEC_INPUT_MULTI_DEVICE)
|
||||
#define SEC_TSP_RAW_DATA_BUF_SIZE (2 * 50 * 1024) /* 100 KB */
|
||||
#else
|
||||
#define SEC_TSP_RAW_DATA_BUF_SIZE (50 * 1024) /* 50 KB */
|
||||
#endif
|
||||
#define SEC_TSP_COMMAND_HISTORY_BUF_SIZE (10 * 1024) /* 10 KB */
|
||||
#define SEC_TSP_SPONGE_LOG_BUF_SIZE (128 * 1024) /* 128 KB */
|
||||
|
||||
#define SEC_TSP_LOG_TIMESTAMP_SIZE 50
|
||||
#define SEC_TSP_LOG_EXTRA_SIZE 10
|
||||
|
||||
/**
|
||||
* sec_debug_tsp_log : Leave tsp log in tsp_msg file.
|
||||
* ( Timestamp + Tsp logs )
|
||||
* sec_debug_tsp_log_msg : Leave tsp log in tsp_msg file and
|
||||
* add additional message between timestamp and tsp log.
|
||||
* ( Timestamp + additional Message + Tsp logs )
|
||||
*/
|
||||
void sec_tsp_sponge_log(char *buf);
|
||||
void sec_debug_tsp_log_msg(char *msg, char *buf);
|
||||
void sec_debug_tsp_fail_hist(char *msg, char *buf);
|
||||
void sec_tsp_log_fix(void);
|
||||
void sec_tsp_raw_data_clear(char mode);
|
||||
void sec_debug_tsp_raw_data_msg(char mode, char *msg, char *buf);
|
||||
void sec_debug_tsp_command_history(char *buf);
|
||||
|
||||
int sec_tsp_log_init(void);
|
||||
#endif /* _SEC_TSP_LOG_H_ */
|
28
include/linux/input/spu-sign-verify.h
Normal file
28
include/linux/input/spu-sign-verify.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* spu-sign-verify.h
|
||||
*
|
||||
* Author: JJungs-lee <jhs2.lee@samsung.com>
|
||||
*
|
||||
*/
|
||||
#ifndef _SPU_SIGN_VERIFY_H_
|
||||
#define _SPU_SIGN_VERIFY_H_
|
||||
|
||||
#include <linux/string.h>
|
||||
|
||||
/* TAG NAME */
|
||||
#define TSP_TAG "TSP"
|
||||
#define WACOM_TAG "WACOM"
|
||||
|
||||
/* METADATA LEN */
|
||||
#define DIGEST_LEN 32
|
||||
#define SIGN_LEN 512
|
||||
|
||||
/* TAG LEN */
|
||||
#define TAG_LEN(FW) strlen(FW##_TAG)
|
||||
|
||||
/* TOTAL METADATA SIZE */
|
||||
#define SPU_METADATA_SIZE(FW) ((TAG_LEN(FW)) + (DIGEST_LEN) + (SIGN_LEN))
|
||||
|
||||
extern long spu_firmware_signature_verify(const char *fw_name, const u8 *fw_data, const long fw_size);
|
||||
|
||||
#endif //end _SPU_SIGN_VERIFY_H_
|
Reference in New Issue
Block a user