Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp822676ybl; Wed, 11 Dec 2019 08:03:18 -0800 (PST) X-Google-Smtp-Source: APXvYqzK/INGvNRwZkyMTIHG8dGlEUux0ufdwJU6HSqQd9Y2m+1SlXP+ZgzBe7k9OHlSwEsLF3TX X-Received: by 2002:aca:5657:: with SMTP id k84mr3381267oib.113.1576080198098; Wed, 11 Dec 2019 08:03:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576080198; cv=none; d=google.com; s=arc-20160816; b=xNPPdW/q46fFAZjmfNTsDOJr6nw/qNDeQGYopj8QTA9cTX7hhoOlAy8DhZD4WR12vN f68R1Hl5vWs2NzMEfdvep9g5NYWJCFDXhFCCaI1RRCXgzzOVadC2rhd2aVU0B0br90HL gZlC27aqoUk0OM/5CXyF6G5xas5d/GvUOv/ZA7ZnJCRDp2ZfAQjuBhA2mlWFyITnh9IP lnORS1FPf2VNmVlSL7r9DuOHn7laTr7gXdcUQ0ADeg3PC4qGxLQTg6m92+xOgfkWmohe ND9nprDn5iARI3Igwj09eGoMN1O3TUmof2jHeC0UoIlvEA7319cfxqum+390GVfSznmT 94lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Uxn1ylepdysFli4MsozxA56f+SZ2SFw3ke/7sp6qbGs=; b=jAXBaTzTkQxtLYzAZSw92iDhDRmGD7sRvyWbQpmc+i/XOFK0MVzQygTrfpKm5o0//G gH4w22/lfGmJpOepH2/PalkVpSHmCbzuJq+/5p1eFRzF8XJCRLjlcKRCGWtdaNO9rAmC 02KhTVmXIBITIMBq05AeCajmXJu5tNv9nEYBgbmO1+VuN8AFNxVJrhfxi8AOHyAo808V b0OzdTsEfDwXbrDXiMQuBlgXLblnWfbO17JnxweXOZXrjqvKpuIcSgN3FULami7WvT2p HTlgo1p3tOrbXoLA+q6HKDgSkD+JAGlGFlKK8W7UxucqOhX4snWf7ZN6E3/ntCoJUcDO +X0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="EmlL++8/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u21si1264861otq.137.2019.12.11.08.03.01; Wed, 11 Dec 2019 08:03:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="EmlL++8/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388078AbfLKQBl (ORCPT + 99 others); Wed, 11 Dec 2019 11:01:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:36862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730764AbfLKPNZ (ORCPT ); Wed, 11 Dec 2019 10:13:25 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BAD4E20663; Wed, 11 Dec 2019 15:13:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077205; bh=8fXR3pDHRmhmejxjqkM7w/Bbc1ZTBgKxvue1qmh4iVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EmlL++8/v0i2/R78MlFVaiEos0yFhBKu37fgpNX9C+nQIFyt7QWsEBVTAklJ1Wayp 0iMQKh45BBiD8yUZB//Ft/P76qYlDW4Ap94H7s5yv67GyLNpJv4POW/+UOSExxSRHO qyV3M402QhK0as0ZFzeOY9lVf8OqR+k3NNdbVZIc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , Dmitry Torokhov Subject: [PATCH 5.3 057/105] Input: synaptics-rmi4 - dont increment rmiaddr for SMBus transfers Date: Wed, 11 Dec 2019 16:05:46 +0100 Message-Id: <20191211150243.392936394@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.153659747@linuxfoundation.org> References: <20191211150221.153659747@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans Verkuil commit a284e11c371e446371675668d8c8120a27227339 upstream. This increment of rmi_smbus in rmi_smb_read/write_block() causes garbage to be read/written. The first read of SMB_MAX_COUNT bytes is fine, but after that it is nonsense. Trial-and-error showed that by dropping the increment of rmiaddr everything is fine and the F54 function properly works. I tried a hack with rmi_smb_write_block() as well (writing to the same F54 touchpad data area, then reading it back), and that suggests that there too the rmiaddr increment has to be dropped. It makes sense that if it has to be dropped for read, then it has to be dropped for write as well. It looks like the initial work with F54 was done using i2c, not smbus, and it seems nobody ever tested F54 with smbus. The other functions all read/write less than SMB_MAX_COUNT as far as I can tell, so this issue was never noticed with non-F54 functions. With this change I can read out the touchpad data correctly on my Lenovo X1 Carbon 6th Gen laptop. Signed-off-by: Hans Verkuil Link: https://lore.kernel.org/r/8dd22e21-4933-8e9c-a696-d281872c8de7@xs4all.nl Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/rmi4/rmi_smbus.c | 2 -- 1 file changed, 2 deletions(-) --- a/drivers/input/rmi4/rmi_smbus.c +++ b/drivers/input/rmi4/rmi_smbus.c @@ -163,7 +163,6 @@ static int rmi_smb_write_block(struct rm /* prepare to write next block of bytes */ cur_len -= SMB_MAX_COUNT; databuff += SMB_MAX_COUNT; - rmiaddr += SMB_MAX_COUNT; } exit: mutex_unlock(&rmi_smb->page_mutex); @@ -215,7 +214,6 @@ static int rmi_smb_read_block(struct rmi /* prepare to read next block of bytes */ cur_len -= SMB_MAX_COUNT; databuff += SMB_MAX_COUNT; - rmiaddr += SMB_MAX_COUNT; } retval = 0;