nova_0flash_mmi: Novatek TP 0flash driver.

TP:
Initial release for Moto Defender based on SVN V4.18.

Change-Id: I66825b8962c6f4a187fa4eea4364015124118b40
Signed-off-by: haojl2 <haojl2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1412019
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Hongshu Lou <louhs1@motorola.com>
Reviewed-by: Hujun Liao <liaohj@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
haojl2 2019-07-26 11:12:26 +08:00 • committed by Yeqing Wang
commit 9f8659ac96
10 changed files with 6246 additions and 0 deletions

View file

@ -0,0 +1,14 @@
DLKM_DIR := motorola/kernel/modules
LOCAL_PATH := $(call my-dir)
ifeq ($(DLKM_INSTALL_TO_VENDOR_OUT),true)
NOVA_MMI_MODULE_PATH := $(TARGET_OUT_VENDOR)/lib/modules/
else
NOVA_MMI_MODULE_PATH := $(KERNEL_MODULES_OUT)
endif
include $(CLEAR_VARS)
LOCAL_MODULE := nova_0flash_mmi.ko
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(NOVA_MMI_MODULE_PATH)
include $(DLKM_DIR)/AndroidKernelModule.mk

View file

@ -0,0 +1,13 @@
# add -Wall to try to catch everything we can.
EXTRA_CFLAGS += -Wall
EXTRA_CFLAGS += -I$(TOP)/motorola/kernel/modules/include \
-I$(TOP)/motorola/kernel/modules/drivers/input/touchscreen/nova_0flash_mmi
ifeq ($(filter m y, $(CONFIG_TOUCHSCREEN_NT36xxx_HOSTDL_SPI)),)
obj-m := nova_0flash_mmi.o
endif
nova_0flash_mmi-objs += nt36xxx.o
nova_0flash_mmi-objs += nt36xxx_ext_proc.o
nova_0flash_mmi-objs += nt36xxx_fw_update.o
nova_0flash_mmi-objs += nt36xxx_mp_ctrlram.o

View file

