Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3795428iog; Tue, 21 Jun 2022 06:14:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uxKb5x78/K9DUUfsNTNqObBky7+0hdDwWQWMOmrHfxjbPGxu7HBRt8JyQFQ+purpDrrnAi X-Received: by 2002:a17:906:649b:b0:711:fde4:3a31 with SMTP id e27-20020a170906649b00b00711fde43a31mr25619892ejm.236.1655817158775; Tue, 21 Jun 2022 06:12:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655817158; cv=none; d=google.com; s=arc-20160816; b=ECioyRC4lJeBSTYxddY/XJQB7x8lkhRBqA5iPb9LL9GYS7x32MCEX/9xWSidTu0h7Y lGQchGiCMUKyk3aHlKZz7BzPIRx7azZvqX9oDCP6iB3ZZZSCCMfCR7ZSRYms+u0M1s2Y bq61leI0vZ+u4i9DGREpOiydlvw3rzvV4niH0DKDic/5shnTkFORfGng6Ziz12MOq0zb uko/3a1DuXz74Bij/+VQ3oIjyrGx9aI2iEM78VvtCLi4uoaGN2I8HNsEccNCIgdo+Uhy 8muYKduy42ilrEJzqHX2SmDBxKgfJ+pnDoowfTX6RZBJFzqXh5EQ17f5nrqDOrYwAf1X fxhw== 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=YV+qTrBSZlEdVwvYGQdRpxUtm5BLonFPqiCggidUwTw=; b=WgE0gQV+WIV5qikev4eirpPpxRvselYWfoA8UxdrlAZfc2xxqtyAg+YlFDL3bj1S50 9Hj3iLSFuAG8jMcef5kRIiMYd+uonwBEgdpIk74jeSvAdhOEQZjPJVpnggO6rmmSUlEh Z9fMDBqBLZpMNzg2YJFdosSBULT4HTCAlRvPBn8dr3baWXjNdnA499XdSPEYC/i8LUvk BPq0xTAeii3NeV2P+K/qPxKAMMbYdY2JtREc0IqjMQAFw62mJEVVPc1CEq+EC0RVrDdd w+EPNpVmrQguGIcTgYTYdgHkjrj/HzaQ16UG8uPQgkHKdj9bgIYXskEXC0YNfGYx0bvK c4kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DzjD39TO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id yw18-20020a170907245200b00715854c27a5si12305085ejb.431.2022.06.21.06.12.12; Tue, 21 Jun 2022 06:12:38 -0700 (PDT) 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=DzjD39TO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350581AbiFUMkF (ORCPT + 99 others); Tue, 21 Jun 2022 08:40:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350477AbiFUMjt (ORCPT ); Tue, 21 Jun 2022 08:39:49 -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 3F2B32459E for ; Tue, 21 Jun 2022 05:39:48 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id e2so8244920edv.3 for ; Tue, 21 Jun 2022 05:39:48 -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=DzjD39TO7HO7BYMja/VLATnaxbVRWSyYcQpTzloDDWZX9fn4l/9ro6ykcILPApxrkO 6vPdVBsjJgL5uAUXCSslYuh/0EzQXAc5nGXP/dm0roklLNQxMOzU+hozlFJlDaxiKEgP r4frnOOI5K4eI6tDbyLGe1sLU2uOfcm/sxAAQ= 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=gsb5igLWKkNXukBlT1bQekmlbZKbxV/WwMy/8eMHGZ+2ydQ+LkqF1B2lKJtUehw+/W aeh0RaYw1M7KfHv2XOJLe8xVcSOMk4zWJmP/ltqtAJB3qVrIMVqvoxNxCo9LKH0D3wMF ZgsIUXCyrXKEmu1SjjcSEQNaaNnGtzkWVMXrnE76k7GA6D8fLPvrzG2nzf3mah+Q0UlO e8sTWxKhcW73dub29lZkLLoHM11VUN8LgJEdjvrBcyL3upcGW6zJCSDPWlKfi/465Bow x7G1GlW4HTOIm4uUpiNQ3hGM14bTLmVBE1a9WvmiurZCfDfCkXYh/yhE5JPbh3pAFgzE fevw== X-Gm-Message-State: AJIora/L1gM7WPWEyrnyEcZRdHrH8x9GNILhVSsId+D4xoe46Vjej9qo SFabvw6BOELs0cnyjWIEng/Z9eCT7MFVNg== X-Received: by 2002:a05:6402:b8c:b0:435:6d4b:37e4 with SMTP id cf12-20020a0564020b8c00b004356d4b37e4mr20951504edb.109.1655815186334; Tue, 21 Jun 2022 05:39:46 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-80-116-90-174.pool80116.interbusiness.it. [80.116.90.174]) by smtp.gmail.com with ESMTPSA id c19-20020aa7c753000000b004357063bf60sm8003945eds.41.2022.06.21.05.39.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 05:39:45 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Dario Binacchi , Michael Trimarchi , Oliver Graute , Dmitry Torokhov , Marco Felsch , linux-input@vger.kernel.org Subject: [RESEND PATCH v4 5/6] Input: edt-ft5x06 - show firmware version by sysfs Date: Tue, 21 Jun 2022 14:39:36 +0200 Message-Id: <20220621123937.1330389-6-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220621123937.1330389-1-dario.binacchi@amarulasolutions.com> References: <20220621123937.1330389-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 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; -- 2.32.0