On Mon, Jul 5, 2021 at 1:59 AM Pkshih <pkshih@xxxxxxxxxxx> wrote: > > -----Original Message----- > > From: Oleksij Rempel [mailto:o.rempel@xxxxxxxxxxxxxx] > > Based on this and other part of this driver I would recommend to use > > regmap. It will provide to additional interface for the register > > access. And typically for the network devices we have an ethtool > > interface for that. > > > > Could I know the 'regmap' you mentioned? include/linux/regmap.h drivers/base/regmap/ It's a driver framework and API for abstracting register accesses, whether they are accessed directly via MMIO, or behind some kind of indirect bus (I2C, SPI, etc.). It also happens to have its own debugfs operators for doing various kinds of register get/set/dump. So if you can successfully teach your driver to use it, then you don't need to implement your own debugfs files for it. I've only ever used regmap with Device Tree systems (which can more easily specify syscon nodes, etc. -- see Documentation/devicetree/bindings/regmap/regmap.txt). I'm totally unfamiliar how to use this with ACPI (which I'm sure you want to support). I'm sure it's possible somehow. FWIW, search engines turn up a few basic articles about it, if you find its documentation or code examples too sparse: https://www.collabora.com/news-and-blog/blog/2020/05/27/using-regmaps-to-make-linux-drivers-more-generic/ Brian