/* * Elan I2C/SMBus Touchpad driver * * Copyright (c) 2013 ELAN Microelectronics Corp. * * Author: 林政維 (Duson Lin) <dusonlin@emc.com.tw> * Author: KT Liao <kt.liao@emc.com.tw> * Version: 1.6.3 * * Based on cyapa driver: * copyright (c) 2011-2012 Cypress Semiconductor, Inc. * copyright (c) 2011-2012 Google, Inc. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation. * * Trademarks are the property of their respective owners. */#include<linux/acpi.h>#include<linux/delay.h>#include<linux/device.h>#include<linux/firmware.h>#include<linux/i2c.h>#include<linux/init.h>#include<linux/input/mt.h>#include<linux/interrupt.h>#include<linux/irq.h>#include<linux/module.h>#include<linux/slab.h>#include<linux/kernel.h>#include<linux/sched.h>#include<linux/input.h>#include<linux/uaccess.h>#include<linux/jiffies.h>#include<linux/completion.h>#include<linux/of.h>#include<linux/property.h>#include<linux/regulator/consumer.h>#include<asm/unaligned.h>#include"elan_i2c.h"#define DRIVER_NAME "elan_i2c"#define ELAN_VENDOR_ID 0x04f3#define ETP_MAX_PRESSURE 255#define ETP_FWIDTH_REDUCE 90#define ETP_FINGER_WIDTH 15#define ETP_RETRY_COUNT 3#define ETP_MAX_FINGERS 5#define ETP_FINGER_DATA_LEN 5#define ETP_REPORT_ID 0x5D#define ETP_TP_REPORT_ID 0x5E#define ETP_REPORT_ID_OFFSET 2#define ETP_TOUCH_INFO_OFFSET 3#define ETP_FINGER_DATA_OFFSET 4#define ETP_HOVER_INFO_OFFSET 30#define ETP_MAX_REPORT_LEN 34/* The main device structure */structelan_tp_data{structi2c_client*client;structinput_dev*input;structinput_dev*tp_input;/* trackpoint input node */structregulator*vcc;conststructelan_transport_ops*ops;/* for fw update */structcompletionfw_completion;boolin_fw_update;structmutexsysfs_mutex;unsignedintmax_x;unsignedintmax_y;unsignedintwidth_x;unsignedintwidth_y;unsignedintx_res;unsignedinty_res;u8pattern;u16product_id;u8fw_version;u8sm_version;u8iap_version;u16fw_checksum;intpressure_adjustment;u8mode;u16ic_type;u16