[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211221174344.1249202-3-suichen@google.com>
Date: Tue, 21 Dec 2021 09:43:43 -0800
From: Sui Chen <suichen@...gle.com>
To: linux-kernel@...r.kernel.org
Cc: linux-i2c@...r.kernel.org, openbmc@...ts.ozlabs.org,
joel@....id.au, andrew@...id.au, tali.perry1@...il.com,
benjaminfair@...gle.com, krellan@...gle.com
Subject: [RFC Patch v3 2/3] i2c: npcm7xx: add tx_complete counter
From: Tali Perry <tali.perry1@...il.com>
Add tx_copmplete counter which increments when a
valid transaction completes.
Signed-off-by: Tali Perry <tali.perry1@...il.com>
---
drivers/i2c/busses/i2c-npcm7xx.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
index 2ad166355ec9b..cc7abd0b870be 100644
--- a/drivers/i2c/busses/i2c-npcm7xx.c
+++ b/drivers/i2c/busses/i2c-npcm7xx.c
@@ -314,6 +314,7 @@ struct npcm_i2c {
u64 rec_fail_cnt;
u64 nack_cnt;
u64 timeout_cnt;
+ u64 tx_complete_cnt;
};
static inline void npcm_i2c_select_bank(struct npcm_i2c *bus,
@@ -684,6 +685,8 @@ static void npcm_i2c_callback(struct npcm_i2c *bus,
switch (op_status) {
case I2C_MASTER_DONE_IND:
bus->cmd_err = bus->msgs_num;
+ if (bus->tx_complete_cnt < ULLONG_MAX)
+ bus->tx_complete_cnt++;
fallthrough;
case I2C_BLOCK_BYTES_ERR_IND:
/* Master tx finished and all transmit bytes were sent */
@@ -2223,6 +2226,7 @@ static void npcm_i2c_init_debugfs(struct platform_device *pdev,
debugfs_create_u64("rec_succ_cnt", 0444, d, &bus->rec_succ_cnt);
debugfs_create_u64("rec_fail_cnt", 0444, d, &bus->rec_fail_cnt);
debugfs_create_u64("timeout_cnt", 0444, d, &bus->timeout_cnt);
+ debugfs_create_u64("tx_complete_cnt", 0444, d, &bus->tx_complete_cnt);
bus->debugfs = d;
}
--
2.34.1.307.g9b7440fafd-goog
Powered by blists - more mailing lists