From patchwork Thu Aug 18 19:05:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Duggan X-Patchwork-Id: 9288795 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 98550607FF for ; Fri, 19 Aug 2016 01:03:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 889892926D for ; Fri, 19 Aug 2016 01:03:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CF1F2927E; Fri, 19 Aug 2016 01:03:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=2.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E99C82926D for ; Fri, 19 Aug 2016 01:03:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750953AbcHSBDE (ORCPT ); Thu, 18 Aug 2016 21:03:04 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:48761 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754006AbcHSBDC (ORCPT ); Thu, 18 Aug 2016 21:03:02 -0400 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 2D28D2058E; Thu, 18 Aug 2016 15:05:39 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Thu, 18 Aug 2016 15:05:39 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=duggan.us; h=cc :date:from:message-id:subject:to:x-sasl-enc:x-sasl-enc; s= mesmtp; bh=wrgHUBj4SextiMRhF/rXr6FN9S0=; b=v7DbIyRykosl/BuKLtYpD eomjLgYkRh8f1prWwTeSpF3lYw5Uen7LG6clL/MIkVmd4i6quxB4VakuqGGlM6Dp +mMT6vrzSy4Ru7KlifQHXVDighdcaRIZVljLCQiSG3nC4gSMLFDU0+C2w3FvOuUY ZG7WfaEbiDdtdESDOjyhe0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-sasl-enc:x-sasl-enc; s=smtpout; bh=wrgHUBj4SextiMRhF/rXr6FN9S 0=; b=XBM5yv07oSX32Qrg7NpgExDG/cFKCCimUkqU9OLANKV2Mh6pcTEK/X6cPG txxbiz/UQ3AGntSFrL6m6CooO/CvIlqX5YuF+JH1QOUUsf4AwIz7Klt1ulVB28E0 8SRftKk7fpW3GhiMRVPVQPaKfJbWKcEkjTnWFrDapymT6FuUc= X-Sasl-enc: 9QaEWqOER3z0JK5lyZo5JKPEEfM3uzGks7gLs0b70oQI 1471547138 Received: from noble.synaptics-inc.local (unknown [192.147.44.15]) by mail.messagingengine.com (Postfix) with ESMTPA id 1BA8DCCE67; Thu, 18 Aug 2016 15:05:38 -0400 (EDT) From: Andrew Duggan To: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andrew Duggan , Dmitry Torokhov , Benjamin Tissoires , Vincent Huang , Chris Healy , Nitin Chaudhary , stable@vger.kernel.org Subject: [PATCH] Input: synaptics-rmi4: Fix register descriptor subpacket map construction Date: Thu, 18 Aug 2016 12:05:33 -0700 Message-Id: <1471547133-26819-1-git-send-email-andrew@duggan.us> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Andrew Duggan The map_offset variable is specific to the register and needs to be reset in the loop. Otherwise, subsequent register's subpacket maps will have their bits set at the wrong index. This results in the max X and Y and the resolution to not be set on some devices which use F12. Signed-off-by: Andrew Duggan Tested-by: Nitin Chaudhary Cc: stable@vger.kernel.org Reviewed-by: Benjamin Tissoires --- In rmi_f12_read_sensor_tuning() we call rmi_register_desc_has_subpacket() to check the subpacket map to make sure a subpacket exists to ensure that the buffer contains the correct data. It happened that on my the test devices the register we were checking was also the first register. This issues showed up on newer devices where F12 CTRL 8 is not teh first control register. Thanks, Andrew drivers/input/rmi4/rmi_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index 2b6b97e..19843f1 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -553,10 +553,10 @@ int rmi_read_register_desc(struct rmi_device *d, u16 addr, goto free_struct_buff; reg = find_first_bit(rdesc->presense_map, RMI_REG_DESC_PRESENSE_BITS); - map_offset = 0; for (i = 0; i < rdesc->num_registers; i++) { struct rmi_register_desc_item *item = &rdesc->registers[i]; int reg_size = struct_buf[offset]; + map_offset = 0; ++offset; if (reg_size == 0) {