linux/drivers/input/touchscreen/elants_i2c.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Elan Microelectronics touch panels with I2C interface
 *
 * Copyright (C) 2014 Elan Microelectronics Corporation.
 * Scott Liu <[email protected]>
 *
 * This code is partly based on hid-multitouch.c:
 *
 *  Copyright (c) 2010-2012 Stephane Chatty <[email protected]>
 *  Copyright (c) 2010-2012 Benjamin Tissoires <[email protected]>
 *  Copyright (c) 2010-2012 Ecole Nationale de l'Aviation Civile, France
 *
 * This code is partly based on i2c-hid.c:
 *
 * Copyright (c) 2012 Benjamin Tissoires <[email protected]>
 * Copyright (c) 2012 Ecole Nationale de l'Aviation Civile, France
 * Copyright (c) 2012 Red Hat, Inc
 */


#include <linux/bits.h>
#include <linux/module.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/platform_device.h>
#include <linux/async.h>
#include <linux/i2c.h>
#include <linux/delay.h>
#include <linux/uaccess.h>
#include <linux/buffer_head.h>
#include <linux/slab.h>
#include <linux/firmware.h>
#include <linux/input/mt.h>
#include <linux/input/touchscreen.h>
#include <linux/acpi.h>
#include <linux/of.h>
#include <linux/pm_wakeirq.h>
#include <linux/gpio/consumer.h>
#include <linux/regulator/consumer.h>
#include <linux/uuid.h>
#include <linux/unaligned.h>

/* Device, Driver information */
#define DEVICE_NAME

/* Convert from rows or columns into resolution */
#define ELAN_TS_RESOLUTION(n, m)

/* FW header data */
#define HEADER_SIZE
#define FW_HDR_TYPE
#define FW_HDR_COUNT
#define FW_HDR_LENGTH

/* Buffer mode Queue Header information */
#define QUEUE_HEADER_SINGLE
#define QUEUE_HEADER_NORMAL
#define QUEUE_HEADER_WAIT
#define QUEUE_HEADER_NORMAL2

/* Command header definition */
#define CMD_HEADER_WRITE
#define CMD_HEADER_READ
#define CMD_HEADER_6B_READ
#define CMD_HEADER_ROM_READ
#define CMD_HEADER_RESP
#define CMD_HEADER_6B_RESP
#define CMD_HEADER_ROM_RESP
#define CMD_HEADER_HELLO
#define CMD_HEADER_REK

/* FW position data */
#define PACKET_SIZE_OLD
#define PACKET_SIZE
#define MAX_CONTACT_NUM
#define FW_POS_HEADER
#define FW_POS_STATE
#define FW_POS_TOTAL
#define FW_POS_XY
#define FW_POS_TOOL_TYPE
#define FW_POS_CHECKSUM
#define FW_POS_WIDTH
#define FW_POS_PRESSURE

#define HEADER_REPORT_10_FINGER

/* Header (4 bytes) plus 3 full 10-finger packets */
#define MAX_PACKET_SIZE

#define BOOT_TIME_DELAY_MS

/* FW read command, 0x53 0x?? 0x0, 0x01 */
#define E_ELAN_INFO_FW_VER
#define E_ELAN_INFO_BC_VER
#define E_ELAN_INFO_X_RES
#define E_ELAN_INFO_Y_RES
#define E_ELAN_INFO_REK
#define E_ELAN_INFO_TEST_VER
#define E_ELAN_INFO_FW_ID
#define E_INFO_OSR
#define E_INFO_PHY_SCAN
#define E_INFO_PHY_DRIVER

/* FW write command, 0x54 0x?? 0x0, 0x01 */
#define E_POWER_STATE_SLEEP
#define E_POWER_STATE_RESUME

#define MAX_RETRIES
#define MAX_FW_UPDATE_RETRIES

#define ELAN_FW_PAGESIZE

/* calibration timeout definition */
#define ELAN_CALI_TIMEOUT_MSEC

#define ELAN_POWERON_DELAY_USEC
#define ELAN_RESET_DELAY_MSEC

/* FW boot code version */
#define BC_VER_H_BYTE_FOR_EKTH3900x1_I2C
#define BC_VER_H_BYTE_FOR_EKTH3900x2_I2C
#define BC_VER_H_BYTE_FOR_EKTH3900x3_I2C
#define BC_VER_H_BYTE_FOR_EKTH5312x1_I2C
#define BC_VER_H_BYTE_FOR_EKTH5312x2_I2C
#define BC_VER_H_BYTE_FOR_EKTH5312cx1_I2C
#define BC_VER_H_BYTE_FOR_EKTH5312cx2_I2C
#define BC_VER_H_BYTE_FOR_EKTH5312x1_I2C_USB
#define BC_VER_H_BYTE_FOR_EKTH5312x2_I2C_USB
#define BC_VER_H_BYTE_FOR_EKTH5312cx1_I2C_USB
#define BC_VER_H_BYTE_FOR_EKTH5312cx2_I2C_USB

