Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp844752pxb; Thu, 17 Feb 2022 16:24:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJw9/valY+OnTRS9GOpZuZtoohpgrdCrKxeqzZadTDwc0H9qgAKwEscDtYG0fHq11M91+jir X-Received: by 2002:a17:902:7485:b0:14f:3b6:1847 with SMTP id h5-20020a170902748500b0014f03b61847mr5060110pll.70.1645143842253; Thu, 17 Feb 2022 16:24:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645143842; cv=none; d=google.com; s=arc-20160816; b=mavEZ+2hNFqcVROgovZpckKXbHBVCJ5BQuUmltkq0Vw2DwMV7iZnP94twfzaUcyAVr tSFdxH4/PfFjl9PAlbaBxo6OHtCY6gaCIFdO0cWGX212UaOVsBBzlQP7030YmgItcL0X jtnnjG8IZHOZt3J52Xk+DugMwaiTHRIQ3u/LRyeD8WMS/TWdFe+OCdymB5YZlVilFd6T 35XxiLD6BskenoNjsQxTqLCxMMr1ueP3L/ZVhuWM+czzqXJO5qTsgCB63L68ZwJNIiLR 30xZ9C9kYpD6aDVAxaeWEObl4ijBwKUqPkisEVaUqQyYxIHvx9UQqNqMSeKmW0sLfbnq 37ug== 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=aYavHrz9uYq/HYgPLL5fx/Iu7jH8mcTwpcrMb6KNtKI=; b=Nb4ton7ZjBu5EIvhAVNkf3xnjJoDuRSw/BcbmfT+LcNseVz0rwhAVnrRR+Gpq8HWAF WXfVVnSUjtbfFuPD0sszcpJiqruqkIJksVId2nYntzOL1RE6IYjFKyR+d9vfPFFyDL4A pMRmXIeYtRczKPxnmRlBsaqErtevL0xKk/XrtqwANizElF3p0yvS9Nk7tcpRd/eRjVrP s9LN638kTzaREsCoJ9XFzVIPxmBdL2g1PmoITF6U5qpVPj1kqAjEB0UhlH5yde0Zb4m3 9slcaDD+5a3whQE1GoF81AB4F3/RMX/3Z/mBDRzkGrOwn/Mz6sAYy8IbPG7Plpo/Qw+h aPwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=r5K+R2co; 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 Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id j3si20674262plr.520.2022.02.17.16.23.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 16:24:02 -0800 (PST) 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=r5K+R2co; 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 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5BCBF378F70; Thu, 17 Feb 2022 15:47:04 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243552AbiBQQ4u (ORCPT + 99 others); Thu, 17 Feb 2022 11:56:50 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243505AbiBQQ4a (ORCPT ); Thu, 17 Feb 2022 11:56:30 -0500 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E87332B356E for ; Thu, 17 Feb 2022 08:56:15 -0800 (PST) Received: by mail-ed1-x534.google.com with SMTP id h18so10764598edb.7 for ; Thu, 17 Feb 2022 08:56:15 -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=aYavHrz9uYq/HYgPLL5fx/Iu7jH8mcTwpcrMb6KNtKI=; b=r5K+R2coy5q4cY3OP9vctSLzr0ShVogrBO27Epuj1++nU+u2nz7CHLrdFYzy0/G5sU 38xdpMowBMKN6Gp7/5ReB4809KvA9uYMZhJdWw9VcfkoaXxQ3TIfDGJRhpsAk8z//fwz iXkk8iiDdaRSrdGNQBs1+CasbFMS7nFaZqa50= 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=aYavHrz9uYq/HYgPLL5fx/Iu7jH8mcTwpcrMb6KNtKI=; b=fa8dhRSSkhozUxGo+e5EipiJUg8m6amPovpIN03+ayZAI11KQf3XWo5DxgS0u4d3mc T8BheNsm909MddVrjr3vS8bcTUysauKpgrCxex9mQTxFZxtL9fMs1/COIgTwWkMmjXII HUc5VtIPM4b2vuvbC/wBpgbiIuVARJ1YaTPfozLYPJRfTTsOPYAWrnWnoa5aLPzP17uc ub2EVr/53820pUucyQF11gNlZPoUmEiCyA42uauX/HNxy/XZpzygKBdJyLnacJDGbvzN WKSdTd8mtGXDYv5CLjgVdH5ZV3vNQ5VN07JB3xQGebiSqrR1lQ/5VXDKdPUfMwOrhCTh EDXw== X-Gm-Message-State: AOAM533uZjazSZwF5GzL59/GunIrC8q/0YvILy8US9S9EPrIpPTu+TbN c6a9zNRAqtvzl9gOrjA+6cO3wnWBRQLHpg== X-Received: by 2002:a50:fc09:0:b0:40f:e199:b266 with SMTP id i9-20020a50fc09000000b0040fe199b266mr3490936edr.350.1645116973788; Thu, 17 Feb 2022 08:56:13 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.pdxnet.pdxeng.ch (host-87-0-15-73.retail.telecomitalia.it. [87.0.15.73]) by smtp.gmail.com with ESMTPSA id v4sm965323ejb.72.2022.02.17.08.56.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 08:56:13 -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 v2 6/6] Input: edt-ft5x06 - show crc and header errors by sysfs Date: Thu, 17 Feb 2022 17:55:58 +0100 Message-Id: <20220217165559.313366-7-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220217165559.313366-1-dario.binacchi@amarulasolutions.com> References: <20220217165559.313366-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 --- 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 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 }; -- 2.32.0