ina260-sysfs-driver/README.md

29 lines
1.4 KiB
Markdown
Raw Permalink Normal View History

2023-08-14 12:24:03 +02:00
# INA260 Linux Drivers
2023-07-12 13:10:00 +00:00
2023-08-14 12:24:03 +02:00
This project provides two drivers:
2023-08-24 13:43:14 +02:00
1) `ina2xx.c` that is compatible with [hwmon](https://docs.kernel.org/hwmon/hwmon-kernel-api.html)
2) `ina260.c` that provides an entire support for registers and fields of the ina260 and maximize performance over compatibility
2023-08-14 12:24:03 +02:00
2023-07-12 13:10:00 +00:00
## Installation
2023-07-12 16:07:20 +02:00
$ make
$ sudo insmod ina260.ko
2023-07-12 13:10:00 +00:00
2023-08-11 12:44:50 +02:00
## Managing INA260 devices
- Add device: `echo ina260 [devaddr] > /sys/bus/i2c/devices/<bus>/new_device`
- Delete device: `echo [devaddr] > /sys/bus/i2c/devices/<bus>/delete_device`
2023-08-24 13:43:14 +02:00
## Sysfs structure for the `ina2xx.c`
2023-08-14 12:24:03 +02:00
2023-08-24 13:43:14 +02:00
You will mostly use the [lm-sensors](https://github.com/lm-sensors/lm-sensors) utility.
2023-08-14 12:24:03 +02:00
2023-08-24 13:43:14 +02:00
## Sysfs structure for the `ina260.c`
2023-08-11 12:44:50 +02:00
- Overview: `tree /sys/kernel/ina260`
- You can access to each device registers in `/sys/kernel/ina260/<device>/registers/`
- You can access to each device register fields in `/sys/kernel/ina260/<device>/fields/`
- You can access to the currently measured current, voltage and power via `/sys/kernel/ina260/<device>/<power|current|voltage>` (units are watts, amperes and volts respectively)
2023-07-12 13:10:00 +00:00
2023-08-11 12:44:50 +02:00
For more informations on the registers/fields, please refer to the [ina260 datasheet](https://www.ti.com/lit/gpn/INA260).
2023-07-12 13:10:00 +00:00
2023-08-11 12:44:50 +02:00
## Notes
- Tested so far on a [Beaglebone Black](https://www.beagleboard.org/boards/beaglebone-black) with a [Mikrobus Cape](https://www.mikroe.com/beaglebone-mikrobus-cape) with up to four ina260 devices attached.