Skip to content

Commit

Permalink
Input: synaptics-rmi4 - limit the range of what GPIOs are buttons
Browse files Browse the repository at this point in the history
By convention the first 6 bits of F30 Ctrl 2 and 3 are used to signify
GPIOs which are connected to buttons. Additional GPIOs may be used as
input GPIOs to signal the touch controller of some event
(ie disable touchpad). These additional GPIOs may meet the criteria of
a button in rmi_f30_is_valid_button() but should not be considered
buttons. This patch limits the GPIOs which are mapped to buttons to just
the first 6.

Signed-off-by: Andrew Duggan <[email protected]>
Reported-by: Daniel Martin <[email protected]>
Tested-by: Daniel Martin <[email protected]>
Acked-By: Benjamin Tissoires <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
  • Loading branch information
aduggan-syna authored and dtor committed Oct 27, 2017
1 parent a508294 commit 3e64fcb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/input/rmi4/rmi_f30.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,17 +232,18 @@ static int rmi_f30_map_gpios(struct rmi_function *fn,
unsigned int trackstick_button = BTN_LEFT;
bool button_mapped = false;
int i;
int button_count = min_t(u8, f30->gpioled_count, TRACKSTICK_RANGE_END);

f30->gpioled_key_map = devm_kcalloc(&fn->dev,
f30->gpioled_count,
button_count,
sizeof(f30->gpioled_key_map[0]),
GFP_KERNEL);
if (!f30->gpioled_key_map) {
dev_err(&fn->dev, "Failed to allocate gpioled map memory.\n");
return -ENOMEM;
}

for (i = 0; i < f30->gpioled_count; i++) {
for (i = 0; i < button_count; i++) {
if (!rmi_f30_is_valid_button(i, f30->ctrl))
continue;

Expand Down

0 comments on commit 3e64fcb

Please sign in to comment.