Skip to content

config.sonic: Build driver for sensor INA238#585

Open
RayWang-micas wants to merge 1 commit into
sonic-net:masterfrom
RayWang-micas:master
Open

config.sonic: Build driver for sensor INA238#585
RayWang-micas wants to merge 1 commit into
sonic-net:masterfrom
RayWang-micas:master

Conversation

@RayWang-micas
Copy link
Copy Markdown

@RayWang-micas RayWang-micas commented Jun 1, 2026

## Why I did it

The target platform uses INA238 power monitoring devices. The current kernel configuration does not build the INA238 driver, which prevents the sensors from being exposed through the Linux hwmon framework.

This change enables CONFIG_SENSORS_INA238 in SONiC.

## How I verified it

Platform: Micas M2-6951-64HC-CP

Kernel log:

dmesg | grep ina238
[ 23.824230] ina238 57-0040: power monitor ina238 (Rshunt = 10000 uOhm, gain = 4)
[ 23.824238] i2c i2c-57: new_device: Instantiated device ina238 at 0x40
[ 23.837771] ina238 58-0041: power monitor ina238 (Rshunt = 10000 uOhm, gain = 4)
[ 23.837779] i2c i2c-58: new_device: Instantiated device ina238 at 0x41

Hwmon interface created successfully:
/sys/bus/i2c/devices/57-0040/hwmon/hwmon30/

Example readings:
root@sonic:/sys/bus/i2c/devices/57-0040/hwmon/hwmon30# cat name
ina238
root@sonic:/sys/bus/i2c/devices/57-0040/hwmon/hwmon30# cat in0_input
3
root@sonic:/sys/bus/i2c/devices/57-0040/hwmon/hwmon30# cat in1_input
54434
root@sonic:/sys/bus/i2c/devices/57-0040/hwmon/hwmon30# cat curr1_input
360
root@sonic:/sys/bus/i2c/devices/57-0040/hwmon/hwmon30# cat power1_input
19555200
root@sonic:/sys/bus/i2c/devices/57-0040/hwmon/hwmon30# cat temp1_input
37750

@RayWang-micas RayWang-micas requested a review from a team as a code owner June 1, 2026 08:41
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented Jun 1, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: RayWang-micas / name: RayWang-micas (9ca1985)

@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@RayWang-micas RayWang-micas changed the title Update config.sonic Enable ina238 Jun 1, 2026
Copy link
Copy Markdown
Contributor

@paulmenzel paulmenzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make the commit subject/title more specific. Maybe:

config.sonic: Build driver for sensor INA238

Then amend the commit message, and document on what system you need this, and paste the Linux log lines of the driver, that it is actually used and working.

Do the same for the merge/pull request description.

@paulmenzel
Copy link
Copy Markdown
Contributor

And of course welcome to SONiC, and thank you for your contribution. It’s much appreciated.

@RayWang-micas RayWang-micas changed the title Enable ina238 config.sonic: Build driver for sensor INA238 Jun 1, 2026
@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Validation:
- Platform: Micas M2-6951-64HC-CP
- Kernel: 6.12.41+deb13-sonic-amd64

Driver probe log:
root@sonic:/home/admin# dmesg | grep ina238
[   23.824230] ina238 57-0040: power monitor ina238 (Rshunt = 10000 uOhm, gain = 4)
[   23.824238] i2c i2c-57: new_device: Instantiated device ina238 at 0x40
[   23.837771] ina238 58-0041: power monitor ina238 (Rshunt = 10000 uOhm, gain = 4)
[   23.837779] i2c i2c-58: new_device: Instantiated device ina238 at 0x41

Hwmon interface:
root@sonic:/sys/bus/i2c/devices/57-0040/hwmon/hwmon30# ls
curr1_input  in0_input  in0_max_alarm  in0_min_alarm  in1_max        in1_min        name   power1_input  power1_max_alarm  temp1_input  temp1_max_alarm
device       in0_max    in0_min        in1_input      in1_max_alarm  in1_min_alarm  power  power1_max    subsystem         temp1_max    uevent
root@sonic:/sys/bus/i2c/devices/57-0040/hwmon/hwmon30# cat name
ina238
root@sonic:/sys/bus/i2c/devices/57-0040/hwmon/hwmon30# cat in0_input
3
root@sonic:/sys/bus/i2c/devices/57-0040/hwmon/hwmon30# cat in1_input
54434
root@sonic:/sys/bus/i2c/devices/57-0040/hwmon/hwmon30# cat curr1_input
360
root@sonic:/sys/bus/i2c/devices/57-0040/hwmon/hwmon30# cat power1_input
19555200
root@sonic:/sys/bus/i2c/devices/57-0040/hwmon/hwmon30# cat temp1_input
37750

Signed-off-by: RayWang-micas <ray@micasnetworks.com>
@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@RayWang-micas
Copy link
Copy Markdown
Author

Please make the commit subject/title more specific. Maybe:

config.sonic: Build driver for sensor INA238

Then amend the commit message, and document on what system you need this, and paste the Linux log lines of the driver, that it is actually used and working.

Do the same for the merge/pull request description.

Thanks for the review and tips.
Updated accordingly and added validation logs.

@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants