Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4602337iob; Sun, 8 May 2022 18:52:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAmyJOENLTsyA4yjFN0QcXXbcQrtVOiGpYqGYyjfd0KBxoSN23+yfe66z6Ffzc7hJOWr2W X-Received: by 2002:a17:90a:191a:b0:1dc:a3d3:f579 with SMTP id 26-20020a17090a191a00b001dca3d3f579mr24098577pjg.30.1652061166790; Sun, 08 May 2022 18:52:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652061166; cv=none; d=google.com; s=arc-20160816; b=U5xGioz0t0EQaz8mQpwd0XVp+YPVGW0/XHXeNFznhERM5wviGrI6x0lmb+u47C2OXP SL/7IrBfFXi7ImSVn8IjNOunvCs5PtdGBt7d+hzOrByKjjYz93ucJEZZ677rcP6HVnAx vNROHtEIYxSFuSVqgci/ZWG6fPB8Ynfw5+k9hXz/UC/yXMmUijxvsGIveIsdD4W0bnyD qniqfVecsAIDxF+VhhISXmaYcrbRYOY2ogn6J85Z/tlVU1r7lTICieSie1BVBJlJnptd ZXKDr9HfnadwjOOA9ogYW+Gc4+qpEXjt2YdH4u126DbchovZBeSNZWF4k6Cdhvw4r4tZ Ln2A== 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=DIbi3GRjoNdplByz+CZDnN2hStQRFN3t4hydV1qkD6LyjI6UZrmV/Po2Q6kJKR4mVP jSElbo6lP1YmUFjPLbUtbVqHDjBiZBd2H2Vu5nt1fX7irdvCbcSh6TZc8invw/SC/ITk yXt1L55eN7THtRTV8atFaeIz0jFCKfzGNYJlbSOoQWbbf50gaHsTGxckFBL7GaY/uHJ1 OCC73XXE/e5Mt6cw59nQntFGd7fxfATbt6bverTfiqPk19WvYNIm28OFMPBlzVdzMXfm D5VSy5PGLL5CHOcCYb9Px25SYs55g+y3+As1U4CCaspDt0EWJY1rWPbjQStZm1l0CSbs 1unw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=GGOnWmM+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id r21-20020a62e415000000b004fa3a8dff9csi11488294pfh.83.2022.05.08.18.52.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 18:52:46 -0700 (PDT) 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=GGOnWmM+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 52F4F1C90B; Sun, 8 May 2022 18:52:29 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381524AbiEEQAt (ORCPT + 99 others); Thu, 5 May 2022 12:00:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381100AbiEEQAa (ORCPT ); Thu, 5 May 2022 12:00:30 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8178B59BA0 for ; Thu, 5 May 2022 08:56:47 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id dk23so9571845ejb.8 for ; Thu, 05 May 2022 08:56:47 -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=GGOnWmM+dib97LLhpKHFjBcXVhNv1/UEEN1uoYHq/GvckRFSW3S8fQ2sph+fQs2vfT czDyYd5J85wk6QFJUkGtfKAFPEQaUhJstFWjMED9ytYezlk9Cg5VHjdD1cdL5i68xlBn +tgAldMJ8tKuTWK261uHa1OTcHJWslHOn503U= 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=4dReSWIe7cfqyVMc2+23TsUN47wIQbtdoMKmnLMKzHOex33Z2ITjSNt0B0YdccR+KD 3asRG9Yn4Zrmi813Aw2/rdmAEnhibUqG3C4p8g3Mq2AXGcCyDuN1Ffnb9343z/0kyUEc I+RcPP0PzDcyFW3BjtiOX3bMnN7Wi45wa/Ah9VL7LHmrps7MC3tQyzqFq54HgLF0tMdD sOX3z2TnmqjZRtIRlBVYax7qoNmP8gBspb6TRmr2z7z3jB/Lq6TQaMEXNX6iEqVvO5zm yy3OOBsmyxL97IXhkRmnSZPxsQWElbbbMQo8NJQN4SkSJJapAM1fiBQWxGb+gx68BdiT lDmQ== X-Gm-Message-State: AOAM533+KhgVqCM1hoHkf+egcOzCmKA3TygvXEM2z5nJu2xjEztCYeV7 GARP4MzGdNf5MGJ5u1PZx3gAOWtj4z92kg== X-Received: by 2002:a17:906:80d4:b0:6f3:bead:750c with SMTP id a20-20020a17090680d400b006f3bead750cmr27155533ejx.129.1651766206844; Thu, 05 May 2022 08:56:46 -0700 (PDT) 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 a4-20020aa7d904000000b0042617ba6385sm1009328edr.15.2022.05.05.08.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 May 2022 08:56:46 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Dario Binacchi , Michael Trimarchi , Oliver Graute , Dmitry Torokhov , Marco Felsch , Stephan Gerhold , linux-input@vger.kernel.org Subject: [RESEND PATCH v4 5/6] Input: edt-ft5x06 - show firmware version by sysfs Date: Thu, 5 May 2022 17:56:34 +0200 Message-Id: <20220505155635.419653-6-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220505155635.419653-1-dario.binacchi@amarulasolutions.com> References: <20220505155635.419653-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 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