Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp809335ybl; Wed, 11 Dec 2019 07:51:07 -0800 (PST) X-Google-Smtp-Source: APXvYqz/H0CIMJin/o0Rxb22dyo25bJthHMUYrbFe5AZyue4zoLBXu3k7DD3R00Nci+xdElNkH1K X-Received: by 2002:aca:f484:: with SMTP id s126mr3169696oih.48.1576079467541; Wed, 11 Dec 2019 07:51:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576079467; cv=none; d=google.com; s=arc-20160816; b=sPNiOkNg/vhfy25hXzqusT6bpYyv0AsO/eksMOEyYMJf5D/9ZELCJBVx67F5o7gjYP 2HUKf/vCRNnp0TGJAao8+/BCn2CkfAoG7etJr9plr5j26QcMq5dw2ASUzGdvT8opD3Y1 h2+w9VwwSIEAye0rIb67zMlqRGd7DLQH8kEa7UmvbBhtXUh0qv7caCTweCf1+aG1sctD TOjrjWOByrl91PeX4imQXVLdE9UhImgqgN3KoBDmJZS5vtKn47nLF5fXMcBAtTTdbwk8 rkbQJZhSeFo5Z5iJRKX1VvvfCe99nJNnGi5s9B2zA+ne8tYJf5QZYeRxgmdhoSi1/T2c Oobg== 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=wTOi9Cjfom0SobdFdfgfigWFjow51IfwKpuODpmgFuQ=; b=Ev9JR5C20Y6tRcMkBpQTCw70pNYk6ekTCMxNuw+9dZeURAlkzguQEJbi5isGtGbTnX lMKYqvjLApAO27KJxdGQ7qhVKZoqVWDYpR8ageto9KHLdTC84j7K/693QLIlJ/6ioZzo R4nDOkSN8SqJ2admDiiYbXKixRi/iguy0gv6v5yWi4THpy+RUZR0wBS0sPYniTW2FFap Sh5XuTTXjHTsq4nAjPRpt0fdeHsRYIqkhFm8Zsdc3/J2aklF45XYqt60IRjrZqozIxaY sbRLaoFytDOALnVGoKku/he2pazuwFUh3m4Qf+NTGEQZnHmx5zajl3PP9uLQb93xiWQn 2fhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Lr2A/KzG"; 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 i12si1353444otk.215.2019.12.11.07.50.55; Wed, 11 Dec 2019 07:51:07 -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="Lr2A/KzG"; 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 S1732869AbfLKPYl (ORCPT + 99 others); Wed, 11 Dec 2019 10:24:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:56022 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732866AbfLKPYi (ORCPT ); Wed, 11 Dec 2019 10:24:38 -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 0DBA82077B; Wed, 11 Dec 2019 15:24:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077878; bh=V9iFbAEEh/ISObvSLThdcNRuyHPmWRB7uxhJV2IbNc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lr2A/KzGmDy6po2nIz8a9sVaHRDYTajzwNMa6SOB5qqsKGm/Rua9skCHYr/bmt3kb JAhtmy2p4TXzu4u6woAzgt/eYSqNB1u24TPadb7UUy/Rk+IJLjUPP+iI3vJCtK7Jcl isU/WxQdryvaibhC7djHn6reZI58Vw1fYmytsXMQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , Dmitry Torokhov Subject: [PATCH 4.19 206/243] Input: synaptics-rmi4 - dont increment rmiaddr for SMBus transfers Date: Wed, 11 Dec 2019 16:06:08 +0100 Message-Id: <20191211150353.088399161@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150339.185439726@linuxfoundation.org> References: <20191211150339.185439726@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 @@ -166,7 +166,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); @@ -218,7 +217,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;