Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2145942iof; Tue, 7 Jun 2022 21:16:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHm5yKXQp8XfPgemmnURmuqny+1jc0CgV6tYVxVgkCW2VH4pHeauZ4S5oQvN/bwt3vlRlK X-Received: by 2002:a17:902:7582:b0:162:1131:23c2 with SMTP id j2-20020a170902758200b00162113123c2mr32506960pll.83.1654661819596; Tue, 07 Jun 2022 21:16:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654661819; cv=none; d=google.com; s=arc-20160816; b=qkghJnyUXg+SGy5XnWgFjM3EmhqQLsz+Gbrd2iOyxf2BjntLvk6c4jag/zg6SWWYq7 dTpTAwT/rUipj4+BpHX3CKBAbbBjaMwI09XS3DS6L9UHyHr+hAqeO3q1d2HEIBx+3Guk Z6GN1CvCLAyP9ip1XxLO5eRFySPyCMIeIlpQPM7JOptfaEaSYJsUeOfX/WVk9oE2eOGd VTrZJO9ywZ9DiHJZffBebLy8vNsjtoMrnm/GrcQeN9jxV/RXrVSKvkkjfYkIFLu39bFG LU0758xlP+ejtWk6FgZLC+f2AsCJa6BFMIVJDDRe2YJABmREFy62YcS1EpJDGrKipPIF T1Aw== 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=wOFzxvgVTckcCvRoWEVpf1DgcvIIMKR69WNheqaDM/DlxMM0orJYmxSgrXawFcj9Vx N9cZDOySxdNkutEO2x4x/mdOcvtJWNwIKHastFxP9VUc4caMtLiru/Y+yn2x8Wvm4UB2 qWMhEIX/ryEzOxGBe1O26hbUrjpzpKaarrzGl2gW/i68GeDUBZRsVp8e5YBKu0e7+YKZ bonShmx4yte4ZgZIBLDtR1F/tl50SZa9Qtenhk/WsQzItzdmi7H9OUeM/qz1tHp5Ks7k 4gS3vcYk8BMO1gJBs/dB0IgdP2A4mXuL1EbVl6RrXHdlckcurNwVicpq3N8TG8A3ZSb4 IGNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=LWvpO211; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id k74-20020a62844d000000b0050dfdded307si26478652pfd.31.2022.06.07.21.16.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:16:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=LWvpO211; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 BC15A304B7A; Tue, 7 Jun 2022 20:48:12 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240427AbiFGJ4h (ORCPT + 99 others); Tue, 7 Jun 2022 05:56:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240343AbiFGJ4P (ORCPT ); Tue, 7 Jun 2022 05:56:15 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECDD6E77E5 for ; Tue, 7 Jun 2022 02:56:13 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id d14so14383930wra.10 for ; Tue, 07 Jun 2022 02:56: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=LWvpO2114CcFhnPuXDbMOKOgTCqpLbgJvTRo0iopS0xVNOimOsa1zLOE4ftWcofEjy 9Sosbg4OgmX5Km/kkHUmp8dXWbMa7PoFQoy40vfOA1RTVlcSePQMwovbKkknFLegnTqr Di/IfQNi3nzBsZANZ1qTUWLVRbWzATWNTEuXk= 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=EWz8eOtGaH8she62+dxjsRzqEhsRrEKxPq9HFhwlXHYHCTO4c9dmraSBjUQrAGez9h RTZEk0sgDeXjwj1kGA76TfM4RDpbs4kCAWp5Y/jGP/8r3+7/9jqtqq0h7nDJMgw/be4T NWMaJNNMagTbqOq17m5MkfBa7xFsl8Dpqew2b84NFhpIh9U+mHB8rCRuT0xuwRbhMiWm tziXKRmDxrKsgrwHH2XRiIt20oKdQGRYxcFge5NttU5NwpNtVK4xUDIN5MJbyAvowRXj hhQhM5t+UWbWSeoIRNRlGHNiflBpjbH/BlXJsKhX13ncUjM7zLe0IovzasUn5TLeE9ya qShg== X-Gm-Message-State: AOAM5331MNJKR9C4T9f8GHGdT+sWZkqcbIfyHRz6XLOkgM8UGDpZcRsS zMs5BK3w9FSoFuqf4Lj+fk/dv4Q06bd+kg== X-Received: by 2002:a5d:6b07:0:b0:20d:97f:ca6b with SMTP id v7-20020a5d6b07000000b0020d097fca6bmr26089070wrw.390.1654595773110; Tue, 07 Jun 2022 02:56:13 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.pdxnet.pdxeng.ch (mob-5-90-137-51.net.vodafone.it. [5.90.137.51]) by smtp.gmail.com with ESMTPSA id b12-20020a5d4b8c000000b0020feb9c44c2sm17693546wrt.20.2022.06.07.02.56.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 02:56:12 -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, 7 Jun 2022 11:55:55 +0200 Message-Id: <20220607095556.1034338-6-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220607095556.1034338-1-dario.binacchi@amarulasolutions.com> References: <20220607095556.1034338-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