Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3448858pxb; Mon, 4 Apr 2022 17:19:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypByvxJmv26O7l9EvfNBHkCvUUlESu5pSlM5magOg/XWsjs35PJKkFUXl3yJ7VG37i/029 X-Received: by 2002:a63:6c4:0:b0:382:8506:c127 with SMTP id 187-20020a6306c4000000b003828506c127mr618519pgg.279.1649117940897; Mon, 04 Apr 2022 17:19:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649117940; cv=none; d=google.com; s=arc-20160816; b=y9hjXj+qPNGcyImej7gGIAzJmCYwz/Opte6bwbXHaKeEPvqPvOHgucFkpkm6KNUlIl zure+WSDxQ1yr2lavcz4j5M92QN8ImQ8IjKTJ4Li/+H+aT1OIxGCAzebbKe5lPUAAeso GnSvFAIERDtEW8m8/iqggTpVVQKXwT3T6Nxyz6hlpTu2WdYqAH/ayCdGTDET2QqFuZCX KWgrx0V6abhBegOcfZQLSWWrbX26HnvkTmz0wp22MfUkJe97lekRyqP5i0j+ipgzqT0G SjkP9t08L3G7XBJ2e4VogrvLLC26mdpI0AZ65j2M4xMJsVWv/rkBi8mzJlOxKJYhjCCI 6Cig== 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=Qyk8NK0EGRC5R72RH7zPgqb5jGLn/mnJ5lRkmE6eMxB4iLHlyQjX9X4QkQDzdF2bST TFi2mr5AkncgMuTODCAtItVJ1gDrBP2QS+10J+qY7Ff19iJGy8CSqUo0nFpMIlWQh0AZ +5BelXVZLMdCIAtBd2ldvmD6yUJT9dK50JIhrUXH1KN4WDjblFDo5vmNLzbWufw3fzpE GT74y9g6yjb+zx764H0P3mHEwzitrOoqqTiuosVIU1E8YNdMpnqW5bUXMPi92e7lqoE/ cQoQfK5KrVfM9+clIyT4vtnGh7/cThjxhgfm8tBYHk3YXhMxe5oiPw0MciCXKgnYK+rh xW/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=j5pKyZu3; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d3-20020a170902cec300b00153b2d1648csi11887242plg.148.2022.04.04.17.18.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 17:19:00 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=j5pKyZu3; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5D7756FF68; Mon, 4 Apr 2022 16:45:45 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359399AbiDCQM0 (ORCPT + 99 others); Sun, 3 Apr 2022 12:12:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359371AbiDCQMO (ORCPT ); Sun, 3 Apr 2022 12:12:14 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD70727173 for ; Sun, 3 Apr 2022 09:10:18 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id f18so3287004edc.5 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=MDczORioDIjU6wnM3K+JeaqttuBAKhBdZHbwj2ChHFVYSt/8JgZFEtleDlTcy+TEbJ kXED9eN1+zPF6Q7Mf81YQOuEaY+7PKc95zwNwqyPBAeP+sXbxkBAoxrjWMzHtmAVVhLQ Box8XuRXBB3rfpatkr2lR9K50oecZSpKOZq2+BNBBeIQESRbHu5eEGYR6l1XjyRaBSVt q4QdFglxNwnk3I9LIDM77SnRAB3NKtb3jg3l5kg228LE8v3/3MSLSXBl9uUgx/gVk76K p2Xqmk3xQ1OBg72ehhVGfVKfv4htrsMxLt8VRDE2GnqFW1hOY0cN0EyC+G2qVcYzyaUw 9KCQ== X-Gm-Message-State: AOAM530AOy8RjnCPChr9dJRHplzMeRXm+fTzsvw3DGHOIlMs9Ctmt0bi R+5sV0KHlFOjoQr5NRCPPqsE5azzNeZuIA== 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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