From patchwork Sun Apr 3 16:09:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 556369 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 E2C22C433FE for ; Sun, 3 Apr 2022 16:10:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239124AbiDCQMG (ORCPT ); Sun, 3 Apr 2022 12:12:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243162AbiDCQMF (ORCPT ); Sun, 3 Apr 2022 12:12:05 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EC492655E for ; Sun, 3 Apr 2022 09:10:11 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id p15so15284565ejc.7 for ; Sun, 03 Apr 2022 09:10:11 -0700 (PDT) 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=TyZtZSd5cTSSlPOn3/pu61X0lFqS8ubq/VPK6S5b8ro=; b=Et0x6Y7F1iuWFq4t2YgWOaDRcl9a4JJq2zpna5IXkXVoauGMD9BJDAwx7udZHy3jTk nKToBLqvvTYc3moR/2eKmTGR4nOC+7hwO9l2KArDMRsxbCrElTxr2Jx86nJlPAJDphf7 41v41IyW9CujMfn5RvHp+YkOV6NlGN1RDupU4= 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=TyZtZSd5cTSSlPOn3/pu61X0lFqS8ubq/VPK6S5b8ro=; b=Jsehe/SfayTwNnAW343lll3bgtRXxxhTH/r+B7ixkJcqhr6eAceEXszBIMNhkSUpeM mAg2/23rB7VOBdZVrfiSr3geJwII9DXwInwDLv7Q4qP9QGqa3738w3c3mTaMY00eGlR5 FqYXDSQCWTK6nD8xHNvKsEIphuG8FJoFCyX/3XM693KUKU8K2m0MAQTQrSWu/DACRPUp hbnFpTc0ok+u2UWdsC899nMucxXmJAawJ/qF4dnSxn0to2xv1aktluMPftJC/tGszqB5 TzMTEBhNxW+oT4y9VzvGEB+zzZyrpnEW/nSX/lvtfw+GbRq5D8crTpOrdpOAi7Lnqvez BYLg== X-Gm-Message-State: AOAM531C22DiVYtKwQl6m1r3T43DIe4OcwSdwjRiXw8lAHj7q75/8zlA leuuLIhWliCz1vERXlRhyAOs4g== X-Google-Smtp-Source: ABdhPJyboxIs/IjHPPN58voFRnczkg4LSb1oi1jBLbpUgVQlwQVc8XlauFHnkc65mMm4VVsMWKvW9w== X-Received: by 2002:a17:907:86a3:b0:6da:870c:af44 with SMTP id qa35-20020a17090786a300b006da870caf44mr7318818ejc.445.1649002210058; Sun, 03 Apr 2022 09:10:10 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-0-15-73.retail.telecomitalia.it. [87.0.15.73]) by smtp.gmail.com with ESMTPSA id do8-20020a170906c10800b006dfe2af50d8sm3350119ejc.121.2022.04.03.09.10.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Apr 2022 09:10:09 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Dario Binacchi , Michael Trimarchi , Rob Herring , Dmitry Torokhov , Krzysztof Kozlowski , Rob Herring , Stephan Gerhold , devicetree@vger.kernel.org, linux-input@vger.kernel.org Subject: [PATCH v4 1/6] dt-bindings: input: touchscreen: edt-ft5x06: add report-rate-hz Date: Sun, 3 Apr 2022 18:09:34 +0200 Message-Id: <20220403160939.541621-2-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220403160939.541621-1-dario.binacchi@amarulasolutions.com> References: <20220403160939.541621-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 Acked-by: Rob Herring --- Changes in v4: - Add Rob Herring 'Acked-by' tag. Changes in v3: - Add hz unit suffix. - Add '|' to description. .../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..46bc8c028fe6 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-hz: + description: | + Allows setting the scan rate in Hertz. + M06 supports range from 30 to 140 Hz. + M12 supports range from 1 to 255 Hz. + minimum: 1 + maximum: 255 + touchscreen-size-x: true touchscreen-size-y: true touchscreen-fuzz-x: true From patchwork Sun Apr 3 16:09:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 556368 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 962ACC433EF for ; Sun, 3 Apr 2022 16:10:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351647AbiDCQMH (ORCPT ); Sun, 3 Apr 2022 12:12:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359340AbiDCQMG (ORCPT ); Sun, 3 Apr 2022 12:12:06 -0400 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 9700426135 for ; Sun, 3 Apr 2022 09:10:12 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id a6so4375787ejk.0 for ; Sun, 03 Apr 2022 09:10:12 -0700 (PDT) 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=5FXIG1Rp9D4NgAZ2oOx6JgdhKdrDvM+0LjdQT4OHOI8=; b=PEdeQlAmTB+oRXhow/DiSMS0dzkqifSRR5KnIXNBwW2PFE+Sf2c2vtjFHDENS+u/0g 2/8Jhu4ObZAOHzneccLyKm0KwTqY0v34xZhd6wpx4oQ7c1OU4JmcJGjt7Oxc3eTKNS34 WVVCUWsb/6cjIVT2mZENbng2he2OzbeYFk55w= 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=5FXIG1Rp9D4NgAZ2oOx6JgdhKdrDvM+0LjdQT4OHOI8=; b=Fpns1qo1XyZJkW/1jqG4pK5RfIbwVgerj1OCI5WZzR4hMTeDjd72eD6K041kgLbgtn SY+jZD3e2Aqv7sXiXPWZbcNbdt9K74O3L0+eFDh0FxmLmtGKxUb4mgVHiOyJywyvgOwC 196/vpZbhj2aCR/KkAuCKKAQh+TPOUgqZCiL3LQATIAE64URcj8v31YLMq5wV7Mdhqlw fVOiFatzAj3qMl9B88aQiLlI4q9E4xIVbllp1fmsoh8uXOnjkLtcIt/Ay1axUDRFefGu MoyUtFnnXrgk3fulgSq0q46pzoEcz2DZ+Y+cc+ZNA3dVv1t8oN333wLbOfjdr6oXee/j xI0A== X-Gm-Message-State: AOAM530O5DPzcP5s7DNYIllmL0Sb492R0MWk82BDLmWECKgw5R4oGZ0S hOons1833s9roOdRAZsu8UsA8Q== X-Google-Smtp-Source: ABdhPJx2EiCn6oIz3xwA7kuubx2zwrTARJQk+WrgKlupc3ZX7fHyXd0dNeE4SgPTNoR2MAf1HlHM7A== X-Received: by 2002:a17:907:1b08:b0:6da:b62a:762a with SMTP id mp8-20020a1709071b0800b006dab62a762amr7227689ejc.60.1649002211204; Sun, 03 Apr 2022 09:10:11 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-0-15-73.retail.telecomitalia.it. [87.0.15.73]) by smtp.gmail.com with ESMTPSA id do8-20020a170906c10800b006dfe2af50d8sm3350119ejc.121.2022.04.03.09.10.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Apr 2022 09:10:10 -0700 (PDT) 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 v4 2/6] Input: edt-ft5x06 - get/set M12 report rate by sysfs Date: Sun, 3 Apr 2022 18:09:35 +0200 Message-Id: <20220403160939.541621-3-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220403160939.541621-1-dario.binacchi@amarulasolutions.com> References: <20220403160939.541621-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 --- (no changes since v1) 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 Apr 3 16:09:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 555964 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 B23ECC4321E for ; Sun, 3 Apr 2022 16:10:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359348AbiDCQMI (ORCPT ); Sun, 3 Apr 2022 12:12:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359346AbiDCQMH (ORCPT ); Sun, 3 Apr 2022 12:12:07 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A444D26541 for ; Sun, 3 Apr 2022 09:10:13 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id n6so1263452ejc.13 for ; Sun, 03 Apr 2022 09:10:13 -0700 (PDT) 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=NIUuHRgvgWCmYJCricL+FHDsiVQYgUJ0FjEwcnUqvHA=; b=hd7rJB3C5Y4XSBLY/KDKNm08VdUSXnsrPOnuFOPdrlqeDPMGdLcvJEGg9NRy1ZVmqE kIJMPZGO7jdv4gvLF3mT2f7CTWyXpAWq2pxte1SUnWvkOV+pjXbiZ4phZMKeS8uKzI2K EghIZ+5W8Qsb0YW2CVvKairMG5L58p1T1ljxE= 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=NIUuHRgvgWCmYJCricL+FHDsiVQYgUJ0FjEwcnUqvHA=; b=kcs+Y1nGrBTkO24A/p42tkp2cxezqMPxr5D4DMp2gQ2Y0YOqaKg9mOR5zZ+TDTuLZV Zwc+gVqSiicZNrQfUxRccydQTO21DyknN05gRkLcLHNMSj7ZDgS963BmwcuYJo6E/JK8 YvfiJOdDko3AHH4IUWt/P/o6Ihf9ZO+V7lI++p1kdvBvDggfdhqe9QB/LMZ3e09P+hze 54WoNllGZLBzWA2MeoJoXb1/3iMJyxMjUGLdJNuIEqB4g5Zp57PPoNDLQ943cqr+jwuY qxSfeyGDDjNkdYCuyF3esKNV/1YJHQls3wAguIAPEJ1Q6qhcrqQ6lZIFPPA5JIsVYHuU GTuw== X-Gm-Message-State: AOAM531BOcws34RNOd8I7KWlpW1iW4Ei434HCn/QvY+VoPmtaYBLZXVa BeWEGnzE0gsaMbCuKj2WzDgOsMcZE9/hAA== X-Google-Smtp-Source: ABdhPJwxkkD74Kb5RSwttXg/1bmRJ+1VogERBB+jgoNHYldMlN+gM2rpVZRa1xb20ZeUACCAea1MMA== X-Received: by 2002:a17:907:6d12:b0:6e4:cd9b:c7f0 with SMTP id sa18-20020a1709076d1200b006e4cd9bc7f0mr7354000ejc.628.1649002212208; Sun, 03 Apr 2022 09:10:12 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-0-15-73.retail.telecomitalia.it. [87.0.15.73]) by smtp.gmail.com with ESMTPSA id do8-20020a170906c10800b006dfe2af50d8sm3350119ejc.121.2022.04.03.09.10.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Apr 2022 09:10:11 -0700 (PDT) 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 v4 3/6] Input: edt-ft5x06 - set report rate by dts property Date: Sun, 3 Apr 2022 18:09:36 +0200 Message-Id: <20220403160939.541621-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220403160939.541621-1-dario.binacchi@amarulasolutions.com> References: <20220403160939.541621-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 --- (no changes since v3) Changes in v3: - Check the lower and upper limits of the report-rate-hz value - Convert the M06 report-rate-hz value 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 77f061af5c61..843e8b0522f7 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -1084,6 +1084,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, struct input_dev *input; unsigned long irq_flags; int error; + u32 report_rate; char fw_version[EDT_NAME_LEN]; dev_dbg(&client->dev, "probing for EDT FT5x06 I2C\n"); @@ -1213,6 +1214,35 @@ 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-hz", + &report_rate)) { + tsdata->report_rate = report_rate; + if (tsdata->version == EDT_M06) { + if (report_rate < 30) + report_rate = 30; + else if (report_rate > 140) + report_rate = 140; + } else if (report_rate < 1) { + report_rate = 1; + } else if (report_rate > 255) + report_rate = 255; + + if (report_rate != tsdata->report_rate) + dev_warn(&client->dev, + "report-rate %dHz is unsupported, use %dHz\n", + tsdata->report_rate, report_rate); + + if (tsdata->version == EDT_M06) + report_rate /= 10; + + tsdata->report_rate = 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 Apr 3 16:09:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 556366 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 0D77BC433FE for ; Sun, 3 Apr 2022 16:10:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359339AbiDCQMP (ORCPT ); Sun, 3 Apr 2022 12:12:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359360AbiDCQMM (ORCPT ); Sun, 3 Apr 2022 12:12:12 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ABD92656A for ; Sun, 3 Apr 2022 09:10:16 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id q26so731238edc.7 for ; Sun, 03 Apr 2022 09:10:16 -0700 (PDT) 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=b85JvDSGn8w4tr7JpVbjtxkbsu1O4D+F+hX3OsbfqCs=; b=jat0lQdm52wwDg35BRb5L+8nm59997TipvzzKI5U6EjUYX77r5sTCbvkZayFkxAOCZ WAInrj3s+FmISyd1yLFWu2dSjimET8Xaqv+IT4iNXmeOeSYChSMn6CVikS/Knq9edU0q jZFJ6oNBK/hPaoQ7SW2JwUA2CNs0rG3wUyhAo= 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=b85JvDSGn8w4tr7JpVbjtxkbsu1O4D+F+hX3OsbfqCs=; b=6+NCfMax8V0GXEVZONaP+9Bm9Rtm2iEkeHQGL6YvV+0tg4RBksvQHx7XTP22e9o1s7 QH/A4QGuDYd8fdiy/jps+szEAKAjWyf5gxuto9Zidv2taE1kc3NIHY+CsDwaxpM3CscX LY1tPv9vco62IlqDqU/oD89MboLPwLp8nNcfVWHzgOS4aTZKQrWvNoN5MXqZFDUSLpKX a4gV4+XIaHcskWkqeAeDStaXtTyIkboqw6uO9NzTS7M4NaCK/+eFxcXlMp8JM6M65wKi 2nTgspFlaH1s73ApFPrUJa0939s90kZMDuq9uj0i0q42y2E6FChlNcyPUpHjnIr4+vQC JpEg== X-Gm-Message-State: AOAM533z+DP1BaxWYOWIC0WclAaMl/vWrxIFWxw77CrMVYsfJO/tHJvg A5zkzzDdiEJO1UNnvIjZIMtkgg== X-Google-Smtp-Source: ABdhPJzcLGOnjOrPRiBpsnz6wQXGHR6X3ut39/lKnZBrVAXqviYH5mKjaGIXhr4WTKUhBF+IH4Ot2Q== X-Received: by 2002:a05:6402:348b:b0:419:172c:e2aa with SMTP id v11-20020a056402348b00b00419172ce2aamr29411793edc.261.1649002214776; Sun, 03 Apr 2022 09:10:14 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-0-15-73.retail.telecomitalia.it. [87.0.15.73]) by smtp.gmail.com with ESMTPSA id do8-20020a170906c10800b006dfe2af50d8sm3350119ejc.121.2022.04.03.09.10.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Apr 2022 09:10:14 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Dario Binacchi , Michael Trimarchi , Oliver Graute , Dmitry Torokhov , Stephan Gerhold , linux-input@vger.kernel.org Subject: [PATCH v4 4/6] Input: edt-ft5x06 - show model name by sysfs Date: Sun, 3 Apr 2022 18:09:37 +0200 Message-Id: <20220403160939.541621-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220403160939.541621-1-dario.binacchi@amarulasolutions.com> References: <20220403160939.541621-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 Acked-by: Oliver Graute --- (no changes since v1) 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 843e8b0522f7..89157deebfcb 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 Apr 3 16:09:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 555963 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 61B4DC4332F for ; Sun, 3 Apr 2022 16:10:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359355AbiDCQMO (ORCPT ); Sun, 3 Apr 2022 12:12:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359353AbiDCQMN (ORCPT ); Sun, 3 Apr 2022 12:12:13 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 468802657C for ; Sun, 3 Apr 2022 09:10:17 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id qh7so5309449ejb.11 for ; Sun, 03 Apr 2022 09:10:17 -0700 (PDT) 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=YV+qTrBSZlEdVwvYGQdRpxUtm5BLonFPqiCggidUwTw=; b=iNbeRPoQ0lC1x2A8rGJ8qnjRYe9Z4CPywbDg+PdtSPQ2sL/dhoyKjxLexQjrSM1mlh 3qZhVVaQ0gGMh4FKXGbkDg7ANq+TKjj0oHtFsypJqF/79T2PZ4FRLFgNQvglTykHLmEc VyGHfyznGcIAxNtcqrMUwNbxM0jIC6HoNR2yw= 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=YV+qTrBSZlEdVwvYGQdRpxUtm5BLonFPqiCggidUwTw=; b=e8z6jCgCTQv7ufA9Ubb9y6V8z7prAqH+TG2salkvvvUNDwVYeVyhQJf4zPJ+6MmEih OL4E13Zu189gjB/4xD5dYE5aFVOU5CfU3aHaLhRscUS33VynN4jzGvaNIU8U5uxq3AP+ D6nx5q8NXxfSgCGeIgaz7cZVF803ARKrvi6Fq+VHaf+JnRIjsBqgwsw9J82qpoe4a7q+ vnojpLc53TZL6e/L3XV5LAoqjW3Zau9DhSl1mEUdovVNlBJSeCV3kh0HeX6yeesBfIT4 odsnUr7OHvr53wnXpYkNnRDm2+yW0xPkOhQxtybftRiEXCVeJD0oM6mBw+f8EMkMIZff xb6A== X-Gm-Message-State: AOAM533yJFWDVnFKvrwMxCoxwxlyYXSH2imrlvhGGBqU+Kt9wUZXpKvK 8HKIeprFmcfmndT+IUvN45yB7A== X-Google-Smtp-Source: ABdhPJy9vg4Bj1FgF7E/aH2B732BM37r6W+MbxnO/cO1+8k6fuxoGlX3NE9wwVDKXTEF2jmrOCgn7A== X-Received: by 2002:a17:907:3f9a:b0:6e0:e2f5:aded with SMTP id hr26-20020a1709073f9a00b006e0e2f5adedmr7464654ejc.743.1649002215867; Sun, 03 Apr 2022 09:10:15 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-0-15-73.retail.telecomitalia.it. [87.0.15.73]) by smtp.gmail.com with ESMTPSA id do8-20020a170906c10800b006dfe2af50d8sm3350119ejc.121.2022.04.03.09.10.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Apr 2022 09:10:15 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Dario Binacchi , Michael Trimarchi , Oliver Graute , Dmitry Torokhov , Stephan Gerhold , linux-input@vger.kernel.org Subject: [PATCH v4 5/6] Input: edt-ft5x06 - show firmware version by sysfs Date: Sun, 3 Apr 2022 18:09:38 +0200 Message-Id: <20220403160939.541621-6-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220403160939.541621-1-dario.binacchi@amarulasolutions.com> References: <20220403160939.541621-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 Acked-by: Oliver Graute --- (no changes since v1) 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 89157deebfcb..bab92344b2ea 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 @@ -1097,7 +1110,6 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, unsigned long irq_flags; int error; u32 report_rate; - char fw_version[EDT_NAME_LEN]; dev_dbg(&client->dev, "probing for EDT FT5x06 I2C\n"); @@ -1210,7 +1222,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; @@ -1257,7 +1269,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 Apr 3 16:09:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 556367 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 22359C43217 for ; Sun, 3 Apr 2022 16:10:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359358AbiDCQMP (ORCPT ); Sun, 3 Apr 2022 12:12:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359368AbiDCQMN (ORCPT ); Sun, 3 Apr 2022 12:12:13 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DD5C26ACE for ; Sun, 3 Apr 2022 09:10:18 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id d10so3558589edj.0 for ; Sun, 03 Apr 2022 09:10:18 -0700 (PDT) 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=V78a4T+XxMalGYKe1sIzEqFdtRWisjMfkHNLxFh+Xuk=; b=j5pKyZu382YZsQQ6JTv1XVN4SkGe5+p7wzzOR+TXmcRQpvxtsHPqQdpp59CO0+Wpkw O1FdVC1BKOY2PjwWu4PiG6PPybVN3xozelYqaj1+JvmN+zxDYRiZGgaffIKQM8pIwNh8 NSYX12DWCHMngFixEj8hlfdkTmvdhUWp/o270= 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=V78a4T+XxMalGYKe1sIzEqFdtRWisjMfkHNLxFh+Xuk=; b=X27/tfhTNp21mpoMHE6MXzChXA0T/Cy/KM4WoiwryWWBB9cNWsM3Q7Wdv4VZ0PPVYG Rgw3kJVGfVtceNqiHSB0icCs80dcVpxOM3Jc5aAOeGmgzgLkewQVDyG4cdEsnH/JW7B/ dcMD4VsWZcWBMLCMJFfIasHo60ufN/gY2o0sn5rnUDVpTD+r8Psg84qp8H92iJFB/v07 6xXZ2h91Nz0idLT0JbnN3lxkolg4/d77KGtsGkPguMKa5TY4udxjQpJ9KgLz+wEyZM54 XhRQE1bJpftTDrU0FkkZLVQvvYgZzhi/LIP/GYMt5XqHx5Rs5ZZ1h4Qnc0/FYI7gYAO2 j6pA== X-Gm-Message-State: AOAM531cxGjpkF76AI3ZlhV9nhDMG15JRA3IxvSzZOgSX22TxFedKE8J lsPNS+fCS2hk8U8J54HfoXY6EA== X-Google-Smtp-Source: ABdhPJycUUBIC0Nq2ppBparTGefe6HldISjHe1t+Ctkdpq43uiW4rw85OhOjn6Zr3IYUU4N7T2m2qQ== X-Received: by 2002:aa7:d857:0:b0:41c:d08e:3c94 with SMTP id f23-20020aa7d857000000b0041cd08e3c94mr1340900eds.10.1649002216982; Sun, 03 Apr 2022 09:10:16 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-0-15-73.retail.telecomitalia.it. [87.0.15.73]) by smtp.gmail.com with ESMTPSA id do8-20020a170906c10800b006dfe2af50d8sm3350119ejc.121.2022.04.03.09.10.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Apr 2022 09:10:16 -0700 (PDT) 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 v4 6/6] Input: edt-ft5x06 - show crc and header errors by sysfs Date: Sun, 3 Apr 2022 18:09:39 +0200 Message-Id: <20220403160939.541621-7-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220403160939.541621-1-dario.binacchi@amarulasolutions.com> References: <20220403160939.541621-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 --- (no changes since v2) Changes in v2: - Add Oliver Graute's 'Acked-by' tag to: * Input: edt-ft5x06 - show model name by sysfs * Input: edt-ft5x06 - show firmware version by sysfs - Fix yaml file. Tested with `make DT_CHECKER_FLAGS=-m dt_binding_check'. 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 bab92344b2ea..3deb66d67469 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 };