Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2665466ybh; Mon, 16 Mar 2020 07:29:41 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtXMbeOdt21M0rdgC+elHejvhJw+4LtcbQgP2rT0a4rOmDadCfpGN40rqYdb6Igw8s5WbR9 X-Received: by 2002:a54:4396:: with SMTP id u22mr17754464oiv.128.1584368981527; Mon, 16 Mar 2020 07:29:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584368981; cv=none; d=google.com; s=arc-20160816; b=rRKJLNbXKVMogGIhbuGdztGxwdrv+PSKLg6IZNFStuvs2BcmojbzHVQ6VzKuPV0dR8 cGbpkVKU2YhOP9jY/SIyKYnY3dQ0+8FLBzoQWF5IULxZ200dEiSYJik0OzXchLlgQJX9 d4zvmivGo8HwNwPND6CM9W+aYMtB+RFEbwEYSxRslP+BlUpV7Y5VrWZmwQ/MJvgQ9Zl4 t9xjPIvh/xSthU2ZgQK5oB0+frZEFo9ALj8XgPcDS+2Abidj5ZtrtkGcAsTu4TyP8Fbq JKaQjQENRQXh3Ge6Aaj0Ezk+Bd7ew5L67U4qSDwlm2P9bpovj4627sjMOlJatRt/dcPE uc9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:message-id:date :subject:cc:to:from; bh=33kjZyy8sNq0QZ32yv4KT/fTBgtjo3X7gcTDkVGzAg0=; b=l+1UZ+IXaCgl+2c/I6mJCxhRoRtVTieTP88tvU/jZD8jrRjHUX1u0UEIYnRfAMymzl noP+p7FH3dqHDuor5WNV2e+m3q9KJI82NEezATUOxBTAtUn3HotiFD+WR/cjnJ/azsvA XRx84bklK6PKLQGxa06ec+dH6xGhPdzbdzwi2QFnlGv/MCnnZd5VPYPgzylEN+w4OsyF +OHKpgV+RTewhsEvljPFSB1/ulHtdjDrz5nRdzxCKKGg0ITCgWLPo8wWPkvle/SueyAC 3wL5zThS1pcyY37vS8HCyC85g7I6+EJVoveShusE1Swoj5c/oiso2DnYmAogOjH549DC 81CA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=puri.sm Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z9si41702otj.157.2020.03.16.07.29.28; Mon, 16 Mar 2020 07:29:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=puri.sm Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731492AbgCPO2I (ORCPT + 99 others); Mon, 16 Mar 2020 10:28:08 -0400 Received: from comms.puri.sm ([159.203.221.185]:34396 "EHLO comms.puri.sm" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731465AbgCPO2I (ORCPT ); Mon, 16 Mar 2020 10:28:08 -0400 Received: from localhost (localhost [127.0.0.1]) by comms.puri.sm (Postfix) with ESMTP id 0B272E0422; Mon, 16 Mar 2020 07:28:07 -0700 (PDT) Received: from comms.puri.sm ([127.0.0.1]) by localhost (comms.puri.sm [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Lv14Uuw2sJos; Mon, 16 Mar 2020 07:28:06 -0700 (PDT) From: Martin Kepplinger To: dmitry.torokhov@gmail.com, andriy.shevchenko@linux.intel.com, m.felsch@pengutronix.de, mylene.josserand@bootlin.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Martin Kepplinger Subject: [PATCH] Input: edt-ft5x06 - add fw_version debugfs file to read Date: Mon, 16 Mar 2020 15:27:56 +0100 Message-Id: <20200316142756.25344-1-martin.kepplinger@puri.sm> Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add simple fw_version file in debugfs to read the value from 0xa6 which is the firmware version. Signed-off-by: Martin Kepplinger --- Since we got at least 2 different FT firmware version in our controller, we need to distinguish them. thanks, martin drivers/input/touchscreen/edt-ft5x06.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index bc7fb2c005b5..efb09bba739a 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -51,6 +51,8 @@ #define EV_REGISTER_OFFSET_Y 0x45 #define EV_REGISTER_OFFSET_X 0x46 +#define REG_FW_VERSION 0xa6 + #define NO_REGISTER 0xff #define WORK_REGISTER_OPMODE 0x3c @@ -685,6 +687,22 @@ static int edt_ft5x06_debugfs_mode_set(void *data, u64 mode) DEFINE_SIMPLE_ATTRIBUTE(debugfs_mode_fops, edt_ft5x06_debugfs_mode_get, edt_ft5x06_debugfs_mode_set, "%llu\n"); +static int edt_ft5x06_debugfs_fw_version_get(void *data, u64 *version) +{ + struct edt_ft5x06_ts_data *tsdata = data; + struct i2c_client *client = tsdata->client; + + *version = edt_ft5x06_register_read(tsdata, REG_FW_VERSION); + if (*version == 0xff || *version == 0x00) + dev_dbg(&client->dev, "failed to get firmware version\n"); + + return 0; +}; + +DEFINE_SIMPLE_ATTRIBUTE(debugfs_fw_version_fops, + edt_ft5x06_debugfs_fw_version_get, + NULL, "%llu\n"); + static ssize_t edt_ft5x06_debugfs_raw_data_read(struct file *file, char __user *buf, size_t count, loff_t *off) { @@ -779,6 +797,9 @@ edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata, debugfs_create_file("mode", S_IRUSR | S_IWUSR, tsdata->debug_dir, tsdata, &debugfs_mode_fops); + debugfs_create_file("fw_version", S_IRUSR, + tsdata->debug_dir, tsdata, + &debugfs_fw_version_fops); debugfs_create_file("raw_data", S_IRUSR, tsdata->debug_dir, tsdata, &debugfs_raw_data_fops); } -- 2.20.1