input: touchscreen: Import fst2 driver from google kernel modules and adjust build
Change-Id: Iea7bfed5c95f1b07977cf87b9b53e9a5d77cbc77 Signed-off-by: Jens Reidel <adrian@travitia.xyz>
This commit is contained in:
parent
bf3b2adc8e
commit
ed815ef071
@ -1341,6 +1341,8 @@ source "drivers/input/touchscreen/focaltech_touch/Kconfig"
|
||||
|
||||
source "drivers/input/touchscreen/fts_spi/Kconfig"
|
||||
|
||||
source "drivers/input/touchscreen/fst2/Kconfig"
|
||||
|
||||
source "drivers/input/touchscreen/xiaomi/Kconfig"
|
||||
|
||||
source "drivers/input/touchscreen/synaptics_dsx/Kconfig"
|
||||
|
@ -116,6 +116,7 @@ obj-$(CONFIG_TOUCHSCREEN_FTS) += focaltech_touch/
|
||||
obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_DSX) += synaptics_dsx/
|
||||
obj-$(CONFIG_TOUCHSCREEN_ZINITIX) += zinitix.o
|
||||
obj-$(CONFIG_TOUCHSCREEN_ST_FTS_V521_SPI) += fts_spi/
|
||||
obj-$(CONFIG_TOUCHSCREEN_FST2) += fst2/
|
||||
obj-$(CONFIG_TOUCHSCREEN_XIAOMI_TOUCHFEATURE) += xiaomi/
|
||||
obj-$(CONFIG_TOUCHSCREEN_NT36XXX_SPI) += nt36xxx/
|
||||
obj-$(CONFIG_TOUCHSCREEN_NT36XXX_I2C) += nt36xxx/
|
||||
|
8
drivers/input/touchscreen/fst2/Kconfig
Normal file
8
drivers/input/touchscreen/fst2/Kconfig
Normal file
@ -0,0 +1,8 @@
|
||||
config TOUCHSCREEN_FST2
|
||||
tristate "STMicroelectronics multitouch touchscreen - FingerTipS (FST2)"
|
||||
depends on I2C || SPI
|
||||
help
|
||||
Say Y here to enable STMicroelectronics (FST2) touchscreen support.
|
||||
If unsure, say N.
|
||||
To compile this driver as a module, choose M here: the module
|
||||
will be called fst2.
|
24
drivers/input/touchscreen/fst2/Makefile
Normal file
24
drivers/input/touchscreen/fst2/Makefile
Normal file
@ -0,0 +1,24 @@
|
||||
ifneq ($(KERNELRELEASE),)
|
||||
obj-$(CONFIG_TOUCHSCREEN_FST2) := fst2.o
|
||||
fst2-y := fts_lib/fts_flash.o \
|
||||
fts_lib/fts_io.o \
|
||||
fts_lib/fts_test.o \
|
||||
fts_proc.o \
|
||||
fts.o
|
||||
else
|
||||
KDIR = $(OUT)/obj/KERNEL_OBJ
|
||||
CROSS_COMPILE = $(ANDROID_TOOLCHAIN)/aarch64-linux-android-
|
||||
CLANG = $(ANDROID_BUILD_TOP)/prebuilts/clang/host/linux-x86/clang-r370808
|
||||
REAL_CC = $(CLANG)/bin/clang
|
||||
AR = $(CLANG)/bin/llvm-ar
|
||||
LLVM_NM = $(CLANG)/bin/llvm-nm
|
||||
LD = $(CLANG)/bin/ld.lld
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
default:
|
||||
$(MAKE) ARCH=arm64 CROSS_COMPILE=$(CROSS_COMPILE) REAL_CC=$(REAL_CC) CLANG_TRIPLE=aarch64-linux-gnu- AR=$(AR) LLVM_NM=$(LLVM_NM) LD=$(LD) -C $(KDIR) M=$(PWD) modules
|
||||
clean:
|
||||
@rm -rf *.o* *.order *.symvers *.mod* .*.o.cmd .*.mod.o.cmd .*.ko.cmd .tmp_versions *.ko
|
||||
@find -name *.o | xargs rm -f
|
||||
endif
|
1330
drivers/input/touchscreen/fst2/fts.c
Normal file
1330
drivers/input/touchscreen/fst2/fts.c
Normal file
File diff suppressed because it is too large
Load Diff
132
drivers/input/touchscreen/fst2/fts.h
Normal file
132
drivers/input/touchscreen/fst2/fts.h
Normal file
@ -0,0 +1,132 @@
|
||||
/*
|
||||
*
|
||||
**************************************************************************
|
||||
** STMicroelectronics **
|
||||
**************************************************************************
|
||||
* *
|
||||
* FTS Capacitive touch screen controller (FingerTipS) *
|
||||
* *
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file fts.h
|
||||
* \brief Contains all the definitions and structs used generally by the driver
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_FTS_I2C_H_
|
||||
#define _LINUX_FTS_I2C_H_
|
||||
|
||||
#include <linux/device.h>
|
||||
#include "fts_lib/fts_io.h"
|
||||
|
||||
#define FTS_TS_DRV_NAME "fts"
|
||||
#define FTS_TS_DRV_VERSION "6.0.3"
|
||||
#define FTS_TS_DRV_VER 0x06000003
|
||||
|
||||
#define MAX_FIFO_EVENT 100
|
||||
|
||||
/* **** PANEL SPECIFICATION **** */
|
||||
#define X_AXIS_MAX 1440 /* /< Max X coordinate of the display */
|
||||
#define X_AXIS_MIN 0 /* /< min X coordinate of the display */
|
||||
#define Y_AXIS_MAX 2959 /* /< Max Y coordinate of the display */
|
||||
#define Y_AXIS_MIN 0 /* /< min Y coordinate of the display */
|
||||
|
||||
#define PRESSURE_MIN 0 /* /< min value of pressure reported */
|
||||
#define PRESSURE_MAX 127 /* /< Max value of pressure reported */
|
||||
|
||||
#define DISTANCE_MIN 0 /* /< min distance between the tool and the
|
||||
* display */
|
||||
#define DISTANCE_MAX 127 /* /< Max distance between the tool and the
|
||||
* display */
|
||||
|
||||
#define TOUCH_ID_MAX 10 /* /< Max number of simoultaneous touches
|
||||
* reported */
|
||||
|
||||
#define AREA_MIN PRESSURE_MIN /* /< min value of Major/minor axis
|
||||
* reported */
|
||||
#define AREA_MAX PRESSURE_MAX /* /< Man value of Major/minor axis
|
||||
* reported */
|
||||
/* **** END **** */
|
||||
|
||||
|
||||
|
||||
#define DEBUG
|
||||
|
||||
/* Touch Types */
|
||||
#define TOUCH_TYPE_FINGER_HOVER 0x00
|
||||
#define TOUCH_TYPE_FINGER 0x01 /* /< Finger touch */
|
||||
#define TOUCH_TYPE_GLOVE 0x02 /* /< Glove touch */
|
||||
#define TOUCH_TYPE_LARGE 0x03
|
||||
|
||||
/*
|
||||
* Forward declaration
|
||||
*/
|
||||
struct fts_ts_info;
|
||||
|
||||
/*
|
||||
* Dispatch event handler
|
||||
*/
|
||||
typedef void (*event_dispatch_handler_t)
|
||||
(struct fts_ts_info *info, unsigned char *data);
|
||||
|
||||
/**
|
||||
* Struct which contains information about the HW platform and set up
|
||||
*/
|
||||
struct fts_hw_platform_data {
|
||||
int (*power)(bool on);
|
||||
int irq_gpio; /* /< number of the gpio associated to the interrupt pin
|
||||
* */
|
||||
int reset_gpio; /* /< number of the gpio associated to the reset pin */
|
||||
const char *vdd_reg_name; /* /< name of the VDD regulator */
|
||||
const char *avdd_reg_name; /* /< name of the AVDD regulator */
|
||||
};
|
||||
/**
|
||||
* Struct contains FTS capacitive touch screen device information
|
||||
*/
|
||||
struct fts_ts_info {
|
||||
struct device *dev; /* /< Pointer to the structure device */
|
||||
#ifdef I2C_INTERFACE
|
||||
struct i2c_client *client; /* /< I2C client structure */
|
||||
#else
|
||||
struct spi_device *client; /* /< SPI client structure */
|
||||
#endif
|
||||
struct fts_hw_platform_data *board; /* /< HW info retrieved from
|
||||
* device tree */
|
||||
struct regulator *vdd_reg; /* /< DVDD power regulator */
|
||||
struct regulator *avdd_reg; /* /< AVDD power regulator */
|
||||
struct input_dev *input_dev; /* /< Input device structure */
|
||||
struct mutex input_report_mutex;/* /< mutex for handling the report
|
||||
* of the pressure of keys */
|
||||
struct work_struct work; /* /< Event work thread */
|
||||
struct work_struct suspend_work; /* /< Suspend work thread */
|
||||
struct work_struct resume_work; /* /< Resume work thread */
|
||||
struct workqueue_struct *event_wq; /* /< Workqueue used for event
|
||||
* handler, suspend and resume
|
||||
* work threads */
|
||||
event_dispatch_handler_t *event_dispatch_table;
|
||||
int resume_bit; /* /< Indicate if screen off/on */
|
||||
unsigned int mode; /* /< Device operating mode (bitmask: msb
|
||||
* indicate if active or lpm) */
|
||||
struct notifier_block notifier; /* /< Used for be notified from a
|
||||
* suspend/resume event */
|
||||
unsigned long touch_id; /* /< Bitmask for touch id (mapped to input
|
||||
* slots) */
|
||||
bool sensor_sleep; /* /< if true suspend was called while if false
|
||||
* resume was called */
|
||||
#ifndef FW_UPDATE_ON_PROBE
|
||||
struct delayed_work fwu_work; /* /< Delayed work thread for fw update
|
||||
* process */
|
||||
struct workqueue_struct *fwu_workqueue;/* /< Fw update work
|
||||
* queue */
|
||||
#endif
|
||||
};
|
||||
|
||||
extern int fts_proc_init(void);
|
||||
extern int fts_proc_remove(void);
|
||||
int fts_enable_interrupt(void);
|
||||
int fts_disable_interrupt(void);
|
||||
|
||||
#endif
|
28417
drivers/input/touchscreen/fst2/fts_fw.h
Normal file
28417
drivers/input/touchscreen/fst2/fts_fw.h
Normal file
File diff suppressed because it is too large
Load Diff
202
drivers/input/touchscreen/fst2/fts_lib/fts_error.h
Normal file
202
drivers/input/touchscreen/fst2/fts_lib/fts_error.h
Normal file
@ -0,0 +1,202 @@
|
||||
/*
|
||||
*
|
||||
**************************************************************************
|
||||
** STMicroelectronics **
|
||||
**************************************************************************
|
||||
* *
|
||||
* FTS error/info kernel log reporting *
|
||||
* *
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file ftsError.h
|
||||
* \brief Contains all the definitions and structs which refer to Error
|
||||
* conditions
|
||||
*/
|
||||
|
||||
#ifndef FTS_ERROR_H
|
||||
#define FTS_ERROR_H
|
||||
|
||||
/** @defgroup error_codes Error Codes
|
||||
* Error codes that can be reported by the driver functions.
|
||||
* An error code is made up by 4 bytes, each byte indicate a logic error
|
||||
* level.\n
|
||||
* From the LSB to the MSB, the logic level increase going from a low level
|
||||
* error (I2C,TIMEOUT) to an high level error (flashing procedure fail,
|
||||
* production test fail etc)
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* FIRST LEVEL ERROR CODE */
|
||||
/** @defgroup first_level First Level Error Code
|
||||
* @ingroup error_codes
|
||||
* Errors related to low level operation which are not under control of driver,
|
||||
* such as: communication protocol (I2C/SPI), timeout, file operations ...
|
||||
* @{
|
||||
*/
|
||||
#define OK ((int)0x00000000) /* /< No ERROR */
|
||||
#define ERROR_ALLOC ((int)0x80000001) /* /< allocation of
|
||||
* memory failed */
|
||||
#define ERROR_BUS_R ((int)0x80000002) /* /< i2c/spi read
|
||||
* failed */
|
||||
#define ERROR_BUS_W ((int)0x80000003) /* /< i2c/spi write
|
||||
* failed */
|
||||
#define ERROR_BUS_WR ((int)0x80000004) /* /< i2c/spi write/
|
||||
* read failed */
|
||||
#define ERROR_BUS_O ((int)0x80000005) /* /< error during
|
||||
* opening an i2c
|
||||
* device */
|
||||
#define ERROR_OP_NOT_ALLOW ((int)0x80000006) /* /< operation not
|
||||
* allowed */
|
||||
#define ERROR_TIMEOUT ((int)0x80000007) /* /< timeout expired!
|
||||
* exceed the max number
|
||||
* of retries or the max
|
||||
* waiting time */
|
||||
#define ERROR_FILE_NOT_FOUND ((int)0x80000008) /* /< the file that i
|
||||
* want to open is not
|
||||
* found */
|
||||
#define ERROR_FILE_PARSE ((int)0x80000009) /* /< error during
|
||||
* parsing the file */
|
||||
#define ERROR_FILE_READ ((int)0x8000000A)/* /< error during
|
||||
* reading the file */
|
||||
#define ERROR_LABEL_NOT_FOUND ((int)0x8000000B)/* /<label not found */
|
||||
#define ERROR_FW_NO_UPDATE ((int)0x8000000C) /* /< fw in the chip
|
||||
* newer than the one in
|
||||
* the bin file */
|
||||
#define ERROR_FLASH_UNKNOWN ((int)0x8000000D) /* /< flash status
|
||||
* busy or unknown */
|
||||
#define ERROR_FLASH_CODE_UPDATE ((int)0x8000000E) /*/< error updating
|
||||
*fw in flash code part*/
|
||||
#define ERROR_FLASH_SEC_UPDATE ((int)0x8000000F) /*/< error updating
|
||||
*flash section*/
|
||||
#define ERROR_FLASH_UPDATE ((int)0x80000010) /*/< error after any
|
||||
*flash update*/
|
||||
#define ERROR_INIT ((int)0x80000011)
|
||||
/*/< error in Full Panel Intilisation includes auto tune*/
|
||||
#define ERROR_WRONG_CHIP_ID ((int)0x80000012) /*/<chip id mismatch*/
|
||||
#define ERROR_CH_LEN ((int)0x80000013) /* /< unable to read
|
||||
* the force and/or
|
||||
* sense length */
|
||||
#define ERROR_PROD_TEST_CHECK_FAIL ((int)0x80000014)
|
||||
/*/<production test limits check failure*/
|
||||
|
||||
/** @}*/
|
||||
|
||||
/* SECOND LEVEL ERROR CODE */
|
||||
/** @defgroup second_level Second Level Error Code
|
||||
* @ingroup error_codes
|
||||
* Errors related to simple logic operations in the IC which require one
|
||||
* command or which are part of a more complex procedure
|
||||
* @{
|
||||
*/
|
||||
#define ERROR_GET_FRAME_DATA ((int)0x80000100) /* /< unable to
|
||||
* retrieve the data of
|
||||
* a required frame */
|
||||
#define ERROR_WRONG_DATA_SIGN ((int)0x80000200) /* /< the signature of
|
||||
* the host data is not
|
||||
* HEADER_SIGNATURE */
|
||||
#define ERROR_SYSTEM_RESET_FAIL ((int)0x80000300) /* /< the comand
|
||||
* SYSTEM RESET
|
||||
* failed */
|
||||
#define ERROR_FLASH_NOT_READY ((int)0x80000400) /* /< flash
|
||||
* status not
|
||||
* ready within
|
||||
* a timeout */
|
||||
|
||||
|
||||
/** @}*/
|
||||
|
||||
/* THIRD LEVEL ERROR CODE */
|
||||
/** @defgroup third_level Third Level Error Code
|
||||
* @ingroup error_codes
|
||||
* Errors related to logic operations in the IC which require more
|
||||
*commands/steps or which are part of a more complex procedure
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define ERROR_GET_FRAME ((int)0x80010000) /*/<frame read error*/
|
||||
#define ERROR_GET_CX ((int)0x80020000)/*/<cx data read err*/
|
||||
#define ERROR_MEMH_READ ((int)0x80030000)
|
||||
/* /< memh reading failed */
|
||||
|
||||
|
||||
|
||||
/** @}*/
|
||||
|
||||
/* FOURTH LEVEL ERROR CODE */
|
||||
/** @defgroup fourth_level Fourth Level Error Code
|
||||
* @ingroup error_codes
|
||||
* Errors related to the highest logic operations in the IC which have an
|
||||
* important impact on the driver flow or which require several commands and
|
||||
* steps to be executed
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#define ERROR_FLASH_PROCEDURE ((int)0x81000000) /* /< fw update
|
||||
* procedure failed */
|
||||
#define ERROR_PROD_TEST_ITO ((int)0x82000000) /* /< production
|
||||
* ito test failed */
|
||||
#define ERROR_PROD_TEST_RAW ((int)0x83000000) /* /< production
|
||||
*raw data test failed */
|
||||
#define ERROR_PROD_TEST_CX ((int)0x84000000) /* /< production
|
||||
*test cx data failed */
|
||||
|
||||
/** @}*/
|
||||
|
||||
/** @}*/ /* end of error_commands section */
|
||||
|
||||
/* ERROR TYPE */
|
||||
/** @defgroup error_type Error Event Types
|
||||
* @ingroup events_group
|
||||
* Types of EVT_ID_ERROR events reported by the FW
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define EVT_TYPE_ERROR_HARD_FAULT 0x01/* /< Hard Fault */
|
||||
#define EVT_TYPE_ERROR_MEMORY_MANAGE 0x02/* /< Memory Mange */
|
||||
#define EVT_TYPE_ERROR_BUS_FAULT 0x03/* /< Bus Fault */
|
||||
#define EVT_TYPE_ERROR_USAGE_FAULT 0x04/* /< Usage Fault */
|
||||
#define EVT_TYPE_ERROR_WATCHDOG 0x05/* /< Watchdog timer
|
||||
* expired */
|
||||
#define EVT_TYPE_ERROR_ITO_FORCETOGND 0x60 /* /< Force channel/s
|
||||
* short to ground */
|
||||
#define EVT_TYPE_ERROR_ITO_SENSETOGND 0x61 /* /< Sense channel/s
|
||||
* short to ground */
|
||||
#define EVT_TYPE_ERROR_ITO_FLTTOGND 0x62 /* /< Flt short to
|
||||
* ground */
|
||||
#define EVT_TYPE_ERROR_ITO_FORCETOVDD 0x63 /* /< Force channel/s
|
||||
* short to VDD */
|
||||
#define EVT_TYPE_ERROR_ITO_SENSETOVDD 0x64 /* /< Sense channel/s
|
||||
* short to VDD */
|
||||
#define EVT_TYPE_ERROR_ITO_FLTTOVDD 0x65
|
||||
#define EVT_TYPE_ERROR_ITO_FORCE_P2P 0x66/*/< Pin to Pin short Force
|
||||
* channel/s */
|
||||
#define EVT_TYPE_ERROR_ITO_SENSE_P2P 0x67 /* /< Pin to Pin short
|
||||
* Sense channel/s */
|
||||
#define EVT_TYPE_ERROR_ITO_FLT_P2P 0x68 /*/<Flt short pin to pin*/
|
||||
#define EVT_TYPE_ERROR_ITO_FORCEOPEN 0x69 /* /< Force Panel open */
|
||||
#define EVT_TYPE_ERROR_ITO_SENSEOPEN 0x6A /* /< Sense Panel open */
|
||||
/** @}*/
|
||||
|
||||
/* TIMEOUT */
|
||||
/** @defgroup timeouts Timeouts
|
||||
* Definitions of all the Timeout used in several operations
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define TIMEOUT_RESOLUTION 10
|
||||
/* /< timeout resolution in ms (all timeout should be multiples of this unit) */
|
||||
#define TIMEOUT_FW_REG_STATUS 300
|
||||
/* /< timeout of the FW Register request status */
|
||||
#define TIMEOUT_GENERAL 100
|
||||
/* /< general timeout in ms */
|
||||
#define TIMEOUT_FPI 5000
|
||||
/* /< timeout of the Full panel Init command */
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
1355
drivers/input/touchscreen/fst2/fts_lib/fts_flash.c
Normal file
1355
drivers/input/touchscreen/fst2/fts_lib/fts_flash.c
Normal file
File diff suppressed because it is too large
Load Diff
141
drivers/input/touchscreen/fst2/fts_lib/fts_flash.h
Normal file
141
drivers/input/touchscreen/fst2/fts_lib/fts_flash.h
Normal file
@ -0,0 +1,141 @@
|
||||
/*
|
||||
*
|
||||
**************************************************************************
|
||||
** STMicroelectronics **
|
||||
**************************************************************************
|
||||
* *
|
||||
* FTS API for Flashing the IC *
|
||||
* *
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file ftsFlash.h
|
||||
* \brief Contains all the definitions and structs to handle the FW update
|
||||
*process
|
||||
*/
|
||||
|
||||
#ifndef FTS_FLASH_H
|
||||
#define FTS_FLASH_H
|
||||
|
||||
/*#define FW_H_FILE*/
|
||||
|
||||
#ifdef FW_H_FILE
|
||||
#define PATH_FILE_FW "NULL"
|
||||
#else
|
||||
#define PATH_FILE_FW "st_fts.ubin" /* /< new FW bin file name */
|
||||
#endif
|
||||
|
||||
#ifdef FW_H_FILE
|
||||
#define FW_SIZE_NAME myArray_size /* /< name of the variable in
|
||||
* the FW header file which
|
||||
* specified the dimension of
|
||||
* the FW data array */
|
||||
#define FW_ARRAY_NAME myArray /* /< name of the variable in the FW
|
||||
* header file which specified the FW
|
||||
* data array */
|
||||
#endif
|
||||
|
||||
#define FLASH_MAX_SECTIONS 10 /* /<maximum flash sections
|
||||
* supported*/
|
||||
|
||||
/**
|
||||
* Struct which stores the status of FW to be updated in each flash sections
|
||||
*during the flash procedure
|
||||
*/
|
||||
struct force_update_flag {
|
||||
u8 code_update; /* /< flag to update FW code */
|
||||
u8 section_update[FLASH_MAX_SECTIONS]; /* /< flag
|
||||
*to update FW sections */
|
||||
u8 panel_init; /* /< flag to initiate Full panel Init */
|
||||
};
|
||||
|
||||
/**
|
||||
* Struct which contains the header and data of a flash section
|
||||
*/
|
||||
struct fw_section {
|
||||
u16 sec_id; /* /< FW section ID mapped for
|
||||
*each flash sections */
|
||||
u16 sec_ver; /* /< FW section version */
|
||||
u32 sec_size; /* /< FW sectionsize in bytes */
|
||||
u8 *sec_data; /* /< FW section data */
|
||||
};
|
||||
|
||||
/**
|
||||
* Struct which contains information and data of the FW file to be burnt
|
||||
*into the IC
|
||||
*/
|
||||
struct firmware_file {
|
||||
u16 fw_ver; /* /< FW version of the FW file */
|
||||
u8 flash_code_pages; /* /<size of fw code in pages*/
|
||||
u8 panel_info_pages; /* /<size of fw sections in pages*/
|
||||
u32 fw_code_size; /* /< size of fw code in bytes*/
|
||||
u8 *fw_code_data; /*/< fw code data*/
|
||||
u8 num_code_pages; /*size depending on the FW code size*/
|
||||
u8 num_sections; /* fw sections in fw file */
|
||||
struct fw_section sections[FLASH_MAX_SECTIONS]; /* /< fw section
|
||||
data for each section*/
|
||||
};
|
||||
|
||||
/**
|
||||
* Define section ID mapping for flash sections
|
||||
*/
|
||||
typedef enum {
|
||||
FINGERTIP_FW_CODE = 0x0000, /* /< FW main code*/
|
||||
FINGERTIP_FW_REG = 0x0001, /* /< FW Reg section */
|
||||
FINGERTIP_MUTUAL_CX = 0x0002, /* /< FW mutual cx */
|
||||
FINGERTIP_SELF_CX = 0x0003, /* /< FW self cx */
|
||||
} fw_section_t;
|
||||
|
||||
#define FLASH_PAGE_SIZE (4 * 1024) /* /<page size of 4KB*/
|
||||
#define BIN_HEADER_SIZE (32 + 4) /* /< fw ubin main header size
|
||||
* including crc */
|
||||
#define SECTION_HEADER_SIZE 20 /* /< fw ubin section header size */
|
||||
#define BIN_HEADER 0xBABEFACE /* /< fw ubin main header
|
||||
* identifier constant */
|
||||
#define SECTION_HEADER 0xB16B00B5 /* /< fw ubin section header
|
||||
* identifier constant */
|
||||
#define CHIP_ID 0x3652 /* /< chip id of finger tip
|
||||
* device, spruce */
|
||||
#define NUM_FLASH_PAGES 48 /* /< number of flash pages in
|
||||
* fingertip device, spruce */
|
||||
#define DMA_CHUNK 32 /* /< Max number of bytes that
|
||||
* can be written to the DMA */
|
||||
#define FLASH_CHUNK (64 * 1024)/* /< Max number of bytes
|
||||
* that the DMA can burn
|
||||
* on the flash in one
|
||||
* shot in FTI */
|
||||
#define FLASH_RETRY_COUNT 200 /* /< number of attemps to read the
|
||||
* flash status */
|
||||
#define FLASH_WAIT_BEFORE_RETRY 50 /* /< time to wait in ms between
|
||||
* status readings */
|
||||
#define FLASH_ERASE_READY_VAL 0x6A
|
||||
#define FLASH_PGM_READY_VAL 0x71
|
||||
#define FLASH_DMA_CODE_VAL 0xC0
|
||||
#define FLASH_DMA_CONFIG_VAL 0x72
|
||||
#define REG_CRC_MASK 0x03 /* /< mask to read
|
||||
*fw register status of reg crc*/
|
||||
#define REG_MISC_MASK 0x0C /* /< mask to read
|
||||
*fw register status of misc crc*/
|
||||
#define MS_CRC_MASK 0x0F /* /< mask to read
|
||||
*fw register status of ms cx crc*/
|
||||
#define SS_CRC_MASK 0xF0 /* /< mask to read fw register
|
||||
* status of ss cx crc*/
|
||||
#define IOFF_CRC_MASK 0xFF /* /< mask to read fw
|
||||
* register status of ioff crc*/
|
||||
#define RAWMS_CRC_MASK 0x03 /* /< mask to read
|
||||
*fw register status of
|
||||
* raw frame data crc*/
|
||||
|
||||
int read_fw_file(const char *path, struct firmware_file *fw);
|
||||
int flash_burn(struct firmware_file fw,
|
||||
struct force_update_flag *force_update);
|
||||
int flash_section_burn(struct firmware_file fw, fw_section_t section,
|
||||
u8 save_to_flash);
|
||||
int read_sys_info(void);
|
||||
int flash_update(struct force_update_flag *force_update);
|
||||
int configure_spi4(void);
|
||||
int full_panel_init(struct force_update_flag *force_update);
|
||||
#endif
|
2103
drivers/input/touchscreen/fst2/fts_lib/fts_io.c
Normal file
2103
drivers/input/touchscreen/fst2/fts_lib/fts_io.c
Normal file
File diff suppressed because it is too large
Load Diff
417
drivers/input/touchscreen/fst2/fts_lib/fts_io.h
Normal file
417
drivers/input/touchscreen/fst2/fts_lib/fts_io.h
Normal file
@ -0,0 +1,417 @@
|
||||
/*
|
||||
*
|
||||
**************************************************************************
|
||||
** STMicroelectronics **
|
||||
**************************************************************************
|
||||
* *
|
||||
* I2C/SPI Communication *
|
||||
* *
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
*
|
||||
*/
|
||||
/*!
|
||||
* \file ftsIO.h
|
||||
* \brief Contains all the definitions and prototypes used and implemented in
|
||||
* ftsIO.c
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_FTS_IO_H_
|
||||
#define _LINUX_FTS_IO_H_
|
||||
|
||||
/*#define I2C_INTERFACE*/
|
||||
#ifdef I2C_INTERFACE
|
||||
#define I2C_SAD 0x49 /* /< slave address of the IC */
|
||||
#define DUMMY_BYTE 0 /* /< first byte read is not
|
||||
* Dummy byte */
|
||||
#else
|
||||
#define SPI4_WIRE /* /< comment if the master is SPI3 wires
|
||||
* (MOSI and MISO share same line) */
|
||||
#define SPI_CLOCK_FREQ 7000000 /* /< clock frequency in Hz of
|
||||
* the SPI bus */
|
||||
#define SPI_DELAY_CS 10 /* /< time in usec to wait
|
||||
* before rising the CS */
|
||||
#define DUMMY_BYTE 1 /* /< first byte read is Dummy byte */
|
||||
#endif
|
||||
|
||||
#define SYS_INFO_SIZE 256
|
||||
#define DIE_INFO_SIZE 16
|
||||
#define RELEASE_INFO_SIZE 8
|
||||
|
||||
#define FTS_CMD_HDM_SPI_W 0xB6
|
||||
#define FTS_CMD_HDM_SPI_R 0xB7
|
||||
#define FTS_CMD_REG_SPI_W 0xB2
|
||||
#define FTS_CMD_REG_SPI_R 0xB1
|
||||
#define FTS_CMD_NONE 0x00
|
||||
#define FTS_CMD_HW_REG_W 0xFA
|
||||
|
||||
#ifdef I2C_INTERFACE
|
||||
#define FTS_CMD_HW_REG_R 0xFA
|
||||
#define FRAME_BUFFER_ADDR 0x8000
|
||||
#define READ_CHUNK 1024
|
||||
#define WRITE_CHUNK 1024
|
||||
#define MEMORY_CHUNK 1024
|
||||
#else
|
||||
#define FTS_CMD_HW_REG_R 0xFB
|
||||
#define FRAME_BUFFER_ADDR 0x0000
|
||||
#define SPI_REG_W_CHUNK 128
|
||||
#define SPI_REG_R_CHUNK 1024
|
||||
#define SPI_HDM_W_CHUNK 1024
|
||||
#define SPI_HDM_R_CHUNK 1024
|
||||
#define READ_CHUNK SPI_HDM_R_CHUNK
|
||||
#define WRITE_CHUNK SPI_HDM_W_CHUNK
|
||||
#define MEMORY_CHUNK SPI_HDM_R_CHUNK
|
||||
#endif
|
||||
#define I2C_RETRY 3
|
||||
#define I2C_WAIT_BEFORE_RETRY 2
|
||||
#define GPIO_NOT_DEFINED -1
|
||||
|
||||
|
||||
#define FW_ADDR_SIZE BITS_16
|
||||
#define HW_ADDR_SIZE BITS_32
|
||||
|
||||
#define CHIP_ID_ADDRESS 0x20000000
|
||||
#define UVLO_CTRL_ADDR 0x2000001B
|
||||
#define SYS_RST_ADDR 0x20000024
|
||||
#define BOOT_OPT_ADDR 0x20000025
|
||||
#define SPI4_CONFIG_ADDR 0x2000002D
|
||||
#define GPIO_GPIO_PU_ADDR 0x20000034
|
||||
#define GPIO_MISO_CONFIG_ADDR 0x2000003E
|
||||
#define FLASH_FSM_CTRL_ADDR 0x20000068
|
||||
#define FLASH_ERASE_CTRL_ADDR 0x2000006A
|
||||
#define PAGE_SEL_ADDR 0x2000006B
|
||||
#define FLASH_MULTI_PAGE_ERASE_ADDR 0x2000006E
|
||||
#define FLASH_DMA_ADDR 0x20000072
|
||||
#define CODE_STATUS_ADDR 0x20000078
|
||||
#define FLASH_CTRL_ADDR 0x200000DE
|
||||
#define FLASH_PAGE_MASK_ADDR 0x20000128
|
||||
|
||||
#define FRAME_BUFFER_ADDRESS 0x20010000
|
||||
#define FLASH_START_ADDR 0x00000000
|
||||
|
||||
#define SCAN_MODE_ADDR 0x0010
|
||||
#define FLASH_SAVE_ADDR 0x0020
|
||||
#define HDM_WRITE_REQ_ADDR 0x0021
|
||||
#define PI_ADDR 0x0022
|
||||
#define HDM_REQ_ADDR 0x0023
|
||||
#define ITO_TRIGGER_ADDR 0x0024
|
||||
#define SYS_ERROR_ADDR 0x0040
|
||||
#define FIFO_READ_ADDR 0x0060
|
||||
|
||||
/* EVENT ID */
|
||||
/** @defgroup events_group FW Event IDs and Types
|
||||
* Event IDs and Types pushed by the FW into the FIFO
|
||||
* @{
|
||||
*/
|
||||
#define EVT_ID_NOEVENT 0x00 /* /< No Events */
|
||||
#define EVT_ID_CONTROLLER_READY 0x03 /* /< Controller ready, issued
|
||||
* after a system reset. */
|
||||
#define EVT_ID_ENTER_POINT 0x13 /* /< Touch enter in the
|
||||
* sensing area */
|
||||
#define EVT_ID_MOTION_POINT 0x23 /* /< Touch motion (a specific
|
||||
* touch changed position) */
|
||||
#define EVT_ID_LEAVE_POINT 0x33 /* /< Touch leave the sensing
|
||||
* area */
|
||||
#define EVT_ID_USER_REPORT 0x53 /* /< User related events
|
||||
* triggered (keys,
|
||||
* gestures, proximity etc) */
|
||||
#define EVT_ID_DEBUG 0xE3 /* /< Debug Info */
|
||||
#define EVT_ID_ERROR 0xF3 /* /< Error Event */
|
||||
|
||||
#define FIFO_EVENT_SIZE 8 /* /< number of bytes of one event */
|
||||
#define NUM_EVT_ID (((EVT_ID_ERROR & 0xF0) >> 4)+1)
|
||||
/* /< Max number of unique event IDs supported */
|
||||
/** @}*/
|
||||
|
||||
#define BYTES_PER_NODE 2
|
||||
#define SYNC_FRAME_HEADER_SIZE 16
|
||||
#define COMP_HEADER_SIZE 16
|
||||
|
||||
#define HDM_REQ_SYS_INFO 0x01
|
||||
#define HDM_REQ_CX_MS_TOUCH 0x10
|
||||
#define HDM_REQ_CX_MS_LOW_POWER 0x11
|
||||
#define HDM_REQ_CX_SS_TOUCH 0x12
|
||||
#define HDM_REQ_CX_SS_TOUCH_IDLE 0x13
|
||||
#define HDM_REQ_TOT_CX_MS_TOUCH 0x50
|
||||
#define HDM_REQ_TOT_CX_MS_LOW_POWER 0x51
|
||||
#define HDM_REQ_TOT_IX_SS_TOUCH 0x52
|
||||
#define HDM_REQ_TOT_IX_SS_TOUCH_IDLE 0x53
|
||||
|
||||
|
||||
#define SYSTEM_RESET_VAL 0x80
|
||||
#define SCAN_MODE_HIBERNATE 0x00
|
||||
#define SCAN_MODE_ACTIVE 0x01
|
||||
#define SCAN_MODE_LOW_POWER 0x02
|
||||
#define SCAN_MODE_LOCK_ACTIVE 0x10
|
||||
#define SCAN_MODE_LOCK_LP_DETECT 0x13
|
||||
#define SCAN_MODE_LOCK_LP_ACTIVE 0x14
|
||||
|
||||
/*#define MS_GV_METHOD
|
||||
#define SS_GV_METHOD*/
|
||||
|
||||
typedef signed char i8;
|
||||
/** @addtogroup system_info
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Struct which contains fundamental informations about the chip and its
|
||||
*configuration
|
||||
*/
|
||||
struct sys_info {
|
||||
u16 u16_api_ver_rev;
|
||||
u8 u8_api_ver_minor;
|
||||
u8 u8_api_ver_major;
|
||||
u16 u16_chip0_ver;
|
||||
u16 u16_chip0_id;
|
||||
u16 u16_chip1_ver;
|
||||
u16 u16_chip1_id;
|
||||
u16 u16_fw_ver;
|
||||
u16 u16_svn_rev;
|
||||
u16 u16_pe_ver;
|
||||
u16 u16_reg_ver;
|
||||
u16 u16_scr_x_res;
|
||||
u16 u16_scr_y_res;
|
||||
u8 u8_scr_tx_len;
|
||||
u8 u8_scr_rx_len;
|
||||
u8 u8_die_info[DIE_INFO_SIZE];
|
||||
u8 u8_release_info[RELEASE_INFO_SIZE];
|
||||
u32 u32_flash_org_info;
|
||||
u8 u8_cfg_afe_ver;
|
||||
u8 u8_ms_scr_afe_ver;
|
||||
u8 u8_ms_scr_gv_ver;
|
||||
u8 u8_ms_scr_lp_afe_ver;
|
||||
u8 u8_ms_scr_lp_gv_ver;
|
||||
u8 u8_ss_tch_afe_ver;
|
||||
u8 u8_ss_tch_gv_ver;
|
||||
u8 u8_ss_det_afe_ver;
|
||||
u8 u8_ss_det_gv_ver;
|
||||
u16 u16_dbg_info_addr;
|
||||
u16 u16_ms_scr_raw_addr;
|
||||
u16 u16_ms_scr_filter_addr;
|
||||
u16 u16_ms_scr_strength_addr;
|
||||
u16 u16_ms_scr_baseline_addr;
|
||||
u16 u16_ss_tch_tx_raw_addr;
|
||||
u16 u16_ss_tch_tx_filter_addr;
|
||||
u16 u16_ss_tch_tx_strength_addr;
|
||||
u16 u16_ss_tch_tx_baseline_addr;
|
||||
u16 u16_ss_tch_rx_raw_addr;
|
||||
u16 u16_ss_tch_rx_filter_addr;
|
||||
u16 u16_ss_tch_rx_strength_addr;
|
||||
u16 u16_ss_tch_rx_baseline_addr;
|
||||
u16 u16_ss_det_tx_raw_addr;
|
||||
u16 u16_ss_det_tx_filter_addr;
|
||||
u16 u16_ss_det_tx_strength_addr;
|
||||
u16 u16_ss_det_tx_baseline_addr;
|
||||
u16 u16_ss_det_rx_raw_addr;
|
||||
u16 u16_ss_det_rx_filter_addr;
|
||||
u16 u16_ss_det_rx_strength_addr;
|
||||
u16 u16_ss_det_rx_baseline_addr;
|
||||
u32 u32_reg_default_sect_flash_addr;
|
||||
u32 u32_misc_sect_flash_addr;
|
||||
u32 u32_cx_ms_scr_flash_addr;
|
||||
u32 u32_cx_ms_scr_lp_flash_addr;
|
||||
u32 u32_cx_ss_tch_flash_addr;
|
||||
u32 u32_cx_ss_det_flash_addr;
|
||||
u32 u32_ioff_ms_scr_flash_addr;
|
||||
u32 u32_ioff_ms_scr_lp_flash_addr;
|
||||
u32 u32_ioff_ss_tch_flash_addr;
|
||||
u32 u32_ioff_ss_det_flash_addr;
|
||||
u32 u32_pure_raw_ms_scr_flash_addr;
|
||||
u32 u32_pure_raw_ms_scr_lp_flash_addr;
|
||||
u32 u32_pure_raw_ss_tch_flash_addr;
|
||||
u32 u32_pure_raw_ss_det_flash_addr;
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
/**
|
||||
* Possible types of MS frames
|
||||
*/
|
||||
typedef enum {
|
||||
MS_RAW = 0, /* /< Mutual Sense Raw Frame */
|
||||
MS_FILTER = 1, /* /< Mutual Sense Filtered Frame */
|
||||
MS_STRENGTH = 2, /* /< Mutual Sense Baseline Frame */
|
||||
MS_BASELINE = 3, /* /< Mutual Sense Key Raw Frame */
|
||||
} ms_frame_type_t;
|
||||
|
||||
/**
|
||||
* Possible types of SS frames
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
SS_RAW = 0, /* /< Self Sense Raw Frame */
|
||||
SS_FILTER = 1, /* /< Self Sense Filtered Frame */
|
||||
SS_STRENGTH = 2, /* /< Self Sense Strength Frame*/
|
||||
SS_BASELINE = 3, /* /< Self Sense Baseline Frame */
|
||||
SS_DETECT_RAW = 4,/* /< Self Sense Detect Raw Frame */
|
||||
SS_DETECT_FILTER = 5,/* /< Self Sense Detect Filter Frame */
|
||||
SS_DETECT_STRENGTH = 6,/* /< Self Sense Detect Strength Frame */
|
||||
SS_DETECT_BASELINE = 7,/* /< Self Sense Detect Baseline Frame */
|
||||
} ss_frame_type_t;
|
||||
|
||||
|
||||
/**
|
||||
* Struct which contains the general info about Frames and Initialization Data
|
||||
*/
|
||||
struct data_header {
|
||||
int force_node; /* /< Number of Force Channels in the
|
||||
* frame/Initialization data */
|
||||
int sense_node; /* /< Number of Sense Channels in the
|
||||
* frame/Initialization data */
|
||||
int type; /* /< Type of frame/Initialization data */
|
||||
};
|
||||
|
||||
/**
|
||||
* Struct which contains the MS data info and frame
|
||||
*/
|
||||
|
||||
struct mutual_sense_frame {
|
||||
struct data_header header; /* /< Header which contain basic info of the
|
||||
* frame */
|
||||
short *node_data; /* /< Data of the frame */
|
||||
int node_data_size; /* /< Dimension of the data of the frame */
|
||||
};
|
||||
|
||||
/**
|
||||
* Struct which contains the SS data info and frame
|
||||
*/
|
||||
|
||||
struct self_sense_frame {
|
||||
struct data_header header; /* /< Header which contain basic info of the
|
||||
* frame */
|
||||
short *force_data; /* /< Force Channels Data */
|
||||
short *sense_data; /* /< Sense Channels Data */
|
||||
};
|
||||
|
||||
/**
|
||||
* Struct which contains the MS CX data info and frame
|
||||
*/
|
||||
|
||||
struct mutual_sense_cx_data {
|
||||
struct data_header header; /* /< Header which contain basic info of the
|
||||
* frame */
|
||||
i8 cx1;/* /< Cx1 value (can be negative)) */
|
||||
i8 *node_data;/* /< Data of the frame */
|
||||
int node_data_size;/* /< Dimension of the data of the frame */
|
||||
};
|
||||
|
||||
/**
|
||||
* Struct which contains the TOT MS Initialization data
|
||||
*/
|
||||
|
||||
struct mutual_total_cx_data {
|
||||
struct data_header header; /* /< Header which contain basic info of the
|
||||
* frame */
|
||||
short *node_data;/* /< Data of the frame */
|
||||
int node_data_size;/* /< Dimension of the data of the frame */
|
||||
};
|
||||
/**
|
||||
* Struct which contains the SS CX data info and frame
|
||||
*/
|
||||
|
||||
struct self_sense_cx_data {
|
||||
struct data_header header; /* /< Header */
|
||||
u8 tx_ix0; /* /< SS TX IX0 */
|
||||
u8 rx_ix0; /* /< SS RX IX0 */
|
||||
u8 tx_ix1; /* /< SS TX IX1 */
|
||||
u8 rx_ix1; /* /< SS RX IX1*/
|
||||
u8 tx_max_n; /* /< SS TX MaxN */
|
||||
u8 rx_max_n; /* /< SS RX MaxN */
|
||||
i8 tx_cx1; /* /< SS TX Cx1 (can be negative)*/
|
||||
i8 rx_cx1; /* /< SS RX Cx1 (can be negative)*/
|
||||
u8 *ix2_tx; /* /< pointer to an array of bytes which contains Force
|
||||
* Ix2 data node */
|
||||
u8 *ix2_rx; /* /< pointer to an array of bytes which contains Sense
|
||||
* Ix2 data node */
|
||||
i8 *cx2_tx; /* /< pointer to an array of bytes which contains Force
|
||||
* Cx2 data node (can be negative) */
|
||||
i8 *cx2_rx; /* /< pointer to an array of bytes which contains Sense
|
||||
* Cx2 data node (can be negative)) */
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Struct which contains the TOT SS Initialization data
|
||||
*/
|
||||
struct self_total_cx_data {
|
||||
struct data_header header; /* /< Header */
|
||||
u16 *ix_tx; /* /< pointer to an array of ushort which contains TOT
|
||||
* SS IX Force data */
|
||||
u16 *ix_rx;/* /< pointer to an array of ushort which contains TOT
|
||||
* SS IX Sense data */
|
||||
};
|
||||
|
||||
/**
|
||||
* Possible data sizes
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
NO_ADDR = 0,
|
||||
BITS_8 = 1,
|
||||
BITS_16 = 2,
|
||||
BITS_24 = 3,
|
||||
BITS_32 = 4,
|
||||
BITS_40 = 5,
|
||||
BITS_48 = 6,
|
||||
BITS_56 = 7,
|
||||
BITS_64 = 8,
|
||||
} addr_size_t;
|
||||
|
||||
|
||||
#ifdef I2C_INTERFACE
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/i2c-dev.h>
|
||||
struct i2c_client *get_client(void);
|
||||
#else
|
||||
#include <linux/spi/spi.h>
|
||||
struct spi_device *get_client(void);
|
||||
#endif
|
||||
struct device *get_dev(void);
|
||||
void set_reset_gpio(int gpio);
|
||||
int open_channel(void *clt);
|
||||
void log_info(int force, const char *msg, ...);
|
||||
int fts_read(u8 *outBuf, int byte_to_read);
|
||||
int fts_write_read(u8 *cmd, int cmd_length, u8 *out_buf, int byte_to_read);
|
||||
int fts_write(u8 *cmd, int cmd_length);
|
||||
int fts_write_u8ux(u8 cmd, addr_size_t addr_size, u64 address, u8 *data, int
|
||||
data_size);
|
||||
int fts_write_read_u8ux(u8 cmd, addr_size_t addr_size, u64 address,
|
||||
u8 *out_buf, int byte_to_read, int has_dummy_byte);
|
||||
int u8_to_u16(u8 *src, u16 *dst);
|
||||
int u8_to_u16_be(u8 *src, u16 *dst);
|
||||
int u8_to_u16n(u8 *src, int src_length, u16 *dst);
|
||||
int u16_to_u8(u16 src, u8 *dst);
|
||||
int u16_to_u8_be(u16 src, u8 *dst);
|
||||
int u16_to_u8n_be(u16 *src, int src_length, u8 *dst);
|
||||
int u8_to_u32(u8 *src, u32 *dst);
|
||||
int u8_to_u32_be(u8 *src, u32 *dst);
|
||||
int u32_to_u8(u32 src, u8 *dst);
|
||||
int u32_to_u8_be(u32 src, u8 *dst);
|
||||
int u8_to_u64_be(u8 *src, u64 *dest, int size);
|
||||
int u64_to_u8_be(u64 src, u8 *dest, int size);
|
||||
int from_id_to_mask(u8 id, u8 *mask, int size);
|
||||
int fts_system_reset(int poll_event);
|
||||
int fts_hdm_write_request(u8 save_to_flash);
|
||||
int fts_request_hdm(u8 type);
|
||||
int fts_fw_request(u16 address, u8 bit_to_set, u8 auto_clear,
|
||||
int time_to_wait);
|
||||
char *print_hex(char *label, u8 *buff, int count, u8 *result);
|
||||
int poll_for_event(int *event_to_search, int event_bytes,
|
||||
u8 *read_data, int time_to_wait);
|
||||
int fts_write_fw_reg(u16 address, u8 *data, uint32_t length);
|
||||
int fts_read_fw_reg(u16 address, u8 *read_data, uint32_t read_length);
|
||||
int fts_write_hdm(u16 address, u8 *data, int length);
|
||||
int fts_read_hdm(u16 address, u8 *read_data, uint32_t read_length);
|
||||
int fts_read_sys_errors(void);
|
||||
int get_ms_frame(ms_frame_type_t type, struct mutual_sense_frame *frame);
|
||||
int get_ss_frame(ss_frame_type_t type, struct self_sense_frame *frame);
|
||||
int get_sync_frame(u8 type, struct mutual_sense_frame *ms_frame,
|
||||
struct self_sense_frame *ss_frame);
|
||||
int get_mutual_cx_data(u8 type, struct mutual_sense_cx_data *ms_cx_data);
|
||||
int get_self_cx_data(u8 type, struct self_sense_cx_data *ss_cx_data);
|
||||
int get_mutual_total_cx_data(u8 type,
|
||||
struct mutual_total_cx_data *tot_ms_cx_data);
|
||||
int get_self_total_cx_data(u8 type, struct self_total_cx_data *tot_ss_cx_data);
|
||||
|
||||
#endif
|
2316
drivers/input/touchscreen/fst2/fts_lib/fts_test.c
Normal file
2316
drivers/input/touchscreen/fst2/fts_lib/fts_test.c
Normal file
File diff suppressed because it is too large
Load Diff
210
drivers/input/touchscreen/fst2/fts_lib/fts_test.h
Normal file
210
drivers/input/touchscreen/fst2/fts_lib/fts_test.h
Normal file
@ -0,0 +1,210 @@
|
||||
/*
|
||||
*
|
||||
**************************************************************************
|
||||
** STMicroelectronics **
|
||||
**************************************************************************
|
||||
* *
|
||||
* FTS API for MP test **
|
||||
* *
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file ftsTest.h
|
||||
* \brief Contains all the definitions and structs related to the Mass
|
||||
*Production Test
|
||||
*/
|
||||
|
||||
#ifndef FTS_TEST_H
|
||||
#define FTS_TEST_H
|
||||
|
||||
#include "fts_io.h"
|
||||
|
||||
#define MAX_LIMIT_FILE_NAME 100/* /< max number of chars of the limit file name
|
||||
* */
|
||||
|
||||
/**
|
||||
* Struct which store the data coming from a Production Limit File
|
||||
*/
|
||||
struct limit_file {
|
||||
char *data;
|
||||
int size;
|
||||
char name[MAX_LIMIT_FILE_NAME];
|
||||
};
|
||||
|
||||
/*#define LIMITS_H_FILE*/
|
||||
|
||||
#ifndef LIMITS_H_FILE
|
||||
#define LIMITS_FILE "stm_fts_production_limits.csv"
|
||||
/* /< Name of the Production Test Limit File */
|
||||
#else
|
||||
#define LIMITS_FILE "NULL"
|
||||
#endif
|
||||
|
||||
#ifdef LIMITS_H_FILE
|
||||
#define LIMITS_SIZE_NAME myArray2_size /* /< name of the
|
||||
* variable in the
|
||||
* limits header file
|
||||
* which specified the
|
||||
* dimension of the
|
||||
* limits data array */
|
||||
#define LIMITS_ARRAY_NAME myArray2 /* /< name of the
|
||||
* variable in the
|
||||
* limits header file
|
||||
* which specified the
|
||||
* limits data array */
|
||||
#endif
|
||||
|
||||
|
||||
/** @defgroup mp_test Mass Production Test
|
||||
* Mass production test API.
|
||||
* Mass Production Test (MP) should be executed at least one time in the life
|
||||
* of every device \n
|
||||
* It used to verify that tit is not present any hardware damage and
|
||||
* initialize some value of the chip in order to guarantee the working
|
||||
* performance \n
|
||||
* The MP test is made up by 3 steps:
|
||||
* - ITO test = production_test_ito() \n
|
||||
* - Initialization = production_test_initialization() \n
|
||||
* - Data Test = production_test_data(),
|
||||
* it is possible to select which items test thanks to the TestToDo struct\n
|
||||
* To execute the Data Test it is mandatory load some thresholds that
|
||||
* are stored in the Limit File.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup limit_file Limit File
|
||||
* @ingroup mp_test
|
||||
* Production Test Limit File is a csv which contains thresholds of the data to
|
||||
* test.
|
||||
* This file can be loaded from the file system or stored as a header file
|
||||
* according to the LIMITS_H_FILE define \n
|
||||
* For each selectable test item there can be one or more associated labels
|
||||
* which store the corresponding thresholds \n
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Struct used to specify which test perform during the Mass Production Test.
|
||||
* For each test item selected in this structure, there should be one or
|
||||
* more labels associated in the Limit file from where load the thresholds
|
||||
*/
|
||||
|
||||
struct test_to_do {
|
||||
int mutual_ito_raw; /* /<check ITO Raw data in a node is
|
||||
* within the min and max value provided
|
||||
* for that node*/
|
||||
int mutual_ito_raw_adj; /* /<check ITO RawH/V data in a node is
|
||||
* within the min and max value provided
|
||||
* for that node*/
|
||||
int mutual_raw; /* /<check Raw data in a node is within the
|
||||
* min and max value provided for that node*/
|
||||
int mutual_raw_lp; /* /<check LP Raw data in a node is within the
|
||||
* min and max value provided for that node*/
|
||||
int self_force_raw; /* /<check Self Force Raw in a node is within
|
||||
* the min and max value provided for that node*/
|
||||
int self_force_raw_lp; /* /<check Self Force RawLP in a node is within
|
||||
* the min and max value provided for that node*/
|
||||
int self_sense_raw; /* /<check Self Sense Raw in a node is within
|
||||
* the min and max value provided for that node*/
|
||||
int self_sense_raw_lp; /* /<check Self Sense RawLp in a node is within
|
||||
* the min and max value provided for that node*/
|
||||
int mutual_cx_lp; /* /<check Mutual Total CX in a node is within
|
||||
* the min and max value provided for that node*/
|
||||
int mutual_cx_lp_adj; /* /<check Mutual Total CX Hor/Ver in a node is
|
||||
* within the min and max value provided for that
|
||||
* node*/
|
||||
int self_force_ix; /* /<check self Total IX force in a node is
|
||||
* within the min and max value provided for
|
||||
* that node*/
|
||||
int self_force_ix_lp; /* /<check self Total IX force LP in a node is
|
||||
* within the min and max value provided for that
|
||||
* node*/
|
||||
int self_sense_ix; /* /<check self Total IX sense in a node is
|
||||
* within the min and max value provided for
|
||||
* that node*/
|
||||
int self_sense_ix_lp; /* /<check self Total IX sense LP in a node is
|
||||
* within the min and max value provided for
|
||||
* that node*/
|
||||
};
|
||||
|
||||
|
||||
#define WAIT_FOR_FRESH_FRAMES 200
|
||||
#define WAIT_AFTER_SENSEOFF 50
|
||||
#define NO_INIT 0
|
||||
#define RETRY_INIT_BOOT 3
|
||||
|
||||
#define MS_RAW_ITO_ADJH "MS_ITO_RAW_ADJ_HOR"
|
||||
#define MS_RAW_ITO_ADJV "MS_ITO_RAW_ADJ_VER"
|
||||
#define MS_RAW_ITO_EACH_NODE_MIN "MS_ITO_RAW_MIN"
|
||||
#define MS_RAW_ITO_EACH_NODE_MAX "MS_ITO_RAW_MAX"
|
||||
#define MS_RAW_EACH_NODE_MIN "MS_RAW_MIN"
|
||||
#define MS_RAW_EACH_NODE_MAX "MS_RAW_MAX"
|
||||
#define MS_RAW_LP_EACH_NODE_MIN "MS_LP_RAW_MIN"
|
||||
#define MS_RAW_LP_EACH_NODE_MAX "MS_LP_RAW_MAX"
|
||||
#define SS_RAW_FORCE_EACH_NODE_MIN "SS_RAW_FORCE_MIN"
|
||||
#define SS_RAW_FORCE_EACH_NODE_MAX "SS_RAW_FORCE_MAX"
|
||||
#define SS_RAW_SENSE_EACH_NODE_MIN "SS_RAW_SENSE_MIN"
|
||||
#define SS_RAW_SENSE_EACH_NODE_MAX "SS_RAW_SENSE_MAX"
|
||||
#define SS_RAW_LP_FORCE_EACH_NODE_MIN "SS_LP_RAW_FORCE_MIN"
|
||||
#define SS_RAW_LP_FORCE_EACH_NODE_MAX "SS_LP_RAW_FORCE_MAX"
|
||||
#define SS_RAW_LP_SENSE_EACH_NODE_MIN "SS_LP_RAW_SENSE_MIN"
|
||||
#define SS_RAW_LP_SENSE_EACH_NODE_MAX "SS_LP_RAW_SENSE_MIN"
|
||||
#define MS_TOTAL_CX_LP_MIN "MS_LP_TOTAL_CX_MIN"
|
||||
#define MS_TOTAL_CX_LP_MAX "MS_LP_TOTAL_CX_MAX"
|
||||
#define MS_TOTAL_CX_LP_ADJH "MS_LP_TOTAL_CX_ADJ_HOR"
|
||||
#define MS_TOTAL_CX_LP_ADJV "MS_LP_TOTAL_CX_ADJ_VER"
|
||||
#define SS_FORCE_TOTAL_IX_MIN "SS_TOTAL_IX_FORCE_MIN"
|
||||
#define SS_FORCE_TOTAL_IX_MAX "SS_TOTAL_IX_FORCE_MAX"
|
||||
#define SS_FORCE_TOTAL_IX_LP_MIN "SS_LP_TOTAL_IX_FORCE_MIN"
|
||||
#define SS_FORCE_TOTAL_IX_LP_MAX "SS_LP_TOTAL_IX_FORCE_MAX"
|
||||
#define SS_SENSE_TOTAL_IX_MIN "SS_TOTAL_IX_SENSE_MIN"
|
||||
#define SS_SENSE_TOTAL_IX_MAX "SS_TOTAL_IX_SENSE_MAX"
|
||||
#define SS_SENSE_TOTAL_IX_LP_MIN "SS_LP_TOTAL_IX_SENSE_MIN"
|
||||
#define SS_SENSE_TOTAL_IX_LP_MAX "SS_LP_TOTAL_IX_SENSE_MAX"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int init_test_to_do(void);
|
||||
int parse_production_test_limits(char *path, struct limit_file *file,
|
||||
char *label, int **data, int *row, int *column);
|
||||
int read_line(char *data, char *line, int size, int *n);
|
||||
int get_limits_file(char *path, struct limit_file *file);
|
||||
int free_limits_file(struct limit_file *file);
|
||||
int free_current_limits_file(void);
|
||||
void print_frame_i8(char *label, i8 **matrix, int row, int column);
|
||||
void print_frame_short(char *label, short **matrix, int row, int column);
|
||||
void print_frame_u16(char *label, u16 **matrix, int row, int column);
|
||||
short **array_1d_to_2d_short(short *data, int size, int columns);
|
||||
i8 **array_1d_to_2d_i8(i8 *data, int size, int columns);
|
||||
u16 **array_1d_to_2d_u16(u16 *data, int size, int columns);
|
||||
|
||||
/**@}*/
|
||||
|
||||
/**@}*/
|
||||
|
||||
/** @defgroup mp_api MP API
|
||||
* @ingroup mp_test
|
||||
* Functions to execute the MP test.
|
||||
* The parameters of these functions allow to customize their behavior
|
||||
* in order to satisfy different scenarios
|
||||
* @{
|
||||
*/
|
||||
int fts_production_test_ito(char *path_limits, struct test_to_do *tests);
|
||||
int fts_production_test_ms_raw(char *path_limits, struct test_to_do *tests);
|
||||
int fts_production_test_ms_raw_lp(char *path_limits, struct test_to_do *tests);
|
||||
int fts_production_test_ss_raw(char *path_limits, struct test_to_do *tests);
|
||||
int fts_production_test_ss_raw_lp(char *path_limits, struct test_to_do *tests);
|
||||
int fts_production_test_ms_cx_lp(char *path_limits, struct test_to_do *tests);
|
||||
int fts_production_test_ss_ix(char *path_limits, struct test_to_do *tests);
|
||||
int fts_production_test_ss_ix_lp(char *path_limits, struct test_to_do *tests);
|
||||
int fts_production_test_main(char *path_limits, struct test_to_do *tests,
|
||||
int do_init);
|
||||
/** @}*/
|
||||
|
||||
|
||||
#endif
|
26819
drivers/input/touchscreen/fst2/fts_limits.h
Normal file
26819
drivers/input/touchscreen/fst2/fts_limits.h
Normal file
File diff suppressed because it is too large
Load Diff
1086
drivers/input/touchscreen/fst2/fts_proc.c
Normal file
1086
drivers/input/touchscreen/fst2/fts_proc.c
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user