提交 ae8e80c5 编写于 作者: H Hans de Goede 提交者: Dmitry Torokhov

Input: goodix - use input_copy_abs() helper

Use the new input_copy_abs() helper and move the 2 input_abs_set_res()
calls up to be directly after the 2 input_copy_abs() calls, so that
the calls initializing the X and Y axis are all together.
Signed-off-by: NHans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20220131143539.109142-3-hdegoede@redhat.comSigned-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
上级 cb66b9ba
...@@ -306,23 +306,8 @@ static struct input_dev *goodix_create_pen_input(struct goodix_ts_data *ts) ...@@ -306,23 +306,8 @@ static struct input_dev *goodix_create_pen_input(struct goodix_ts_data *ts)
if (!input) if (!input)
return NULL; return NULL;
input_alloc_absinfo(input); input_copy_abs(input, ABS_X, ts->input_dev, ABS_MT_POSITION_X);
if (!input->absinfo) { input_copy_abs(input, ABS_Y, ts->input_dev, ABS_MT_POSITION_Y);
input_free_device(input);
return NULL;
}
input->absinfo[ABS_X] = ts->input_dev->absinfo[ABS_MT_POSITION_X];
input->absinfo[ABS_Y] = ts->input_dev->absinfo[ABS_MT_POSITION_Y];
__set_bit(ABS_X, input->absbit);
__set_bit(ABS_Y, input->absbit);
input_set_abs_params(input, ABS_PRESSURE, 0, 255, 0, 0);
input_set_capability(input, EV_KEY, BTN_TOUCH);
input_set_capability(input, EV_KEY, BTN_TOOL_PEN);
input_set_capability(input, EV_KEY, BTN_STYLUS);
input_set_capability(input, EV_KEY, BTN_STYLUS2);
__set_bit(INPUT_PROP_DIRECT, input->propbit);
/* /*
* The resolution of these touchscreens is about 10 units/mm, the actual * The resolution of these touchscreens is about 10 units/mm, the actual
* resolution does not matter much since we set INPUT_PROP_DIRECT. * resolution does not matter much since we set INPUT_PROP_DIRECT.
...@@ -330,6 +315,13 @@ static struct input_dev *goodix_create_pen_input(struct goodix_ts_data *ts) ...@@ -330,6 +315,13 @@ static struct input_dev *goodix_create_pen_input(struct goodix_ts_data *ts)
*/ */
input_abs_set_res(input, ABS_X, 10); input_abs_set_res(input, ABS_X, 10);
input_abs_set_res(input, ABS_Y, 10); input_abs_set_res(input, ABS_Y, 10);
input_set_abs_params(input, ABS_PRESSURE, 0, 255, 0, 0);
input_set_capability(input, EV_KEY, BTN_TOUCH);
input_set_capability(input, EV_KEY, BTN_TOOL_PEN);
input_set_capability(input, EV_KEY, BTN_STYLUS);
input_set_capability(input, EV_KEY, BTN_STYLUS2);
__set_bit(INPUT_PROP_DIRECT, input->propbit);
input->name = "Goodix Active Pen"; input->name = "Goodix Active Pen";
input->phys = "input/pen"; input->phys = "input/pen";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册