From patchwork Thu Apr 21 18:59:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 564580 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 0C182C433F5 for ; Thu, 21 Apr 2022 19:00:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1391690AbiDUTD1 (ORCPT ); Thu, 21 Apr 2022 15:03:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391693AbiDUTD0 (ORCPT ); Thu, 21 Apr 2022 15:03:26 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09C9039BBD for ; Thu, 21 Apr 2022 12:00:34 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id b24so7679508edu.10 for ; Thu, 21 Apr 2022 12:00:33 -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=KbJ8suT6akcFwDGZZ32/sv2cxbF45zgAuxPQdj0QfCAEmFFGuOSHqDPkEYVLLpv42J VTkFcGMp4k5nnelCelym6LrPoY+l3XZZ49/RQ3UrzxKHLL21LM2vUwulDGa9cBudRD/t 5z/JSupRQa2FRkazVocJUBr3XCLfI8bQvS3Zw= 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=uonrBdI5rrZW1g/9vefDfOb0FGAzaf/r7GWhU/Q1tC+XTvAAWDCcoZsJToEiKCa1BA 6FQIsU7LS8kH43jP5d/jCT0gslHdjnE14UFPuCaX6U/uDEZINm8wjiUFLJb1UT5KefR6 W2xrX2ekcwTGeDA4baXQq5SCCx8cQ5J4ae37FA2v5VZqeYeLnLDAqj0msZrptbKd06fP qSthjESxtKezEL6qyhnY4TnTDmM6uCPs6X5/1QZ3zxw5F83KZk4QsB0ivhs+OwLiqBnA 2c+cDAQh8vpIbhg+QXWPLSi3OxKtCmQm8YLEbGpYvCw+cfUIVaZwf3t2eWFoiX3ux4RM Gp4Q== X-Gm-Message-State: AOAM533bvxK3iQBv+gyoiA2wcWtEGVMGu44yJybR+TsHN4FXYUL0+aOL q33kFTWPw0r4O0o+tE+c1tfNoQ== X-Google-Smtp-Source: ABdhPJzEgotpyjr8bxxnZGEw6QSFUz9Ctnbf2mCUqRiQErf3p7gK/T1Vy3eydjWyUgOQDWbl4g6mpg== X-Received: by 2002:aa7:de0e:0:b0:41d:6e55:24aa with SMTP id h14-20020aa7de0e000000b0041d6e5524aamr1026380edv.368.1650567632578; Thu, 21 Apr 2022 12:00:32 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com (host-87-0-15-73.retail.telecomitalia.it. [87.0.15.73]) by smtp.gmail.com with ESMTPSA id s11-20020a170906284b00b006e108693850sm7975142ejc.28.2022.04.21.12.00.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 12:00:29 -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: [RESEND PATCH v4 1/6] dt-bindings: input: touchscreen: edt-ft5x06: add report-rate-hz Date: Thu, 21 Apr 2022 20:59:58 +0200 Message-Id: <20220421190003.3228699-2-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220421190003.3228699-1-dario.binacchi@amarulasolutions.com> References: <20220421190003.3228699-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 Thu Apr 21 18:59:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 565121 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 22447C433F5 for ; Thu, 21 Apr 2022 19:00:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1391675AbiDUTDi (ORCPT ); Thu, 21 Apr 2022 15:03:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391687AbiDUTDf (ORCPT ); Thu, 21 Apr 2022 15:03:35 -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 C78BC48E72 for ; Thu, 21 Apr 2022 12:00:41 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id s18so11998727ejr.0 for ; Thu, 21 Apr 2022 12:00:41 -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=MaR3Nh0a44PUeP4GD3N3fQzpOlKuDClTPxLe42jw/eCBgTgd5mP96liXIDHRTXppE6 ixs8Ql1juGJM6TIDGV2+bJ9iYvfZ00PBMmh1w8O1yGdYwLdAzEODqrF9D0bSqvGeq50m sW/4spg0aTemVpI+udSkE8CjxlOk3WfAac4+4= 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=IQXmsoraVAQSKA8TwIzND2Zlfxst74xLQ23jDcxkGAsK5icWSvQVqCvVV3MPpJ1qpY RmWEsv6+8aABJS5eIpxRSrGdj/iCgBVdUQUqGC2rZNgofkaoS99b5P9WDXYSWrF6l0dS bIAyyF+XxDRr3EouNDPDWLv0diNNYBK2snu9Jf/ar0Rlt+WCnAgfh2hfmv+Ggczr2y6V 3lX9M6AK9LbnGHiugmyNJUeiuzAUzSRKHeZ/vv24Se8Xb5y2YW/on+6285iRY2tZ6OBk bOGJB4/ht4lBaWr9rY5oUe/qKlrSbH4VtJzTRc9EML938/EEq+fIu9mR9bEgujSVdidL AkPg== X-Gm-Message-State: AOAM530bpLJ5IheYCQd2FHlBebn5T7j2u/Li89IzzXQyBKOum3vifUFr nZfLgrvnZXCXEY83VYRTvCpqfA== X-Google-Smtp-Source: ABdhPJxoL9Wtl1u17AlU4k2DNhoDrILAoq0+heR0L3nJccvzIFmIBYZJqw8kj58yiZXBbRQhzIKFIg== X-Received: by 2002:a17:907:1b19:b0:6f0:1022:1430 with SMTP id mp25-20020a1709071b1900b006f010221430mr843589ejc.13.1650567640396; Thu, 21 Apr 2022 12:00:40 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com (host-87-0-15-73.retail.telecomitalia.it. [87.0.15.73]) by smtp.gmail.com with ESMTPSA id s11-20020a170906284b00b006e108693850sm7975142ejc.28.2022.04.21.12.00.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 12:00:34 -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: [RESEND PATCH v4 2/6] Input: edt-ft5x06 - get/set M12 report rate by sysfs Date: Thu, 21 Apr 2022 20:59:59 +0200 Message-Id: <20220421190003.3228699-3-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220421190003.3228699-1-dario.binacchi@amarulasolutions.com> References: <20220421190003.3228699-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 Thu Apr 21 19:00:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 564579 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 73BF3C433EF for ; Thu, 21 Apr 2022 19:00:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1391684AbiDUTDo (ORCPT ); Thu, 21 Apr 2022 15:03:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391713AbiDUTDl (ORCPT ); Thu, 21 Apr 2022 15:03:41 -0400 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 9F49441FA1 for ; Thu, 21 Apr 2022 12:00:50 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id d6so2605751ede.8 for ; Thu, 21 Apr 2022 12:00:50 -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=m2IC8FNcMpgWptpAk5irJwhOTaeWH7pd1WYL0g/hEONSJ34jgGfLZtZiLIJJSCUJ0l JmrOJQSrFs2W7lnz/IKcWhRnBQx5ZYZPmiTjP+A+R8IusFP4rSZKWgtKgzQnaJy0lDR4 ovtzUi7Nyiz5PfyX9jbzD91/J6mi+3Ez71YjE= 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=erOjRtoLmAH8mnWZG3WFaff1/Qh2M4z1he9jMFrf9C7KoTrh6fAFtliMvZ1N4I9FX6 aIlkQcyAVLo5dzATmjNcDasyNS2+bvZZR6iONQj5Q9ixrHryGhCZFtxC96v/7P+f6Jvv pVSNlhohGB4h+f2f9XpyAxt15vBZmf7ZNKfE/ZcNOYX1wtPp/XHnnD45Rylm+sxRU9Kj t2Yne2VvobWIL4A2VR9LXsZMJSXCB0fgBYWwB7d1+s/eb7a7jIwSs3NETrYIaWAZZaTv hx1qmrrp7i/7nIMtO1GyM7yvJeEfdN5WzMOiOFG2xrxT7S886l7NvbNC8+iNetO0zA2P PKaA== X-Gm-Message-State: AOAM532lnu1w6Hkk9xZZtYLC2aks5mQY+KoO7l5Y09NvQIvKguAv5pae o+tW1InKVEhEJPHn1OmGCFN/uA== X-Google-Smtp-Source: ABdhPJxQiLhPFSbkfabOPaFiFv0NiEGVjipYprjVWUNCWZdLj48Nxc0yKpYdzzHF3PJT+UpVZvBAeQ== X-Received: by 2002:a05:6402:1707:b0:41d:9794:6421 with SMTP id y7-20020a056402170700b0041d97946421mr1047302edu.212.1650567649267; Thu, 21 Apr 2022 12:00:49 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com (host-87-0-15-73.retail.telecomitalia.it. [87.0.15.73]) by smtp.gmail.com with ESMTPSA id s11-20020a170906284b00b006e108693850sm7975142ejc.28.2022.04.21.12.00.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 12:00:42 -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: [RESEND PATCH v4 3/6] Input: edt-ft5x06 - set report rate by dts property Date: Thu, 21 Apr 2022 21:00:00 +0200 Message-Id: <20220421190003.3228699-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220421190003.3228699-1-dario.binacchi@amarulasolutions.com> References: <20220421190003.3228699-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 Thu Apr 21 19:00:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 565120 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 AA39DC433F5 for ; Thu, 21 Apr 2022 19:01:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1391695AbiDUTEg (ORCPT ); Thu, 21 Apr 2022 15:04:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348745AbiDUTEf (ORCPT ); Thu, 21 Apr 2022 15:04:35 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E31F041FA1 for ; Thu, 21 Apr 2022 12:01:44 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id i27so11878144ejd.9 for ; Thu, 21 Apr 2022 12:01:44 -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=ka0bSzqelK6lJUthcRpFwJgtlNk/odO7kgggb5rUBc+F9MxHrAiagKn17SvGC6jvkl BTE5CZ+DkTc2VSfuLv8wBIWTDffVF0jwMdBKR7zX4NT7PHstkijKl8PQtxkOShOghHUz bzl8LWmOaNwYy0ryHBX5rA1mezy5nnM/gyp+o= 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=aqY3DSpURzJo+S3M00mz0kQhN2lKnAd9syxRwfEVSiSzLq1j3VDJKNyf32+fyxkjpQ HpoiLO3jT3dyBoIG1HBEeC3rWIuB80SztLW2rl8NsX/1/egfhH5wqyDgPzV40reDNcb2 zx11BUS7cwCeY6DCQDK/Mqy1NmXcC3m5uf0f6rHCW5o2RTtKPShxAeW3yVrrgnBTJ0kZ FWNvvH+TTLBeHjCUQ+n3nB7iQKd0r177m9i6T0zPAUSGJltLc1aQ8HVNOf8miEeewAld jWoR243EgZzg+uS+SMrWChRNQ34j8O+ZxwHPx/oyhXwfqMWhgmCk0HygWFJNuMTRgfR0 OAEg== X-Gm-Message-State: AOAM532kEhtzr0cYgh9hgdBfozOXagp5JuCDc2VFx3Dk9ghW8gJICmfD UXWYxsBGyWdVXA1MxdTPglNrLg== X-Google-Smtp-Source: ABdhPJxVGUh+88fza3C0hBCin08Pv3Ewf46UwISRqQuu2FYh8ryW+j/atM0tg7WYIEtPnpITj/krSA== X-Received: by 2002:a17:906:2bcb:b0:6e7:f655:3b96 with SMTP id n11-20020a1709062bcb00b006e7f6553b96mr801376ejg.175.1650567703496; Thu, 21 Apr 2022 12:01:43 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com (host-87-0-15-73.retail.telecomitalia.it. [87.0.15.73]) by smtp.gmail.com with ESMTPSA id s11-20020a170906284b00b006e108693850sm7975142ejc.28.2022.04.21.12.00.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 12:01:04 -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: [RESEND PATCH v4 4/6] Input: edt-ft5x06 - show model name by sysfs Date: Thu, 21 Apr 2022 21:00:01 +0200 Message-Id: <20220421190003.3228699-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220421190003.3228699-1-dario.binacchi@amarulasolutions.com> References: <20220421190003.3228699-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 Thu Apr 21 19:00:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 564578 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 06876C433F5 for ; Thu, 21 Apr 2022 19:02:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237507AbiDUTFE (ORCPT ); Thu, 21 Apr 2022 15:05:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389443AbiDUTFE (ORCPT ); Thu, 21 Apr 2022 15:05:04 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 829AF3A5C1 for ; Thu, 21 Apr 2022 12:02:13 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id ks6so11962350ejb.1 for ; Thu, 21 Apr 2022 12:02: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=YV+qTrBSZlEdVwvYGQdRpxUtm5BLonFPqiCggidUwTw=; b=B1H5ZgGpA63O5v5dDseCQC6tK+EJtNplHma4xWuSCMbmqOMxRoeqCVZLiBpjha9ied HJ0QtiOUImNuvD3lpJ8AOVNqvxXLzuO8WMkJNpKLVeGzPXvm9kem0R40B3e3G8TnVk28 lY31fw5J9GhwRn0P4mOlchEOVhna0sfWs7PKQ= 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=6IGl5PHr15RsLMevgOK/+0pOF1zRQS76zQYDG/s0GDnPyo3EoDRTP+YN0mhViCmLuM 4gs56FzglqAss0d71a9B9xDc3R8ScKbEZTCx2S3Rt2yqMy0kUdm2+X9jkTunqFP98c17 XHPN4mfzZlUlfqUAscZ+E+enQFuo2ocKipWsKMry+Z8DcjLEXOKyrAH+msSxSAtVQjhd Xxxc4anZZQEwZOMlUQiLAdvE1VJbagDXOkR1GiO+NGhZR5cjJSffuZko/F3dLCejFWZY k+dyKnZ47lfY0IXtbWBNaPxVKIosAf0nR9xVj2gC+2CfMcK9Z+vRWdReXGxRCSb0mU17 1fKg== X-Gm-Message-State: AOAM530pUOUdUn0vOJ9v7XfxTy5e/8MaABswV5ifq45iKsBl4VAQKdsL ZHK6B/0/vST02qrS0uoy/UTPG68Vzv/wYA== X-Google-Smtp-Source: ABdhPJwGnZ7s87UVdhDRJD6kiBB+YdmIaMSZceyr0LboNbbh6ou7VG2d0CGXpF4Nkk6oL49LbjBzEw== X-Received: by 2002:a17:907:7f09:b0:6f0:2991:9c76 with SMTP id qf9-20020a1709077f0900b006f029919c76mr853725ejc.170.1650567732081; Thu, 21 Apr 2022 12:02:12 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com (host-87-0-15-73.retail.telecomitalia.it. [87.0.15.73]) by smtp.gmail.com with ESMTPSA id s11-20020a170906284b00b006e108693850sm7975142ejc.28.2022.04.21.12.01.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 12:01:48 -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: [RESEND PATCH v4 5/6] Input: edt-ft5x06 - show firmware version by sysfs Date: Thu, 21 Apr 2022 21:00:02 +0200 Message-Id: <20220421190003.3228699-6-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220421190003.3228699-1-dario.binacchi@amarulasolutions.com> References: <20220421190003.3228699-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 Thu Apr 21 19:00:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 565119 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 5CBC4C433F5 for ; Thu, 21 Apr 2022 19:02:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1391724AbiDUTFP (ORCPT ); Thu, 21 Apr 2022 15:05:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391716AbiDUTFN (ORCPT ); Thu, 21 Apr 2022 15:05:13 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3775E49902 for ; Thu, 21 Apr 2022 12:02:23 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id d6so2611080ede.8 for ; Thu, 21 Apr 2022 12:02:23 -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=HHkEqxTxydBkOPTAWKKQG/XvT+4YPu7xQsaD3xEJkvmj/jeK3VMbwKQ98Hbg4RrxiH YELlCFmGs11cjfEKrDmGA95J5WqdeDTp8cqZivOwf0LvaC+Bw6LnM9/isAzazgkYZZhW GHhXNNhnP63fA/YlhvZ9WEMMZ1Lf61iZnKvKM= 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=ipnxDsvjbFLK/mb0ib+gVOXJhJUatMrR4hvOe2dWKpFtWihpnDZ+wkWCItryk01QM9 bM74/d7KG0rbDg29a2rgbp1mCXuh2DUlYYY9+KcgGn1NXztbeZmkBtoBHd2HJ9kjnd/c bSaiDYeseV9zntoMLm0PAvzzgrSC53H1tM3msX+/ILcwLn1Qk0DBWTS5Jynv1O8AOrX4 ULoFDUvXpCKOXogaTGblUdt0PedlxoG5YnHz1/ws1lNVWNzn3qOeCKJUmepsf/z0uo+s aVtl3Ik/9sY9xfW1DBH5x3PdqiuyB5ddh9axISEEHBt47S3wwLRL6u9+gPyXblxr5Nrv vT0g== X-Gm-Message-State: AOAM532NWIJqaSwMfER3cgW1CLhDZ8fHNi7G2PYY+k3dSTFBGwPON5YA f7VtRfY0J9al78RgVLR6+M6lCg== X-Google-Smtp-Source: ABdhPJz0KGL6rSjm6EhATFv3ykGqeGZcALLvHUMKiYbjmdhG/nGMAxcs10My5jkMKrm9TOdaIQh09w== X-Received: by 2002:a05:6402:1a44:b0:41d:8969:e4c9 with SMTP id bf4-20020a0564021a4400b0041d8969e4c9mr997941edb.299.1650567741656; Thu, 21 Apr 2022 12:02:21 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com (host-87-0-15-73.retail.telecomitalia.it. [87.0.15.73]) by smtp.gmail.com with ESMTPSA id s11-20020a170906284b00b006e108693850sm7975142ejc.28.2022.04.21.12.02.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 12:02:13 -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: [RESEND PATCH v4 6/6] Input: edt-ft5x06 - show crc and header errors by sysfs Date: Thu, 21 Apr 2022 21:00:03 +0200 Message-Id: <20220421190003.3228699-7-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220421190003.3228699-1-dario.binacchi@amarulasolutions.com> References: <20220421190003.3228699-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 };