From patchwork Sun Feb 13 17:15:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 542460 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5484C433EF for ; Sun, 13 Feb 2022 17:15:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237259AbiBMRP6 (ORCPT ); Sun, 13 Feb 2022 12:15:58 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237243AbiBMRP6 (ORCPT ); Sun, 13 Feb 2022 12:15:58 -0500 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3332858E5B for ; Sun, 13 Feb 2022 09:15:52 -0800 (PST) Received: by mail-ej1-x631.google.com with SMTP id qk11so12592346ejb.2 for ; Sun, 13 Feb 2022 09:15:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=i1RYgt0bRyM5+K2M0i2x/hO7uPol3JRFphrZi4pLhJE=; b=eDDKPuA0ZIRuuv+Ui4l8NM4SLz3TFkdl8RpCqVxuo/9HKjvHpmpp1QEtLQb9GbOcQC saiSJL+1vTCvsRG+13ab9jRlePInIwGc7+564H+hRhWaFCr8eMJ+zkbWUcnNLv15vUX5 9YabH8RGBRZGYfQmshJ+HjH2DvbkiIlYU4LEs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=i1RYgt0bRyM5+K2M0i2x/hO7uPol3JRFphrZi4pLhJE=; b=WbowHPlSkhZk4O8OpL/ti1iIH3mmPhE8arFP0z4bKlKFeFH9lmsNKnDyDqG6f2bplu EEifzwSuY7CumZHGY9cxukysYf3xYbmLuT3zxDkXi0ss/gigvhdGW9k/UErspHWVbPQy PvmXRgI0/5ygevndikEmNBDXzg98SRyud6UxJipzkvm1gwkqKBB6FJjYvE7bV3Llie0H aSS0uwnx3uqvLgd5vdcb0HxO6kIGxw+ZHY71XOa1YoPQ65lYB1jZb5m3eJ6gfbSn/VZ1 ea7hAGslQSK2XICqhLLQlL82J3TxFlii5e5XdA1DRCQO7f7POvVmXyHK3efCXy5Vh9bY Z6fQ== X-Gm-Message-State: AOAM530kT7ckOMmK7sqc1frIL3W2WIS8+2T7bnFIOmKz1iCQBrZyat/n fgkybyeJiOOlSbsuFtYSxh8k1Q== X-Google-Smtp-Source: ABdhPJzr35wW1sMK5FzxA73gYiBRCu4+lYqZ+2I90LD7agEyCPLVnMjtHEGObv/1ZgCTauKagGCplA== X-Received: by 2002:a17:907:234b:: with SMTP id we11mr8334781ejb.5.1644772550831; Sun, 13 Feb 2022 09:15:50 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-82-52-8-210.retail.telecomitalia.it. [82.52.8.210]) by smtp.gmail.com with ESMTPSA id o10sm6598878ejj.6.2022.02.13.09.15.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Feb 2022 09:15:50 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Dario Binacchi , Michael Trimarchi , Dmitry Torokhov , Rob Herring , Stephan Gerhold , devicetree@vger.kernel.org, linux-input@vger.kernel.org Subject: [PATCH 1/6] dt-bindings: input: touchscreen: edt-ft5x06: add report-rate Date: Sun, 13 Feb 2022 18:15:27 +0100 Message-Id: <20220213171532.346270-2-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220213171532.346270-1-dario.binacchi@amarulasolutions.com> References: <20220213171532.346270-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org It allows to change the M06/M12 default scan rate. Co-developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- .../devicetree/bindings/input/touchscreen/edt-ft5x06.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml index 2e8da7470513..a4cd9bb156b2 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml @@ -85,6 +85,14 @@ properties: minimum: 0 maximum: 80 + report-rate: + description: Allows setting the scan rate. + M06: range from 3 (30 Hz) to 14 (140 Hz). + M12: range from 1 (1 Hz) to 255 (255 Hz). + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + maximum: 255 + touchscreen-size-x: true touchscreen-size-y: true touchscreen-fuzz-x: true From patchwork Sun Feb 13 17:15:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 542659 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B735C433F5 for ; Sun, 13 Feb 2022 17:16:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237258AbiBMRQE (ORCPT ); Sun, 13 Feb 2022 12:16:04 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237290AbiBMRQD (ORCPT ); Sun, 13 Feb 2022 12:16:03 -0500 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4BEE59393 for ; Sun, 13 Feb 2022 09:15:57 -0800 (PST) Received: by mail-ed1-x532.google.com with SMTP id z21so2630091edb.13 for ; Sun, 13 Feb 2022 09:15:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FrUQuHtQGj/olmQcr/n4ScE+eFPqjZP07zyR2QXuUyo=; b=RXpZl8YC9hanx1D2+vwt7BQkAYxHhGoOdEVbmEjf4wONwi8ijXLzFrKwEaCfxMlBoq 2n6GoVQtS883m7X/+K0OhuZtkfFCgyDxkBA6QuxeeDWWPHkyvuXNwIJ6zNkXCa9HjSq1 lLq6BCD/Z5LrbemtYYi41eVsZzzbZckTt/h94= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FrUQuHtQGj/olmQcr/n4ScE+eFPqjZP07zyR2QXuUyo=; b=ddDJsDeMTgIEnSqAY6wQFe8QUhvDJsEqJ0J/iCXi8ZgypXxb61iDM4bvkPJYSb4+cM lnjYRtB08L+KY6dqsKU5ZrZ0y5wuLqvRYOu+DrtyEbySxLCEmXO5nCCIBb9HqfmkPt7T pKdFistEmSM30mwsf/yL7HGT//prQ65lMZzZt9bjeSO5YxjO4rxrpNnatbPHHx/ySSW8 tKJWTH/UvbgBNHtkKu7Qvql7ikxpaUOkfkeoIYywgbiRG6Ps4U2VzAv3fQwGeLRYeD6t KEaNLcRK1uNa0HC7pw64d3KfvLmsKH77F4yXv43O3Um6wrg3oeeweC4z4382J4WYJMbm qoEA== X-Gm-Message-State: AOAM531Ok5HBTWS67Jk8+SD+zMkl6FV0HWO7QbpMx+3kKvw+v3MrIacL lMUwzcOHWYyu4qmNDpBar9Tr5g== X-Google-Smtp-Source: ABdhPJxyWFo4IjRBoQ1Gocg+ptlDZguqCDuolaKqN2bMpfmuccQowxnGKwOh6uY6XIhaAwyHEMDOJA== X-Received: by 2002:a05:6402:2987:: with SMTP id eq7mr2738833edb.330.1644772556567; Sun, 13 Feb 2022 09:15:56 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-82-52-8-210.retail.telecomitalia.it. [82.52.8.210]) by smtp.gmail.com with ESMTPSA id o10sm6598878ejj.6.2022.02.13.09.15.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Feb 2022 09:15:56 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Dario Binacchi , Michael Trimarchi , Dmitry Torokhov , Marco Felsch , Oliver Graute , Stephan Gerhold , linux-input@vger.kernel.org Subject: [PATCH 2/6] Input: edt-ft5x06 - get/set M12 report rate by sysfs Date: Sun, 13 Feb 2022 18:15:28 +0100 Message-Id: <20220213171532.346270-3-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220213171532.346270-1-dario.binacchi@amarulasolutions.com> References: <20220213171532.346270-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Add support for reading/writing scan rate (SC) register for M12 by sysfs. The register value is equal to the SC (Hz), unlike M06, where instead it is equal to SC / 10. Co-developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Tested-by: Dario Binacchi Signed-off-by: Dario Binacchi --- drivers/input/touchscreen/edt-ft5x06.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index bb2e1cbffba7..77f061af5c61 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -47,6 +47,8 @@ #define M09_REGISTER_NUM_X 0x94 #define M09_REGISTER_NUM_Y 0x95 +#define M12_REGISTER_REPORT_RATE 0x88 + #define EV_REGISTER_THRESHOLD 0x40 #define EV_REGISTER_GAIN 0x41 #define EV_REGISTER_OFFSET_Y 0x45 @@ -523,9 +525,9 @@ static EDT_ATTR(offset_y, S_IWUSR | S_IRUGO, NO_REGISTER, NO_REGISTER, /* m06: range 20 to 80, m09: range 0 to 30, m12: range 1 to 255... */ static EDT_ATTR(threshold, S_IWUSR | S_IRUGO, WORK_REGISTER_THRESHOLD, M09_REGISTER_THRESHOLD, EV_REGISTER_THRESHOLD, 0, 255); -/* m06: range 3 to 14, m12: (0x64: 100Hz) */ +/* m06: range 3 to 14, m12: range 1 to 255 */ static EDT_ATTR(report_rate, S_IWUSR | S_IRUGO, WORK_REGISTER_REPORT_RATE, - NO_REGISTER, NO_REGISTER, 0, 255); + M12_REGISTER_REPORT_RATE, NO_REGISTER, 0, 255); static struct attribute *edt_ft5x06_attrs[] = { &edt_ft5x06_attr_gain.dattr.attr, @@ -1030,7 +1032,8 @@ static void edt_ft5x06_ts_set_regs(struct edt_ft5x06_ts_data *tsdata) case EDT_M09: case EDT_M12: reg_addr->reg_threshold = M09_REGISTER_THRESHOLD; - reg_addr->reg_report_rate = NO_REGISTER; + reg_addr->reg_report_rate = tsdata->version == EDT_M12 ? + M12_REGISTER_REPORT_RATE : NO_REGISTER; reg_addr->reg_gain = M09_REGISTER_GAIN; reg_addr->reg_offset = M09_REGISTER_OFFSET; reg_addr->reg_offset_x = NO_REGISTER; From patchwork Sun Feb 13 17:15:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 542459 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98B28C433EF for ; Sun, 13 Feb 2022 17:16:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237307AbiBMRQK (ORCPT ); Sun, 13 Feb 2022 12:16:10 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235491AbiBMRQJ (ORCPT ); Sun, 13 Feb 2022 12:16:09 -0500 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87AD458E74 for ; Sun, 13 Feb 2022 09:16:03 -0800 (PST) Received: by mail-ej1-x632.google.com with SMTP id k25so32971175ejp.5 for ; Sun, 13 Feb 2022 09:16:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pqCmSI3oKgXqeKRHORXbpr0RliiGdpjxqXgh77LeuyE=; b=UGi8i1E0VtCl4TrRHyJC7+OxbcGu58MuNZmH8NIyBazCX7XnZcl9L09tzxQHXp2ZIa Y0N7pIhXSGFKWe+4S4dgBXPvTwEbk4CnSiHw/oFY1gtQPhQ3KHL/ZeFJeY6qkiOBI0t2 RAluvfJOG9hxIUlo5Ur+kB/K92zvFsYZxLLHE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pqCmSI3oKgXqeKRHORXbpr0RliiGdpjxqXgh77LeuyE=; b=W2SeqVFfacMH+BWE4p1lmN91YZFfj5lSSg77DQ4vz3o1D0/ShDC0vwCG+fCVu7zuDD hXhGjRrybuDaQld7HYOwZqG666LO91uVJDz4pkmcmzVnu22lzvanN9PpsYZWFxE+w7nq WO6+vn4EZsMQFi4u7+MnClFVDMnrD+2jkUQUGz0V95TPmfrxyjDaj/GNqzgAWpL81z3d YZRFHY1JYhP/a257JJGZCsmMiiDN93AGdxoYEa1UV8UGK1S1d1O+t+v29emtmcyiKS5M MsNzSf5IQ8K6geHwJtMHvKD0KnTGVeaADRo3SBC+NoHfWzc8dlapNNmCykfORKm96YBn cUfQ== X-Gm-Message-State: AOAM533F7BU5sQxWSKT6BCKdoEscPZJxHYxDO2FG3ESrYo2hQBTJV249 SUWHLCkm2TVUh5jQTN+UxqL4dA== X-Google-Smtp-Source: ABdhPJxAyoFOOO1M/a8oyMsOReXM7VsC/c2C44LtpK2zndZP7PB8W/IICUrzii9PWZgCKw3Vsho7XA== X-Received: by 2002:a17:906:720e:: with SMTP id m14mr8820358ejk.399.1644772562128; Sun, 13 Feb 2022 09:16:02 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-82-52-8-210.retail.telecomitalia.it. [82.52.8.210]) by smtp.gmail.com with ESMTPSA id o10sm6598878ejj.6.2022.02.13.09.15.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Feb 2022 09:16:01 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Dario Binacchi , Michael Trimarchi , Dmitry Torokhov , Marco Felsch , Oliver Graute , Stephan Gerhold , linux-input@vger.kernel.org Subject: [PATCH 3/6] Input: edt-ft5x06 - set report rate by dts property Date: Sun, 13 Feb 2022 18:15:29 +0100 Message-Id: <20220213171532.346270-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220213171532.346270-1-dario.binacchi@amarulasolutions.com> References: <20220213171532.346270-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org It allows to change the M06/M12 default scan rate on driver probing. Co-developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/input/touchscreen/edt-ft5x06.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index 77f061af5c61..b3e492cfc41c 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -1213,6 +1213,14 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, edt_ft5x06_ts_get_defaults(&client->dev, tsdata); edt_ft5x06_ts_get_parameters(tsdata); + if (tsdata->reg_addr.reg_report_rate != NO_REGISTER && + !of_property_read_u32(client->dev.of_node, "report-rate", + (u32 *)&tsdata->report_rate)) { + edt_ft5x06_register_write(tsdata, + tsdata->reg_addr.reg_report_rate, + tsdata->report_rate); + } + dev_dbg(&client->dev, "Model \"%s\", Rev. \"%s\", %dx%d sensors\n", tsdata->name, fw_version, tsdata->num_x, tsdata->num_y); From patchwork Sun Feb 13 17:15:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 542658 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A307EC433F5 for ; Sun, 13 Feb 2022 17:16:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237293AbiBMRQQ (ORCPT ); Sun, 13 Feb 2022 12:16:16 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237330AbiBMRQP (ORCPT ); Sun, 13 Feb 2022 12:16:15 -0500 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C7DD593BF for ; Sun, 13 Feb 2022 09:16:09 -0800 (PST) Received: by mail-ed1-x52d.google.com with SMTP id co28so23879494edb.1 for ; Sun, 13 Feb 2022 09:16:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S/AsjkW3t1KrHMKTVETxff67/Nhsqoh6KaKB0r1nIHg=; b=OhSfpnRD1YPDchKrwVRFJJYXMk6u5meI3NMZMrYecw0xMUGolwUHGc4TvGAdcbOxKk ElDkIIplEyEzpiVNPQaVGtjMFbS8/eGfUDk04HDOMtV+4vMuXoQbryADR3Qh1cnUiCf9 h4uoxj3FF1vTgabKpTjPExR5YPRqDhykRrgRA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S/AsjkW3t1KrHMKTVETxff67/Nhsqoh6KaKB0r1nIHg=; b=Ns+et1KmVsmR56Jou4PGUpvlNn0M2tXq8scSfT+RAYBMPOf/pXoVqvWM7mtvr6bYjV MqNukxj5zrQhcQl6FcFguBb1ZBU8SIAx3pfcTxLXuEhNP7QCOCL5tt0x3Cq/IWAOIEVI y11tylkEsr3eWxFoVbi1IQ+/xaHF1RIvs8uJ4tHo+QQCZ2ZFj/pOHtV9Ci8LgMPBolbt DdfpFamAsuiia+NvS3gqO1KUGiJxAZSwWYqUjNqPnphffeVHAfSsdxBlIk2eQsnBwlrn O5hcogHlabRaEaLX8cxiIe81vyUXY0/79PcVdz4Zz4A0VNro6N/ViONNe0WR+vBeSjp7 6pVQ== X-Gm-Message-State: AOAM532kocuasOjPbeCMcI5j72/vVcMSSwf2HgPmwJSyKteMa1WV5eFC NMe1a7tpgzOv+kIoeZA5/Smvlw== X-Google-Smtp-Source: ABdhPJxrhwPuYKOdIizMvYFMLYKBgKqQ2+EcHj42DduLcW8oPZq34Prkn2uqnjs7rfzzQAlyou1mEg== X-Received: by 2002:a05:6402:2947:: with SMTP id ed7mr11924581edb.141.1644772567637; Sun, 13 Feb 2022 09:16:07 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-82-52-8-210.retail.telecomitalia.it. [82.52.8.210]) by smtp.gmail.com with ESMTPSA id o10sm6598878ejj.6.2022.02.13.09.16.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Feb 2022 09:16:07 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Dario Binacchi , Michael Trimarchi , Dmitry Torokhov , Marco Felsch , Oliver Graute , Stephan Gerhold , linux-input@vger.kernel.org Subject: [PATCH 4/6] Input: edt-ft5x06 - show model name by sysfs Date: Sun, 13 Feb 2022 18:15:30 +0100 Message-Id: <20220213171532.346270-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220213171532.346270-1-dario.binacchi@amarulasolutions.com> References: <20220213171532.346270-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The model name was printed only if debug mode was enabled. Now you can always get it from sysfs. Co-developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/input/touchscreen/edt-ft5x06.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index b3e492cfc41c..eb1231d1c0b4 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -529,6 +529,17 @@ static EDT_ATTR(threshold, S_IWUSR | S_IRUGO, WORK_REGISTER_THRESHOLD, static EDT_ATTR(report_rate, S_IWUSR | S_IRUGO, WORK_REGISTER_REPORT_RATE, M12_REGISTER_REPORT_RATE, NO_REGISTER, 0, 255); +static ssize_t model_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client); + + return scnprintf(buf, PAGE_SIZE, "%s\n", tsdata->name); +} + +static DEVICE_ATTR_RO(model); + static struct attribute *edt_ft5x06_attrs[] = { &edt_ft5x06_attr_gain.dattr.attr, &edt_ft5x06_attr_offset.dattr.attr, @@ -536,6 +547,7 @@ static struct attribute *edt_ft5x06_attrs[] = { &edt_ft5x06_attr_offset_y.dattr.attr, &edt_ft5x06_attr_threshold.dattr.attr, &edt_ft5x06_attr_report_rate.dattr.attr, + &dev_attr_model.attr, NULL }; From patchwork Sun Feb 13 17:15:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 542458 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F856C433F5 for ; Sun, 13 Feb 2022 17:16:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237337AbiBMRQU (ORCPT ); Sun, 13 Feb 2022 12:16:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237333AbiBMRQU (ORCPT ); Sun, 13 Feb 2022 12:16:20 -0500 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CB8A59380 for ; Sun, 13 Feb 2022 09:16:14 -0800 (PST) Received: by mail-ed1-x52d.google.com with SMTP id y17so21901120edd.10 for ; Sun, 13 Feb 2022 09:16:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/PAiX6O2/FWZ7wNjpZzseMRWrZbr6IoxG6JcDDkQD60=; b=amOnERdPT9H+IwBJM3P+hh/Sy+S2jwc8bY/zLvUoUqye4y+G6DNtVCfQUBH7kwyj6R k3wHyY6NREnEdjInWb9/+BlCKtxqQNATvSkiTCrVfEOlWS6Ms4KT89V/XlUjFjmgQJsK H2zBbl2rXbW0s1CPTZuSqjPVzYajGJQoc7hic= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/PAiX6O2/FWZ7wNjpZzseMRWrZbr6IoxG6JcDDkQD60=; b=niEWJRavKkD5iyBy1dC8XDwj/nGJkweAESo32nUISRQ5ewunQu5xBErGzB63e1L8ap QJ17E984BS5tndTu6dHUGWBgHI1KuD5E5QuCMO7e6BeaA0nENEcZRPytUrv6wP5zyvoY EFgrZRRqIdKZ7bjZnPTYvfkNlJT11bg+8ZehgZACFHOUTsomi1hdiwyS36+g+s1AoUlP aOak/tEofyF+9n4DbdeN9Kl5HWeRrW8Z/EF15tmrbO5rf4nhNrHVZXnlRwX/Z0jsIlor TzIH5dhRuiYjSecQLeGO6oa7Rob1dnj/b809F5vFcUoF2KG4ol9m3nyq3usOMvyJtffr 0UGg== X-Gm-Message-State: AOAM532bknPIbu7TbI+1cllut5aG0m4GDcRcaTU8BAqyU7LwzcyCCxgj KGvp2w5EdmLhD35ZrzuxYuBAJg== X-Google-Smtp-Source: ABdhPJxntKEs+MA/xUiWA4gqiByzwrUbjM6NSHNDQsaZnvM0aQHkscQrG103/ZqcZzMlwjAIoTNMFw== X-Received: by 2002:a05:6402:b6a:: with SMTP id cb10mr11800292edb.140.1644772573027; Sun, 13 Feb 2022 09:16:13 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-82-52-8-210.retail.telecomitalia.it. [82.52.8.210]) by smtp.gmail.com with ESMTPSA id o10sm6598878ejj.6.2022.02.13.09.16.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Feb 2022 09:16:12 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Dario Binacchi , Michael Trimarchi , Dmitry Torokhov , Marco Felsch , Oliver Graute , Stephan Gerhold , linux-input@vger.kernel.org Subject: [PATCH 5/6] Input: edt-ft5x06 - show firmware version by sysfs Date: Sun, 13 Feb 2022 18:15:31 +0100 Message-Id: <20220213171532.346270-6-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220213171532.346270-1-dario.binacchi@amarulasolutions.com> References: <20220213171532.346270-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The firmware version was printed only if debug mode was enabled. Now you can always get it from sysfs. Co-developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/input/touchscreen/edt-ft5x06.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index eb1231d1c0b4..2c946c155108 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -129,6 +129,7 @@ struct edt_ft5x06_ts_data { int max_support_points; char name[EDT_NAME_LEN]; + char fw_version[EDT_NAME_LEN]; struct edt_reg_addr reg_addr; enum edt_ver version; @@ -540,6 +541,17 @@ static ssize_t model_show(struct device *dev, struct device_attribute *attr, static DEVICE_ATTR_RO(model); +static ssize_t fw_version_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client); + + return scnprintf(buf, PAGE_SIZE, "%s\n", tsdata->fw_version); +} + +static DEVICE_ATTR_RO(fw_version); + static struct attribute *edt_ft5x06_attrs[] = { &edt_ft5x06_attr_gain.dattr.attr, &edt_ft5x06_attr_offset.dattr.attr, @@ -548,6 +560,7 @@ static struct attribute *edt_ft5x06_attrs[] = { &edt_ft5x06_attr_threshold.dattr.attr, &edt_ft5x06_attr_report_rate.dattr.attr, &dev_attr_model.attr, + &dev_attr_fw_version.attr, NULL }; @@ -834,13 +847,13 @@ static void edt_ft5x06_ts_teardown_debugfs(struct edt_ft5x06_ts_data *tsdata) #endif /* CONFIG_DEBUGFS */ static int edt_ft5x06_ts_identify(struct i2c_client *client, - struct edt_ft5x06_ts_data *tsdata, - char *fw_version) + struct edt_ft5x06_ts_data *tsdata) { u8 rdbuf[EDT_NAME_LEN]; char *p; int error; char *model_name = tsdata->name; + char *fw_version = tsdata->fw_version; /* see what we find if we assume it is a M06 * * if we get less than EDT_NAME_LEN, we don't want @@ -1096,7 +1109,6 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, struct input_dev *input; unsigned long irq_flags; int error; - char fw_version[EDT_NAME_LEN]; dev_dbg(&client->dev, "probing for EDT FT5x06 I2C\n"); @@ -1209,7 +1221,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, tsdata->input = input; tsdata->factory_mode = false; - error = edt_ft5x06_ts_identify(client, tsdata, fw_version); + error = edt_ft5x06_ts_identify(client, tsdata); if (error) { dev_err(&client->dev, "touchscreen probe failed\n"); return error; @@ -1235,7 +1247,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, dev_dbg(&client->dev, "Model \"%s\", Rev. \"%s\", %dx%d sensors\n", - tsdata->name, fw_version, tsdata->num_x, tsdata->num_y); + tsdata->name, tsdata->fw_version, tsdata->num_x, tsdata->num_y); input->name = tsdata->name; input->id.bustype = BUS_I2C; From patchwork Sun Feb 13 17:15:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 542657 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1392C433EF for ; Sun, 13 Feb 2022 17:16:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237332AbiBMRQ0 (ORCPT ); Sun, 13 Feb 2022 12:16:26 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237357AbiBMRQZ (ORCPT ); Sun, 13 Feb 2022 12:16:25 -0500 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8C3C59A63 for ; Sun, 13 Feb 2022 09:16:19 -0800 (PST) Received: by mail-ed1-x532.google.com with SMTP id w10so5264096edd.11 for ; Sun, 13 Feb 2022 09:16:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rQYl0dGLPQaYPKlZy5p+ObPQe0jk7S0A9el98YwShaU=; b=cNDAwwYFmPeLVTViYQOxsGrwgPWtQ2157SqHTdz0SHEHEHMcFVv1Ifd29mytsT/x6w zWF/eA4M3y7+O8TB/k74oNy6OZnWef///qSI93LQRfpP3x1KNN6AJeB/IMOjczivruAS +G+2FPSob0cF73MOsaahsLbrgQE/lSun03Eb8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rQYl0dGLPQaYPKlZy5p+ObPQe0jk7S0A9el98YwShaU=; b=R7l35Wsj22Ys3dlNkJAcziPp2eofyZzuYVkIO8rFIQkPltGy6CHV9Oh+4dpzxNmrka F8RioS9SRjNl0nyJ13Ls6VuYYSEG4JTDZD6OoyiPhxu7Hn22NJIx/40MOISUGMESlapY Y+YZr+Px8IjVT+Gx6tqJFipqlChhHtP+xdOLFIY96l1AZs3MszdqqjiYJqYnEOWKUgNE 4YCi5CD64SVRJsbCCwv7o84kPha2Pt/Uy76SCtQIIWqIdmGj80NkDwzQuIN6qshtnA6W 824FEbxL/rmSFlKtaVYpcIl2Lq4jj9ZQU2gUgOwUgsu54Grn8FwnThP+prJ70Vu7KtRS JPuA== X-Gm-Message-State: AOAM530b9lWrdKENttuUsKw0p43MiD7DwU+FV8pa02U9YfnnIdgQxszW xvIOGHgeuucVxkayGJLG/nNPEg== X-Google-Smtp-Source: ABdhPJz1+ElSDy0Xw2owhdJ3AK81iTPSd1fOsrCzNVNkcXAJBwdAWO7NHDNPISa8Vf5xGbuxS7c5cA== X-Received: by 2002:a05:6402:4313:: with SMTP id m19mr11792561edc.320.1644772578260; Sun, 13 Feb 2022 09:16:18 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-82-52-8-210.retail.telecomitalia.it. [82.52.8.210]) by smtp.gmail.com with ESMTPSA id o10sm6598878ejj.6.2022.02.13.09.16.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Feb 2022 09:16:17 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Dario Binacchi , Michael Trimarchi , Dmitry Torokhov , Oliver Graute , Stephan Gerhold , linux-input@vger.kernel.org Subject: [PATCH 6/6] Input: edt-ft5x06 - show crc and header errors by sysfs Date: Sun, 13 Feb 2022 18:15:32 +0100 Message-Id: <20220213171532.346270-7-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220213171532.346270-1-dario.binacchi@amarulasolutions.com> References: <20220213171532.346270-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org M06 sends packets with header and crc for data verification. Now you can check at runtime how many packets have been dropped. Co-developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/input/touchscreen/edt-ft5x06.c | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index 2c946c155108..376aa4405104 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -133,6 +133,8 @@ struct edt_ft5x06_ts_data { struct edt_reg_addr reg_addr; enum edt_ver version; + unsigned int crc_errors; + unsigned int header_errors; }; struct edt_i2c_chip_data { @@ -181,6 +183,7 @@ static bool edt_ft5x06_ts_check_crc(struct edt_ft5x06_ts_data *tsdata, crc ^= buf[i]; if (crc != buf[buflen-1]) { + tsdata->crc_errors++; dev_err_ratelimited(&tsdata->client->dev, "crc error: 0x%02x expected, got 0x%02x\n", crc, buf[buflen-1]); @@ -238,6 +241,7 @@ static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id) if (tsdata->version == EDT_M06) { if (rdbuf[0] != 0xaa || rdbuf[1] != 0xaa || rdbuf[2] != datalen) { + tsdata->header_errors++; dev_err_ratelimited(dev, "Unexpected header: %02x%02x%02x!\n", rdbuf[0], rdbuf[1], rdbuf[2]); @@ -552,6 +556,30 @@ static ssize_t fw_version_show(struct device *dev, static DEVICE_ATTR_RO(fw_version); +/* m06 only */ +static ssize_t header_errors_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client); + + return scnprintf(buf, PAGE_SIZE, "%d\n", tsdata->header_errors); +} + +static DEVICE_ATTR_RO(header_errors); + +/* m06 only */ +static ssize_t crc_errors_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client); + + return scnprintf(buf, PAGE_SIZE, "%d\n", tsdata->crc_errors); +} + +static DEVICE_ATTR_RO(crc_errors); + static struct attribute *edt_ft5x06_attrs[] = { &edt_ft5x06_attr_gain.dattr.attr, &edt_ft5x06_attr_offset.dattr.attr, @@ -561,6 +589,8 @@ static struct attribute *edt_ft5x06_attrs[] = { &edt_ft5x06_attr_report_rate.dattr.attr, &dev_attr_model.attr, &dev_attr_fw_version.attr, + &dev_attr_header_errors.attr, + &dev_attr_crc_errors.attr, NULL };