提交 3e64fcbd 编写于 作者: A Andrew Duggan 提交者: Dmitry Torokhov

Input: synaptics-rmi4 - limit the range of what GPIOs are buttons

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: NAndrew Duggan <aduggan@synaptics.com>
Reported-by: NDaniel Martin <consume.noise@gmail.com>
Tested-by: NDaniel Martin <consume.noise@gmail.com>
Acked-By: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
上级 a5082947
...@@ -232,9 +232,10 @@ static int rmi_f30_map_gpios(struct rmi_function *fn, ...@@ -232,9 +232,10 @@ static int rmi_f30_map_gpios(struct rmi_function *fn,
unsigned int trackstick_button = BTN_LEFT; unsigned int trackstick_button = BTN_LEFT;
bool button_mapped = false; bool button_mapped = false;
int i; int i;
int button_count = min_t(u8, f30->gpioled_count, TRACKSTICK_RANGE_END);
f30->gpioled_key_map = devm_kcalloc(&fn->dev, f30->gpioled_key_map = devm_kcalloc(&fn->dev,
f30->gpioled_count, button_count,
sizeof(f30->gpioled_key_map[0]), sizeof(f30->gpioled_key_map[0]),
GFP_KERNEL); GFP_KERNEL);
if (!f30->gpioled_key_map) { if (!f30->gpioled_key_map) {
...@@ -242,7 +243,7 @@ static int rmi_f30_map_gpios(struct rmi_function *fn, ...@@ -242,7 +243,7 @@ static int rmi_f30_map_gpios(struct rmi_function *fn,
return -ENOMEM; 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)) if (!rmi_f30_is_valid_button(i, f30->ctrl))
continue; continue;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册