Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935797AbdGTKCU (ORCPT ); Thu, 20 Jul 2017 06:02:20 -0400 Received: from mail-ty1jpn01on0055.outbound.protection.outlook.com ([104.47.93.55]:33008 "EHLO JPN01-TY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934012AbdGTKCP (ORCPT ); Thu, 20 Jul 2017 06:02:15 -0400 From: Masaki Ota To: Takashi Iwai CC: Paul Donohue , Laura Abbott , Dmitry Torokhov , Pali Rohar , Nick Fletcher , "linux-input@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "scott.s.lowe@gmail.com" Subject: RE: [REGRESSION] Touchpad failure after e7348396c6d5 ("Input: ALPS - fix V8+ protocol handling (73 03 28)") Thread-Topic: [REGRESSION] Touchpad failure after e7348396c6d5 ("Input: ALPS - fix V8+ protocol handling (73 03 28)") Thread-Index: AQHS28lZ6isdvv9kdkG/gMORaIsZVqIShTyAgAWPoYCACKbrMIAEC3aAgABT8qCAB4UPgIAAFhYAgAA3XACAIhV5gIAARVuAgAC9iICAAJo4gIAKgiQAgAGQgnCAAAyFgIAAAHVA Date: Thu, 20 Jul 2017 10:02:10 +0000 Message-ID: References: <75b84b97-5f36-a3be-bb4e-e43cd72d9921@redhat.com> <20170619184315.GF1855@TopQuark.net> <0995261b-8d19-64af-9b66-e1eab579a3d4@redhat.com> <20170619232026.GG1855@TopQuark.net> <20170711195821.GG1855@TopQuark.net> <20170712162841.GI1855@TopQuark.net> In-Reply-To: Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: suse.de; dkim=none (message not signed) header.d=none;suse.de; dmarc=none action=none header.from=jp.alps.com; x-originating-ip: [106.184.109.136] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;KAWPR01MB1089;20:dEFIbZ3TUpfy4GHcSR+1ey4bqTL+j54x/sBX/epRmWwLM80vibMj+/g1T/OxyudSnGPqiSbPn7f/6E7yCmNYZXR74gpPYPuvfuzzYdn15XohvGO1HGZHjqEqLN0hJ/YRTLxCno6J7DDxCGPlKiH51TbMvkOBULWo+aucXh+NHLDMxzBfmtjcwswFU15aQYpTYLG1FYhhtiHKbSuVZR+ZLPrIZr7TibB2Jh2QcHZ8QOROH6XTJLWhIRPGRTlA1+Ei x-ms-office365-filtering-correlation-id: 4fbfe461-ee2e-403b-f74d-08d4cf566374 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254075)(300000503095)(300135400095)(48565401081)(2017052603031)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:KAWPR01MB1089; x-ms-traffictypediagnostic: KAWPR01MB1089: x-exchange-antispam-report-test: UriScan:(20558992708506)(236129657087228)(9452136761055)(48057245064654)(84791874153150)(9931346810618); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(2017060910075)(5005006)(8121501046)(3002001)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123560025)(20161123555025)(20161123564025)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:KAWPR01MB1089;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:KAWPR01MB1089; x-forefront-prvs: 0374433C81 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(39410400002)(39850400002)(39860400002)(39840400002)(39450400003)(39400400002)(377454003)(13464003)(24454002)(81166006)(54906002)(66066001)(25786009)(85182001)(478600001)(55016002)(8936002)(38730400002)(6306002)(74316002)(14454004)(53546010)(53936002)(575784001)(229853002)(9686003)(189998001)(86362001)(305945005)(4326008)(50986999)(54356999)(5660300001)(6436002)(6246003)(3660700001)(42882006)(966005)(2906002)(6916009)(2950100002)(110136004)(6506006)(76176999)(6116002)(77096006)(3846002)(8676002)(99286003)(2900100001)(39060400002)(3280700002)(7736002)(7696004)(93886004)(102836003)(33656002);DIR:OUT;SFP:1101;SCL:1;SRVR:KAWPR01MB1089;H:KAWPR01MB1092.jpnprd01.prod.outlook.com;FPR:;SPF:None;MLV:ovrnspm;PTR:InfoNoRecords;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-OriginatorOrg: jp.alps.com X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2017 10:02:10.6642 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 57e76998-77bd-4b82-a424-198f46eb2254 X-MS-Exchange-Transport-CrossTenantHeadersStamped: KAWPR01MB1089 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id v6KA2RDG011405 Content-Length: 9997 Lines: 257 Hi, Some user reported that this issue happened from kernel 4.10.7. Because the below patch was applied on it. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?id=0186e6a4e501d39f5f90dd7e5887bc668aef06c4 So, I thought the cause of this issue is this patch. Original code meaning is Kernel 4.10.6, it seems not to have this issue. Best Regards, Masaki Ota -----Original Message----- From: Takashi Iwai [mailto:tiwai@suse.de] Sent: Thursday, July 20, 2017 6:35 PM To: 太田 真喜 Masaki Ota Cc: Paul Donohue ; Laura Abbott ; Dmitry Torokhov ; Pali Rohar ; Nick Fletcher ; linux-input@vger.kernel.org; linux-kernel@vger.kernel.org; scott.s.lowe@gmail.com Subject: Re: [REGRESSION] Touchpad failure after e7348396c6d5 ("Input: ALPS - fix V8+ protocol handling (73 03 28)") On Thu, 20 Jul 2017 11:20:20 +0200, Masaki Ota wrote: > > Hi, Takashi-san, > > That's great! > > Actually, SS4 PLUS device is a little different from SS4 device. > I added SS4 PLUS code as below. > Could you try it? Yes, it works as expected. Feel free to take: Tested-by: Takashi Iwai > And I still wonder why this issue does not happen on original code though X value is so large. Which original code are you referring to? The bug manifests itself only for decoding multi-touch events. thanks, Takashi > > --- a/drivers/input/mouse/alps.c > +++ b/drivers/input/mouse/alps.c > @@ -1210,14 +1210,24 @@ static int alps_decode_ss4_v2(struct > alps_fields *f, > > case SS4_PACKET_ID_TWO: > if (priv->flags & ALPS_BUTTONPAD) { > - f->mt[0].x = SS4_BTL_MF_X_V2(p, 0); > + if (IS_SS4PLUS_DEV(priv->dev_id)) { > + f->mt[0].x = SS4_PLUS_BTL_MF_X_V2(p, 0); > + f->mt[1].x = SS4_PLUS_BTL_MF_X_V2(p, 1); > + } else { > + f->mt[0].x = SS4_BTL_MF_X_V2(p, 0); > + f->mt[1].x = SS4_BTL_MF_X_V2(p, 1); > + } > f->mt[0].y = SS4_BTL_MF_Y_V2(p, 0); > - f->mt[1].x = SS4_BTL_MF_X_V2(p, 1); > f->mt[1].y = SS4_BTL_MF_Y_V2(p, 1); > } else { > - f->mt[0].x = SS4_STD_MF_X_V2(p, 0); > + if (IS_SS4PLUS_DEV(priv->dev_id)) { > + f->mt[0].x = SS4_PLUS_STD_MF_X_V2(p, 0); > + f->mt[1].x = SS4_PLUS_STD_MF_X_V2(p, 1); > + } else { > + f->mt[0].x = SS4_STD_MF_X_V2(p, 0); > + f->mt[1].x = SS4_STD_MF_X_V2(p, 1); > + } > f->mt[0].y = SS4_STD_MF_Y_V2(p, 0); > - f->mt[1].x = SS4_STD_MF_X_V2(p, 1); > f->mt[1].y = SS4_STD_MF_Y_V2(p, 1); > } > f->pressure = SS4_MF_Z_V2(p, 0) ? 0x30 : 0; @@ -1234,16 +1244,27 @@ > static int alps_decode_ss4_v2(struct alps_fields *f, > > case SS4_PACKET_ID_MULTI: > if (priv->flags & ALPS_BUTTONPAD) { > - f->mt[2].x = SS4_BTL_MF_X_V2(p, 0); > + if (IS_SS4PLUS_DEV(priv->dev_id)) { > + f->mt[0].x = SS4_PLUS_BTL_MF_X_V2(p, 0); > + f->mt[1].x = SS4_PLUS_BTL_MF_X_V2(p, 1); > + } else { > + f->mt[2].x = SS4_BTL_MF_X_V2(p, 0); > + f->mt[3].x = SS4_BTL_MF_X_V2(p, 1); > + } > + > f->mt[2].y = SS4_BTL_MF_Y_V2(p, 0); > - f->mt[3].x = SS4_BTL_MF_X_V2(p, 1); > f->mt[3].y = SS4_BTL_MF_Y_V2(p, 1); > no_data_x = SS4_MFPACKET_NO_AX_BL; > no_data_y = SS4_MFPACKET_NO_AY_BL; > } else { > - f->mt[2].x = SS4_STD_MF_X_V2(p, 0); > + if (IS_SS4PLUS_DEV(priv->dev_id)) { > + f->mt[0].x = SS4_PLUS_STD_MF_X_V2(p, 0); > + f->mt[1].x = SS4_PLUS_STD_MF_X_V2(p, 1); > + } else { > + f->mt[0].x = SS4_STD_MF_X_V2(p, 0); > + f->mt[1].x = SS4_STD_MF_X_V2(p, 1); > + } > f->mt[2].y = SS4_STD_MF_Y_V2(p, 0); > - f->mt[3].x = SS4_STD_MF_X_V2(p, 1); > f->mt[3].y = SS4_STD_MF_Y_V2(p, 1); > no_data_x = SS4_MFPACKET_NO_AX; > no_data_y = SS4_MFPACKET_NO_AY; > @@ -2536,8 +2557,8 @@ static int alps_set_defaults_ss4_v2(struct > psmouse *psmouse, > > memset(otp, 0, sizeof(otp)); > > - if (alps_get_otp_values_ss4_v2(psmouse, 0, &otp[0][0]) || > - alps_get_otp_values_ss4_v2(psmouse, 1, &otp[1][0])) > + if (alps_get_otp_values_ss4_v2(psmouse, 1, &otp[1][0]) || > + alps_get_otp_values_ss4_v2(psmouse, 0, &otp[0][0])) > return -1; > > alps_update_device_area_ss4_v2(otp, priv); diff --git > a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h index > 4334f2805d93..75542199edda 100644 > --- a/drivers/input/mouse/alps.h > +++ b/drivers/input/mouse/alps.h > @@ -99,6 +99,10 @@ enum SS4_PACKET_ID { > ((_b[1 + _i * 3] << 5) & 0x1F00) \ > ) > > +#define SS4_PLUS_STD_MF_X_V2(_b, _i) (((_b[0 + (_i) * 3] << 4) & 0x0070) | \ > + ((_b[1 + (_i) * 3] << 4) & 0x0F80) \ > + ) > + > #define SS4_STD_MF_Y_V2(_b, _i) (((_b[1 + (_i) * 3] << 3) & 0x0010) | \ > ((_b[2 + (_i) * 3] << 5) & 0x01E0) | \ > ((_b[2 + (_i) * 3] << 4) & 0x0E00) \ > @@ -108,6 +112,10 @@ enum SS4_PACKET_ID { > ((_b[0 + (_i) * 3] >> 3) & 0x0010) \ > ) > > +#define SS4_PLUS_BTL_MF_X_V2(_b, _i) (SS4_PLUS_STD_MF_X_V2(_b, _i) | \ > + ((_b[0 + (_i) * 3] >> 4) & 0x0008) \ > + ) > + > #define SS4_BTL_MF_Y_V2(_b, _i) (SS4_STD_MF_Y_V2(_b, _i) | \ > ((_b[0 + (_i) * 3] >> 3) & 0x0008) \ > ) > -- > > Best Regards, > Masaki Ota > -----Original Message----- > From: Takashi Iwai [mailto:tiwai@suse.de] > Sent: Wednesday, July 19, 2017 5:57 PM > To: Paul Donohue > Cc: Laura Abbott ; 太田 真喜 Masaki Ota > ; Dmitry Torokhov ; > Pali Rohar ; Nick Fletcher > ; linux-input@vger.kernel.org; > linux-kernel@vger.kernel.org; scott.s.lowe@gmail.com > Subject: Re: [REGRESSION] Touchpad failure after e7348396c6d5 ("Input: > ALPS - fix V8+ protocol handling (73 03 28)") > > On Wed, 12 Jul 2017 18:28:41 +0200, > Paul Donohue wrote: > > > > On Wed, Jul 12, 2017 at 09:16:43AM +0200, Takashi Iwai wrote: > > > On Tue, 11 Jul 2017 21:58:21 +0200, Paul Donohue wrote: > > > > > > > > On Tue, Jul 11, 2017 at 05:50:07PM +0200, Takashi Iwai wrote: > > > > > Hi, just joining to the party in the middle, as I'm also > > > > > facing the same problem on Dell E7270 laptop. Has this issue > > > > > already been addressed? > > > > > > > > > > If not, the following was my result: > > > > > > > > > > - the first patch slowed the pointer movement a lot, it's even slower > > > > > than the old kernel (e.g. 4.4.x). > > > > > The two finger scroll works fine on all touchpad area now. > > > > > > > > > > - the second patch made the pointer movement even faster than now (as > > > > > I feel, not quite sure). The two finger scroll doesn't work at the > > > > > right side of the touchpad. > > > > > > > > > > > > > > > The kernel output from the first patch is below: > > > > > psmouse serio1: alps: test1 pitch 37x37 num-electrodes 8x7 > > > > > physical size 25x22mm res 69x69 max 1792x1536 > > > > > > > > > > Let me know if you have any further test. > > > > > > > > > > > > > > > thanks, > > > > > > > > > > Takashi > > > > > > > > Do you have the kernel output from the second patch? > > > > > > Here it is: > > > > > > psmouse serio1: alps: test2 pitch 50x54 num-electrodes 20x11 > > > physical size 95x54mm res 25x23 max 2432x1280 > > > > Thanks! > > > > Wow, this is weird ... Values that cause scrolling issues for you work fine for me. > > > > It looks like the priv->x_max value that is causing your problem, but perhaps you can confirm this with another test: > > Revert the patches above, then just before the 'return' at the end of alps_update_device_area_ss4_v2() add the following line: > > priv->x_max = 1792; > > I suspect this line will make two-finger scrolling work again. > > > > It might also help if you could experiment with other x_max values. 2432 is the correct value that causes problems for you.. Does a small value like 500 or a large value like 5000 change the behavior? > > > > Another test you can try is to add a print statement in the 'case SS4_PACKET_ID_TWO' section of alps_decode_ss4_v2() and print out the f->mt[0].x and f->mt[1].x values. With x_max set to 2432, what range of x values does this print when scrolling works, and what range of values are printed when scrolling doesn't work? > > Sorry for the late reply. > > I checked your suggestion, and noticed that actually x_max is a red > herring. Then I started looking at the output of evtest (should have > done from the beginning!), and the problem became obvious: the > reported X values for MT with finger > 1 are doubled, e.g. it reports > 4800 instead of 2400. The MT_Y coordinate looks OK, so it's only about MT_X. And finger=1 reports correctly. > > After reading the code, I ended up the patch like below. This seems working through a quick test. Could anyone check the patch to see whether it works / breaks anything? > > The evtest showed that the MT_X for finger 3 and 4 are also bogus, and the patch should address it, too. > > My only concern so far is whether correcting this globally is right, or it's specific to some certain models. This needs the confirmation from ALPS people... > > > thanks, > > Takashi > > > --- a/drivers/input/mouse/alps.h > +++ b/drivers/input/mouse/alps.h > @@ -96,8 +96,8 @@ enum SS4_PACKET_ID { > > #define SS4_BTN_V2(_b) ((_b[0] >> 5) & SS4_MASK_NORMAL_BUTTONS) > > -#define SS4_STD_MF_X_V2(_b, _i) (((_b[0 + (_i) * 3] << 5) & 0x00E0) | \ > - ((_b[1 + _i * 3] << 5) & 0x1F00) \ > +#define SS4_STD_MF_X_V2(_b, _i) (((_b[0 + (_i) * 3] << 4) & 0x0070) | \ > + ((_b[1 + (_i) * 3] << 4) & 0x0F80) \ > ) > > #define SS4_STD_MF_Y_V2(_b, _i) (((_b[1 + (_i) * 3] << 3) & 0x0010) | \ > @@ -106,7 +106,7 @@ enum SS4_PACKET_ID { > ) > > #define SS4_BTL_MF_X_V2(_b, _i) (SS4_STD_MF_X_V2(_b, _i) | \ > - ((_b[0 + (_i) * 3] >> 3) & 0x0010) \ > + ((_b[0 + (_i) * 3] >> 2) & 0x0008) \ > ) > > #define SS4_BTL_MF_Y_V2(_b, _i) (SS4_STD_MF_Y_V2(_b, _i) | \ >