Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3769824iog; Tue, 21 Jun 2022 05:45:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uZjjr9w6VQSeE41KkacMJhkTkCkXb2+q4K9bVsDYlASX9d3L+BqtHYcfC0s3DjSiYumyYr X-Received: by 2002:a63:4c:0:b0:408:c003:a45c with SMTP id 73-20020a63004c000000b00408c003a45cmr26264931pga.252.1655815541077; Tue, 21 Jun 2022 05:45:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655815541; cv=none; d=google.com; s=arc-20160816; b=T/OSHrYasB86jP7O1kcUQ5VevDOw6OHJ+djouMQBmxDAhejoFdnL+JjaZjXStJqfqX YOFqRn0dUyPz7e//pUi6FHTbxno3nyG7xekj35QlpR4zLphHEGkjowQcEdWW3pw0GiPs EaeW3Dobv8j+Gxh2lPXkv+q/Wv3ugH1y4IQQvdy7m7vN5jSqpJgcMzjZxnV6TAEGmDWI PLamueKiSTbAeMq0YtwnlB+Csw+y84Wjz/i3TsZzaWYG1eD+UjNehhfgdmTmc91f4yzb 8/c/ur7UfljuY2ddXd1St5TaXYREj9x/9NI1cP2hi50ad27neZc46WhSFyDIW/OTBjx2 SGnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=V78a4T+XxMalGYKe1sIzEqFdtRWisjMfkHNLxFh+Xuk=; b=Hyvzs9MBLwBraTMcxLj9QglNuZJZlF+AEFACoqTIwblRAHpmGI1O5VRW3Ydxel1Ox6 8cGK2Gw03IKJantKxmMUkAt0fLnS4lTKiIsOuIeIpdN++78Fx+/+Xql+BkPxzGhhbGmf QTj780kLPvY0RVdFTGpXn7KY7nE9jj0xABwLNr+oDMWvQE1rOfmw899/O0W0O72gxhRP Y+/BOPdJXNT2CQ4ylWza6EeK7aAqtl5fO3f0NqoP3P/JrEy8TVgec1OPniYf+ogCsIEm Vx8mQrcP9oM2Og1bIvDRZKPSCCGPl4US1jjH+sFYTcRfWpJjLt8T3HvhZbmQkWnR1Rws 0wCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="USYW0p//"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i16-20020a170902cf1000b00165bb998d85si18982097plg.619.2022.06.21.05.45.27; Tue, 21 Jun 2022 05:45:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="USYW0p//"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350600AbiFUMkI (ORCPT + 99 others); Tue, 21 Jun 2022 08:40:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350512AbiFUMju (ORCPT ); Tue, 21 Jun 2022 08:39:50 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F93924F17 for ; Tue, 21 Jun 2022 05:39:49 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id ej4so15228732edb.7 for ; Tue, 21 Jun 2022 05:39:49 -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=USYW0p//evI6FmwwoomQYK1kmu7U+jM2to1UOgYGvAZmu9YJV48sYKlssNA1bxE3Q9 ehN0vy0xceUsqbYpvhE7OCKxffLkmpTFER0fm0bAzPrS/BOct2K6FevtBDwnb46eL4K7 uOkAMNcv+n/lDS9hna9RMNUwo10pQGuvaOPJ8= 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=qThagQpXDDP2+g88Qf2o9ag3smyuVKOBtKh6VvX2cHPToIzQcmhBT6QkfstemO0Pvm G6+f90bId21wj0hUT1RFETWlje7AoMCZmg3Uo6sOi6DXF7E4drAI7jifXZyuTZ1wYATD K4nAeUNzRROMWQNRocaXRlWTTi8BkZc7dKTGs77moO5kiWipUUH/E60RK0Tj8xb1+EoU nA1RfGsu2prPNdNU7AZuy5obZCaH/KPjuiXFLC9kq237GQLLB3I9osW24ygH06sLEGbc CBISC8DmJe3ORgCBTl16HtU41VuuY1n1frlprkx77t3VKIisAoRPnDOb1ngdqdH9z7UZ lIsw== X-Gm-Message-State: AJIora/KqhjXh4XP0P6K0tzMkB+M3xq8EVr0pkrf2ZtXrea9N/VyCcAs 54F63s2blqUGOc0Mb+9G+HA+TeFjQYJqjQ== X-Received: by 2002:aa7:c542:0:b0:435:75e:8a7b with SMTP id s2-20020aa7c542000000b00435075e8a7bmr29236378edr.108.1655815187550; Tue, 21 Jun 2022 05:39:47 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-80-116-90-174.pool80116.interbusiness.it. [80.116.90.174]) by smtp.gmail.com with ESMTPSA id c19-20020aa7c753000000b004357063bf60sm8003945eds.41.2022.06.21.05.39.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 05:39:47 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Dario Binacchi , Michael Trimarchi , Dmitry Torokhov , Marco Felsch , Oliver Graute , linux-input@vger.kernel.org Subject: [RESEND PATCH v4 6/6] Input: edt-ft5x06 - show crc and header errors by sysfs Date: Tue, 21 Jun 2022 14:39:37 +0200 Message-Id: <20220621123937.1330389-7-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220621123937.1330389-1-dario.binacchi@amarulasolutions.com> References: <20220621123937.1330389-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 }; -- 2.32.0