From patchwork Sat Jun 23 15:45:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mack X-Patchwork-Id: 10483751 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 4ED5D6023A for ; Sat, 23 Jun 2018 15:46:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 550472896D for ; Sat, 23 Jun 2018 15:46:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49E8928996; Sat, 23 Jun 2018 15:46:37 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, 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 D7F0128A4A for ; Sat, 23 Jun 2018 15:46:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751625AbeFWPqf (ORCPT ); Sat, 23 Jun 2018 11:46:35 -0400 Received: from mail.bugwerft.de ([46.23.86.59]:47868 "EHLO mail.bugwerft.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751474AbeFWPqe (ORCPT ); Sat, 23 Jun 2018 11:46:34 -0400 Received: from localhost.localdomain (p57BC930A.dip0.t-ipconnect.de [87.188.147.10]) by mail.bugwerft.de (Postfix) with ESMTPSA id 96CD528B04A; Sat, 23 Jun 2018 15:43:23 +0000 (UTC) From: Daniel Mack To: dmitry.torokhov@gmail.com, robh+dt@kernel.org Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, Daniel Mack Subject: [PATCH v2 3/4] input: touchscreen: eeti: drop module parameters, parse DT properties Date: Sat, 23 Jun 2018 17:45:32 +0200 Message-Id: <20180623154533.26901-4-daniel@zonque.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180623154533.26901-1-daniel@zonque.org> References: <20180623154533.26901-1-daniel@zonque.org> 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 The only user of this driver in mainline does not make use of the module parameters, so let's remove them. All properties for this driver should be set through DT or pdata. Use touchscreen_parse_properties() to automatically set some of the common touchscreen properties and derive the axis inversion through that. And finally, use touchscreen_report_pos() to handle the DT properties automatically instead of doing the inversion ourselves. Signed-off-by: Daniel Mack --- drivers/input/touchscreen/eeti_ts.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c index cc4fd33f9d6d..84561dfde7c4 100644 --- a/drivers/input/touchscreen/eeti_ts.c +++ b/drivers/input/touchscreen/eeti_ts.c @@ -25,9 +25,9 @@ */ #include -#include #include #include +#include #include #include #include @@ -36,18 +36,11 @@ #include #include -static bool flip_x; -module_param(flip_x, bool, 0644); -MODULE_PARM_DESC(flip_x, "flip x coordinate"); - -static bool flip_y; -module_param(flip_y, bool, 0644); -MODULE_PARM_DESC(flip_y, "flip y coordinate"); - struct eeti_ts { struct i2c_client *client; struct input_dev *input; struct gpio_desc *attn_gpio; + struct touchscreen_properties props; bool running; }; @@ -74,17 +67,10 @@ static void eeti_ts_report_event(struct eeti_ts *eeti, u8 *buf) x >>= res - EETI_TS_BITDEPTH; y >>= res - EETI_TS_BITDEPTH; - if (flip_x) - x = EETI_MAXVAL - x; - - if (flip_y) - y = EETI_MAXVAL - y; - if (buf[0] & REPORT_BIT_HAS_PRESSURE) input_report_abs(eeti->input, ABS_PRESSURE, buf[5]); - input_report_abs(eeti->input, ABS_X, x); - input_report_abs(eeti->input, ABS_Y, y); + touchscreen_report_pos(eeti->input, &eeti->props, x, y, false); input_report_key(eeti->input, BTN_TOUCH, buf[0] & REPORT_BIT_PRESSED); input_sync(eeti->input); } @@ -179,6 +165,8 @@ static int eeti_ts_probe(struct i2c_client *client, input_set_abs_params(input, ABS_Y, 0, EETI_MAXVAL, 0, 0); input_set_abs_params(input, ABS_PRESSURE, 0, 0xff, 0, 0); + touchscreen_parse_properties(input, false, &eeti->props); + input->name = client->name; input->id.bustype = BUS_I2C; input->open = eeti_ts_open;