Phosphor Hwmon Poller being skipped since ads1115 sensor conf file is not installed correctly

432 Views Asked by At

I am trying to add ads1115 sensor to my Rpi4-b board with Openbmc 2.8.0. My configuration is almost done but phophor-hwmon-readd does not start to read the values. I referred to the following issue and think that my conf file might not correctly be installed. However, I have no idea why it isn't installed as expected and someone kindly give me advice on this.

I referred to: How can I add a sensor to OpenBMC? #3063 https://github.com/openbmc/openbmc/issues/3063

Here are what I checked.

Adding ads1115 to dts

ads1115@48 {
    compatible = "ti,ads1115";
    reg = <0x48>;
    status = "okay";
};

ADS1115 driver is loaded for the device in dts and the sensor starts working.

snipped lsmod output

root@raspberrypi4:/# lsmod
Module                  Size  Used by

ads1015                16384  0
raspberrypi_hwmon      16384  0
hwmon                  16384  2 ads1015,raspberrypi_hwmon
i2c_dev                20480  0

 root@raspberrypi4:/#

Added device exists on fsys

root@raspberrypi4:/# ls -la /sys/firmware/devicetree/base/soc/i2c\@7e804000/ads1115\@48/*
-r--r--r--    1 root     root            11 Jan  1 00:02 /sys/firmware/devicetree/base/soc/i2c@7e804000/ads1115@48/compatible
-r--r--r--    1 root     root             8 Jan  1 00:02 /sys/firmware/devicetree/base/soc/i2c@7e804000/ads1115@48/name
-r--r--r--    1 root     root             4 Jan  1 00:02 /sys/firmware/devicetree/base/soc/i2c@7e804000/ads1115@48/reg
-r--r--r--    1 root     root             5 Jan  1 00:02 /sys/firmware/devicetree/base/soc/i2c@7e804000/ads1115@48/status
root@raspberrypi4:/#

of_node correctly points out the added device

root@raspberrypi4:/# cat /sys/class/hwmon/hwmon1/of_node/compatible
ti,ads1115

root@raspberrypi4:/# cat /sys/class/hwmon/hwmon1/of_node/name
ads1115

root@raspberrypi4:/# hexdump /sys/class/hwmon/hwmon1/of_node/reg
0000000 0000 4800
0000004

udevadm output looks no problem

root@raspberrypi4:/# udevadm test /sys/class/hwmon/hwmon1
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

Load module index
Parsed configuration file /lib/systemd/network/99-default.link
Created link configuration context.
Reading rules file: /lib/udev/rules.d/50-udev-default.rules
Reading rules file: /lib/udev/rules.d/60-autosuspend-chromiumos.rules
Reading rules file: /lib/udev/rules.d/60-block.rules
Reading rules file: /lib/udev/rules.d/60-cdrom_id.rules
Reading rules file: /lib/udev/rules.d/60-drm.rules
Reading rules file: /lib/udev/rules.d/60-evdev.rules
Reading rules file: /lib/udev/rules.d/60-fido-id.rules
Reading rules file: /lib/udev/rules.d/60-input-id.rules
Reading rules file: /lib/udev/rules.d/60-persistent-alsa.rules
Reading rules file: /lib/udev/rules.d/60-persistent-input.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage-tape.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage.rules
Reading rules file: /lib/udev/rules.d/60-persistent-v4l.rules
Reading rules file: /lib/udev/rules.d/60-sensor.rules
Reading rules file: /lib/udev/rules.d/60-serial.rules
Reading rules file: /lib/udev/rules.d/61-autosuspend-manual.rules
Reading rules file: /lib/udev/rules.d/64-btrfs.rules
Reading rules file: /lib/udev/rules.d/70-hwmon.rules
Reading rules file: /lib/udev/rules.d/70-iio.rules
Reading rules file: /lib/udev/rules.d/70-joystick.rules
Reading rules file: /lib/udev/rules.d/70-leds.rules
Reading rules file: /lib/udev/rules.d/70-mouse.rules
Reading rules file: /lib/udev/rules.d/70-touchpad.rules
Reading rules file: /lib/udev/rules.d/75-net-description.rules
Reading rules file: /lib/udev/rules.d/75-probe_mtd.rules
Reading rules file: /lib/udev/rules.d/78-sound-card.rules
Reading rules file: /lib/udev/rules.d/80-drivers.rules
Reading rules file: /lib/udev/rules.d/80-net-setup-link.rules
Reading rules file: /lib/udev/rules.d/80-obmc-console-uart.rules
Reading rules file: /etc/udev/rules.d/99-com.rules
/etc/udev/rules.d/99-com.rules:10 Invalid value "/bin/sh -c 'ALIASES=/proc/device-tree/aliases; if cmp -s $ALIASES/uart0 $ALIASES/serial0; then echo 0;elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then echo 1; else exit 1; fi'" for PROGRAM (char 58: invalid substitution type), ignoring, but please fix it.
/etc/udev/rules.d/99-com.rules:21 Invalid value "/bin/sh -c 'ALIASES=/proc/device-tree/aliases; if cmp -s $ALIASES/uart1 $ALIASES/serial0; then echo 0; elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then echo 1; else exit 1; fi '" for PROGRAM (char 58: invalid substitution type), ignoring, but please fix it.
Reading rules file: /lib/udev/rules.d/99-systemd.rules
Reading rules file: /etc/udev/rules.d/can.rules
Reading rules file: /etc/udev/rules.d/touchscreen.rules
DEVPATH=/devices/platform/soc/fe804000.i2c/i2c-1/1-0048/hwmon/hwmon1
OF_NAME=ads1115
OF_FULLNAME=/soc/i2c@7e804000/ads1115@48
OF_COMPATIBLE_0=ti,ads1115
OF_COMPATIBLE_N=1
ACTION=add
SUBSYSTEM=hwmon
USEC_INITIALIZED=761973935
run: '/usr/bin/start_hwmon.sh start /devices/platform/soc/fe804000.i2c/i2c-1/1-0048/hwmon/hwmon1 /soc/i2c@7e804000/ads1115@48'
Unload module index
Unloaded link configuration context.
root@raspberrypi4:/#

