Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5560514pxb; Mon, 14 Feb 2022 01:57:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJysW2r0f5oi2mhHSqRfyU8adyu0lrjjz5UKja1jtD8a/q05KhhqQI5U2J7kR5PyuoMKgdIP X-Received: by 2002:a17:906:7493:: with SMTP id e19mr3551402ejl.580.1644832659277; Mon, 14 Feb 2022 01:57:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644832659; cv=none; d=google.com; s=arc-20160816; b=aLgVNn3EBAYD16beglXnYmDdJBtP8FcP0QhYCDWek4KIIiGnEYW0jvnPSWDZ21mTmH XSFcDCv/QdE2sRwSf1nyX1GGrbDz4hjjAbRa3gPvupq+Y7OIGmQdEIesh35cnqWKqh4K 7HENg4zoMSBsaBrCXC7iEg1lxOguju6pkm70oc7Vy6n3EH1tGJBnGNWWdbY5D18V1um2 77zPVIBOvOntDDp0vt6qguMxKei2fdgzzof7+7ZuN838NdCoIvinrL2guKUFql+PZyVA BYcp/Gu0JF0pK8PIwJUlZJLb1Ml3+RMkkjQAowz/bNzZXySuHk30Q6LIlQQk5A7LTabN cBNQ== 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=/PAiX6O2/FWZ7wNjpZzseMRWrZbr6IoxG6JcDDkQD60=; b=ZpGcOJi5EOnvyC1Z29WFAvj+jpmvIyF4EiT037u3FB6SNQrFwqGxfY9Sxm1YsBvj96 orKS7kQ+ulO6fiCPfdxOA6fqUtXw0E8LPSOLUe+bL0U6v2zvVpWAKglWhHxYox6DD1bv NHWQ79lQmmvMqhagCCPzQJaBZHXW7HPARwY3AqocaVGKFeg9MKX1LINWyze6ccnrZLdk 59m5PrRNyHYkNWayRomYsYgBrFZFDRbyYlHqzyhrAEfPphVgF0ttXzenHLZMeiB1Kikg KLW2IHRt6t2G2dht+1ombWbAPTrqmO3mUu1uQVbt9UV36miRkzA4xQeYa27CkMR8/3CG SM2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=amOnERdP; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kx3si19890986ejc.840.2022.02.14.01.57.16; Mon, 14 Feb 2022 01:57:39 -0800 (PST) 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=amOnERdP; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237353AbiBMRQX (ORCPT + 99 others); Sun, 13 Feb 2022 12:16:23 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237332AbiBMRQU (ORCPT ); Sun, 13 Feb 2022 12:16:20 -0500 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 A077E58E74 for ; Sun, 13 Feb 2022 09:16:14 -0800 (PST) Received: by mail-ed1-x533.google.com with SMTP id g7so7824219edb.5 for ; Sun, 13 Feb 2022 09:16:14 -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=/PAiX6O2/FWZ7wNjpZzseMRWrZbr6IoxG6JcDDkQD60=; b=amOnERdPT9H+IwBJM3P+hh/Sy+S2jwc8bY/zLvUoUqye4y+G6DNtVCfQUBH7kwyj6R k3wHyY6NREnEdjInWb9/+BlCKtxqQNATvSkiTCrVfEOlWS6Ms4KT89V/XlUjFjmgQJsK H2zBbl2rXbW0s1CPTZuSqjPVzYajGJQoc7hic= 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=/PAiX6O2/FWZ7wNjpZzseMRWrZbr6IoxG6JcDDkQD60=; b=OKMk1LE1QsASGC6oH27iVvM42Ex9JXc0Umgnqa7mjVmleSpllDHm56aL2I7Js3JSkC QPxW/0w5hWH8UuDBginC1q53bev25mb8M/tctagT2Qp4EU9hLc+MsMBYHRE7aeoDal80 K7KD6ZzYSKNM3pw///uLzndXt09/sLsiXDOeWZ9GSPyoxBNZNSAnuCOS0iyw2PK55DJ4 eGCMi68vYaml4IttipJ6ShrhrXfFX+37DKVFRFAujDtUVSU3UPH1XFnAzVjd/QnzcP7Z gcnVdmWKYRxSK2OxdmmVkUuZlDc/P2aVSzQw16w4GB5HdhmDDwBN+C2JE+eEw6nBKIRi 8YGA== X-Gm-Message-State: AOAM532fdID2qljUVg/iziIWQ0XRdZBArSA5jFCpjZzXqqrPK8AT/bdN dQrGP86R8gsPOIO1YhSY1YmTcJ7jM/HpWg== X-Received: by 2002:a05:6402:b6a:: with SMTP id cb10mr11800292edb.140.1644772573027; Sun, 13 Feb 2022 09:16:13 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-82-52-8-210.retail.telecomitalia.it. [82.52.8.210]) by smtp.gmail.com with ESMTPSA id o10sm6598878ejj.6.2022.02.13.09.16.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Feb 2022 09:16:12 -0800 (PST) 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 5/6] Input: edt-ft5x06 - show firmware version by sysfs Date: Sun, 13 Feb 2022 18:15:31 +0100 Message-Id: <20220213171532.346270-6-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220213171532.346270-1-dario.binacchi@amarulasolutions.com> References: <20220213171532.346270-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=unavailable 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 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 --- 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 eb1231d1c0b4..2c946c155108 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 @@ -1096,7 +1109,6 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, struct input_dev *input; unsigned long irq_flags; int error; - char fw_version[EDT_NAME_LEN]; dev_dbg(&client->dev, "probing for EDT FT5x06 I2C\n"); @@ -1209,7 +1221,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; @@ -1235,7 +1247,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; -- 2.32.0