static struct i2c_board_info rmi4_i2c_devices[] = { { I2C_BOARD_INFO("rmi_i2c", SYNAPTIC_ADDR), .platform_data = &rmi4_platformdata, .irq = MSM_GPIO_TO_INT(TOUCH_INT_GPIO), }, };
static struct rmi_device_platform_data rmi4_platformdata = { .driver_name = "rmi_controller", .level_triggered = 1, .attn_gpio = SYNAPTIC_ATTEN_GPIO, .attn_polarity = RMI_ATTN_ACTIVE_LOW, .gpio_config = synaptic_ic_gpio_init, .f1a_button_map = &synaptic_rmi4_button_map, #ifdef CONFIG_RMI4_VIRTUAL_BUTTON .virtualbutton_map = &tm1559_virtualbutton_map, #endif };
static struct i2c_driver rmi_i2c_driver = { .driver = { .owner = THIS_MODULE, .name = "rmi_i2c" // Name should be matched to platform device }, .id_table = rmi_id, .probe = rmi_i2c_probe, .remove = __devexit_p(rmi_i2c_remove), .shutdown = rmi_i2c_shutdown, }; static int __init rmi_i2c_init(void) { int ret; ret = i2c_add_driver(&rmi_i2c_driver); return ret; } static void __exit rmi_i2c_exit(void) { i2c_del_driver(&rmi_i2c_driver); } module_init(rmi_i2c_init); module_exit(rmi_i2c_exit); MODULE_AUTHOR("Christopher Heiny <[email protected]>"); MODULE_DESCRIPTION("RMI I2C driver"); MODULE_LICENSE("GPL"); MODULE_VERSION(RMI_DRIVER_VERSION);
Function$1A query registers
F1A_0D_Query0 — MaxButtonCount — BIT[2:0]
F1A_0D_Query1 —
Has Filter Strength — BIT[7]
Has Strongest Button Hysteresis — BIT[6]
Has Release Threshold — BIT[5]
Has PerButton Threshold — BIT[4]
Has TxRx Mapping — BIT[3]
Has Multi Button Select — BIT[2]
Has Interrupt Enable — BIT[1]
Has General Control — BIT[0]
These registers control the operation of the capacitive buttons.
F1A_0D_Ctrl0: general control
The fields in this register are defined as follows:
MultiButtonReporting (F1A_0D_Ctrl0, bits 1:0)
This 2-bit field describes how buttons in the MultiButton group (seeF1A_0D_Ctrl2) will be
reported.
00: Unrestricted buttons
The user can touch the buttons in any combination, and every touchedbutton’sBtn bit (in
the F1A_0D_Data0.* registers) will be set to ‘1’.
01: Reserved
10: Strongest button only
The user is expected to touch only one button in the MultiButton group ata time. If
multiple buttons in the group are touched, only the Btn bit correspondingto the button
with the strongest finger signal will be set to ‘1’.
11: First button only
The user is expected to touch only one button in the MultiButton group ata time. When a
button is touched, its Btn bit will be set to 1. Until that button is released, nootherBtn bits
will be set even if additional buttons in the group are touched.
FilterMode (F1A_0D_Ctrl0, bits 3:2)
Capacitive buttons are always filtered to reduce the effects of electricalnoise. The filter may be
customized for specific noise environments. The strength of the filter canbe adjusted using
F1A_0D_Ctrl08.
00: Standard filter
In most environments, this filter provides the best balance between buttonresponsiveness
and noise rejection.
01: Debounce filter
In environments with unusually high levels of electrical noise, thisfilter provides higher
levels of noise rejection, but at the cost of increased time to reportbutton touches and
releases. When this filter is enabled, very fast button taps might not bedetected. This filter
should be used only when the standard filter is unsuitable.
10, 11: Reserved
F1A_0D_Ctrl1.*: button interrupt enable
The bits in this register determine whether the ATTN interrupt isgenerated in response to button touches
and releases.
The register contains one bit per button, defined as follows:
IntEnBtn0 (F1A_0D_Ctrl1.0, bit 0)
This bit controls the behavior of the ATTN interrupt in response to Button0.
When this bit is set to 1, an ATTN interrupt is generated whenever theBtn0 bit changes state.
When this bit is set to 0, an ATTN interrupt is not generated when theBtn0 bit changes state.
Additional IntEnBtnn bits control the behavior of the ATTN interrupt inresponse to their corresponding
Btn bits.
F1A_0D_Ctrl2.*: multi button group selection
The bits in this register specify which buttons are members of theMultiButton group. The register contains
one bit per button, defined as follows:
MultiBtn0 (F1A_0D_Ctrl2.0, bit 0)
This bit specifies whether Button 0 is affected by the MultiButtonReportingsetting. When thisbit
is set to ‘1’, Button 0 is a member of the MultiButton group and istherefore affected by the
MultiButtonReporting setting. When this bit is set to ‘0’,Button 0 is not a member of the
MultiButton group and so is not affected by the MultiButtonReportingsetting.
Additional MultiBtn bits specify whether their corresponding buttons aremembers of the MultiButton
group.
F1A_0D_Ctrl3.* and F1A_0D_Ctrl4.*: electrode mapping
Each capacitive button is located at the intersection of a transmitter(Tx) electrode and a receiver (Rx)
electrode. These registers specify the location of each button. There isone pair of registers per button,
defined as follows:
TransmitterBtn0 (F1A_0D_Ctrl3.0)
This register specifies the transmitter electrode which corresponds toButton 0. A value of 0xFF in
this field indicates that Button 0 is disabled.
ReceiverBtn0 (F1A_0D_Ctrl4.0)
This register specifies the receiver electrode which corresponds to Button0.
Additional pairs of TransmitterBtnn and ReceiverBtnn registersspecify the locations of their
correspondingbuttons.
F1A_0D_Ctrl5.*: button touch threshold
These registers adjust button sensitivity. There is one register perbutton, defined as follows:
ThresholdBtn0 (F1A_0D_Ctrl5.0)
This register specifies the Button 0 touch threshold. The value isunsigned, from 0 to 255.
Additional ThresholdBtnregisters adjustthe threshold of their corresponding buttons.
F1A_0D_Ctrl6: release threshold
This register is defined as follows:
ButtonReleaseThreshold (F1A_0D_Ctrl6)
This register sets the release threshold for all buttons. It is thepercentage of the touch threshold at
which a button is determined to not be pressed. The percentage is storedas a 0.8 unsigned fixedpoint
value.
F1A_0D_Ctrl7: strongest-button hysteresis
This register is defined as follows:
StrongestButtonHysteresis (F1A_0D_Ctrl6)
This register has an effect only when MultiButtonReportingis set to “StrongestButton Only”
mode, and it only affects buttons in the MultiButton group. It specifiesthe amount by which the
finger signal of a newly-touched button must exceed that of thecurrently-reported button in order
for the new button to be reported instead of the current button. When thisfield is set to a low value,
a new button will be reported if its finger signal is only slightlystronger than that of the currentlyreported
button. When this field is set to a high value, a new button will not bereported unless its
finger signal ismuch stronger than that of the currently-reported button.
F1A_0D_Ctrl8: filter strength
This register is defined as follows:
FilterStrength (F1A_0D_Ctrl8)
This register affects the strength of the filter selected in FilterMode (F1A_0D_Ctrl0,bits 3:2).
Each filter mode may use this register differently, but increasing thevalue of this register always
increases theamount of filtering performed on 0-D buttons.
This registerreports the state of the capacitive buttons
The bits in this register indicate the touched/released state of eachbutton. The register contains one bit per
button, defined as follows:
Btn0 (F1A_0D_Data0, bit 0)
When this bit reports as ‘1’, button 0 is touched. When this bit reportsas ‘0’, button 0 is not
touched.
Btn1 (F1A_0D_Data0, bit 1)
When this bit reports as ‘1’, button 1 is touched. When this bit reportsas ‘0’, button 1 is not
touched.
Btn2 (F1A_0D_Data0, bit 2)
When this bit reports as ‘1’, button 2 is touched. When this bit reportsas ‘0’, button 2 is not
touched.
Btn3 (F1A_0D_Data0, bit 3)
When this bit reports as ‘1’, button 3 is touched. When this bit reportsas ‘0’, button 3 is not
touched.
Btn4 (F1A_0D_Data0, bit 4)
When this bit reports as ‘1’, button 4 is touched. When this bit reportsas ‘0’, button 4 is not
touched.
Btn5 (F1A_0D_Data0, bit 5)
When this bit reports as ‘1’, button 5 is touched. When this bit reportsas ‘0’, button 5 is not
touched.
Function $1A has one interrupt source. Function $1A asserts an interruptrequest whenever both of these
conditions are met:
A Btnn bit changes from ‘0’ to ‘1’ or from ‘1’ to ‘0’.
The corresponding IntEnBtnn bit is set to ‘1’.
Touch button only need a pad on the PCB to be button, so it makes the button height nearly be zero.
触摸按键只需要一个薄薄的铜箔层来做按键,所以它使按键厚度几乎为零。