linux/drivers/input/touchscreen/wdt87xx_i2c.c

/*
 * Weida HiTech WDT87xx TouchScreen I2C driver
 *
 * Copyright (c) 2015  Weida Hi-Tech Co., Ltd.
 * HN Chen <[email protected]>
 *
 * This software is licensed under the terms of the GNU General Public
 * License, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 */

#include <linux/i2c.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/irq.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/firmware.h>
#include <linux/input/mt.h>
#include <linux/acpi.h>
#include <linux/unaligned.h>

#define WDT87XX_NAME
#define WDT87XX_FW_NAME
#define WDT87XX_CFG_NAME

#define MODE_ACTIVE
#define MODE_READY
#define MODE_IDLE
#define MODE_SLEEP
#define MODE_STOP

#define WDT_MAX_FINGER
#define WDT_RAW_BUF_COUNT
#define WDT_V1_RAW_BUF_COUNT
#define WDT_FIRMWARE_ID

#define PG_SIZE
#define MAX_RETRIES

#define MAX_UNIT_AXIS

#define PKT_READ_SIZE
#define PKT_WRITE_SIZE

/* the finger definition of the report event */
#define FINGER_EV_OFFSET_ID
#define FINGER_EV_OFFSET_X
#define FINGER_EV_OFFSET_Y
#define FINGER_EV_SIZE

#define FINGER_EV_V1_OFFSET_ID
#define FINGER_EV_V1_OFFSET_W
#define FINGER_EV_V1_OFFSET_P
#define FINGER_EV_V1_OFFSET_X
#define FINGER_EV_V1_OFFSET_Y
#define FINGER_EV_V1_SIZE

/* The definition of a report packet */
#define TOUCH_PK_OFFSET_REPORT_ID
#define TOUCH_PK_OFFSET_EVENT
#define TOUCH_PK_OFFSET_SCAN_TIME
#define TOUCH_PK_OFFSET_FNGR_NUM

#define TOUCH_PK_V1_OFFSET_REPORT_ID
#define TOUCH_PK_V1_OFFSET_EVENT
#define TOUCH_PK_V1_OFFSET_SCAN_TIME
#define TOUCH_PK_V1_OFFSET_FNGR_NUM

/* The definition of the controller parameters */
#define CTL_PARAM_OFFSET_FW_ID
#define CTL_PARAM_OFFSET_PLAT_ID
#define CTL_PARAM_OFFSET_XMLS_ID1
#define CTL_PARAM_OFFSET_XMLS_ID2
#define CTL_PARAM_OFFSET_PHY_CH_X
#define CTL_PARAM_OFFSET_PHY_CH_Y
#define CTL_PARAM_OFFSET_PHY_X0
#define CTL_PARAM_OFFSET_PHY_X1
#define CTL_PARAM_OFFSET_PHY_Y0
#define CTL_PARAM_OFFSET_PHY_Y1
#define CTL_PARAM_OFFSET_PHY_W
#define CTL_PARAM_OFFSET_PHY_H
#define CTL_PARAM_OFFSET_FACTOR

/* The definition of the device descriptor */
#define WDT_GD_DEVICE
#define DEV_DESC_OFFSET_VID
#define DEV_DESC_OFFSET_PID

/* Communication commands */
#define PACKET_SIZE
#define VND_REQ_READ
#define VND_READ_DATA
#define VND_REQ_WRITE

#define VND_CMD_START
#define VND_CMD_STOP
#define VND_CMD_RESET

#define VND_CMD_ERASE

#define VND_GET_CHECKSUM

#define VND_SET_DATA
#define VND_SET_COMMAND_DATA
#define VND_SET_CHECKSUM_CALC
#define VND_SET_CHECKSUM_LENGTH

#define VND_CMD_SFLCK
#define VND_CMD_SFUNL

#define CMD_SFLCK_KEY
#define CMD_SFUNL_KEY

#define STRIDX_PLATFORM_ID
#define STRIDX_PARAMETERS

#define CMD_BUF_SIZE
#define PKT_BUF_SIZE

/* The definition of the command packet */
#define CMD_REPORT_ID_OFFSET
#define CMD_TYPE_OFFSET
#define CMD_INDEX_OFFSET
#define CMD_KEY_OFFSET
#define CMD_LENGTH_OFFSET
#define CMD_DATA_OFFSET

/* The definition of firmware chunk tags */
#define FOURCC_ID_RIFF
#define FOURCC_ID_WHIF
#define FOURCC_ID_FRMT
#define FOURCC_ID_FRWR
#define FOURCC_ID_CNFG

#define CHUNK_ID_FRMT
#define CHUNK_ID_FRWR
#define CHUNK_ID_CNFG

#define FW_FOURCC1_OFFSET
#define FW_SIZE_OFFSET
#define FW_FOURCC2_OFFSET
#define FW_PAYLOAD_OFFSET

