From patchwork Sun Apr 26 16:11:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 11510691 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7C0CD14DD for ; Sun, 26 Apr 2020 16:11:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 651E120A8B for ; Sun, 26 Apr 2020 16:11:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b="gciuW6Hb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726228AbgDZQLq (ORCPT ); Sun, 26 Apr 2020 12:11:46 -0400 Received: from rere.qmqm.pl ([91.227.64.183]:44824 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725778AbgDZQLP (ORCPT ); Sun, 26 Apr 2020 12:11:15 -0400 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 499CZT1ZyYz11D; Sun, 26 Apr 2020 18:11:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1587917473; bh=tA/XPgpGJbSi7V9EhJqnCr4qj2YgmKhxnLWBran/2S8=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=gciuW6Hbb79FTP+KgTWhzMaN29GWFNxgKoyr5j8dd1jDXE1yBoyNoqqOUsqeenetQ vpfMJyCbp0ciIA72mm1nQ13nXMz/TjQA/Y+We8ZNjwf9Qfw6X6Q6xpPIFdyLfUu3sY bc3PaYv6sydQTSBs7BoLKxeVDYntyVqp3bDbunE9CWfgLw8pAXAxu1jtdUc0K9pS2O u31QLmAotsgsEL/tgW+jP0j6K0OPMrpU7606vokjXyS51Z+rhmTp5XhAuPQCewd5Rr ySspwImnZU4sVv8oJ+0OUfCpBdkYKeMnkFy9wUMgDtAmMoCH4EWcdHAvr6Uf+fKH6G dAOckCN1coIrA== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.2 at mail Date: Sun, 26 Apr 2020 18:11:12 +0200 Message-Id: <6988fbee4b349686faa7fdea2137c431a79baf14.1587916846.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH v4 04/10] input: elants: override touchscreen info with DT properties MIME-Version: 1.0 To: David Heidelberg , Dmitry Osipenko , Dmitry Torokhov , Henrik Rydberg , James Chen , Johnny Chuang , Rob Herring , Scott Liu Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Allow overriding of information from hardware and support additional common DT properties like axis inversion. This is required for eg. Nexus 7 and TF300T where the programmed values in firmware differ from reality. Signed-off-by: Dmitry Osipenko [moved "prop" before DMA buffer] Signed-off-by: Michał Mirosław --- drivers/input/touchscreen/elants_i2c.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c index 58aa9b7dbcbf..c08a7971cd32 100644 --- a/drivers/input/touchscreen/elants_i2c.c +++ b/drivers/input/touchscreen/elants_i2c.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -150,6 +151,7 @@ struct elants_data { unsigned int y_res; unsigned int x_max; unsigned int y_max; + struct touchscreen_properties prop; enum elants_state state; enum elants_iap_mode iap_mode; @@ -894,8 +896,7 @@ static void elants_i2c_mt_event(struct elants_data *ts, u8 *buf, input_mt_slot(input, i); input_mt_report_slot_state(input, MT_TOOL_FINGER, true); - input_event(input, EV_ABS, ABS_MT_POSITION_X, x); - input_event(input, EV_ABS, ABS_MT_POSITION_Y, y); + touchscreen_report_pos(input, &ts->prop, x, y, true); input_event(input, EV_ABS, ABS_MT_PRESSURE, p); input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, w); @@ -1322,6 +1323,8 @@ static int elants_i2c_probe(struct i2c_client *client, input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res); input_abs_set_res(ts->input, ABS_MT_TOUCH_MAJOR, 1); + touchscreen_parse_properties(ts->input, true, &ts->prop); + error = input_mt_init_slots(ts->input, MAX_CONTACT_NUM, INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED); if (error) {