meta-ampere: mtjade: sensor: change to use dbus-sensor

Replace sensor monitoring in phosphor-hwmon by
dbus-sensor/entity-manager.

Tested:
1. Check IPMI sensor report for Temp and ADC sensors with correct
threshold
$ ipmitool sdr list
$ ipmitool sensor list all
2. Check Redfish Thermal and Power schema for Temperature and ADC
sensors

Signed-off-by: Thang Q. Nguyen <thang@os.amperecomputing.com>
Change-Id: Idbb719ed01a28892bce32adce062c56dd51d3088
diff --git a/meta-ampere/meta-jade/recipes-phosphor/configuration/dbus-sensors_%.bbappend b/meta-ampere/meta-jade/recipes-phosphor/configuration/dbus-sensors_%.bbappend
new file mode 100644
index 0000000..bfd03f8
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/configuration/dbus-sensors_%.bbappend
@@ -0,0 +1 @@
+PACKAGECONFIG:remove = " cpusensor ipmbsensor"
diff --git a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@100/tmp175@28.conf b/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@100/tmp175@28.conf
deleted file mode 100644
index 5d1ed09..0000000
--- a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@100/tmp175@28.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-LABEL_temp1=TS1_Temp
-CRITHI_temp1=50000
-CRITLO_temp1=1000
diff --git a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@100/tmp175@29.conf b/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@100/tmp175@29.conf
deleted file mode 100644
index 2429d8e..0000000
--- a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@100/tmp175@29.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-LABEL_temp1=TS2_Temp
-CRITHI_temp1=50000
-CRITLO_temp1=1000
diff --git a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@100/tmp175@2a.conf b/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@100/tmp175@2a.conf
deleted file mode 100644
index 60d2783..0000000
--- a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@100/tmp175@2a.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-LABEL_temp1=TS3_Temp
-CRITHI_temp1=50000
-CRITLO_temp1=1000
diff --git a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@100/tmp175@2b.conf b/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@100/tmp175@2b.conf
deleted file mode 100644
index 9b79874..0000000
--- a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@100/tmp175@2b.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-LABEL_temp1=TS4_Temp
-CRITHI_temp1=50000
-CRITLO_temp1=1000
diff --git a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@100/tmp175@2c.conf b/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@100/tmp175@2c.conf
deleted file mode 100644
index c9fc00c..0000000
--- a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@100/tmp175@2c.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-LABEL_temp1=TS5_Temp
-CRITHI_temp1=50000
-CRITLO_temp1=1000
diff --git a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@100/tmp175@2d.conf b/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@100/tmp175@2d.conf
deleted file mode 100644
index 6c71eca..0000000
--- a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@100/tmp175@2d.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-LABEL_temp1=TS6_Temp
-CRITHI_temp1=50000
-CRITLO_temp1=1000
diff --git a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@1c0/psu@58.conf b/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@1c0/psu@58.conf
deleted file mode 100644
index 944085d..0000000
--- a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@1c0/psu@58.conf
+++ /dev/null
@@ -1,17 +0,0 @@
-LABEL_temp1= "PSU0_TEMP"
-CRITHI_temp1=64000
-
-LABEL_power2= "PSU0_POUTPUT"
-
-LABEL_fan1="PSU0_fan1"
-CRITHI_fan1=20300
-
-LABEL_in1= "PSU0_VINPUT"
-LABEL_in2= "PSU0_VOUTPUT"
-
-LABEL_curr1= "PSU0_IINPUT"
-LABEL_curr2= "PSU0_IOUTPUT"
-
-LABEL_power1= "PSU0_PINPUT"
-
-INTERVAL=10000000
diff --git a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@1c0/psu@59.conf b/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@1c0/psu@59.conf
deleted file mode 100644
index 15b9655..0000000
--- a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/bus@1e78a000/i2c-bus@1c0/psu@59.conf
+++ /dev/null
@@ -1,17 +0,0 @@
-LABEL_temp1 = "PSU1_TEMP"
-CRITHI_temp1=64000
-
-LABEL_power2 = "PSU1_POUTPUT"
-
-LABEL_fan1 = "PSU1_fan1"
-CRITHI_fan1=20300
-
-LABEL_in1= "PSU1_VINPUT"
-LABEL_in2= "PSU1_VOUTPUT"
-
-LABEL_curr1= "PSU1_IINPUT"
-LABEL_curr2= "PSU1_IOUTPUT"
-
-LABEL_power1 = "PSU1_PINPUT"
-
-INTERVAL=10000000
diff --git a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/pwm-tacho-controller@1e786000.conf b/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/pwm-tacho-controller@1e786000.conf
deleted file mode 100644
index b14392b..0000000
--- a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/ahb/apb/pwm-tacho-controller@1e786000.conf
+++ /dev/null
@@ -1,60 +0,0 @@
-LABEL_fan5 = "FAN3_1"
-CRITLO_fan5=500
-CRITHI_fan5=23100
-
-LABEL_fan6 = "FAN3_2"
-CRITLO_fan6=500
-CRITHI_fan6=23100
-
-LABEL_fan7 = "FAN4_1"
-CRITLO_fan7=500
-CRITHI_fan7=23100
-
-LABEL_fan8 = "FAN4_2"
-CRITLO_fan8=500
-CRITHI_fan8=23100
-
-LABEL_fan9 = "FAN5_1"
-CRITLO_fan9=500
-CRITHI_fan9=23100
-
-LABEL_fan10 = "FAN5_2"
-CRITLO_fan10=500
-CRITHI_fan10=23100
-
-LABEL_fan11 = "FAN6_1"
-CRITLO_fan11=500
-CRITHI_fan11=23100
-
-LABEL_fan12 = "FAN6_2"
-CRITLO_fan12=500
-CRITHI_fan12=23100
-
-LABEL_fan13 = "FAN7_1"
-CRITLO_fan13=500
-CRITHI_fan13=23100
-
-LABEL_fan14 = "FAN7_2"
-CRITLO_fan14=500
-CRITHI_fan14=23100
-
-LABEL_fan15 = "FAN8_1"
-CRITLO_fan15=500
-CRITHI_fan15=23100
-
-LABEL_fan16 = "FAN8_2"
-CRITLO_fan16=500
-CRITHI_fan16=23100
-
-PWM_TARGET_fan5 = "3"
-PWM_TARGET_fan6 = "3"
-PWM_TARGET_fan7 = "4"
-PWM_TARGET_fan8 = "4"
-PWM_TARGET_fan9 = "5"
-PWM_TARGET_fan10 = "5"
-PWM_TARGET_fan11 = "6"
-PWM_TARGET_fan12 = "6"
-PWM_TARGET_fan13 = "7"
-PWM_TARGET_fan14 = "7"
-PWM_TARGET_fan15 = "8"
-PWM_TARGET_fan16 = "8"
diff --git a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/iio-hwmon-adc14.conf b/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/iio-hwmon-adc14.conf
deleted file mode 100644
index a5c5c2a..0000000
--- a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/iio-hwmon-adc14.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-LABEL_in1=3V3_SB
-GAIN_in1=3
-CRITHI_in1=3960
-CRITLO_in1=2320
diff --git a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/iio-hwmon-battery.conf b/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/iio-hwmon-battery.conf
deleted file mode 100644
index 3cc5822..0000000
--- a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/iio-hwmon-battery.conf
+++ /dev/null
@@ -1,11 +0,0 @@
-LABEL_in1=VBAT_RTC
-GAIN_in1=3
-CRITHI_in1=3564
-CRITLO_in1=2106
-
-# GPIOS4 needs to be pulled high for battery voltage reading
-GPIOCHIP_in1=0
-GPIO_in1=148
-
-# Read it every day so it does not impact battery life
-INTERVAL=86400000000
diff --git a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/iio-hwmon.conf b/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/iio-hwmon.conf
deleted file mode 100644
index 4e46123..0000000
--- a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon/obmc/mtjade/hwmon/iio-hwmon.conf
+++ /dev/null
@@ -1,123 +0,0 @@
-LABEL_in1=S0_0V8_VDDC_SOC
-CRITHI_in1=960
-CRITLO_in1=560
-
-LABEL_in2=S1_0V8_VDDC_SOC
-CRITHI_in2=960
-CRITLO_in2=560
-
-LABEL_in3=S0_0V75_PCP
-CRITHI_in3=1323
-CRITLO_in3=504
-
-LABEL_in4=S1_0V75_PCP
-CRITHI_in4=1323
-CRITLO_in4=504
-
-LABEL_in5=S0_1V2_VDDQ0123
-CRITHI_in5=1442
-CRITLO_in5=840
-
-LABEL_in6=S1_1V2_VDDQ0123
-CRITHI_in6=1442
-CRITLO_in6=840
-
-LABEL_in7=S0_0V6_VTT0123
-CRITHI_in7=720
-CRITLO_in7=420
-
-LABEL_in8=S1_0V6_VTT0123
-CRITHI_in8=720
-CRITLO_in8=420
-
-LABEL_in9=S0_2V5_VPP0123
-GAIN_in9=2
-CRITHI_in9=3000
-CRITLO_in9=1755
-
-LABEL_in10=S1_2V5_VPP0123
-GAIN_in10=2
-CRITHI_in10=3000
-CRITLO_in10=1755
-
-LABEL_in11=S0_1V2_VDDQ4567
-CRITHI_in11=1442
-CRITLO_in11=840
-
-LABEL_in12=S1_1V2_VDDQ4567
-CRITHI_in12=1442
-CRITLO_in12=840
-
-LABEL_in13=S0_0V6_VTT4567
-CRITHI_in13=720
-CRITLO_in13=420
-
-LABEL_in14=S1_0V6_VTT4567
-CRITHI_in14=720
-CRITLO_in14=420
-
-LABEL_in15=S0_2V5_VPP4567
-GAIN_in15=2
-CRITHI_in15=3000
-CRITLO_in15=1755
-
-LABEL_in16=S1_2V5_VPP4567
-GAIN_in16=2
-CRITHI_in16=3000
-CRITLO_in16=1755
-
-LABEL_in17=S0_0V85_RCA
-CRITHI_in17=1080
-CRITLO_in17=630
-
-LABEL_in18=S1_0V85_RCA
-CRITHI_in18=1080
-CRITLO_in18=630
-
-LABEL_in19=S0_1V8_VDDH
-GAIN_in19=2
-CRITHI_in19=2156
-CRITLO_in19=1265
-
-LABEL_in20=S1_1V8_VDDH
-GAIN_in20=2
-CRITHI_in20=2156
-CRITLO_in20=1265
-
-LABEL_in21=S0_1V5_VDDH
-CRITHI_in21=1800
-CRITLO_in21=1053
-
-LABEL_in22=S1_1V5_VDDH
-CRITHI_in22=1800
-CRITLO_in22=1053
-
-LABEL_in23=S0_1V8_SOC
-GAIN_in23=2
-CRITHI_in23=2156
-CRITLO_in23=1265
-
-LABEL_in24=S1_1V8_SOC
-GAIN_in24=2
-CRITHI_in24=2156
-CRITLO_in24=1265
-
-LABEL_in25=S0_1V8_PCP
-GAIN_in25=2
-CRITHI_in25=2156
-CRITLO_in25=1265
-
-LABEL_in26=S1_1V8_PCP
-GAIN_in26=2
-CRITHI_in26=2156
-CRITLO_in26=1265
-
-LABEL_in27=S0_3V3_SOC
-GAIN_in27=3
-CRITHI_in27=3960
-CRITLO_in27=2320
-
-LABEL_in28=S1_3V3_SOC
-GAIN_in28=3
-CRITHI_in28=3960
-CRITLO_in28=2320
diff --git a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon_%.bbappend b/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon_%.bbappend
deleted file mode 100644
index a77a59b..0000000
--- a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-hwmon_%.bbappend
+++ /dev/null
@@ -1,31 +0,0 @@
-FILESEXTRAPATHS:append:mtjade := "${THISDIR}/${PN}:"
-
-EXTRA_OEMESON:append:mtjade = " -Dnegative-errno-on-fail=true"
-
-CHIPS:mtjade = " \
-        bus@1e78a000/i2c-bus@100/tmp175@28 \
-        bus@1e78a000/i2c-bus@100/tmp175@29 \
-        bus@1e78a000/i2c-bus@100/tmp175@2a \
-        bus@1e78a000/i2c-bus@100/tmp175@2b \
-        bus@1e78a000/i2c-bus@100/tmp175@2c \
-        bus@1e78a000/i2c-bus@100/tmp175@2d \
-        bus@1e78a000/i2c-bus@1c0/psu@58 \
-        bus@1e78a000/i2c-bus@1c0/psu@59 \
-        pwm-tacho-controller@1e786000 \
-        "
-
-ITEMSFMT = "ahb/apb/{0}.conf"
-
-ITEMS = "${@compose_list(d, 'ITEMSFMT', 'CHIPS:${MACHINE}')}"
-
-ITEMS += "iio-hwmon.conf iio-hwmon-adc14.conf iio-hwmon-battery.conf"
-
-ENVS = "obmc/${MACHINE}/hwmon/{0}"
-SYSTEMD_ENVIRONMENT_FILE:${PN}:append:mtjade = " ${@compose_list(d, 'ENVS', 'ITEMS')}"
-
-do_install:append:mtjade() {
-  SOURCEDIR="${WORKDIR}/obmc/${MACHINE}/hwmon"
-  DESTDIR="${D}${sysconfdir}/default/obmc"
-  install -d ${DESTDIR}
-  cp -r ${SOURCEDIR} ${DESTDIR}
-}