diff options
author | Masaki Ota <masaki.ota@jp.alps.com> | 2017-08-24 18:44:36 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2017-08-24 18:53:46 -0400 |
commit | 4a646580f793d19717f7e034c8d473b509c27d49 (patch) | |
tree | 4f13471d5b2be6d0d84de45777833a95ddacbb3d | |
parent | d912366a59c5384df436fd007667d6e574128b44 (diff) |
Input: ALPS - fix two-finger scroll breakage in right side on ALPS touchpad
Fixed the issue that two finger scroll does not work correctly
on V8 protocol. The cause is that V8 protocol X-coordinate decode
is wrong at SS4 PLUS device. I added SS4 PLUS X decode definition.
Mote notes:
the problem manifests itself by the commit e7348396c6d5 ("Input: ALPS
- fix V8+ protocol handling (73 03 28)"), where a fix for the V8+
protocol was applied. Although the culprit must have been present
beforehand, the two-finger scroll worked casually even with the
wrongly reported values by some reason. It got broken by the commit
above just because it changed x_max value, and this made libinput
correctly figuring the MT events. Since the X coord is reported as
falsely doubled, the events on the right-half side go outside the
boundary, thus they are no longer handled. This resulted as a broken
two-finger scroll.
One finger event is decoded differently, and it didn't suffer from
this problem. The problem was only about MT events. --tiwai
Fixes: e7348396c6d5 ("Input: ALPS - fix V8+ protocol handling (73 03 28)")
Signed-off-by: Masaki Ota <masaki.ota@jp.alps.com>
Tested-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Paul Donohue <linux-kernel@PaulSD.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | drivers/input/mouse/alps.c | 41 | ||||
-rw-r--r-- | drivers/input/mouse/alps.h | 8 |
2 files changed, 39 insertions, 10 deletions
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 262d1057c1da..850b00e3ad8e 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -1215,14 +1215,24 @@ static int alps_decode_ss4_v2(struct alps_fields *f, | |||
1215 | 1215 | ||
1216 | case SS4_PACKET_ID_TWO: | 1216 | case SS4_PACKET_ID_TWO: |
1217 | if (priv->flags & ALPS_BUTTONPAD) { | 1217 | if (priv->flags & ALPS_BUTTONPAD) { |
1218 | f->mt[0].x = SS4_BTL_MF_X_V2(p, 0); | 1218 | if (IS_SS4PLUS_DEV(priv->dev_id)) { |
1219 | f->mt[0].x = SS4_PLUS_BTL_MF_X_V2(p, 0); | ||
1220 | f->mt[1].x = SS4_PLUS_BTL_MF_X_V2(p, 1); | ||
1221 | } else { | ||
1222 | f->mt[0].x = SS4_BTL_MF_X_V2(p, 0); | ||
1223 | f->mt[1].x = SS4_BTL_MF_X_V2(p, 1); | ||
1224 | } | ||
1219 | f->mt[0].y = SS4_BTL_MF_Y_V2(p, 0); | 1225 | f->mt[0].y = SS4_BTL_MF_Y_V2(p, 0); |
1220 | f->mt[1].x = SS4_BTL_MF_X_V2(p, 1); | ||
1221 | f->mt[1].y = SS4_BTL_MF_Y_V2(p, 1); | 1226 | f->mt[1].y = SS4_BTL_MF_Y_V2(p, 1); |
1222 | } else { | 1227 | } else { |
1223 | f->mt[0].x = SS4_STD_MF_X_V2(p, 0); | 1228 | if (IS_SS4PLUS_DEV(priv->dev_id)) { |
1229 | f->mt[0].x = SS4_PLUS_STD_MF_X_V2(p, 0); | ||
1230 | f->mt[1].x = SS4_PLUS_STD_MF_X_V2(p, 1); | ||
1231 | } else { | ||
1232 | f->mt[0].x = SS4_STD_MF_X_V2(p, 0); | ||
1233 | f->mt[1].x = SS4_STD_MF_X_V2(p, 1); | ||
1234 | } | ||
1224 | f->mt[0].y = SS4_STD_MF_Y_V2(p, 0); | 1235 | f->mt[0].y = SS4_STD_MF_Y_V2(p, 0); |
1225 | f->mt[1].x = SS4_STD_MF_X_V2(p, 1); | ||
1226 | f->mt[1].y = SS4_STD_MF_Y_V2(p, 1); | 1236 | f->mt[1].y = SS4_STD_MF_Y_V2(p, 1); |
1227 | } | 1237 | } |
1228 | f->pressure = SS4_MF_Z_V2(p, 0) ? 0x30 : 0; | 1238 | f->pressure = SS4_MF_Z_V2(p, 0) ? 0x30 : 0; |
@@ -1239,16 +1249,27 @@ static int alps_decode_ss4_v2(struct alps_fields *f, | |||
1239 | 1249 | ||
1240 | case SS4_PACKET_ID_MULTI: | 1250 | case SS4_PACKET_ID_MULTI: |
1241 | if (priv->flags & ALPS_BUTTONPAD) { | 1251 | if (priv->flags & ALPS_BUTTONPAD) { |
1242 | f->mt[2].x = SS4_BTL_MF_X_V2(p, 0); | 1252 | if (IS_SS4PLUS_DEV(priv->dev_id)) { |
1253 | f->mt[0].x = SS4_PLUS_BTL_MF_X_V2(p, 0); | ||
1254 | f->mt[1].x = SS4_PLUS_BTL_MF_X_V2(p, 1); | ||
1255 | } else { | ||
1256 | f->mt[2].x = SS4_BTL_MF_X_V2(p, 0); | ||
1257 | f->mt[3].x = SS4_BTL_MF_X_V2(p, 1); | ||
1258 | } | ||
1259 | |||
1243 | f->mt[2].y = SS4_BTL_MF_Y_V2(p, 0); | 1260 | f->mt[2].y = SS4_BTL_MF_Y_V2(p, 0); |
1244 | f->mt[3].x = SS4_BTL_MF_X_V2(p, 1); | ||
1245 | f->mt[3].y = SS4_BTL_MF_Y_V2(p, 1); | 1261 | f->mt[3].y = SS4_BTL_MF_Y_V2(p, 1); |
1246 | no_data_x = SS4_MFPACKET_NO_AX_BL; | 1262 | no_data_x = SS4_MFPACKET_NO_AX_BL; |
1247 | no_data_y = SS4_MFPACKET_NO_AY_BL; | 1263 | no_data_y = SS4_MFPACKET_NO_AY_BL; |
1248 | } else { | 1264 | } else { |
1249 | f->mt[2].x = SS4_STD_MF_X_V2(p, 0); | 1265 | if (IS_SS4PLUS_DEV(priv->dev_id)) { |
1266 | f->mt[0].x = SS4_PLUS_STD_MF_X_V2(p, 0); | ||
1267 | f->mt[1].x = SS4_PLUS_STD_MF_X_V2(p, 1); | ||
1268 | } else { | ||
1269 | f->mt[0].x = SS4_STD_MF_X_V2(p, 0); | ||
1270 | f->mt[1].x = SS4_STD_MF_X_V2(p, 1); | ||
1271 | } | ||
1250 | f->mt[2].y = SS4_STD_MF_Y_V2(p, 0); | 1272 | f->mt[2].y = SS4_STD_MF_Y_V2(p, 0); |
1251 | f->mt[3].x = SS4_STD_MF_X_V2(p, 1); | ||
1252 | f->mt[3].y = SS4_STD_MF_Y_V2(p, 1); | 1273 | f->mt[3].y = SS4_STD_MF_Y_V2(p, 1); |
1253 | no_data_x = SS4_MFPACKET_NO_AX; | 1274 | no_data_x = SS4_MFPACKET_NO_AX; |
1254 | no_data_y = SS4_MFPACKET_NO_AY; | 1275 | no_data_y = SS4_MFPACKET_NO_AY; |
@@ -2541,8 +2562,8 @@ static int alps_set_defaults_ss4_v2(struct psmouse *psmouse, | |||
2541 | 2562 | ||
2542 | memset(otp, 0, sizeof(otp)); | 2563 | memset(otp, 0, sizeof(otp)); |
2543 | 2564 | ||
2544 | if (alps_get_otp_values_ss4_v2(psmouse, 0, &otp[0][0]) || | 2565 | if (alps_get_otp_values_ss4_v2(psmouse, 1, &otp[1][0]) || |
2545 | alps_get_otp_values_ss4_v2(psmouse, 1, &otp[1][0])) | 2566 | alps_get_otp_values_ss4_v2(psmouse, 0, &otp[0][0])) |
2546 | return -1; | 2567 | return -1; |
2547 | 2568 | ||
2548 | alps_update_device_area_ss4_v2(otp, priv); | 2569 | alps_update_device_area_ss4_v2(otp, priv); |
diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h index ed2d6879fa52..c80a7c76cb76 100644 --- a/drivers/input/mouse/alps.h +++ b/drivers/input/mouse/alps.h | |||
@@ -100,6 +100,10 @@ enum SS4_PACKET_ID { | |||
100 | ((_b[1 + _i * 3] << 5) & 0x1F00) \ | 100 | ((_b[1 + _i * 3] << 5) & 0x1F00) \ |
101 | ) | 101 | ) |
102 | 102 | ||
103 | #define SS4_PLUS_STD_MF_X_V2(_b, _i) (((_b[0 + (_i) * 3] << 4) & 0x0070) | \ | ||
104 | ((_b[1 + (_i) * 3] << 4) & 0x0F80) \ | ||
105 | ) | ||
106 | |||
103 | #define SS4_STD_MF_Y_V2(_b, _i) (((_b[1 + (_i) * 3] << 3) & 0x0010) | \ | 107 | #define SS4_STD_MF_Y_V2(_b, _i) (((_b[1 + (_i) * 3] << 3) & 0x0010) | \ |
104 | ((_b[2 + (_i) * 3] << 5) & 0x01E0) | \ | 108 | ((_b[2 + (_i) * 3] << 5) & 0x01E0) | \ |
105 | ((_b[2 + (_i) * 3] << 4) & 0x0E00) \ | 109 | ((_b[2 + (_i) * 3] << 4) & 0x0E00) \ |
@@ -109,6 +113,10 @@ enum SS4_PACKET_ID { | |||
109 | ((_b[0 + (_i) * 3] >> 3) & 0x0010) \ | 113 | ((_b[0 + (_i) * 3] >> 3) & 0x0010) \ |
110 | ) | 114 | ) |
111 | 115 | ||
116 | #define SS4_PLUS_BTL_MF_X_V2(_b, _i) (SS4_PLUS_STD_MF_X_V2(_b, _i) | \ | ||
117 | ((_b[0 + (_i) * 3] >> 4) & 0x0008) \ | ||
118 | ) | ||
119 | |||
112 | #define SS4_BTL_MF_Y_V2(_b, _i) (SS4_STD_MF_Y_V2(_b, _i) | \ | 120 | #define SS4_BTL_MF_Y_V2(_b, _i) (SS4_STD_MF_Y_V2(_b, _i) | \ |
113 | ((_b[0 + (_i) * 3] >> 3) & 0x0008) \ | 121 | ((_b[0 + (_i) * 3] >> 3) & 0x0008) \ |
114 | ) | 122 | ) |