aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorMasaki Ota <masaki.ota@jp.alps.com>2015-03-27 23:44:21 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2015-04-07 11:47:42 -0400
commit8eccd39340adb502ac7131552e8a4a2f35c35e06 (patch)
tree550e2f9ee1cf6774852ea81316ec84cfb09fd9b2 /drivers/input
parent5f63e885ac32429fc1340f5a61e1484022efc773 (diff)
Input: ALPS - refactor alps_set_abs_params_mt()
In preparation for adding support for SS4 touchpads, let's split alps_set_abs_params_mt into common, v7-specific, and other protocols portions. Signed-off-by: Masaki Ota <masaki.ota@jp.alps.com> Acked-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/mouse/alps.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 27bcdbc950c9..c7924b6f7d4b 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -157,6 +157,8 @@ static void alps_set_abs_params_st(struct alps_data *priv,
157 struct input_dev *dev1); 157 struct input_dev *dev1);
158static void alps_set_abs_params_mt(struct alps_data *priv, 158static void alps_set_abs_params_mt(struct alps_data *priv,
159 struct input_dev *dev1); 159 struct input_dev *dev1);
160static void alps_set_abs_params_v7(struct alps_data *priv,
161 struct input_dev *dev1);
160 162
161/* Packet formats are described in Documentation/input/alps.txt */ 163/* Packet formats are described in Documentation/input/alps.txt */
162 164
@@ -2311,7 +2313,7 @@ static int alps_set_protocol(struct psmouse *psmouse,
2311 priv->hw_init = alps_hw_init_v7; 2313 priv->hw_init = alps_hw_init_v7;
2312 priv->process_packet = alps_process_packet_v7; 2314 priv->process_packet = alps_process_packet_v7;
2313 priv->decode_fields = alps_decode_packet_v7; 2315 priv->decode_fields = alps_decode_packet_v7;
2314 priv->set_abs_params = alps_set_abs_params_mt; 2316 priv->set_abs_params = alps_set_abs_params_v7;
2315 priv->nibble_commands = alps_v3_nibble_commands; 2317 priv->nibble_commands = alps_v3_nibble_commands;
2316 priv->addr_command = PSMOUSE_CMD_RESET_WRAP; 2318 priv->addr_command = PSMOUSE_CMD_RESET_WRAP;
2317 priv->x_max = 0xfff; 2319 priv->x_max = 0xfff;
@@ -2437,10 +2439,11 @@ static void alps_set_abs_params_st(struct alps_data *priv,
2437{ 2439{
2438 input_set_abs_params(dev1, ABS_X, 0, priv->x_max, 0, 0); 2440 input_set_abs_params(dev1, ABS_X, 0, priv->x_max, 0, 0);
2439 input_set_abs_params(dev1, ABS_Y, 0, priv->y_max, 0, 0); 2441 input_set_abs_params(dev1, ABS_Y, 0, priv->y_max, 0, 0);
2442 input_set_abs_params(dev1, ABS_PRESSURE, 0, 127, 0, 0);
2440} 2443}
2441 2444
2442static void alps_set_abs_params_mt(struct alps_data *priv, 2445static void alps_set_abs_params_mt_common(struct alps_data *priv,
2443 struct input_dev *dev1) 2446 struct input_dev *dev1)
2444{ 2447{
2445 input_set_abs_params(dev1, ABS_MT_POSITION_X, 0, priv->x_max, 0, 0); 2448 input_set_abs_params(dev1, ABS_MT_POSITION_X, 0, priv->x_max, 0, 0);
2446 input_set_abs_params(dev1, ABS_MT_POSITION_Y, 0, priv->y_max, 0, 0); 2449 input_set_abs_params(dev1, ABS_MT_POSITION_Y, 0, priv->y_max, 0, 0);
@@ -2448,15 +2451,29 @@ static void alps_set_abs_params_mt(struct alps_data *priv,
2448 input_abs_set_res(dev1, ABS_MT_POSITION_X, priv->x_res); 2451 input_abs_set_res(dev1, ABS_MT_POSITION_X, priv->x_res);
2449 input_abs_set_res(dev1, ABS_MT_POSITION_Y, priv->y_res); 2452 input_abs_set_res(dev1, ABS_MT_POSITION_Y, priv->y_res);
2450 2453
2451 input_mt_init_slots(dev1, MAX_TOUCHES, INPUT_MT_POINTER |
2452 INPUT_MT_DROP_UNUSED | INPUT_MT_TRACK | INPUT_MT_SEMI_MT);
2453
2454 set_bit(BTN_TOOL_TRIPLETAP, dev1->keybit); 2454 set_bit(BTN_TOOL_TRIPLETAP, dev1->keybit);
2455 set_bit(BTN_TOOL_QUADTAP, dev1->keybit); 2455 set_bit(BTN_TOOL_QUADTAP, dev1->keybit);
2456}
2457
2458static void alps_set_abs_params_mt(struct alps_data *priv,
2459 struct input_dev *dev1)
2460{
2461 alps_set_abs_params_mt_common(priv, dev1);
2462 input_set_abs_params(dev1, ABS_PRESSURE, 0, 127, 0, 0);
2463
2464 input_mt_init_slots(dev1, MAX_TOUCHES,
2465 INPUT_MT_POINTER | INPUT_MT_DROP_UNUSED |
2466 INPUT_MT_TRACK | INPUT_MT_SEMI_MT);
2467}
2468
2469static void alps_set_abs_params_v7(struct alps_data *priv,
2470 struct input_dev *dev1)
2471{
2472 alps_set_abs_params_mt_common(priv, dev1);
2456 2473
2457 /* V7 is real multi-touch */ 2474 input_mt_init_slots(dev1, MAX_TOUCHES,
2458 if (priv->proto_version == ALPS_PROTO_V7) 2475 INPUT_MT_POINTER | INPUT_MT_DROP_UNUSED |
2459 clear_bit(INPUT_PROP_SEMI_MT, dev1->propbit); 2476 INPUT_MT_TRACK);
2460} 2477}
2461 2478
2462int alps_init(struct psmouse *psmouse) 2479int alps_init(struct psmouse *psmouse)
@@ -2489,9 +2506,6 @@ int alps_init(struct psmouse *psmouse)
2489 dev1->evbit[BIT_WORD(EV_ABS)] |= BIT_MASK(EV_ABS); 2506 dev1->evbit[BIT_WORD(EV_ABS)] |= BIT_MASK(EV_ABS);
2490 2507
2491 priv->set_abs_params(priv, dev1); 2508 priv->set_abs_params(priv, dev1);
2492 /* No pressure on V7 */
2493 if (priv->proto_version != ALPS_PROTO_V7)
2494 input_set_abs_params(dev1, ABS_PRESSURE, 0, 127, 0, 0);
2495 2509
2496 if (priv->flags & ALPS_WHEEL) { 2510 if (priv->flags & ALPS_WHEEL) {
2497 dev1->evbit[BIT_WORD(EV_REL)] |= BIT_MASK(EV_REL); 2511 dev1->evbit[BIT_WORD(EV_REL)] |= BIT_MASK(EV_REL);