2 * Elan I2C/SMBus Touchpad driver
4 * Copyright (c) 2013 ELAN Microelectronics Corp.
6 * Author: 林政維 (Duson Lin) <dusonlin@emc.com.tw>
8 * Based on cyapa driver:
9 * copyright (c) 2011-2012 Cypress Semiconductor, Inc.
10 * copyright (c) 2011-2012 Google, Inc.
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License version 2 as published
14 * by the Free Software Foundation.
16 * Trademarks are the property of their respective owners.
22 #include <linux/types.h>
24 #define ETP_ENABLE_ABS 0x0001
25 #define ETP_ENABLE_CALIBRATE 0x0002
26 #define ETP_DISABLE_CALIBRATE 0x0000
27 #define ETP_DISABLE_POWER 0x0001
29 /* IAP Firmware handling */
30 #define ETP_FW_NAME "elan_i2c.bin"
31 #define ETP_IAP_START_ADDR 0x0083
32 #define ETP_FW_IAP_PAGE_ERR (1 << 5)
33 #define ETP_FW_IAP_INTF_ERR (1 << 4)
34 #define ETP_FW_PAGE_SIZE 64
35 #define ETP_FW_VAILDPAGE_COUNT 768
36 #define ETP_FW_SIGNATURE_SIZE 6
37 #define ETP_FW_SIGNATURE_ADDRESS 0xBFFA
47 struct elan_transport_ops
{
48 int (*initialize
)(struct i2c_client
*client
);
49 int (*sleep_control
)(struct i2c_client
*, bool sleep
);
50 int (*power_control
)(struct i2c_client
*, bool enable
);
51 int (*set_mode
)(struct i2c_client
*client
, u8 mode
);
53 int (*calibrate
)(struct i2c_client
*client
);
54 int (*calibrate_result
)(struct i2c_client
*client
, u8
*val
);
56 int (*get_baseline_data
)(struct i2c_client
*client
,
57 bool max_baseliune
, u8
*value
);
59 int (*get_version
)(struct i2c_client
*client
, bool iap
, u8
*version
);
60 int (*get_sm_version
)(struct i2c_client
*client
, u8
*version
);
61 int (*get_checksum
)(struct i2c_client
*client
, bool iap
, u16
*csum
);
62 int (*get_product_id
)(struct i2c_client
*client
, u8
*id
);
64 int (*get_max
)(struct i2c_client
*client
,
65 unsigned int *max_x
, unsigned int *max_y
);
66 int (*get_resolution
)(struct i2c_client
*client
,
67 u8
*hw_res_x
, u8
*hw_res_y
);
68 int (*get_num_traces
)(struct i2c_client
*client
,
69 unsigned int *x_tracenum
,
70 unsigned int *y_tracenum
);
72 int (*iap_get_mode
)(struct i2c_client
*client
, enum tp_mode
*mode
);
73 int (*iap_reset
)(struct i2c_client
*client
);
75 int (*prepare_fw_update
)(struct i2c_client
*client
);
76 int (*write_fw_block
)(struct i2c_client
*client
,
77 const u8
*page
, u16 checksum
, int idx
);
78 int (*finish_fw_update
)(struct i2c_client
*client
,
79 struct completion
*reset_done
);
81 int (*get_report
)(struct i2c_client
*client
, u8
*report
);
84 extern const struct elan_transport_ops elan_smbus_ops
, elan_i2c_ops
;
86 #endif /* _ELAN_I2C_H */