#define FW_CHUNK_ID_OFFSET
#define FW_CHUNK_SIZE_OFFSET
#define FW_CHUNK_TGT_START_OFFSET
#define FW_CHUNK_PAYLOAD_LEN_OFFSET
#define FW_CHUNK_SRC_START_OFFSET
#define FW_CHUNK_VERSION_OFFSET
#define FW_CHUNK_ATTR_OFFSET
#define FW_CHUNK_PAYLOAD_OFFSET

/* Controller requires minimum 300us between commands */
#define WDT_COMMAND_DELAY_MS
#define WDT_FLASH_WRITE_DELAY_MS
#define WDT_FLASH_ERASE_DELAY_MS
#define WDT_FW_RESET_TIME

struct wdt87xx_sys_param {};

struct wdt87xx_data {};

static int wdt87xx_i2c_xfer(struct i2c_client *client,
			    void *txdata, size_t txlen,
			    void *rxdata, size_t rxlen)
{}

static int wdt87xx_get_desc(struct i2c_client *client, u8 desc_idx,
			    u8 *buf, size_t len)
{}

static int wdt87xx_get_string(struct i2c_client *client, u8 str_idx,
			      u8 *buf, size_t len)
{}

static int wdt87xx_get_feature(struct i2c_client *client,
			       u8 *buf, size_t buf_size)
{}

static int wdt87xx_set_feature(struct i2c_client *client,
			       const u8 *buf, size_t buf_size)
{}

static int wdt87xx_send_command(struct i2c_client *client, int cmd, int value)
{}

static int wdt87xx_sw_reset(struct i2c_client *client)
{}

static const void *wdt87xx_get_fw_chunk(const struct firmware *fw, u32 id)
{}

static int wdt87xx_get_sysparam(struct i2c_client *client,
				struct wdt87xx_sys_param *param)
{}

static int wdt87xx_validate_firmware(struct wdt87xx_data *wdt,
				     const struct firmware *fw)
{}

static int wdt87xx_validate_fw_chunk(const void *data, int id)
{}

static int wdt87xx_write_data(struct i2c_client *client, const char *data,
			      u32 address, int length)
{}

static u16 misr(u16 cur_value, u8 new_value)
{}

static u16 wdt87xx_calculate_checksum(const u8 *data, size_t length)
{}

static int wdt87xx_get_checksum(struct i2c_client *client, u16 *checksum,
				u32 address, int length)
{}

static int wdt87xx_write_firmware(struct i2c_client *client, const void *chunk)
{}

static int wdt87xx_load_chunk(struct i2c_client *client,
			      const struct firmware *fw, u32 ck_id)
{}

static int wdt87xx_do_update_firmware(struct i2c_client *client,
				      const struct firmware *fw,
				      unsigned int chunk_id)
{}

static int wdt87xx_update_firmware(struct device *dev,
				   const char *fw_name, unsigned int chunk_id)
{}

static ssize_t config_csum_show(struct device *dev,
				struct device_attribute *attr, char *buf)
{}

static ssize_t fw_version_show(struct device *dev,
			       struct device_attribute *attr, char *buf)
{}

static ssize_t plat_id_show(struct device *dev,
			    struct device_attribute *attr, char *buf)
{}

static ssize_t update_config_store(struct device *dev,
				   struct device_attribute *attr,
				   const char *buf, size_t count)
{}

static ssize_t update_fw_store(struct device *dev,
			       struct device_attribute *attr,
			       const char *buf, size_t count)
{}

static DEVICE_ATTR_RO(config_csum);
static DEVICE_ATTR_RO(fw_version);
static DEVICE_ATTR_RO(plat_id);
static DEVICE_ATTR_WO(update_config);
static DEVICE_ATTR_WO(update_fw);

static struct attribute *wdt87xx_attrs[] =;
ATTRIBUTE_GROUPS();

static void wdt87xx_report_contact(struct input_dev *input,
				   struct wdt87xx_sys_param *param,
				   u8 *buf)
{}

static irqreturn_t wdt87xx_ts_interrupt(int irq, void *dev_id)
{}

static int wdt87xx_ts_create_input_device(struct wdt87xx_data *wdt)
{}

static int wdt87xx_ts_probe(struct i2c_client *client)
{}

static int wdt87xx_suspend(struct device *dev)
{}

static int wdt87xx_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(wdt87xx_pm_ops, wdt87xx_suspend, wdt87xx_resume);

static const struct i2c_device_id wdt87xx_dev_id[] =;
MODULE_DEVICE_TABLE(i2c, wdt87xx_dev_id);

static const struct acpi_device_id wdt87xx_acpi_id[] =;
MODULE_DEVICE_TABLE(acpi, wdt87xx_acpi_id);

static struct i2c_driver wdt87xx_driver =;
module_i2c_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();