From patchwork Mon Oct 24 22:55:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Dyer X-Patchwork-Id: 9393483 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 AFA4D607F0 for ; Mon, 24 Oct 2016 22:55:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9347C29082 for ; Mon, 24 Oct 2016 22:55:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8418F2917A; Mon, 24 Oct 2016 22:55:56 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 0664629082 for ; Mon, 24 Oct 2016 22:55:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757028AbcJXWzy (ORCPT ); Mon, 24 Oct 2016 18:55:54 -0400 Received: from avasout05.plus.net ([84.93.230.250]:40776 "EHLO avasout05.plus.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752962AbcJXWzy (ORCPT ); Mon, 24 Oct 2016 18:55:54 -0400 Received: from lava ([80.229.148.18]) by avasout05 with smtp id zavp1t00A0Q3Geg01avqES; Mon, 24 Oct 2016 23:55:51 +0100 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.2 cv=a8tyzgaF c=1 sm=1 tr=0 a=o7Djd4SkmPXITDn8qH+ssQ==:117 a=o7Djd4SkmPXITDn8qH+ssQ==:17 a=CH0kA5CcgfcA:10 a=beXlt2xKAAAA:8 a=IzU_GgTjjayhqZjCIzQA:9 a=gcY2M4Ci8LIz02MwfSIM:22 Received: from nick by lava with local (Exim 4.86_2) (envelope-from ) id 1byo9l-0006wP-Cm; Mon, 24 Oct 2016 23:55:49 +0100 From: Nick Dyer To: Dmitry Torokhov , Andrew Duggan , Christopher Heiny , Guenter Roeck Cc: Chris Healy , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Nick Dyer Subject: [PATCH v1] Input: synaptics-rmi4 - allow number of PDT pages to be specified Date: Mon, 24 Oct 2016 23:55:22 +0100 Message-Id: <1477349722-26635-1-git-send-email-nick@shmanahar.org> X-Mailer: git-send-email 2.7.4 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 We have encountered some RMI4 firmwares where there are blank pages in between PDT pages which contain functions. Add a device tree property which can be set to force reading the first N pages. Signed-off-by: Nick Dyer --- Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt | 2 ++ drivers/input/rmi4/rmi_driver.c | 16 ++++++++++++++-- include/linux/rmi.h | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt b/Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt index ec908b9..a611374 100644 --- a/Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt +++ b/Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt @@ -25,6 +25,8 @@ See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt - syna,startup-delay-ms: The number of milliseconds to wait after powering on the device. +- syna,pdt-scan-pages: Scan the first N PDT pages, ignoring blank pages. + - vdd-supply: VDD power supply. See ../regulator/regulator.txt diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index 4a88312..8f94160 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -428,6 +428,8 @@ static int rmi_scan_pdt_page(struct rmi_device *rmi_dev, const struct pdt_entry *entry)) { struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev); + const struct rmi_device_platform_data *pdata = + rmi_get_platform_data(rmi_dev); struct pdt_entry pdt_entry; u16 page_start = RMI4_PAGE_SIZE * page; u16 pdt_start = page_start + PDT_START_SCAN_LOCATION; @@ -449,8 +451,13 @@ static int rmi_scan_pdt_page(struct rmi_device *rmi_dev, return retval; } - return (data->f01_bootloader_mode || addr == pdt_start) ? - RMI_SCAN_DONE : RMI_SCAN_CONTINUE; + if (data->f01_bootloader_mode) + return RMI_SCAN_DONE; + + if (page >= pdata->pdt_scan_pages && addr == pdt_start) + return RMI_SCAN_DONE; + + return RMI_SCAN_CONTINUE; } static int rmi_scan_pdt(struct rmi_device *rmi_dev, void *ctx, @@ -832,6 +839,11 @@ static int rmi_driver_of_probe(struct device *dev, if (retval) return retval; + retval = rmi_of_property_read_u32(dev, &pdata->pdt_scan_pages, + "syna,pdt-scan-pages", 1); + if (retval) + return retval; + return 0; } #else diff --git a/include/linux/rmi.h b/include/linux/rmi.h index e0aca14..2c4570d 100644 --- a/include/linux/rmi.h +++ b/include/linux/rmi.h @@ -207,6 +207,7 @@ struct rmi_device_platform_data_spi { */ struct rmi_device_platform_data { int reset_delay_ms; + u32 pdt_scan_pages; struct rmi_device_platform_data_spi spi_data;