enum elants_chip_id {};

enum elants_state {};

enum elants_iap_mode {};

/* struct elants_data - represents state of Elan touchscreen device */
struct elants_data {};

static int elants_i2c_send(struct i2c_client *client,
			   const void *data, size_t size)
{}

static int elants_i2c_read(struct i2c_client *client, void *data, size_t size)
{}

static int elants_i2c_execute_command(struct i2c_client *client,
				      const u8 *cmd, size_t cmd_size,
				      u8 *resp, size_t resp_size,
				      int retries, const char *cmd_name)
{}

static int elants_i2c_calibrate(struct elants_data *ts)
{}

static int elants_i2c_sw_reset(struct i2c_client *client)
{}

static u16 elants_i2c_parse_version(u8 *buf)
{}

static int elants_i2c_query_hw_version(struct elants_data *ts)
{}

static int elants_i2c_query_fw_version(struct elants_data *ts)
{}

static int elants_i2c_query_test_version(struct elants_data *ts)
{}

static int elants_i2c_query_bc_version(struct elants_data *ts)
{}

static int elants_i2c_query_ts_info_ektf(struct elants_data *ts)
{}

static int elants_i2c_query_ts_info_ekth(struct elants_data *ts)
{}

static int elants_i2c_fastboot(struct i2c_client *client)
{}

static int elants_i2c_initialize(struct elants_data *ts)
{}

/*
 * Firmware update interface.
 */

static int elants_i2c_fw_write_page(struct i2c_client *client,
				    const void *page)
{}

static int elants_i2c_validate_remark_id(struct elants_data *ts,
					 const struct firmware *fw)
{}

static bool elants_i2c_should_check_remark_id(struct elants_data *ts)
{}

static int elants_i2c_do_update_firmware(struct i2c_client *client,
					 const struct firmware *fw,
					 bool force)
{}

static int elants_i2c_fw_update(struct elants_data *ts)
{}

/*
 * Event reporting.
 */

static void elants_i2c_mt_event(struct elants_data *ts, u8 *buf,
				size_t packet_size)
{}

static u8 elants_i2c_calculate_checksum(u8 *buf)
{}

static void elants_i2c_event(struct elants_data *ts, u8 *buf,
			     size_t packet_size)
{}

static irqreturn_t elants_i2c_irq(int irq, void *_dev)
{}

/*
 * sysfs interface
 */
static ssize_t calibrate_store(struct device *dev,
			       struct device_attribute *attr,
			       const char *buf, size_t count)
{}

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

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

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

static DEVICE_ATTR_WO(calibrate);
static DEVICE_ATTR(iap_mode, S_IRUGO, show_iap_mode, NULL);
static DEVICE_ATTR(calibration_count, S_IRUGO, show_calibration_count, NULL);
static DEVICE_ATTR(update_fw, S_IWUSR, NULL, write_update_fw);

struct elants_version_attribute {};

#define __ELANTS_FIELD_SIZE(_field)
#define __ELANTS_VERIFY_SIZE(_field)
#define ELANTS_VERSION_ATTR(_field)

static ssize_t elants_version_attribute_show(struct device *dev,
					     struct device_attribute *dattr,
					     char *buf)
{}

static ELANTS_VERSION_ATTR(fw_version);
static ELANTS_VERSION_ATTR(hw_version);
static ELANTS_VERSION_ATTR(test_version);
static ELANTS_VERSION_ATTR(solution_version);
static ELANTS_VERSION_ATTR(bc_version);
static ELANTS_VERSION_ATTR(iap_version);

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

static int elants_i2c_power_on(struct elants_data *ts)
{}

static void elants_i2c_power_off(void *_data)
{}

#ifdef CONFIG_ACPI
static const struct acpi_device_id i2c_hid_ids[] =;

static const guid_t i2c_hid_guid =;

static bool elants_acpi_is_hid_device(struct device *dev)
{}
#else
static bool elants_acpi_is_hid_device(struct device *dev)
{
	return false;
}
#endif

static int elants_i2c_probe(struct i2c_client *client)
{}

static int elants_i2c_suspend(struct device *dev)
{}

static int elants_i2c_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(elants_i2c_pm_ops,
				elants_i2c_suspend, elants_i2c_resume);

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

#ifdef CONFIG_ACPI
static const struct acpi_device_id elants_acpi_id[] =;
MODULE_DEVICE_TABLE(acpi, elants_acpi_id);
#endif

#ifdef CONFIG_OF
static const struct of_device_id elants_of_match[] =;
MODULE_DEVICE_TABLE(of, elants_of_match);
#endif

static struct i2c_driver elants_i2c_driver =;
module_i2c_driver();

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