2 * Copyright (c) 2011-2016 Synaptics Incorporated
3 * Copyright (c) 2011 Unixphere
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
13 #include <linux/ctype.h>
14 #include <linux/hrtimer.h>
15 #include <linux/ktime.h>
16 #include <linux/input.h>
19 #define RMI_DRIVER_VERSION "2.0"
21 #define SYNAPTICS_INPUT_DEVICE_NAME "Synaptics RMI4 Touch Sensor"
22 #define SYNAPTICS_VENDOR_ID 0x06cb
24 #define GROUP(_attrs) { \
28 #define PDT_PROPERTIES_LOCATION 0x00EF
29 #define BSR_LOCATION 0x00FE
31 #define RMI_PDT_PROPS_HAS_BSR 0x02
33 #define NAME_BUFFER_SIZE 256
35 #define RMI_PDT_ENTRY_SIZE 6
36 #define RMI_PDT_FUNCTION_VERSION_MASK 0x60
37 #define RMI_PDT_INT_SOURCE_COUNT_MASK 0x07
39 #define PDT_START_SCAN_LOCATION 0x00e9
40 #define PDT_END_SCAN_LOCATION 0x0005
41 #define RMI4_END_OF_PDT(id) ((id) == 0x00 || (id) == 0xff)
49 u8 interrupt_source_count
;
54 int rmi_read_pdt_entry(struct rmi_device
*rmi_dev
, struct pdt_entry
*entry
,
57 #define RMI_REG_DESC_PRESENSE_BITS (32 * BITS_PER_BYTE)
58 #define RMI_REG_DESC_SUBPACKET_BITS (37 * BITS_PER_BYTE)
60 /* describes a single packet register */
61 struct rmi_register_desc_item
{
63 unsigned long reg_size
;
65 unsigned long subpacket_map
[BITS_TO_LONGS(
66 RMI_REG_DESC_SUBPACKET_BITS
)];
70 * describes the packet registers for a particular type
71 * (ie query, control, data)
73 struct rmi_register_descriptor
{
74 unsigned long struct_size
;
75 unsigned long presense_map
[BITS_TO_LONGS(RMI_REG_DESC_PRESENSE_BITS
)];
77 struct rmi_register_desc_item
*registers
;
80 int rmi_read_register_desc(struct rmi_device
*d
, u16 addr
,
81 struct rmi_register_descriptor
*rdesc
);
82 const struct rmi_register_desc_item
*rmi_get_register_desc_item(
83 struct rmi_register_descriptor
*rdesc
, u16 reg
);
86 * Calculate the total size of all of the registers described in the
89 size_t rmi_register_desc_calc_size(struct rmi_register_descriptor
*rdesc
);
90 int rmi_register_desc_calc_reg_offset(
91 struct rmi_register_descriptor
*rdesc
, u16 reg
);
92 bool rmi_register_desc_has_subpacket(const struct rmi_register_desc_item
*item
,
95 bool rmi_is_physical_driver(struct device_driver
*);
96 int rmi_register_physical_driver(void);
97 void rmi_unregister_physical_driver(void);
99 char *rmi_f01_get_product_ID(struct rmi_function
*fn
);
101 extern struct rmi_function_handler rmi_f01_handler
;
102 extern struct rmi_function_handler rmi_f11_handler
;
103 extern struct rmi_function_handler rmi_f12_handler
;
104 extern struct rmi_function_handler rmi_f30_handler
;