@ -0,0 +1,10 @@
KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
all:
$(MAKE) -C $(KERNEL_SRC) M=$(shell pwd) modules $(KBUILD_OPTIONS)
modules_install:
$(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(shell pwd) modules_install
clean:
$(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,204 @@
/*
* Copyright (C) 2010 - 2018 Novatek, Inc.
*
* $Revision: 46000 $
* $Date: 2019-06-12 14:25:52 +0800 (週三, 12 六月 2019) $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*/
#ifndef _LINUX_NVT_TOUCH_H
#define _LINUX_NVT_TOUCH_H
#include <linux/delay.h>
#include <linux/input.h>
#include <linux/of.h>
#include <linux/spi/spi.h>
#include <linux/uaccess.h>
#ifdef CONFIG_HAS_EARLYSUSPEND
#include <linux/earlysuspend.h>
#endif
#include "nt36xxx_mem_map.h"
#ifdef CONFIG_MTK_SPI
/* Please copy mt_spi.h file under mtk spi driver folder */
#include "mt_spi.h"
#endif
#ifdef CONFIG_SPI_MT65XX
#include <linux/platform_data/spi-mt65xx.h>
#endif
#define NVT_DEBUG 1
//---GPIO number---
#define NVTTOUCH_RST_PIN 980
#define NVTTOUCH_INT_PIN 943
//---INT trigger mode---
//#define IRQ_TYPE_EDGE_RISING 1
//#define IRQ_TYPE_EDGE_FALLING 2
#define INT_TRIGGER_TYPE IRQ_TYPE_EDGE_RISING
//---SPI driver info.---
#define NVT_SPI_NAME "NVT-ts"
#if NVT_DEBUG
#define NVT_LOG(fmt, args...) pr_err("[%s] %s %d: " fmt, NVT_SPI_NAME, __func__, __LINE__, ##args)
#else
#define NVT_LOG(fmt, args...) pr_info("[%s] %s %d: " fmt, NVT_SPI_NAME, __func__, __LINE__, ##args)
#endif
#define NVT_ERR(fmt, args...) pr_err("[%s] %s %d: " fmt, NVT_SPI_NAME, __func__, __LINE__, ##args)
//---Input device info.---
#define NVT_TS_NAME "NVTCapacitiveTouchScreen"
//---Touch info.---
#define TOUCH_DEFAULT_MAX_WIDTH 1080
#define TOUCH_DEFAULT_MAX_HEIGHT 2340
#define TOUCH_MAX_FINGER_NUM 10
#define TOUCH_KEY_NUM 0
#if TOUCH_KEY_NUM > 0
extern const uint16_t touch_key_array[TOUCH_KEY_NUM];
#endif
#define TOUCH_FORCE_NUM 1000
/* Enable only when module have tp reset pin and connected to host */
#define NVT_TOUCH_SUPPORT_HW_RST 0
//---Customerized func.---
#define NVT_TOUCH_PROC 1
#define NVT_TOUCH_EXT_PROC 1
#define NVT_TOUCH_MP 1
#define MT_PROTOCOL_B 1
#define WAKEUP_GESTURE 1
#if WAKEUP_GESTURE
extern const uint16_t gesture_key_array[];
#endif
#define BOOT_UPDATE_FIRMWARE 1
#define BOOT_UPDATE_FIRMWARE_NAME "novatek_ts_fw.bin"
#define MP_UPDATE_FIRMWARE_NAME "novatek_ts_mp.bin"
#define POINT_DATA_CHECKSUM 1
#define POINT_DATA_CHECKSUM_LEN 65
//---ESD Protect.---
#define NVT_TOUCH_ESD_PROTECT 0
#define NVT_TOUCH_ESD_CHECK_PERIOD 1500 /* ms */
#define NVT_TOUCH_WDT_RECOVERY 1
struct nvt_ts_data {
struct spi_device *client;
struct input_dev *input_dev;
struct delayed_work nvt_fwu_work;
uint16_t addr;
int8_t phys[32];
#if defined(CONFIG_FB)
#ifdef _MSM_DRM_NOTIFY_H_
struct notifier_block drm_notif;
#else
struct notifier_block fb_notif;
#endif
#elif defined(CONFIG_HAS_EARLYSUSPEND)
struct early_suspend early_suspend;
#endif
uint8_t fw_ver;
uint8_t x_num;
uint8_t y_num;
uint16_t abs_x_max;
uint16_t abs_y_max;
uint8_t max_touch_num;
uint8_t max_button_num;
uint32_t int_trigger_type;
int32_t irq_gpio;
uint32_t irq_flags;
int32_t reset_gpio;
uint32_t reset_flags;
struct mutex lock;
const struct nvt_ts_mem_map *mmap;
uint8_t carrier_system;
uint8_t hw_crc;
uint16_t nvt_pid;
uint8_t rbuf[1025];
uint8_t *xbuf;
struct mutex xbuf_lock;
bool irq_enabled;
#ifdef CONFIG_MTK_SPI
struct mt_chip_conf spi_ctrl;
#endif
#ifdef CONFIG_SPI_MT65XX
struct mtk_chip_config spi_ctrl;
#endif
};
#if NVT_TOUCH_PROC
struct nvt_flash_data{
rwlock_t lock;
};
#endif
typedef enum {
RESET_STATE_INIT = 0xA0,// IC reset
RESET_STATE_REK, // ReK baseline
RESET_STATE_REK_FINISH, // baseline is ready
RESET_STATE_NORMAL_RUN, // normal run
RESET_STATE_MAX = 0xAF
} RST_COMPLETE_STATE;
typedef enum {
EVENT_MAP_HOST_CMD = 0x50,
EVENT_MAP_HANDSHAKING_or_SUB_CMD_BYTE = 0x51,
EVENT_MAP_RESET_COMPLETE = 0x60,
EVENT_MAP_FWINFO = 0x78,
EVENT_MAP_PROJECTID = 0x9A,
} SPI_EVENT_MAP;
//---SPI READ/WRITE---
#define SPI_WRITE_MASK(a) (a | 0x80)
#define SPI_READ_MASK(a) (a & 0x7F)
#define DUMMY_BYTES (1)
#define NVT_TRANSFER_LEN (63*1024)
typedef enum {
NVTWRITE = 0,
NVTREAD = 1
} NVT_SPI_RW;
//---extern structures---
extern struct nvt_ts_data *ts;
//---extern functions---
int32_t CTP_SPI_READ(struct spi_device *client, uint8_t *buf, uint16_t len);
int32_t CTP_SPI_WRITE(struct spi_device *client, uint8_t *buf, uint16_t len);
void nvt_bootloader_reset(void);
void nvt_eng_reset(void);
void nvt_sw_reset(void);
void nvt_sw_reset_idle(void);
void nvt_boot_ready(void);
void nvt_bld_crc_enable(void);
void nvt_fw_crc_enable(void);
int32_t nvt_update_firmware(char *firmware_name);
int32_t nvt_check_fw_reset_state(RST_COMPLETE_STATE check_reset_state);
int32_t nvt_get_fw_info(void);
int32_t nvt_clear_fw_status(void);
int32_t nvt_check_fw_status(void);
int32_t nvt_set_page(uint32_t addr);
int32_t nvt_write_addr(uint32_t addr, uint8_t data);
#if NVT_TOUCH_ESD_PROTECT
extern void nvt_esd_check_enable(uint8_t enable);
#endif /* #if NVT_TOUCH_ESD_PROTECT */
#endif /* _LINUX_NVT_TOUCH_H */

View file

@ -0,0 +1,594 @@
/*
* Copyright (C) 2010 - 2018 Novatek, Inc.
*
* $Revision: 47376 $
* $Date: 2019-07-12 09:06:29 +0800 (週五, 12 七月 2019) $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*/
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "nt36xxx.h"
#if NVT_TOUCH_EXT_PROC
#define NVT_FW_VERSION "nvt_fw_version"
#define NVT_BASELINE "nvt_baseline"
#define NVT_RAW "nvt_raw"
#define NVT_DIFF "nvt_diff"
#define BUS_TRANSFER_LENGTH 256
#define NORMAL_MODE 0x00
#define TEST_MODE_1 0x21
#define TEST_MODE_2 0x22
#define HANDSHAKING_HOST_READY 0xBB
#define XDATA_SECTOR_SIZE 256
static uint8_t xdata_tmp[2048] = {0};
static int32_t xdata[2048] = {0};
static struct proc_dir_entry *NVT_proc_fw_version_entry;
static struct proc_dir_entry *NVT_proc_baseline_entry;
static struct proc_dir_entry *NVT_proc_raw_entry;
static struct proc_dir_entry *NVT_proc_diff_entry;
/*******************************************************
Description:
Novatek touchscreen change mode function.
return:
n.a.
*******************************************************/
void nvt_change_mode(uint8_t mode)
{
uint8_t buf[8] = {0};
//---set xdata index to EVENT BUF ADDR---
nvt_set_page(ts->mmap->EVENT_BUF_ADDR | EVENT_MAP_HOST_CMD);
//---set mode---
buf[0] = EVENT_MAP_HOST_CMD;
buf[1] = mode;
CTP_SPI_WRITE(ts->client, buf, 2);
if (mode == NORMAL_MODE) {
buf[0] = EVENT_MAP_HANDSHAKING_or_SUB_CMD_BYTE;
buf[1] = HANDSHAKING_HOST_READY;
CTP_SPI_WRITE(ts->client, buf, 2);
msleep(20);
}
}
/*******************************************************
Description:
Novatek touchscreen get firmware pipe function.
return:
Executive outcomes. 0---pipe 0. 1---pipe 1.
*******************************************************/
uint8_t nvt_get_fw_pipe(void)
{
uint8_t buf[8]= {0};
//---set xdata index to EVENT BUF ADDR---
nvt_set_page(ts->mmap->EVENT_BUF_ADDR | EVENT_MAP_HANDSHAKING_or_SUB_CMD_BYTE);
//---read fw status---
buf[0] = EVENT_MAP_HANDSHAKING_or_SUB_CMD_BYTE;
buf[1] = 0x00;
CTP_SPI_READ(ts->client, buf, 2);
//NVT_LOG("FW pipe=%d, buf[1]=0x%02X\n", (buf[1]&0x01), buf[1]);
return (buf[1] & 0x01);
}
/*******************************************************
Description:
Novatek touchscreen read meta data function.
return:
n.a.
*******************************************************/
void nvt_read_mdata(uint32_t xdata_addr, uint32_t xdata_btn_addr)
{
int32_t i = 0;
int32_t j = 0;
int32_t k = 0;
uint8_t buf[BUS_TRANSFER_LENGTH + 1] = {0};
uint32_t head_addr = 0;
int32_t dummy_len = 0;
int32_t data_len = 0;
int32_t residual_len = 0;
//---set xdata sector address & length---
head_addr = xdata_addr - (xdata_addr % XDATA_SECTOR_SIZE);
dummy_len = xdata_addr - head_addr;
data_len = ts->x_num * ts->y_num * 2;
residual_len = (head_addr + dummy_len + data_len) % XDATA_SECTOR_SIZE;
//printk("head_addr=0x%05X, dummy_len=0x%05X, data_len=0x%05X, residual_len=0x%05X\n", head_addr, dummy_len, data_len, residual_len);
//read xdata : step 1
for (i = 0; i < ((dummy_len + data_len) / XDATA_SECTOR_SIZE); i++) {
//---change xdata index---
nvt_set_page(head_addr + XDATA_SECTOR_SIZE * i);
//---read xdata by BUS_TRANSFER_LENGTH
for (j = 0; j < (XDATA_SECTOR_SIZE / BUS_TRANSFER_LENGTH); j++) {
//---read data---
buf[0] = BUS_TRANSFER_LENGTH * j;
CTP_SPI_READ(ts->client, buf, BUS_TRANSFER_LENGTH + 1);
//---copy buf to xdata_tmp---
for (k = 0; k < BUS_TRANSFER_LENGTH; k++) {
xdata_tmp[XDATA_SECTOR_SIZE * i + BUS_TRANSFER_LENGTH * j + k] = buf[k + 1];
//printk("0x%02X, 0x%04X\n", buf[k+1], (XDATA_SECTOR_SIZE*i + BUS_TRANSFER_LENGTH*j + k));
}
}
//printk("addr=0x%05X\n", (head_addr+XDATA_SECTOR_SIZE*i));
}
//read xdata : step2
if (residual_len != 0) {
//---change xdata index---
nvt_set_page(xdata_addr + data_len - residual_len);
//---read xdata by BUS_TRANSFER_LENGTH
for (j = 0; j < (residual_len / BUS_TRANSFER_LENGTH + 1); j++) {
//---read data---
buf[0] = BUS_TRANSFER_LENGTH * j;
CTP_SPI_READ(ts->client, buf, BUS_TRANSFER_LENGTH + 1);
//---copy buf to xdata_tmp---
for (k = 0; k < BUS_TRANSFER_LENGTH; k++) {
xdata_tmp[(dummy_len + data_len - residual_len) + BUS_TRANSFER_LENGTH * j + k] = buf[k + 1];
//printk("0x%02X, 0x%04x\n", buf[k+1], ((dummy_len+data_len-residual_len) + BUS_TRANSFER_LENGTH*j + k));
}
}
//printk("addr=0x%05X\n", (xdata_addr+data_len-residual_len));
}
//---remove dummy data and 2bytes-to-1data---
for (i = 0; i < (data_len / 2); i++) {
xdata[i] = (int16_t)(xdata_tmp[dummy_len + i * 2] + 256 * xdata_tmp[dummy_len + i * 2 + 1]);
}
#if TOUCH_KEY_NUM > 0
//read button xdata : step3
//---change xdata index---
nvt_set_page(xdata_btn_addr);
//---read data---
buf[0] = (xdata_btn_addr & 0xFF);
CTP_SPI_READ(ts->client, buf, (TOUCH_KEY_NUM * 2 + 1));
//---2bytes-to-1data---
for (i = 0; i < TOUCH_KEY_NUM; i++) {
xdata[ts->x_num * ts->y_num + i] = (int16_t)(buf[1 + i * 2] + 256 * buf[1 + i * 2 + 1]);
}
#endif
//---set xdata index to EVENT BUF ADDR---
nvt_set_page(ts->mmap->EVENT_BUF_ADDR);
}
/*******************************************************
Description:
Novatek touchscreen get meta data function.
return:
n.a.
*******************************************************/
void nvt_get_mdata(int32_t *buf, uint8_t *m_x_num, uint8_t *m_y_num)
{
*m_x_num = ts->x_num;
*m_y_num = ts->y_num;
memcpy(buf, xdata, ((ts->x_num * ts->y_num + TOUCH_KEY_NUM) * sizeof(int32_t)));
}
/*******************************************************
Description:
Novatek touchscreen firmware version show function.
return:
Executive outcomes. 0---succeed.
*******************************************************/
static int32_t c_fw_version_show(struct seq_file *m, void *v)
{
seq_printf(m, "fw_ver=%d, x_num=%d, y_num=%d, button_num=%d\n", ts->fw_ver, ts->x_num, ts->y_num, ts->max_button_num);
return 0;
}
/*******************************************************
Description:
Novatek touchscreen xdata sequence print show
function.
return:
Executive outcomes. 0---succeed.
*******************************************************/
static int32_t c_show(struct seq_file *m, void *v)
{
int32_t i = 0;
int32_t j = 0;
for (i = 0; i < ts->y_num; i++) {
for (j = 0; j < ts->x_num; j++) {
seq_printf(m, "%5d, ", xdata[i * ts->x_num + j]);
}
seq_puts(m, "\n");
}
#if TOUCH_KEY_NUM > 0
for (i = 0; i < TOUCH_KEY_NUM; i++) {
seq_printf(m, "%5d, ", xdata[ts->x_num * ts->y_num + i]);
}
seq_puts(m, "\n");
#endif
seq_printf(m, "\n\n");
return 0;
}
/*******************************************************
Description:
Novatek touchscreen xdata sequence print start
function.
return:
Executive outcomes. 1---call next function.
NULL---not call next function and sequence loop
stop.
*******************************************************/
static void *c_start(struct seq_file *m, loff_t *pos)
{
return *pos < 1 ? (void *)1 : NULL;
}
/*******************************************************
Description:
Novatek touchscreen xdata sequence print next
function.
return:
Executive outcomes. NULL---no next and call sequence
stop function.
*******************************************************/
static void *c_next(struct seq_file *m, void *v, loff_t *pos)
{
++*pos;
return NULL;
}
/*******************************************************
Description:
Novatek touchscreen xdata sequence print stop
function.
return:
n.a.
*******************************************************/
static void c_stop(struct seq_file *m, void *v)
{
return;
}
const struct seq_operations nvt_fw_version_seq_ops = {
.start = c_start,
.next = c_next,
.stop = c_stop,
.show = c_fw_version_show
};
const struct seq_operations nvt_seq_ops = {
.start = c_start,
.next = c_next,
.stop = c_stop,
.show = c_show
};
/*******************************************************
Description:
Novatek touchscreen /proc/nvt_fw_version open
function.
return:
n.a.
*******************************************************/
static int32_t nvt_fw_version_open(struct inode *inode, struct file *file)
{
if (mutex_lock_interruptible(&ts->lock)) {
return -ERESTARTSYS;
}
NVT_LOG("++\n");
#if NVT_TOUCH_ESD_PROTECT
nvt_esd_check_enable(false);
#endif /* #if NVT_TOUCH_ESD_PROTECT */
if (nvt_get_fw_info()) {
mutex_unlock(&ts->lock);
return -EAGAIN;
}
mutex_unlock(&ts->lock);
NVT_LOG("--\n");
return seq_open(file, &nvt_fw_version_seq_ops);
}
static const struct file_operations nvt_fw_version_fops = {
.owner = THIS_MODULE,
.open = nvt_fw_version_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
/*******************************************************
Description:
Novatek touchscreen /proc/nvt_baseline open function.
return:
Executive outcomes. 0---succeed.
*******************************************************/
static int32_t nvt_baseline_open(struct inode *inode, struct file *file)
{
if (mutex_lock_interruptible(&ts->lock)) {
return -ERESTARTSYS;
}
NVT_LOG("++\n");
#if NVT_TOUCH_ESD_PROTECT
nvt_esd_check_enable(false);
#endif /* #if NVT_TOUCH_ESD_PROTECT */
if (nvt_clear_fw_status()) {
mutex_unlock(&ts->lock);
return -EAGAIN;
}
nvt_change_mode(TEST_MODE_2);
if (nvt_check_fw_status()) {
mutex_unlock(&ts->lock);
return -EAGAIN;
}
if (nvt_get_fw_info()) {
mutex_unlock(&ts->lock);
return -EAGAIN;
}
nvt_read_mdata(ts->mmap->BASELINE_ADDR, ts->mmap->BASELINE_BTN_ADDR);
nvt_change_mode(NORMAL_MODE);
mutex_unlock(&ts->lock);
NVT_LOG("--\n");
return seq_open(file, &nvt_seq_ops);
}
static const struct file_operations nvt_baseline_fops = {
.owner = THIS_MODULE,
.open = nvt_baseline_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
/*******************************************************
Description:
Novatek touchscreen /proc/nvt_raw open function.
return:
Executive outcomes. 0---succeed.
*******************************************************/
static int32_t nvt_raw_open(struct inode *inode, struct file *file)
{
if (mutex_lock_interruptible(&ts->lock)) {
return -ERESTARTSYS;
}
NVT_LOG("++\n");
#if NVT_TOUCH_ESD_PROTECT
nvt_esd_check_enable(false);
#endif /* #if NVT_TOUCH_ESD_PROTECT */
if (nvt_clear_fw_status()) {
mutex_unlock(&ts->lock);
return -EAGAIN;
}
nvt_change_mode(TEST_MODE_2);
if (nvt_check_fw_status()) {
mutex_unlock(&ts->lock);
return -EAGAIN;
}
if (nvt_get_fw_info()) {
mutex_unlock(&ts->lock);
return -EAGAIN;
}
if (nvt_get_fw_pipe() == 0)
nvt_read_mdata(ts->mmap->RAW_PIPE0_ADDR, ts->mmap->RAW_BTN_PIPE0_ADDR);
else
nvt_read_mdata(ts->mmap->RAW_PIPE1_ADDR, ts->mmap->RAW_BTN_PIPE1_ADDR);
nvt_change_mode(NORMAL_MODE);
mutex_unlock(&ts->lock);
NVT_LOG("--\n");
return seq_open(file, &nvt_seq_ops);
}
static const struct file_operations nvt_raw_fops = {
.owner = THIS_MODULE,
.open = nvt_raw_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
/*******************************************************
Description:
Novatek touchscreen /proc/nvt_diff open function.
return:
Executive outcomes. 0---succeed. negative---failed.
*******************************************************/
static int32_t nvt_diff_open(struct inode *inode, struct file *file)
{
if (mutex_lock_interruptible(&ts->lock)) {
return -ERESTARTSYS;
}
NVT_LOG("++\n");
#if NVT_TOUCH_ESD_PROTECT
nvt_esd_check_enable(false);
#endif /* #if NVT_TOUCH_ESD_PROTECT */
if (nvt_clear_fw_status()) {
mutex_unlock(&ts->lock);
return -EAGAIN;
}
nvt_change_mode(TEST_MODE_2);
if (nvt_check_fw_status()) {
mutex_unlock(&ts->lock);
return -EAGAIN;
}
if (nvt_get_fw_info()) {
mutex_unlock(&ts->lock);
return -EAGAIN;
}
if (nvt_get_fw_pipe() == 0)
nvt_read_mdata(ts->mmap->DIFF_PIPE0_ADDR, ts->mmap->DIFF_BTN_PIPE0_ADDR);
else
nvt_read_mdata(ts->mmap->DIFF_PIPE1_ADDR, ts->mmap->DIFF_BTN_PIPE1_ADDR);
nvt_change_mode(NORMAL_MODE);
mutex_unlock(&ts->lock);
NVT_LOG("--\n");
return seq_open(file, &nvt_seq_ops);
}
static const struct file_operations nvt_diff_fops = {
.owner = THIS_MODULE,
.open = nvt_diff_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
/*******************************************************
Description:
Novatek touchscreen extra function proc. file node
initial function.
return:
Executive outcomes. 0---succeed. -12---failed.
*******************************************************/
int32_t nvt_extra_proc_init(void)
{
NVT_proc_fw_version_entry = proc_create(NVT_FW_VERSION, 0444, NULL,&nvt_fw_version_fops);
if (NVT_proc_fw_version_entry == NULL) {
NVT_ERR("create proc/%s Failed!\n", NVT_FW_VERSION);
return -ENOMEM;
} else {
NVT_LOG("create proc/%s Succeeded!\n", NVT_FW_VERSION);
}
NVT_proc_baseline_entry = proc_create(NVT_BASELINE, 0444, NULL,&nvt_baseline_fops);
if (NVT_proc_baseline_entry == NULL) {
NVT_ERR("create proc/%s Failed!\n", NVT_BASELINE);
return -ENOMEM;
} else {
NVT_LOG("create proc/%s Succeeded!\n", NVT_BASELINE);
}
NVT_proc_raw_entry = proc_create(NVT_RAW, 0444, NULL,&nvt_raw_fops);
if (NVT_proc_raw_entry == NULL) {
NVT_ERR("create proc/%s Failed!\n", NVT_RAW);
return -ENOMEM;
} else {
NVT_LOG("create proc/%s Succeeded!\n", NVT_RAW);
}
NVT_proc_diff_entry = proc_create(NVT_DIFF, 0444, NULL,&nvt_diff_fops);
if (NVT_proc_diff_entry == NULL) {
NVT_ERR("create proc/%s Failed!\n", NVT_DIFF);
return -ENOMEM;
} else {
NVT_LOG("create proc/%s Succeeded!\n", NVT_DIFF);
}
return 0;
}
/*******************************************************
Description:
Novatek touchscreen extra function proc. file node
deinitial function.
return:
n.a.
*******************************************************/
void nvt_extra_proc_deinit(void)
{
if (NVT_proc_fw_version_entry != NULL) {
remove_proc_entry(NVT_FW_VERSION, NULL);
NVT_proc_fw_version_entry = NULL;
NVT_LOG("Removed /proc/%s\n", NVT_FW_VERSION);
}
if (NVT_proc_baseline_entry != NULL) {
remove_proc_entry(NVT_BASELINE, NULL);
NVT_proc_baseline_entry = NULL;
NVT_LOG("Removed /proc/%s\n", NVT_BASELINE);
}
if (NVT_proc_raw_entry != NULL) {
remove_proc_entry(NVT_RAW, NULL);
NVT_proc_raw_entry = NULL;
NVT_LOG("Removed /proc/%s\n", NVT_RAW);
}
if (NVT_proc_diff_entry != NULL) {
remove_proc_entry(NVT_DIFF, NULL);
NVT_proc_diff_entry = NULL;
NVT_LOG("Removed /proc/%s\n", NVT_DIFF);
}
}
#endif

View file

@ -0,0 +1,940 @@
/*
* Copyright (C) 2010 - 2018 Novatek, Inc.
*
* $Revision: 43459 $
* $Date: 2019-04-17 15:28:41 +0800 (週三, 17 四月 2019) $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*/
#include <linux/firmware.h>
#include <linux/gpio.h>
#include "nt36xxx.h"
#if BOOT_UPDATE_FIRMWARE
#define SIZE_4KB 4096
#define FLASH_SECTOR_SIZE SIZE_4KB
#define FW_BIN_VER_OFFSET (fw_need_write_size - SIZE_4KB)
#define FW_BIN_VER_BAR_OFFSET (FW_BIN_VER_OFFSET + 1)
#define NVT_FLASH_END_FLAG_LEN 3
#define NVT_FLASH_END_FLAG_ADDR (fw_need_write_size - NVT_FLASH_END_FLAG_LEN)
#define NVT_DUMP_PARTITION (0)
#define NVT_DUMP_PARTITION_LEN (1024)
#define NVT_DUMP_PARTITION_PATH "/data/local/tmp"
struct timeval start, end;
const struct firmware *fw_entry = NULL;
static size_t fw_need_write_size = 0;
static uint8_t *fwbuf = NULL;
struct nvt_ts_bin_map {
char name[12];
uint32_t BIN_addr;
uint32_t SRAM_addr;
uint32_t size;
uint32_t crc;
};
static struct nvt_ts_bin_map *bin_map;
static int32_t nvt_get_fw_need_write_size(const struct firmware *fw_entry)
{
int32_t i = 0;
int32_t total_sectors_to_check = 0;
total_sectors_to_check = fw_entry->size / FLASH_SECTOR_SIZE;
/* printk("total_sectors_to_check = %d\n", total_sectors_to_check); */
for (i = total_sectors_to_check; i > 0; i--) {
/* printk("current end flag address checked = 0x%X\n", i * FLASH_SECTOR_SIZE - NVT_FLASH_END_FLAG_LEN); */
/* check if there is end flag "NVT" at the end of this sector */
if (strncmp(&fw_entry->data[i * FLASH_SECTOR_SIZE - NVT_FLASH_END_FLAG_LEN], "NVT", NVT_FLASH_END_FLAG_LEN) == 0) {
fw_need_write_size = i * FLASH_SECTOR_SIZE;
NVT_LOG("fw_need_write_size = %zu(0x%zx), NVT end flag\n", fw_need_write_size, fw_need_write_size);
return 0;
}
/* check if there is end flag "MOD" at the end of this sector */
if (strncmp(&fw_entry->data[i * FLASH_SECTOR_SIZE - NVT_FLASH_END_FLAG_LEN], "MOD", NVT_FLASH_END_FLAG_LEN) == 0) {
fw_need_write_size = i * FLASH_SECTOR_SIZE;
NVT_LOG("fw_need_write_size = %zu(0x%zx), MOD end flag\n", fw_need_write_size, fw_need_write_size);
return 0;
}
}
NVT_ERR("end flag \"NVT\" \"MOD\" not found!\n");
return -1;
}
/*******************************************************
Description:
Novatek touchscreen init variable and allocate buffer
for download firmware function.
return:
n.a.
*******************************************************/
static int32_t nvt_download_init(void)
{
/* allocate buffer for transfer firmware */
//NVT_LOG("NVT_TRANSFER_LEN = 0x%06X\n", NVT_TRANSFER_LEN);
if (fwbuf == NULL) {
fwbuf = (uint8_t *)kzalloc((NVT_TRANSFER_LEN+1), GFP_KERNEL);
if(fwbuf == NULL) {
NVT_ERR("kzalloc for fwbuf failed!\n");
return -ENOMEM;
}
}
return 0;
}
/*******************************************************
Description:
Novatek touchscreen checksum function. Calculate bin
file checksum for comparison.
return:
n.a.
*******************************************************/
static uint32_t CheckSum(const u8 *data, size_t len)
{
uint32_t i = 0;
uint32_t checksum = 0;
for (i = 0 ; i < len+1 ; i++)
checksum += data[i];
checksum += len;
checksum = ~checksum +1;
return checksum;
}
static uint32_t byte_to_word(const uint8_t *data)
{
return data[0] + (data[1] << 8) + (data[2] << 16) + (data[3] << 24);
}
/*******************************************************
Description:
Novatek touchscreen parsing bin header function.
return:
n.a.
*******************************************************/
static uint32_t partition = 0;
static uint8_t ilm_dlm_num = 2;
static int32_t nvt_bin_header_parser(const u8 *fwdata, size_t fwsize)
{
uint32_t list = 0;
uint32_t pos = 0x00;
uint32_t end = 0x00;
uint8_t info_sec_num = 0;
uint8_t ovly_sec_num = 0;
uint8_t ovly_info = 0;
/* Find the header size */
end = fwdata[0] + (fwdata[1] << 8) + (fwdata[2] << 16) + (fwdata[3] << 24);
pos = 0x30; // info section start at 0x30 offset
while (pos < end) {
info_sec_num ++;
pos += 0x10; /* each header info is 16 bytes */
}
/*
* Find the DLM OVLY section
* [0:3] Overlay Section Number
* [4] Overlay Info
*/
ovly_info = (fwdata[0x28] & 0x10) >> 4;
ovly_sec_num = (ovly_info) ? (fwdata[0x28] & 0x0F) : 0;
/*
* calculate all partition number
* ilm_dlm_num (ILM & DLM) + ovly_sec_num + info_sec_num
*/
partition = ilm_dlm_num + ovly_sec_num + info_sec_num;
NVT_LOG("ovly_info = %d, ilm_dlm_num = %d, ovly_sec_num = %d, info_sec_num = %d, partition = %d\n",
ovly_info, ilm_dlm_num, ovly_sec_num, info_sec_num, partition);
/* allocated memory for header info */
bin_map = (struct nvt_ts_bin_map *)kzalloc((partition+1) * sizeof(struct nvt_ts_bin_map), GFP_KERNEL);
if(bin_map == NULL) {
NVT_ERR("kzalloc for bin_map failed!\n");
return -ENOMEM;
}
for (list = 0; list < partition; list++) {
/*
* [1] parsing ILM & DLM header info
* BIN_addr : SRAM_addr : size (12-bytes)
* crc located at 0x18 & 0x1C
*/
if (list < ilm_dlm_num) {
bin_map[list].BIN_addr = byte_to_word(&fwdata[0 + list*12]);
bin_map[list].SRAM_addr = byte_to_word(&fwdata[4 + list*12]);
bin_map[list].size = byte_to_word(&fwdata[8 + list*12]);
if (ts->hw_crc)
bin_map[list].crc = byte_to_word(&fwdata[0x18 + list*4]);
else { //ts->hw_crc
if ((bin_map[list].BIN_addr + bin_map[list].size) < fwsize)
bin_map[list].crc = CheckSum(&fwdata[bin_map[list].BIN_addr], bin_map[list].size);
else {
NVT_ERR("access range (0x%08X to 0x%08X) is larger than bin size!\n",
bin_map[list].BIN_addr, bin_map[list].BIN_addr + bin_map[list].size);
return -EINVAL;
}
} //ts->hw_crc
if (list == 0)
sprintf(bin_map[list].name, "ILM");
else if (list == 1)
sprintf(bin_map[list].name, "DLM");
}
/*
* [2] parsing others header info
* SRAM_addr : size : BIN_addr : crc (16-bytes)
*/
if ((list >= ilm_dlm_num) && (list < (ilm_dlm_num + info_sec_num))) {
/* others partition located at 0x30 offset */
pos = 0x30 + (0x10 * (list - ilm_dlm_num));
bin_map[list].SRAM_addr = byte_to_word(&fwdata[pos]);
bin_map[list].size = byte_to_word(&fwdata[pos+4]);
bin_map[list].BIN_addr = byte_to_word(&fwdata[pos+8]);
if (ts->hw_crc)
bin_map[list].crc = byte_to_word(&fwdata[pos+12]);
else { //ts->hw_crc
if ((bin_map[list].BIN_addr + bin_map[list].size) < fwsize)
bin_map[list].crc = CheckSum(&fwdata[bin_map[list].BIN_addr], bin_map[list].size);
else {
NVT_ERR("access range (0x%08X to 0x%08X) is larger than bin size!\n",
bin_map[list].BIN_addr, bin_map[list].BIN_addr + bin_map[list].size);
return -EINVAL;
}
} //ts->hw_crc
/* detect header end to protect parser function */
if ((bin_map[list].BIN_addr == 0) && (bin_map[list].size != 0)) {
sprintf(bin_map[list].name, "Header");
} else {
sprintf(bin_map[list].name, "Info-%d", (list - ilm_dlm_num));
}
}
/*
* [3] parsing overlay section header info
* SRAM_addr : size : BIN_addr : crc (16-bytes)
*/
if (list >= (ilm_dlm_num + info_sec_num)) {
/* overlay info located at DLM (list = 1) start addr */
pos = bin_map[1].BIN_addr + (0x10 * (list- ilm_dlm_num - info_sec_num));
bin_map[list].SRAM_addr = byte_to_word(&fwdata[pos]);
bin_map[list].size = byte_to_word(&fwdata[pos+4]);
bin_map[list].BIN_addr = byte_to_word(&fwdata[pos+8]);
if (ts->hw_crc)
bin_map[list].crc = byte_to_word(&fwdata[pos+12]);
else { //ts->hw_crc
if ((bin_map[list].BIN_addr + bin_map[list].size) < fwsize)
bin_map[list].crc = CheckSum(&fwdata[bin_map[list].BIN_addr], bin_map[list].size);
else {
NVT_ERR("access range (0x%08X to 0x%08X) is larger than bin size!\n",
bin_map[list].BIN_addr, bin_map[list].BIN_addr + bin_map[list].size);
return -EINVAL;
}
} //ts->hw_crc
sprintf(bin_map[list].name, "Overlay-%d", (list- ilm_dlm_num - info_sec_num));
}
/* BIN size error detect */
if ((bin_map[list].BIN_addr + bin_map[list].size) > fwsize) {
NVT_ERR("access range (0x%08X to 0x%08X) is larger than bin size!\n",
bin_map[list].BIN_addr, bin_map[list].BIN_addr + bin_map[list].size);
return -EINVAL;
}
// NVT_LOG("[%d][%s] SRAM (0x%08X), SIZE (0x%08X), BIN (0x%08X), CRC (0x%08X)\n",
// list, bin_map[list].name,
// bin_map[list].SRAM_addr, bin_map[list].size, bin_map[list].BIN_addr, bin_map[list].crc);
}
return 0;
}
/*******************************************************
Description:
Novatek touchscreen release update firmware function.
return:
n.a.
*******************************************************/
static void update_firmware_release(void)
{
if (fw_entry) {
release_firmware(fw_entry);
}
fw_entry = NULL;
}
/*******************************************************
Description:
Novatek touchscreen request update firmware function.
return:
Executive outcomes. 0---succeed. -1,-22---failed.
*******************************************************/
static int32_t update_firmware_request(char *filename)
{
uint8_t retry = 0;
int32_t ret = 0;
if (NULL == filename) {
return -ENOENT;
}
while (1) {
NVT_LOG("filename is %s\n", filename);
ret = request_firmware(&fw_entry, filename, &ts->client->dev);
if (ret) {
NVT_ERR("firmware load failed, ret=%d\n", ret);
goto request_fail;
}
// check FW need to write size
if (nvt_get_fw_need_write_size(fw_entry)) {
NVT_ERR("get fw need to write size fail!\n");
ret = -EINVAL;
goto invalid;
}
// check if FW version add FW version bar equals 0xFF
if (*(fw_entry->data + FW_BIN_VER_OFFSET) + *(fw_entry->data + FW_BIN_VER_BAR_OFFSET) != 0xFF) {
NVT_ERR("bin file FW_VER + FW_VER_BAR should be 0xFF!\n");
NVT_ERR("FW_VER=0x%02X, FW_VER_BAR=0x%02X\n", *(fw_entry->data+FW_BIN_VER_OFFSET), *(fw_entry->data+FW_BIN_VER_BAR_OFFSET));
ret = -ENOEXEC;
goto invalid;
}
/* BIN Header Parser */
ret = nvt_bin_header_parser(fw_entry->data, fw_entry->size);
if (ret) {
NVT_ERR("bin header parser failed\n");
goto invalid;
} else {
break;
}
invalid:
update_firmware_release();
if (!IS_ERR_OR_NULL(bin_map)) {
kfree(bin_map);
bin_map = NULL;
}
request_fail:
retry++;
if(unlikely(retry > 2)) {
NVT_ERR("error, retry=%d\n", retry);
break;
}
}
return ret;
}
#if NVT_DUMP_PARTITION
/*******************************************************
Description:
Novatek touchscreen dump flash partition function.
return:
n.a.
*******************************************************/
loff_t file_offset = 0;
static int32_t nvt_read_ram_and_save_file(uint32_t addr, uint16_t len, char *name)
{
char file[256] = "";
uint8_t *fbufp = NULL;
int32_t ret = 0;
struct file *fp = NULL;
mm_segment_t org_fs;
sprintf(file, "%s/dump_%s.bin", NVT_DUMP_PARTITION_PATH, name);
NVT_LOG("Dump [%s] from 0x%08X to 0x%08X\n", file, addr, addr+len);
fbufp = (uint8_t *)kzalloc(len+1, GFP_KERNEL);
if(fbufp == NULL) {
NVT_ERR("kzalloc for fbufp failed!\n");
ret = -ENOMEM;
goto alloc_buf_fail;
}
org_fs = get_fs();
set_fs(KERNEL_DS);
fp = filp_open(file, O_RDWR | O_CREAT, 0644);
if (fp == NULL || IS_ERR(fp)) {
ret = -ENOMEM;
NVT_ERR("open file failed\n");
goto open_file_fail;
}
/* SPI read */
//---set xdata index to addr---
nvt_set_page(addr);
fbufp[0] = addr & 0x7F; //offset
CTP_SPI_READ(ts->client, fbufp, len+1);
/* Write to file */
ret = vfs_write(fp, (char __user *)fbufp+1, len, &file_offset);
if (ret != len) {
NVT_ERR("write file failed\n");
goto open_file_fail;
} else {
ret = 0;
}
open_file_fail:
set_fs(org_fs);
if (!IS_ERR_OR_NULL(fp)) {
filp_close(fp, NULL);
fp = NULL;
}
if (!IS_ERR_OR_NULL(fbufp)) {
kfree(fbufp);
fbufp = NULL;
}
alloc_buf_fail:
return ret;
}
/*******************************************************
Description:
Novatek touchscreen nvt_dump_partition function to dump
each partition for debug.
return:
n.a.
*******************************************************/
static int32_t nvt_dump_partition(void)
{
uint32_t list = 0;
char *name;
uint32_t SRAM_addr, size;
uint32_t i = 0;
uint16_t len = 0;
int32_t count = 0;
int32_t ret = 0;
if (NVT_DUMP_PARTITION_LEN >= sizeof(ts->rbuf)) {
NVT_ERR("dump len %d is larger than buffer size %ld\n",
NVT_DUMP_PARTITION_LEN, sizeof(ts->rbuf));
return -EINVAL;
} else if (NVT_DUMP_PARTITION_LEN >= NVT_TRANSFER_LEN) {
NVT_ERR("dump len %d is larger than NVT_TRANSFER_LEN\n", NVT_DUMP_PARTITION_LEN);
return -EINVAL;
}
if (bin_map == NULL) {
NVT_ERR("bin_map is NULL\n");
return -ENOMEM;
}
memset(fwbuf, 0, (NVT_DUMP_PARTITION_LEN+1));
for (list = 0; list < partition; list++) {
/* initialize variable */
SRAM_addr = bin_map[list].SRAM_addr;
size = bin_map[list].size;
name = bin_map[list].name;
/* ignore reserved partition (Reserved Partition size is zero) */
if (!size)
continue;
else
size = size +1;
/* write data to SRAM */
if (size % NVT_DUMP_PARTITION_LEN)
count = (size / NVT_DUMP_PARTITION_LEN) + 1;
else
count = (size / NVT_DUMP_PARTITION_LEN);
for (i = 0 ; i < count ; i++) {
len = (size < NVT_DUMP_PARTITION_LEN) ? size : NVT_DUMP_PARTITION_LEN;
/* dump for debug download firmware */
ret = nvt_read_ram_and_save_file(SRAM_addr, len, name);
if (ret < 0) {
NVT_ERR("nvt_read_ram_and_save_file failed, ret = %d\n", ret);
goto out;
}
SRAM_addr += NVT_DUMP_PARTITION_LEN;
size -= NVT_DUMP_PARTITION_LEN;
}
file_offset = 0;
}
out:
return ret;
}
#endif /* NVT_DUMP_PARTITION */
/*******************************************************
Description:
Novatek touchscreen write data to sram function.
- fwdata : The buffer is written
- SRAM_addr: The sram destination address
- size : Number of data bytes in @fwdata being written
- BIN_addr : The transferred data offset of @fwdata
return:
Executive outcomes. 0---succeed. else---fail.
*******************************************************/
static int32_t nvt_write_sram(const u8 *fwdata,
uint32_t SRAM_addr, uint32_t size, uint32_t BIN_addr)
{
int32_t ret = 0;
uint32_t i = 0;
uint16_t len = 0;
int32_t count = 0;
if (size % NVT_TRANSFER_LEN)
count = (size / NVT_TRANSFER_LEN) + 1;
else
count = (size / NVT_TRANSFER_LEN);
for (i = 0 ; i < count ; i++) {
len = (size < NVT_TRANSFER_LEN) ? size : NVT_TRANSFER_LEN;
//---set xdata index to start address of SRAM---
ret = nvt_set_page(SRAM_addr);
if (ret) {
NVT_ERR("set page failed, ret = %d\n", ret);
return ret;
}
//---write data into SRAM---
fwbuf[0] = SRAM_addr & 0x7F; //offset
memcpy(fwbuf+1, &fwdata[BIN_addr], len); //payload
ret = CTP_SPI_WRITE(ts->client, fwbuf, len+1);
if (ret) {
NVT_ERR("write to sram failed, ret = %d\n", ret);
return ret;
}
SRAM_addr += NVT_TRANSFER_LEN;
BIN_addr += NVT_TRANSFER_LEN;
size -= NVT_TRANSFER_LEN;
}
return ret;
}
/*******************************************************
Description:
Novatek touchscreen nvt_write_firmware function to write
firmware into each partition.
return:
n.a.
*******************************************************/
static int32_t nvt_write_firmware(const u8 *fwdata, size_t fwsize)
{
uint32_t list = 0;
char *name;
uint32_t BIN_addr, SRAM_addr, size;
int32_t ret = 0;
memset(fwbuf, 0, (NVT_TRANSFER_LEN+1));
for (list = 0; list < partition; list++) {
/* initialize variable */
SRAM_addr = bin_map[list].SRAM_addr;
size = bin_map[list].size;
BIN_addr = bin_map[list].BIN_addr;
name = bin_map[list].name;
// NVT_LOG("[%d][%s] SRAM (0x%08X), SIZE (0x%08X), BIN (0x%08X)\n",
// list, name, SRAM_addr, size, BIN_addr);
/* Check data size */
if ((BIN_addr + size) > fwsize) {
NVT_ERR("access range (0x%08X to 0x%08X) is larger than bin size!\n",
BIN_addr, BIN_addr + size);
ret = -EINVAL;
goto out;
}
/* ignore reserved partition (Reserved Partition size is zero) */
if (!size)
continue;
else
size = size +1;
/* write data to SRAM */
ret = nvt_write_sram(fwdata, SRAM_addr, size, BIN_addr);
if (ret) {
NVT_ERR("sram program failed, ret = %d\n", ret);
goto out;
}
}
out:
return ret;
}
/*******************************************************
Description:
Novatek touchscreen check checksum function.
This function will compare file checksum and fw checksum.
return:
n.a.
*******************************************************/
static int32_t nvt_check_fw_checksum(void)
{
uint32_t fw_checksum = 0;
uint32_t len = partition*4;
uint32_t list = 0;
int32_t ret = 0;
memset(fwbuf, 0, (len+1));
//---set xdata index to checksum---
nvt_set_page(ts->mmap->R_ILM_CHECKSUM_ADDR);
/* read checksum */
fwbuf[0] = (ts->mmap->R_ILM_CHECKSUM_ADDR) & 0x7F;
ret = CTP_SPI_READ(ts->client, fwbuf, len+1);
if (ret) {
NVT_ERR("Read fw checksum failed\n");
return ret;
}
/*
* Compare each checksum from fw
* ILM + DLM + Overlay + Info
* ilm_dlm_num (ILM & DLM) + ovly_sec_num + info_sec_num
*/
for (list = 0; list < partition; list++) {
fw_checksum = byte_to_word(&fwbuf[1+list*4]);
/* ignore reserved partition (Reserved Partition size is zero) */
if(!bin_map[list].size)
continue;
if (bin_map[list].crc != fw_checksum) {
NVT_ERR("[%d] BIN_checksum=0x%08X, FW_checksum=0x%08X\n",
list, bin_map[list].crc, fw_checksum);
ret = -EIO;
}
}
return ret;
}
/*******************************************************
Description:
Novatek touchscreen set bootload crc reg bank function.
This function will set hw crc reg before enable crc function.
return:
n.a.
*******************************************************/
static void nvt_set_bld_crc_bank(uint32_t DES_ADDR, uint32_t SRAM_ADDR,
uint32_t LENGTH_ADDR, uint32_t size,
uint32_t G_CHECKSUM_ADDR, uint32_t crc)
{
/* write destination address */
nvt_set_page(DES_ADDR);
fwbuf[0] = DES_ADDR & 0x7F;
fwbuf[1] = (SRAM_ADDR) & 0xFF;
fwbuf[2] = (SRAM_ADDR >> 8) & 0xFF;
fwbuf[3] = (SRAM_ADDR >> 16) & 0xFF;
CTP_SPI_WRITE(ts->client, fwbuf, 4);
/* write length */
//nvt_set_page(LENGTH_ADDR);
fwbuf[0] = LENGTH_ADDR & 0x7F;
fwbuf[1] = (size) & 0xFF;
fwbuf[2] = (size >> 8) & 0xFF;
fwbuf[3] = (size >> 16) & 0x01;
if (ts->hw_crc == 1) {
CTP_SPI_WRITE(ts->client, fwbuf, 3);
} else if (ts->hw_crc > 1) {
CTP_SPI_WRITE(ts->client, fwbuf, 4);
}
/* write golden dlm checksum */
//nvt_set_page(G_CHECKSUM_ADDR);
fwbuf[0] = G_CHECKSUM_ADDR & 0x7F;
fwbuf[1] = (crc) & 0xFF;
fwbuf[2] = (crc >> 8) & 0xFF;
fwbuf[3] = (crc >> 16) & 0xFF;
fwbuf[4] = (crc >> 24) & 0xFF;
CTP_SPI_WRITE(ts->client, fwbuf, 5);
return;
}
/*******************************************************
Description:
Novatek touchscreen set BLD hw crc function.
This function will set ILM and DLM crc information to register.
return:
n.a.
*******************************************************/
static void nvt_set_bld_hw_crc(void)
{
/* [0] ILM */
/* write register bank */
nvt_set_bld_crc_bank(ts->mmap->ILM_DES_ADDR, bin_map[0].SRAM_addr,
ts->mmap->ILM_LENGTH_ADDR, bin_map[0].size,
ts->mmap->G_ILM_CHECKSUM_ADDR, bin_map[0].crc);
/* [1] DLM */
/* write register bank */
nvt_set_bld_crc_bank(ts->mmap->DLM_DES_ADDR, bin_map[1].SRAM_addr,
ts->mmap->DLM_LENGTH_ADDR, bin_map[1].size,
ts->mmap->G_DLM_CHECKSUM_ADDR, bin_map[1].crc);
}
/*******************************************************
Description:
Novatek touchscreen Download_Firmware with HW CRC
function. It's complete download firmware flow.
return:
Executive outcomes. 0---succeed. else---fail.
*******************************************************/
static int32_t nvt_download_firmware_hw_crc(void)
{
uint8_t retry = 0;
int32_t ret = 0;
do_gettimeofday(&start);
while (1) {
/* bootloader reset to reset MCU */
nvt_bootloader_reset();
/* Start to write firmware process */
ret = nvt_write_firmware(fw_entry->data, fw_entry->size);
if (ret) {
NVT_ERR("Write_Firmware failed. (%d)\n", ret);
goto fail;
}
#if NVT_DUMP_PARTITION
ret = nvt_dump_partition();
if (ret) {
NVT_ERR("nvt_dump_partition failed, ret = %d\n", ret);
}
#endif
/* set ilm & dlm reg bank */
nvt_set_bld_hw_crc();
/* enable hw bld crc function */
nvt_bld_crc_enable();
/* clear fw reset status & enable fw crc check */
nvt_fw_crc_enable();
/* Set Boot Ready Bit */
nvt_boot_ready();
ret = nvt_check_fw_reset_state(RESET_STATE_INIT);
if (ret) {
NVT_ERR("nvt_check_fw_reset_state failed. (%d)\n", ret);
goto fail;
} else {
break;
}
fail:
retry++;
if(unlikely(retry > 2)) {
NVT_ERR("error, retry=%d\n", retry);
break;
}
}
do_gettimeofday(&end);
return ret;
}
/*******************************************************
Description:
Novatek touchscreen Download_Firmware function. It's
complete download firmware flow.
return:
n.a.
*******************************************************/
static int32_t nvt_download_firmware(void)
{
uint8_t retry = 0;
int32_t ret = 0;
do_gettimeofday(&start);
while (1) {
/*
* Send eng reset cmd before download FW
* Keep TP_RESX low when send eng reset cmd
*/
#if NVT_TOUCH_SUPPORT_HW_RST
gpio_set_value(ts->reset_gpio, 0);
mdelay(1); //wait 1ms
#endif
nvt_eng_reset();
#if NVT_TOUCH_SUPPORT_HW_RST
gpio_set_value(ts->reset_gpio, 1);
mdelay(10); //wait tRT2BRST after TP_RST
#endif
nvt_bootloader_reset();
/* clear fw reset status */
nvt_write_addr(ts->mmap->EVENT_BUF_ADDR | EVENT_MAP_RESET_COMPLETE, 0x00);
/* Start to write firmware process */
ret = nvt_write_firmware(fw_entry->data, fw_entry->size);
if (ret) {
NVT_ERR("Write_Firmware failed. (%d)\n", ret);
goto fail;
}
#if NVT_DUMP_PARTITION
ret = nvt_dump_partition();
if (ret) {
NVT_ERR("nvt_dump_partition failed, ret = %d\n", ret);
}
#endif
/* Set Boot Ready Bit */
nvt_boot_ready();
ret = nvt_check_fw_reset_state(RESET_STATE_INIT);
if (ret) {
NVT_ERR("nvt_check_fw_reset_state failed. (%d)\n", ret);
goto fail;
}
/* check fw checksum result */
ret = nvt_check_fw_checksum();
if (ret) {
NVT_ERR("firmware checksum not match, retry=%d\n", retry);
goto fail;
} else {
break;
}
fail:
retry++;
if(unlikely(retry > 2)) {
NVT_ERR("error, retry=%d\n", retry);
break;
}
}
do_gettimeofday(&end);
return ret;
}
/*******************************************************
Description:
Novatek touchscreen update firmware main function.
return:
n.a.
*******************************************************/
int32_t nvt_update_firmware(char *firmware_name)
{
int32_t ret = 0;
// request bin file in "/etc/firmware"
ret = update_firmware_request(firmware_name);
if (ret) {
NVT_ERR("update_firmware_request failed. (%d)\n", ret);
goto request_firmware_fail;
}
/* initial buffer and variable */
ret = nvt_download_init();
if (ret) {
NVT_ERR("Download Init failed. (%d)\n", ret);
goto download_fail;
}
/* download firmware process */
if (ts->hw_crc)
ret = nvt_download_firmware_hw_crc();
else
ret = nvt_download_firmware();
if (ret) {
NVT_ERR("Download Firmware failed. (%d)\n", ret);
goto download_fail;
}
NVT_LOG("Update firmware success! <%ld us>\n",
(end.tv_sec - start.tv_sec)*1000000L + (end.tv_usec - start.tv_usec));
/* Get FW Info */
ret = nvt_get_fw_info();
if (ret) {
NVT_ERR("nvt_get_fw_info failed. (%d)\n", ret);
}
download_fail:
if (!IS_ERR_OR_NULL(bin_map)) {
kfree(bin_map);
bin_map = NULL;
}
update_firmware_release();
request_firmware_fail:
return ret;
}
/*******************************************************
Description:
Novatek touchscreen update firmware when booting
function.
return:
n.a.
*******************************************************/
void Boot_Update_Firmware(struct work_struct *work)
{
mutex_lock(&ts->lock);
nvt_update_firmware(BOOT_UPDATE_FIRMWARE_NAME);
mutex_unlock(&ts->lock);
}
#endif /* BOOT_UPDATE_FIRMWARE */

View file

@ -0,0 +1,257 @@
/*
* Copyright (C) 2010 - 2018 Novatek, Inc.
*
* $Revision: 43248 $
* $Date: 2019-04-12 11:06:27 +0800 (週五, 12 四月 2019) $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*/
struct nvt_ts_mem_map {
uint32_t EVENT_BUF_ADDR;
uint32_t RAW_PIPE0_ADDR;
uint32_t RAW_PIPE1_ADDR;
uint32_t BASELINE_ADDR;
uint32_t BASELINE_BTN_ADDR;
uint32_t DIFF_PIPE0_ADDR;
uint32_t DIFF_PIPE1_ADDR;
uint32_t RAW_BTN_PIPE0_ADDR;
uint32_t RAW_BTN_PIPE1_ADDR;
uint32_t DIFF_BTN_PIPE0_ADDR;
uint32_t DIFF_BTN_PIPE1_ADDR;
uint32_t READ_FLASH_CHECKSUM_ADDR;
uint32_t RW_FLASH_DATA_ADDR;
/* Phase 2 Host Download */
uint32_t BOOT_RDY_ADDR;
uint32_t POR_CD_ADDR;
/* BLD CRC */
uint32_t BLD_LENGTH_ADDR;
uint32_t ILM_LENGTH_ADDR;
uint32_t DLM_LENGTH_ADDR;
uint32_t BLD_DES_ADDR;
uint32_t ILM_DES_ADDR;
uint32_t DLM_DES_ADDR;
uint32_t G_ILM_CHECKSUM_ADDR;
uint32_t G_DLM_CHECKSUM_ADDR;
uint32_t R_ILM_CHECKSUM_ADDR;
uint32_t R_DLM_CHECKSUM_ADDR;
uint32_t BLD_CRC_EN_ADDR;
uint32_t DMA_CRC_EN_ADDR;
uint32_t BLD_ILM_DLM_CRC_ADDR;
uint32_t DMA_CRC_FLAG_ADDR;
};
struct nvt_ts_hw_info {
uint8_t carrier_system;
uint8_t hw_crc;
};
static const struct nvt_ts_mem_map NT36675_memory_map = {
.EVENT_BUF_ADDR = 0x22D00,
.RAW_PIPE0_ADDR = 0x24000,
.RAW_PIPE1_ADDR = 0x24000,
.BASELINE_ADDR = 0x21B90,
.BASELINE_BTN_ADDR = 0,
.DIFF_PIPE0_ADDR = 0x20C60,
.DIFF_PIPE1_ADDR = 0x24C60,
.RAW_BTN_PIPE0_ADDR = 0,
.RAW_BTN_PIPE1_ADDR = 0,
.DIFF_BTN_PIPE0_ADDR = 0,
.DIFF_BTN_PIPE1_ADDR = 0,
.READ_FLASH_CHECKSUM_ADDR = 0x24000,
.RW_FLASH_DATA_ADDR = 0x24002,
/* Phase 2 Host Download */
.BOOT_RDY_ADDR = 0x3F10D,
/* BLD CRC */
.BLD_LENGTH_ADDR = 0x3F138, //0x3F138 ~ 0x3F13A (3 bytes)
.ILM_LENGTH_ADDR = 0x3F118, //0x3F118 ~ 0x3F11A (3 bytes)
.DLM_LENGTH_ADDR = 0x3F130, //0x3F130 ~ 0x3F132 (3 bytes)
.BLD_DES_ADDR = 0x3F114, //0x3F114 ~ 0x3F116 (3 bytes)
.ILM_DES_ADDR = 0x3F128, //0x3F128 ~ 0x3F12A (3 bytes)
.DLM_DES_ADDR = 0x3F12C, //0x3F12C ~ 0x3F12E (3 bytes)
.G_ILM_CHECKSUM_ADDR = 0x3F100, //0x3F100 ~ 0x3F103 (4 bytes)
.G_DLM_CHECKSUM_ADDR = 0x3F104, //0x3F104 ~ 0x3F107 (4 bytes)
.R_ILM_CHECKSUM_ADDR = 0x3F120, //0x3F120 ~ 0x3F123 (4 bytes)
.R_DLM_CHECKSUM_ADDR = 0x3F124, //0x3F124 ~ 0x3F127 (4 bytes)
.BLD_CRC_EN_ADDR = 0x3F30E,
.DMA_CRC_EN_ADDR = 0x3F136,
.BLD_ILM_DLM_CRC_ADDR = 0x3F133,
.DMA_CRC_FLAG_ADDR = 0x3F134,
};
static const struct nvt_ts_mem_map NT36672A_memory_map = {
.EVENT_BUF_ADDR = 0x21C00,
.RAW_PIPE0_ADDR = 0x20000,
.RAW_PIPE1_ADDR = 0x23000,
.BASELINE_ADDR = 0x20BFC,
.BASELINE_BTN_ADDR = 0x23BFC,
.DIFF_PIPE0_ADDR = 0x206DC,
.DIFF_PIPE1_ADDR = 0x236DC,
.RAW_BTN_PIPE0_ADDR = 0x20510,
.RAW_BTN_PIPE1_ADDR = 0x23510,
.DIFF_BTN_PIPE0_ADDR = 0x20BF0,
.DIFF_BTN_PIPE1_ADDR = 0x23BF0,
.READ_FLASH_CHECKSUM_ADDR = 0x24000,
.RW_FLASH_DATA_ADDR = 0x24002,
/* Phase 2 Host Download */
.BOOT_RDY_ADDR = 0x3F10D,
/* BLD CRC */
.BLD_LENGTH_ADDR = 0x3F10E, //0x3F10E ~ 0x3F10F (2 bytes)
.ILM_LENGTH_ADDR = 0x3F118, //0x3F118 ~ 0x3F119 (2 bytes)
.DLM_LENGTH_ADDR = 0x3F130, //0x3F130 ~ 0x3F131 (2 bytes)
.BLD_DES_ADDR = 0x3F114, //0x3F114 ~ 0x3F116 (3 bytes)
.ILM_DES_ADDR = 0x3F128, //0x3F128 ~ 0x3F12A (3 bytes)
.DLM_DES_ADDR = 0x3F12C, //0x3F12C ~ 0x3F12E (3 bytes)
.G_ILM_CHECKSUM_ADDR = 0x3F100, //0x3F100 ~ 0x3F103 (4 bytes)
.G_DLM_CHECKSUM_ADDR = 0x3F104, //0x3F104 ~ 0x3F107 (4 bytes)
.R_ILM_CHECKSUM_ADDR = 0x3F120, //0x3F120 ~ 0x3F123 (4 bytes)
.R_DLM_CHECKSUM_ADDR = 0x3F124, //0x3F124 ~ 0x3F127 (4 bytes)
.BLD_CRC_EN_ADDR = 0x3F30E,
.DMA_CRC_EN_ADDR = 0x3F132,
.BLD_ILM_DLM_CRC_ADDR = 0x3F133,
.DMA_CRC_FLAG_ADDR = 0x3F134,
};
static const struct nvt_ts_mem_map NT36772_memory_map = {
.EVENT_BUF_ADDR = 0x11E00,
.RAW_PIPE0_ADDR = 0x10000,
.RAW_PIPE1_ADDR = 0x12000,
.BASELINE_ADDR = 0x10E70,
.BASELINE_BTN_ADDR = 0x12E70,
.DIFF_PIPE0_ADDR = 0x10830,
.DIFF_PIPE1_ADDR = 0x12830,
.RAW_BTN_PIPE0_ADDR = 0x10E60,
.RAW_BTN_PIPE1_ADDR = 0x12E60,
.DIFF_BTN_PIPE0_ADDR = 0x10E68,
.DIFF_BTN_PIPE1_ADDR = 0x12E68,
.READ_FLASH_CHECKSUM_ADDR = 0x14000,
.RW_FLASH_DATA_ADDR = 0x14002,
/* Phase 2 Host Download */
.BOOT_RDY_ADDR = 0x1F141,
.POR_CD_ADDR = 0x1F61C,
/* BLD CRC */
.R_ILM_CHECKSUM_ADDR = 0x1BF00,
};
static const struct nvt_ts_mem_map NT36525_memory_map = {
.EVENT_BUF_ADDR = 0x11A00,
.RAW_PIPE0_ADDR = 0x10000,
.RAW_PIPE1_ADDR = 0x12000,
.BASELINE_ADDR = 0x10B08,
.BASELINE_BTN_ADDR = 0x12B08,
.DIFF_PIPE0_ADDR = 0x1064C,
.DIFF_PIPE1_ADDR = 0x1264C,
.RAW_BTN_PIPE0_ADDR = 0x10634,
.RAW_BTN_PIPE1_ADDR = 0x12634,
.DIFF_BTN_PIPE0_ADDR = 0x10AFC,
.DIFF_BTN_PIPE1_ADDR = 0x12AFC,
.READ_FLASH_CHECKSUM_ADDR = 0x14000,
.RW_FLASH_DATA_ADDR = 0x14002,
/* Phase 2 Host Download */
.BOOT_RDY_ADDR = 0x1F141,
.POR_CD_ADDR = 0x1F61C,
/* BLD CRC */
.R_ILM_CHECKSUM_ADDR = 0x1BF00,
};
static const struct nvt_ts_mem_map NT36676F_memory_map = {
.EVENT_BUF_ADDR = 0x11A00,
.RAW_PIPE0_ADDR = 0x10000,
.RAW_PIPE1_ADDR = 0x12000,
.BASELINE_ADDR = 0x10B08,
.BASELINE_BTN_ADDR = 0x12B08,
.DIFF_PIPE0_ADDR = 0x1064C,
.DIFF_PIPE1_ADDR = 0x1264C,
.RAW_BTN_PIPE0_ADDR = 0x10634,
.RAW_BTN_PIPE1_ADDR = 0x12634,
.DIFF_BTN_PIPE0_ADDR = 0x10AFC,
.DIFF_BTN_PIPE1_ADDR = 0x12AFC,
.READ_FLASH_CHECKSUM_ADDR = 0x14000,
.RW_FLASH_DATA_ADDR = 0x14002,
};
static struct nvt_ts_hw_info NT36675_hw_info = {
.carrier_system = 2,
.hw_crc = 2,
};
static struct nvt_ts_hw_info NT36672A_hw_info = {
.carrier_system = 0,
.hw_crc = 1,
};
static struct nvt_ts_hw_info NT36772_hw_info = {
.carrier_system = 0,
.hw_crc = 0,
};
static struct nvt_ts_hw_info NT36525_hw_info = {
.carrier_system = 0,
.hw_crc = 0,
};
static struct nvt_ts_hw_info NT36676F_hw_info = {
.carrier_system = 0,
.hw_crc = 0,
};
#define NVT_ID_BYTE_MAX 6
struct nvt_ts_trim_id_table {
uint8_t id[NVT_ID_BYTE_MAX];
uint8_t mask[NVT_ID_BYTE_MAX];
const struct nvt_ts_mem_map *mmap;
const struct nvt_ts_hw_info *hwinfo;
};
static const struct nvt_ts_trim_id_table trim_id_table[] = {
{.id = {0xFF, 0xFF, 0xFF, 0x75, 0x66, 0x03}, .mask = {0, 0, 0, 1, 1, 1},
.mmap = &NT36675_memory_map, .hwinfo = &NT36675_hw_info},
{.id = {0x0B, 0xFF, 0xFF, 0x72, 0x66, 0x03}, .mask = {1, 0, 0, 1, 1, 1},
.mmap = &NT36672A_memory_map, .hwinfo = &NT36672A_hw_info},
{.id = {0x0B, 0xFF, 0xFF, 0x82, 0x66, 0x03}, .mask = {1, 0, 0, 1, 1, 1},
.mmap = &NT36672A_memory_map, .hwinfo = &NT36672A_hw_info},
{.id = {0x0B, 0xFF, 0xFF, 0x25, 0x65, 0x03}, .mask = {1, 0, 0, 1, 1, 1},
.mmap = &NT36672A_memory_map, .hwinfo = &NT36672A_hw_info},
{.id = {0x0A, 0xFF, 0xFF, 0x72, 0x65, 0x03}, .mask = {1, 0, 0, 1, 1, 1},
.mmap = &NT36672A_memory_map, .hwinfo = &NT36672A_hw_info},
{.id = {0x0A, 0xFF, 0xFF, 0x72, 0x66, 0x03}, .mask = {1, 0, 0, 1, 1, 1},
.mmap = &NT36672A_memory_map, .hwinfo = &NT36672A_hw_info},
{.id = {0x0A, 0xFF, 0xFF, 0x82, 0x66, 0x03}, .mask = {1, 0, 0, 1, 1, 1},
.mmap = &NT36672A_memory_map, .hwinfo = &NT36672A_hw_info},
{.id = {0x0A, 0xFF, 0xFF, 0x70, 0x66, 0x03}, .mask = {1, 0, 0, 1, 1, 1},
.mmap = &NT36672A_memory_map, .hwinfo = &NT36672A_hw_info},
{.id = {0x0B, 0xFF, 0xFF, 0x70, 0x66, 0x03}, .mask = {1, 0, 0, 1, 1, 1},
.mmap = &NT36672A_memory_map, .hwinfo = &NT36672A_hw_info},
{.id = {0x0A, 0xFF, 0xFF, 0x72, 0x67, 0x03}, .mask = {1, 0, 0, 1, 1, 1},
.mmap = &NT36672A_memory_map, .hwinfo = &NT36672A_hw_info},
{.id = {0x55, 0x00, 0xFF, 0x00, 0x00, 0x00}, .mask = {1, 1, 0, 1, 1, 1},
.mmap = &NT36772_memory_map, .hwinfo = &NT36772_hw_info},
{.id = {0x55, 0x72, 0xFF, 0x00, 0x00, 0x00}, .mask = {1, 1, 0, 1, 1, 1},
.mmap = &NT36772_memory_map, .hwinfo = &NT36772_hw_info},
{.id = {0xAA, 0x00, 0xFF, 0x00, 0x00, 0x00}, .mask = {1, 1, 0, 1, 1, 1},
.mmap = &NT36772_memory_map, .hwinfo = &NT36772_hw_info},
{.id = {0xAA, 0x72, 0xFF, 0x00, 0x00, 0x00}, .mask = {1, 1, 0, 1, 1, 1},
.mmap = &NT36772_memory_map, .hwinfo = &NT36772_hw_info},
{.id = {0xFF, 0xFF, 0xFF, 0x72, 0x67, 0x03}, .mask = {0, 0, 0, 1, 1, 1},
.mmap = &NT36772_memory_map, .hwinfo = &NT36772_hw_info},
{.id = {0xFF, 0xFF, 0xFF, 0x70, 0x66, 0x03}, .mask = {0, 0, 0, 1, 1, 1},
.mmap = &NT36772_memory_map, .hwinfo = &NT36772_hw_info},
{.id = {0xFF, 0xFF, 0xFF, 0x70, 0x67, 0x03}, .mask = {0, 0, 0, 1, 1, 1},
.mmap = &NT36772_memory_map, .hwinfo = &NT36772_hw_info},
{.id = {0xFF, 0xFF, 0xFF, 0x72, 0x66, 0x03}, .mask = {0, 0, 0, 1, 1, 1},
.mmap = &NT36772_memory_map, .hwinfo = &NT36772_hw_info},
{.id = {0xFF, 0xFF, 0xFF, 0x25, 0x65, 0x03}, .mask = {0, 0, 0, 1, 1, 1},
.mmap = &NT36525_memory_map, .hwinfo = &NT36525_hw_info},
{.id = {0xFF, 0xFF, 0xFF, 0x76, 0x66, 0x03}, .mask = {0, 0, 0, 1, 1, 1},
.mmap = &NT36676F_memory_map, .hwinfo = &NT36676F_hw_info}
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,456 @@
/*
* Copyright (C) 2010 - 2018 Novatek, Inc.
*
* $Revision: 46242 $
* $Date: 2019-06-17 10:29:24 +0800 (週一, 17 六月 2019) $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*/
#if NVT_TOUCH_MP
static uint32_t IC_X_CFG_SIZE = 18;
static uint32_t IC_Y_CFG_SIZE = 36;
static uint32_t IC_KEY_CFG_SIZE = 4;
static uint32_t X_Channel = 18;
static uint32_t Y_Channel = 36;
static uint32_t Key_Channel = TOUCH_KEY_NUM;
static uint8_t AIN_X[40] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
static uint8_t AIN_Y[40] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35};
#if TOUCH_KEY_NUM > 0
static uint8_t AIN_KEY[8] = {0, 1, 2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
#endif /* #if TOUCH_KEY_NUM > 0 */
static int32_t PS_Config_Lmt_Short_Rawdata_P[40 * 40] = {
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,14008,
#if TOUCH_KEY_NUM > 0
14008,14008,14008,
#endif /* #if TOUCH_KEY_NUM > 0 */
};
static int32_t PS_Config_Lmt_Short_Rawdata_N[40 * 40] = {
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,
#if TOUCH_KEY_NUM > 0
10000,10000,10000,
#endif /* #if TOUCH_KEY_NUM > 0 */
};
static int32_t PS_Config_Lmt_Open_Rawdata_P[40 * 40] = {
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,5120,
#if TOUCH_KEY_NUM > 0
5120,5120,5120,
#endif /* #if TOUCH_KEY_NUM > 0 */
};
static int32_t PS_Config_Lmt_Open_Rawdata_N[40 * 40] = {
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
#if TOUCH_KEY_NUM > 0
50,50,50,
#endif /* #if TOUCH_KEY_NUM > 0 */
};
static int32_t PS_Config_Lmt_FW_Rawdata_P[40 * 40] = {
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,
#if TOUCH_KEY_NUM > 0
2560,2560,2560,
#endif /* #if TOUCH_KEY_NUM > 0 */
};
static int32_t PS_Config_Lmt_FW_Rawdata_N[40 * 40] = {
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
#if TOUCH_KEY_NUM > 0
240,240,240,
#endif /* #if TOUCH_KEY_NUM > 0 */
};
static int32_t PS_Config_Lmt_FW_CC_P[40 * 40] = {
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
#if TOUCH_KEY_NUM > 0
314,314,314,
#endif /* #if TOUCH_KEY_NUM > 0 */
};
static int32_t PS_Config_Lmt_FW_CC_N[40 * 40] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
#if TOUCH_KEY_NUM > 0
0,0,0,
#endif /* #if TOUCH_KEY_NUM > 0 */
};
static int32_t PS_Config_Lmt_FW_Diff_P[40 * 40] = {
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
#if TOUCH_KEY_NUM > 0
75,75,75,
#endif /* #if TOUCH_KEY_NUM > 0 */
};
static int32_t PS_Config_Lmt_FW_Diff_N[40 *40] = {
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,
#if TOUCH_KEY_NUM > 0
-75,-75,-75,
#endif /* #if TOUCH_KEY_NUM > 0 */
};
static int32_t PS_Config_Diff_Test_Frame = 50;
#endif /* #if NVT_TOUCH_MP */