Skip to content

Commit

Permalink
add npcm7xx debug counters as sysfs attributes
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
quadpixels authored and intel-lab-lkp committed Dec 3, 2021
1 parent 055a47e commit a4ab6f0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/i2c/busses/i2c-npcm7xx.c
Expand Up @@ -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;
}

Expand Down

0 comments on commit a4ab6f0

Please sign in to comment.