ads1115 drivers created files of its value

There are all 8 channels from in0 to in7.

root@raspberrypi4:/sys/class/hwmon/hwmon1/device# ls
driver     in0_input  in2_input  in4_input  in6_input  modalias   of_node    subsystem
hwmon      in1_input  in3_input  in5_input  in7_input  name       power      uevent
root@raspberrypi4:/sys/class/hwmon/hwmon1/device#

No conf file is installed to the right directory

root@raspberrypi4:/etc/default/obmc# ls -la
drwxr-xr-x    3 root     root          1024 Sep 20  2021 .
drwxr-xr-x    4 root     root          1024 Sep 20  2021 ..
-rw-r--r--    1 root     root           165 Sep 17  2021 mapper
drwxr-xr-x    2 root     root          1024 Sep 20  2021 watchdog
root@raspberrypi4:/etc/default/obmc#

journalctl shows "skipped" logs

root@raspberrypi4:/# journalctl | grep -i hwmon
Jan 01 00:00:05 raspberrypi4 systemd[1]: Created slice system-xyz.openbmc_project.Hwmon.slice.
Jan 01 00:00:05 raspberrypi4 systemd[1]: Condition check resulted in Phosphor Hwmon Poller being skipped.
Jan 01 00:00:05 raspberrypi4 systemd[1]: Condition check resulted in Phosphor Hwmon Poller being skipped.
root@raspberrypi4:/#

.Conf file and BBappendfile

yocto@yocto-VM:~/Rpi4-2.8.0/openbmc/meta-evb/meta-evb-raspberrypi/recipes-phosphor$ tree
.
    └── sensors
         ├── phosphor-hwmon
         │    └── obmc
         │         └── hwmon
         │             └── soc
         │                 └── i2c@7e804000
         │                     └── [email protected]
         └── phosphor-hwmon_%.bbappend


yocto@yocto-VM:~/Rpi4-2.8.0/openbmc/meta-evb/meta-evb-raspberrypi/recipes-phosphor$ cat sensors/phosphor-hwmon_%.bbappend 

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

CHIPS = "i2c@7e804000/ads1115@48"
ITEMSFMT = "soc/{0}.conf"

ITEMS = "${@compose_list(d, 'ITEMSFMT', 'CHIPS')}"

ENVS = "obmc/hwmon/{0}"
SYSTEMD_ENVIRONMENT_FILE_${PN} += "${@compose_list(d, 'ENVS', 'ITEMS')}"


yocto@yocto-VM:~/Rpi4-2.8.0/openbmc/meta-evb/meta-evb-raspberrypi/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/soc/i2c@7e804000$ cat [email protected] 
LABEL_in4=cpu
WARNLO_in4=10
WARNHI_in4=270
CRITHI_in4=350
CRITLO_in4=0

Based on what I checked, I think the device is correctly defined to dts and the driver is also loaded accordingly. However, conf file is not installed as expected. I tried changing several parameters but did not work. Now, I have no idea why conf file is not installed. So, I appreciate someone's advice on my case.

1

There are 1 best solutions below

0
On

Checking the final value of SYSTEMD_ENVIRONMENT_FILE_${PN} might give you some clues. ... Actually it just gave me the clue. This needs to be :${PN} and not _${PN}. Yocto changed their syntax for overrides about 6 months ago now and the _ syntax isn't interpreted the way it use to be.Change the value of SYSTEMD_ENVIRONMENT_FILE_${PN} to SYSTEMD_ENVIRONMENT_FILE:${PN} in phosphor-hwmon_%.bbappend file. It will work.