Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp805374pxb; Thu, 17 Feb 2022 15:23:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvR9AoSll6jp+5JbxhIba6ihNbIOKwr42zLsjF9dknCvRbNuvertRHvJACfIu6JaXkFbra X-Received: by 2002:a63:b10:0:b0:373:393f:2015 with SMTP id 16-20020a630b10000000b00373393f2015mr4156410pgl.322.1645140197092; Thu, 17 Feb 2022 15:23:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645140197; cv=none; d=google.com; s=arc-20160816; b=o9QFmpv/e1h5uTYB05eLgKV/QVHbcgTGpM+c7yB48yClC/pYW5KpDAJHSib/dyKU3t c0qfzdd0nqXZLVAZhJHR7F/5vEqzZbsiwl+66vn9p+Y3HPiU4AXC1zayHUiBvfnTtmxg jpYn9fRbM+n6mvOy/+zbfO6ruyeKHZCo4lIGK+36Lp1bKNhoe11n/K2v5X2IznXF2wjr U+VOTt3kUEZKZLfkdf+FCQLDCYIC0UJs0BJT2u8E4lxmDT9aPJFr/Dqgq44b2B6j9Aoc 1ATh2s5EUwYOoIY9wpys9/n8vh7sI3o4f4bNv9enCqQ75Ft8DhDr9w1Dgh+E1mCiZ3Mq CbsA== 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=qYQz8gky+qHKsHMYT1BO0VS7TpJLRjv0uSqSzI+TAgE=; b=OR69VSEepkQ75XQEz36crJYHABtBCXSflFZLbCgdsOZkipDUnw9jCwNj+Xp10Dbmn2 FWD7EBNJLY38X1TDmZ7k5F3mJHcX67GICbE06ZtwpNEokn9TscZTSX2CY5gvqWumw68p bi3GBRkZMLuCBdthzcoTXgwsD3/7kmlwHgLhd5+lVoJhHBbjdrdr4TVcTHVtk5AUqNKf 5ZrPXSmc4Y51Kl4QmzOHJK8uDD/CYC/1bmp8RymC3Dvnlh1fzIhhMddrG/umTeXqf5P/ EqKQPsII3b88YJ6WOVr9JfKkSZGza9LveTXnB2C+KEajtK1kIxBdMJqSbDMKt1tXysPy 30Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=dlrddxDb; 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 12si9401741pgb.18.2022.02.17.15.23.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 15:23:17 -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=dlrddxDb; 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 55945473B6; Thu, 17 Feb 2022 15:09:02 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243519AbiBQQ4p (ORCPT + 99 others); Thu, 17 Feb 2022 11:56:45 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243502AbiBQQ43 (ORCPT ); Thu, 17 Feb 2022 11:56:29 -0500 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 DC9292B3AC1 for ; Thu, 17 Feb 2022 08:56:13 -0800 (PST) Received: by mail-ej1-x62d.google.com with SMTP id qk11so8793333ejb.2 for ; Thu, 17 Feb 2022 08:56:13 -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=qYQz8gky+qHKsHMYT1BO0VS7TpJLRjv0uSqSzI+TAgE=; b=dlrddxDbzDVUNrDPxjnn0fmRX/EXv8asQmJobbE6eGLg93BV+JOb3qtyE9hIWqJ3Pd tQYzpoGxJf5npBm3k4VgypdVrmFLk8fGYn6jVk7c9XQJwNVdOLxWY0lAOI4S4ToQQjKW 8HcAqqJQov6RB+eRFZjFKdg6GnKdiy7nKwIs0= 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=qYQz8gky+qHKsHMYT1BO0VS7TpJLRjv0uSqSzI+TAgE=; b=4NvDa4RJaH11c04X4/Qto4gx8/Tzbg6Eqjr5iltYOWq+ZhepoaFu6w24L0uIDmrkzk IaE90YO05O3TRiKOrPRpbAQkEKvRhVd+QRvdSb8VFLQRVCrOnKM3yasbVIfefB0XW1fO 4ZRWpPMDRodd8W46trSDS+2F73wnmkQQpr6j/3laUAaNGxaLpVfgnJg80Q5uWYc9nzJF tzlKqyfoM/NG/FVcl13Nw4LQw6lXiM4YqGSNH8m3Vv7tB1Qa27JHJQe0ejxcD8x2t1IO JdFWUfmc+ngymonLoJq6zs7qCto+zr7J5We/K43mNXJvgt9tfG2ROM5fY/3kbVVwrZal xBPg== X-Gm-Message-State: AOAM531nM/+E//B436apRioj2X2xyOanVFT5UIPexI8BKInwBYq58pgA aZkG/13hprc1wzKOGHZS7sjhRT+pocOCTA== X-Received: by 2002:a17:907:6006:b0:6ce:46f:fe4b with SMTP id fs6-20020a170907600600b006ce046ffe4bmr2906289ejc.7.1645116971996; Thu, 17 Feb 2022 08:56:11 -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.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 08:56:11 -0800 (PST) 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: [PATCH v2 5/6] Input: edt-ft5x06 - show firmware version by sysfs Date: Thu, 17 Feb 2022 17:55:57 +0100 Message-Id: <20220217165559.313366-6-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 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 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