All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sui Chen <suichen@google.com>
To: linux-kernel@vger.kernel.org
Cc: openbmc@lists.ozlabs.org, linux-i2c@vger.kernel.org,
	joel@jms.id.au, andrew@aj.id.au, tali.perry1@gmail.com,
	benjaminfair@google.com, krellan@google.com, joe@perches.com,
	Sui Chen <suichen@google.com>
Subject: [RFC Patch v2 3/3] add npcm7xx debug counters as sysfs attributes
Date: Thu,  2 Dec 2021 18:37:28 -0800	[thread overview]
Message-ID: <20211203023728.3699610-4-suichen@google.com> (raw)
In-Reply-To: <20211203023728.3699610-1-suichen@google.com>

This change adds npcm7xx debug counters as sysfs attributes using the
i2c_adapter_stats_register_counter function.

Signed-off-by: Sui Chen <suichen@google.com>
Reviewed-by: Tali Perry <tali.perry1@gmail.com>
---
 drivers/i2c/busses/i2c-npcm7xx.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
index 0b87706de31d7..1268b2d71ca0a 100644
--- a/drivers/i2c/busses/i2c-npcm7xx.c
+++ b/drivers/i2c/busses/i2c-npcm7xx.c
@@ -2228,6 +2228,15 @@ static void npcm_i2c_init_debugfs(struct platform_device *pdev,
 	debugfs_create_u64("timeout_cnt", 0444, d, &bus->timeout_cnt);
 	debugfs_create_u64("tx_complete_cnt", 0444, d, &bus->tx_complete_cnt);
 
+	/* register debug counters in sysfs */
+	i2c_adapter_stats_register_counter(&bus->adap, "ber_cnt", &bus->ber_cnt);
+	i2c_adapter_stats_register_counter(&bus->adap, "nack_cnt", &bus->nack_cnt);
+	i2c_adapter_stats_register_counter(&bus->adap, "rec_succ_cnt", &bus->rec_succ_cnt);
+	i2c_adapter_stats_register_counter(&bus->adap, "rec_fail_cnt", &bus->rec_fail_cnt);
+	i2c_adapter_stats_register_counter(&bus->adap, "timeout_cnt", &bus->timeout_cnt);
+	i2c_adapter_stats_register_counter(&bus->adap, "i2c_speed", &bus->bus_freq);
+	i2c_adapter_stats_register_counter(&bus->adap, "tx_complete_cnt", &bus->tx_complete_cnt);
+
 	bus->debugfs = d;
 }
 
-- 
2.34.0.384.gca35af8252-goog


WARNING: multiple messages have this Message-ID (diff)
From: Sui Chen <suichen@google.com>
To: linux-kernel@vger.kernel.org
Cc: benjaminfair@google.com, andrew@aj.id.au,
	openbmc@lists.ozlabs.org, tali.perry1@gmail.com,
	krellan@google.com, linux-i2c@vger.kernel.org, joe@perches.com,
	Sui Chen <suichen@google.com>
Subject: [RFC Patch v2 3/3] add npcm7xx debug counters as sysfs attributes
Date: Thu,  2 Dec 2021 18:37:28 -0800	[thread overview]
Message-ID: <20211203023728.3699610-4-suichen@google.com> (raw)
In-Reply-To: <20211203023728.3699610-1-suichen@google.com>

This change adds npcm7xx debug counters as sysfs attributes using the
i2c_adapter_stats_register_counter function.

Signed-off-by: Sui Chen <suichen@google.com>
Reviewed-by: Tali Perry <tali.perry1@gmail.com>
---
 drivers/i2c/busses/i2c-npcm7xx.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
index 0b87706de31d7..1268b2d71ca0a 100644
--- a/drivers/i2c/busses/i2c-npcm7xx.c
+++ b/drivers/i2c/busses/i2c-npcm7xx.c
@@ -2228,6 +2228,15 @@ static void npcm_i2c_init_debugfs(struct platform_device *pdev,
 	debugfs_create_u64("timeout_cnt", 0444, d, &bus->timeout_cnt);
 	debugfs_create_u64("tx_complete_cnt", 0444, d, &bus->tx_complete_cnt);
 
+	/* register debug counters in sysfs */
+	i2c_adapter_stats_register_counter(&bus->adap, "ber_cnt", &bus->ber_cnt);
+	i2c_adapter_stats_register_counter(&bus->adap, "nack_cnt", &bus->nack_cnt);
+	i2c_adapter_stats_register_counter(&bus->adap, "rec_succ_cnt", &bus->rec_succ_cnt);
+	i2c_adapter_stats_register_counter(&bus->adap, "rec_fail_cnt", &bus->rec_fail_cnt);
+	i2c_adapter_stats_register_counter(&bus->adap, "timeout_cnt", &bus->timeout_cnt);
+	i2c_adapter_stats_register_counter(&bus->adap, "i2c_speed", &bus->bus_freq);
+	i2c_adapter_stats_register_counter(&bus->adap, "tx_complete_cnt", &bus->tx_complete_cnt);
+
 	bus->debugfs = d;
 }
 
-- 
2.34.0.384.gca35af8252-goog


  parent reply	other threads:[~2021-12-03  2:37 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03  2:37 [RFC Patch v2 0/3] I2C statistics as sysfs attributes Sui Chen
2021-12-03  2:37 ` Sui Chen
2021-12-03  2:37 ` [RFC Patch v2 1/3] i2c debug counters " Sui Chen
2021-12-03  2:37   ` Sui Chen
2021-12-03  2:50   ` Joe Perches
2021-12-03  2:50     ` Joe Perches
2021-12-03  5:35     ` Sui Chen
2021-12-03  5:35       ` Sui Chen
2021-12-03  5:54   ` Joe Perches
2021-12-03  5:54     ` Joe Perches
2021-12-03 12:36   ` kernel test robot
2021-12-03 14:18   ` kernel test robot
2021-12-03  2:37 ` [RFC Patch v2 2/3] i2c: npcm7xx: add tx_complete counter Sui Chen
2021-12-03  2:37   ` Sui Chen
2021-12-03  2:37 ` Sui Chen [this message]
2021-12-03  2:37   ` [RFC Patch v2 3/3] add npcm7xx debug counters as sysfs attributes Sui Chen
2021-12-03 21:15   ` kernel test robot
2021-12-03 16:37 ` [RFC Patch v2 0/3] I2C statistics " Wolfram Sang
2021-12-03 16:37   ` Wolfram Sang
2021-12-07 16:00   ` Sui Chen
2022-01-03  9:44     ` Wolfram Sang
2022-01-03  9:44       ` Wolfram Sang
2021-12-05  0:40 [RFC Patch v2 1/3] i2c debug counters " kernel test robot
2021-12-06 14:03 ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211203023728.3699610-4-suichen@google.com \
    --to=suichen@google.com \
    --cc=andrew@aj.id.au \
    --cc=benjaminfair@google.com \
    --cc=joe@perches.com \
    --cc=joel@jms.id.au \
    --cc=krellan@google.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=tali.perry1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.