Xavier NX and Insdustrial IO

Hi, I’m currently porting a project to Jetpack 5.1.1 from Jetpack 4.6. On the project we use iio to monitor ina3221 to check for power, voltages and currents. We enabled the CONFIG_INA3221 on tegra_defconfig and made a couple of changes so the driver was able to compile, but the attributes do not show up, not sure if the path is the same as JP4, I’m looking on /sys/bus/i2c/drivers/ina3221x, the folder does show up after said changes but the attributes are not there. The changes are:
Change 1:

static const struct iio_info ina3221_info = {
	.attrs = &ina3221_groups,
	/*.driver_module = THIS_MODULE,  removed this */ 
	.read_raw = &ina3221_read_raw,
};

Change 2:

	indio_dev->dev.parent = &client->dev;
	indio_dev->modes = INDIO_DIRECT_MODE;
	indio_dev->driver_module = THIS_MODULE; // Added this on the ina3221_probe method
	ret = devm_iio_device_register(chip->dev, indio_dev);
	if (ret < 0) {

Also upon checking the Kconfig I see that it’s deprecated:


config INA3221
	tristate "[DEPRECATED] TI INA3221 3-Channel Shunt and Bus Voltage Monitor"
	depends on I2C
	help
	  TI INA3221 is Triple-Channel, High-Side Measurement, Shunt and Bus
	  Voltage Monitor with I2C Interface
	  Say Y here if you have INA3221 hooked to a I2C bus.

It there a replacement or something similar or something else that I can do to enable the attributes, or do we need to implement our own driver attributes? Also not sure if it’s as simple as I’m looking on the wrong path, since I know that the normal drivers attributes paths did change a bit with the new kernel.

Regards,
Andres
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.c om/
Website: www.ridgerun.com

hello andres.artavia,

Jetson Xavier NX series has one INA3221 power monitor at I2C address 0x40
the node is under… /sys/bus/i2c/drivers/ina3221/7-0040/hwmon/hwmon<x>

BTW,
I’ve also check a Xavier NX flashed with JP-5.1.1,
INA3221 is default enabled. it’s able to check for power, voltages and currents via INA3221.
for example,

root@tegra-ubuntu:~# cat /etc/nv_tegra_release
# R35 (release), REVISION: 3.1, GCID: 32827747, BOARD: t186ref, EABI: aarch64, DATE: Sun Mar 19 15:19:21 UTC 2023
root@tegra-ubuntu:~# cd /sys/bus/i2c/drivers/ina3221/7-0040/hwmon/hwmon5
root@tegra-ubuntu:/sys/bus/i2c/drivers/ina3221/7-0040/hwmon/hwmon5# cat
curr1_crit        curr2_max         curr4_crit_alarm  in2_label         in7_label         subsystem/
curr1_crit_alarm  curr2_max_alarm   curr4_input       in3_enable        name              uevent
curr1_input       curr3_crit        device/           in3_input         of_node/          update_interval
curr1_max         curr3_crit_alarm  in1_enable        in3_label         power/
curr1_max_alarm   curr3_input       in1_input         in4_input         samples
curr2_crit        curr3_max         in1_label         in5_input         shunt1_resistor
curr2_crit_alarm  curr3_max_alarm   in2_enable        in6_input         shunt2_resistor
curr2_input       curr4_crit        in2_input         in7_input         shunt3_resistor
root@tegra-ubuntu:/sys/bus/i2c/drivers/ina3221/7-0040/hwmon/hwmon5# cat in1_input
5120

Hi, thanks for the response.

Got it so its enabled by default, and the path is different. But in case I want/need to add another attribute to said driver, where should I do it?

Regards Andres.

there’re already current, voltage…etc, you may refer to developer guide, Software-Based Power Consumption Modeling.
may I know what’s the actual use-case, thanks

Hi, @JerryChang, actually that link you just sent has the info that I need, I was going to get into the driver and check what each attribute was, but that link has the table with what I need. Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.