* [RFC Patch 2/2] add npcm7xx debug counters as sysfs attributes
@ 2021-10-12 1:08 Sui Chen
[not found] ` <SI2PR03MB616766BD1A04F4D32B9A56A090B69@SI2PR03MB6167.apcprd03.prod.outlook.com>
0 siblings, 1 reply; 2+ messages in thread
From: Sui Chen @ 2021-10-12 1:08 UTC (permalink / raw)
To: linux-i2c
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>
---
drivers/i2c/busses/i2c-npcm7xx.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
index 2ad166355ec9b..def044207cae2 100644
--- a/drivers/i2c/busses/i2c-npcm7xx.c
+++ b/drivers/i2c/busses/i2c-npcm7xx.c
@@ -2224,6 +2224,14 @@ static void npcm_i2c_init_debugfs(struct
platform_device *pdev,
debugfs_create_u64("rec_fail_cnt", 0444, d, &bus->rec_fail_cnt);
debugfs_create_u64("timeout_cnt", 0444, d, &bus->timeout_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);
+
bus->debugfs = d;
}
--
2.33.0.882.g93a45727a2-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RFC Patch 2/2] add npcm7xx debug counters as sysfs attributes
[not found] ` <CAHb3i=t6gCr8TwyZ-wPz26q1Ubz38qVuPyRDkPcVHAQFcmF_ag@mail.gmail.com>
@ 2021-10-12 7:24 ` Tali Perry
0 siblings, 0 replies; 2+ messages in thread
From: Tali Perry @ 2021-10-12 7:24 UTC (permalink / raw)
To: Linux I2C, Sui Chen
On Tue, Oct 12, 2021 at 10:09 AM Tali Perry <tali.perry1@gmail.com> wrote:
> On Tuesday, October 12, 2021 4:08 AM Sui Chen <suichen@google.com> wrote:
>
> 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>
> ---
> drivers/i2c/busses/i2c-npcm7xx.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
> index 2ad166355ec9b..def044207cae2 100644
> --- a/drivers/i2c/busses/i2c-npcm7xx.c
> +++ b/drivers/i2c/busses/i2c-npcm7xx.c
> @@ -2224,6 +2224,14 @@ static void npcm_i2c_init_debugfs(struct platform_device *pdev,
> debugfs_create_u64("rec_fail_cnt", 0444, d, &bus->rec_fail_cnt);
> debugfs_create_u64("timeout_cnt", 0444, d, &bus->timeout_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);
> +
> bus->debugfs = d;
> }
>
> --
> 2.33.0.882.g93a45727a2-goog
>
Reviewed-by: Tali Perry <tali.perry1@gmail.com>
Thanks for this patch!
Tali Perry
Nuvoton
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-12 7:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12 1:08 [RFC Patch 2/2] add npcm7xx debug counters as sysfs attributes Sui Chen
[not found] ` <SI2PR03MB616766BD1A04F4D32B9A56A090B69@SI2PR03MB6167.apcprd03.prod.outlook.com>
[not found] ` <CAHb3i=t6gCr8TwyZ-wPz26q1Ubz38qVuPyRDkPcVHAQFcmF_ag@mail.gmail.com>
2021-10-12 7:24 ` Tali Perry
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.