Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4934176imm; Tue, 16 Oct 2018 02:26:05 -0700 (PDT) X-Google-Smtp-Source: ACcGV6024a19Yw7eRoKZRSxIEGgSE/s7ZHXX9IIuNOT6MYDFBL57E8Nw5D2iIQt26gJNDDI7LlBB X-Received: by 2002:a62:f20f:: with SMTP id m15-v6mr21023252pfh.244.1539681965433; Tue, 16 Oct 2018 02:26:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539681965; cv=none; d=google.com; s=arc-20160816; b=nI9zpaXpcKu6Gimjo0KK5Z2eQL0HXY24tiSZr1DG4KZt/g2cTdVJsPzGlT8LdEmpjT 6H9h3UdLDYRd2duAD2+P2sh6CRWSySmjiIQOMVUKzn2q2er4Uf37mWvug8tBGuqo+BVO tYic460m5QYn/Op2DC/Zj2dZ8VyWqPdg13S14XUIeuc2ymhgv4ssOwPPbwfzKL5SewEo 7B2ddUzex3KFFHbKw3djd/UyUnRFz8rMTNx45H8jZRgBaOCkAp9qdGoUH/2khj2bDVE5 a1WiN/+4upqP+ywUqiqpMcmEYWJKbdraBoR586ZpkeaRmNxooF7vaHprYHTQTDnlEP33 ZbkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=lgoLQytPWfqa4nU8fbEHuDNxeUNU0d4zCnac+2q5iN8=; b=PGmT8b0mx2Tub6s8FEb+F7XAGVkvBkUfhUGIY7CVF4wKs+z/2YYQjiFwEnvvc5jsG6 Aq91NUV1htPnKoi5k9dA9a73mRE94r2FFw8P9FdrpKQ046WZeWHPdQy3di85U2Zsif4Y iqXwOYj/2VX/pCj4BaWalXyYaZindU1pO07Xh62PLz0HMz0efON1/oDZaVtlL8QF1wU0 iTtwO2M/ZbpuowqX56lVvQEBGxpvKIuEzhTMf+ahw1/N3DVzsnNQ2PmDGYMkxbLPN/E3 qgZm0XI4PuiXFxrjRLVVKI48kOroD8eFjpn8i00+JML3KTMuoIq5SJ0+N2gxd/yP1eg+ nt8g== ARC-Authentication-Results: i=1; mx.google.com; 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 c4-v6si13028935pgn.309.2018.10.16.02.25.49; Tue, 16 Oct 2018 02:26:05 -0700 (PDT) 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; 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 S1727100AbeJPRNm (ORCPT + 99 others); Tue, 16 Oct 2018 13:13:42 -0400 Received: from mail1.skidata.com ([91.230.2.99]:36789 "EHLO mail1.skidata.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726083AbeJPRNm (ORCPT ); Tue, 16 Oct 2018 13:13:42 -0400 X-IronPort-AV: E=Sophos;i="5.54,388,1534802400"; d="scan'208";a="12888081" From: Richard Leitner To: , , CC: , , , Richard Leitner Subject: [PATCH 7/7] Input: sx8654 - use common of_touchscreen functions Date: Tue, 16 Oct 2018 11:23:10 +0200 Message-ID: <20181016092310.27346-1-richard.leitner@skidata.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181016091653.26896-1-richard.leitner@skidata.com> References: <20181016091653.26896-1-richard.leitner@skidata.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.111.252] X-ClientProxiedBy: sdex4srv.skidata.net (192.168.111.82) To sdex5srv.skidata.net (192.168.111.83) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org of_touchscreen.c provides a common interface for a axis invertion and swapping of touchscreens. Therefore use it in the sx8654 driver. Signed-off-by: Richard Leitner --- drivers/input/touchscreen/sx8654.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/input/touchscreen/sx8654.c b/drivers/input/touchscreen/sx8654.c index 33f7a0be4ef8..08b064f96b4e 100644 --- a/drivers/input/touchscreen/sx8654.c +++ b/drivers/input/touchscreen/sx8654.c @@ -36,6 +36,7 @@ #include #include #include +#include /* register addresses */ #define I2C_REG_TOUCH0 0x00 @@ -100,6 +101,7 @@ struct sx8654 { struct i2c_client *client; struct gpio_desc *gpio_reset; struct hrtimer timer; + struct touchscreen_properties props; const struct sx865x_data *data; }; @@ -168,8 +170,7 @@ static irqreturn_t sx8650_irq(int irq, void *handle) chdata); } - input_report_abs(ts->input, ABS_X, x); - input_report_abs(ts->input, ABS_Y, y); + touchscreen_report_pos(ts->input, &ts->props, x, y, false); input_report_key(ts->input, BTN_TOUCH, 1); input_sync(ts->input); dev_dbg(dev, "point(%4d,%4d)\n", x, y); @@ -215,8 +216,8 @@ static irqreturn_t sx8654_irq(int irq, void *handle) x = ((data[0] & 0xf) << 8) | (data[1]); y = ((data[2] & 0xf) << 8) | (data[3]); - input_report_abs(sx8654->input, ABS_X, x); - input_report_abs(sx8654->input, ABS_Y, y); + touchscreen_report_pos(sx8654->input, &sx8654->props, x, y, + false); input_report_key(sx8654->input, BTN_TOUCH, 1); input_sync(sx8654->input); @@ -355,6 +356,8 @@ static int sx8654_get_ofdata(struct sx8654 *ts) } dev_dbg(dev, "got GPIO reset pin\n"); + touchscreen_parse_properties(ts->input, false, &ts->props); + return 0; } #else /* CONFIG_OF */ @@ -380,25 +383,11 @@ static int sx8654_probe(struct i2c_client *client, sx8654 = devm_kzalloc(&client->dev, sizeof(*sx8654), GFP_KERNEL); if (!sx8654) return -ENOMEM; - sx8654->client = client; - error = sx8654_get_ofdata(sx8654); - if (error) { - dev_err(&client->dev, "get_ofdata failed: %d\n", error); - return error; - } - - if (!sx8654->data->has_irq_penrelease) { - dev_dbg(&client->dev, "use timer for penrelease\n"); - hrtimer_init(&sx8654->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - sx8654->timer.function = sx865x_penrelease_timer_handler; - } - input = devm_input_allocate_device(&client->dev); if (!input) return -ENOMEM; - sx8654->input = input; input->name = "SX8654 I2C Touchscreen"; @@ -414,6 +403,18 @@ static int sx8654_probe(struct i2c_client *client, input_set_drvdata(sx8654->input, sx8654); + error = sx8654_get_ofdata(sx8654); + if (error) { + dev_err(&client->dev, "get_ofdata failed: %d\n", error); + return error; + } + + if (!sx8654->data->has_irq_penrelease) { + dev_dbg(&client->dev, "use timer for penrelease\n"); + hrtimer_init(&sx8654->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); + sx8654->timer.function = sx865x_penrelease_timer_handler; + } + error = sx8654_reset(sx8654); if (error) { dev_err(&client->dev, "reset failed"); -- 2.11.0