meta-quanta: gbs: add VR/adm1272 temperature sensors

VR temperature sensor names:
vddcr_cpu
vddcr_soc
vddio_abcd
vddio_efgh
p12v_mobo
p12v_fan

adm1272 temperature sensor name:
hotswap

Note:
Since adm1272 PMON_CONFIG didn't enable temperature monitoring by
default, add the driver patch to support it

Signed-off-by: George Hung <george.hung@quantatw.com>
Change-Id: I129bf01e3869188393b333e82317856b48270769
diff --git a/meta-gbs/recipes-kernel/linux/linux-nuvoton/0001-meta-gbs-Enable-adm1272-ADM1272_TEMP1_EN.patch b/meta-gbs/recipes-kernel/linux/linux-nuvoton/0001-meta-gbs-Enable-adm1272-ADM1272_TEMP1_EN.patch
new file mode 100644
index 0000000..1cfd330
--- /dev/null
+++ b/meta-gbs/recipes-kernel/linux/linux-nuvoton/0001-meta-gbs-Enable-adm1272-ADM1272_TEMP1_EN.patch
@@ -0,0 +1,45 @@
+From 8e211c8bc64521d772c4389219889a240b40307b Mon Sep 17 00:00:00 2001
+From: Charles <Charles.Hsu@quantatw.com>
+Date: Fri, 14 Aug 2020 18:06:22 +0800
+Subject: [PATCH] meta-gis: Enable adm1272 ADM1272_TEMP1_EN
+
+---
+ drivers/hwmon/pmbus/adm1275.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/hwmon/pmbus/adm1275.c b/drivers/hwmon/pmbus/adm1275.c
+index 5caa37fbfc18..550b9a8388f6 100644
+--- a/drivers/hwmon/pmbus/adm1275.c
++++ b/drivers/hwmon/pmbus/adm1275.c
+@@ -595,11 +595,13 @@ static int adm1275_probe(struct i2c_client *client,
+ 		tindex = 8;
+ 
+ 		info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT |
+-			PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
++			PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
++			PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
+ 
+-		/* Enable VOUT if not enabled (it is disabled by default) */
+-		if (!(config & ADM1278_VOUT_EN)) {
+-			config |= ADM1278_VOUT_EN;
++		
++		/* Enable VOUT & TEMP1 if not enabled (it is disabled by default) */
++		if ((config & (ADM1278_VOUT_EN | ADM1278_TEMP1_EN)) != (ADM1278_VOUT_EN | ADM1278_TEMP1_EN)) {
++			config |= ADM1278_VOUT_EN | ADM1278_TEMP1_EN;
+ 			ret = i2c_smbus_write_byte_data(client,
+ 							ADM1275_PMON_CONFIG,
+ 							config);
+@@ -610,9 +612,7 @@ static int adm1275_probe(struct i2c_client *client,
+ 			}
+ 		}
+ 
+-		if (config & ADM1278_TEMP1_EN)
+-			info->func[0] |=
+-				PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
++
+ 		if (config & ADM1278_VIN_EN)
+ 			info->func[0] |= PMBUS_HAVE_VIN;
+ 		break;
+-- 
+2.25.1
+
diff --git a/meta-gbs/recipes-kernel/linux/linux-nuvoton_%.bbappend b/meta-gbs/recipes-kernel/linux/linux-nuvoton_%.bbappend
index 6347ff6..4de4ca9 100644
--- a/meta-gbs/recipes-kernel/linux/linux-nuvoton_%.bbappend
+++ b/meta-gbs/recipes-kernel/linux/linux-nuvoton_%.bbappend
@@ -4,3 +4,4 @@
 SRC_URI_append_gbs = " file://0004-Add-kernel-seven-seg-display-support.patch"
 SRC_URI_append_gbs = " file://0004-ben-drivers-misc-Character-device-driver-for-seven-segme.patch"
 SRC_URI_append_gbs = " file://0004-ben-drivers-misc-Platform-driver-for-seven-segment-displ.patch"
+SRC_URI_append_gbs = " file://0001-meta-gbs-Enable-adm1272-ADM1272_TEMP1_EN.patch"
diff --git a/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config/gbs-ipmi-sensors.yaml b/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config/gbs-ipmi-sensors.yaml
index a6660f7..0239923 100644
--- a/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config/gbs-ipmi-sensors.yaml
+++ b/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config/gbs-ipmi-sensors.yaml
@@ -316,6 +316,11 @@
   multiplierM: 1
   rExp: 0
 
+0x27:
+  <<: *temperature
+  entityInstance: 0x28
+  path: /xyz/openbmc_project/sensors/temperature/vddcr_cpu
+
 # PVDDCR_SOC0
 0x3E:
   <<: *voltage_13v5_in
@@ -345,7 +350,12 @@
   multiplierM: 345
   rExp: -3
 
-# PVDDQ_ABCD
+0x28:
+  <<: *temperature
+  entityInstance: 0x29
+  path: /xyz/openbmc_project/sensors/temperature/vddcr_soc
+
+# PVDDIO_ABCD
 0x40:
   <<: *voltage
   entityInstance: 0x10
@@ -374,7 +384,12 @@
   multiplierM: 345
   rExp: -3
 
-# PVDDQ_EFGH
+0x29:
+  <<: *temperature
+  entityInstance: 0x2a
+  path: /xyz/openbmc_project/sensors/temperature/vddio_abcd
+
+# PVDDIO_EFGH
 0x42:
   <<: *voltage
   entityInstance: 0x12
@@ -403,6 +418,11 @@
   multiplierM: 345
   rExp: -3
 
+0x2A:
+  <<: *temperature
+  entityInstance: 0x2b
+  path: /xyz/openbmc_project/sensors/temperature/vddio_efgh
+
 # P12V_1
 0x47:
   <<: *voltage
@@ -432,6 +452,11 @@
   multiplierM: 59
   rExp: -2
 
+0x2B:
+  <<: *temperature
+  entityInstance: 0x2c
+  path: /xyz/openbmc_project/sensors/temperature/p12v_mobo
+
 # P12V_2
 0x49:
   <<: *voltage
@@ -461,6 +486,11 @@
   multiplierM: 59
   rExp: -2
 
+0x2C:
+  <<: *temperature
+  entityInstance: 0x2d
+  path: /xyz/openbmc_project/sensors/temperature/p12v_fan
+
 # Hotswap controller
 0x44:
   <<: *voltage
@@ -508,6 +538,11 @@
           0xFF:
             type: double
 
+0x2D:
+  <<: *temperature
+  entityInstance: 0x2e
+  path: /xyz/openbmc_project/sensors/temperature/hotswap
+
 # fan/pwm mapping
 # fan0/1 on Mobo, fb_fan0/1/2 on fan board
 # PWM0 => fan tach 0
diff --git a/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@88000/adm1272@10.conf b/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@88000/adm1272@10.conf
index 25172e0..41a53c0 100644
--- a/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@88000/adm1272@10.conf
+++ b/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@88000/adm1272@10.conf
@@ -33,3 +33,11 @@
 MAXVALUE_power1 = "2200"
 # READ_Pout is direct value*0.98
 GAIN_power1 = "0.98"
+
+LABEL_temp1= "hotswap"
+WARNLO_temp1= "0"
+WARNHI_temp1= "125000"
+CRITHI_temp1 = "125000"
+CRITLO_temp1 = "0"
+MINVALUE_temp1 = "-128"
+MAXVALUE_temp1 = "127"
diff --git a/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@0/vrm@60.conf b/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@0/vrm@60.conf
index cc77194..4f5ac3f 100644
--- a/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@0/vrm@60.conf
+++ b/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@0/vrm@60.conf
@@ -35,3 +35,12 @@
 MINVALUE_curr2 = "0"
 MAXVALUE_curr2 = "256"
 PWRONMON_curr2 = "ON"
+
+LABEL_temp1= "vddcr_cpu"
+WARNLO_temp1= "0"
+WARNHI_temp1= "125000"
+CRITHI_temp1 = "125000"
+CRITLO_temp1 = "0"
+MINVALUE_temp1 = "-128"
+MAXVALUE_temp1 = "127"
+PWRONMON_temp1 = "ON"
diff --git a/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@1/vrm@61.conf b/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@1/vrm@61.conf
index c1c3d3e..de3ba4d 100644
--- a/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@1/vrm@61.conf
+++ b/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@1/vrm@61.conf
@@ -35,3 +35,12 @@
 MINVALUE_curr2 = "0"
 MAXVALUE_curr2 = "88"
 PWRONMON_curr2 = "ON"
+
+LABEL_temp1= "vddcr_soc"
+WARNLO_temp1= "0"
+WARNHI_temp1= "125000"
+CRITHI_temp1 = "125000"
+CRITLO_temp1 = "0"
+MINVALUE_temp1 = "-128"
+MAXVALUE_temp1 = "127"
+PWRONMON_temp1 = "ON"
diff --git a/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@2/vrm@63.conf b/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@2/vrm@63.conf
index 6fb8563..80be07d 100644
--- a/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@2/vrm@63.conf
+++ b/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@2/vrm@63.conf
@@ -35,3 +35,12 @@
 MINVALUE_curr2 = "0"
 MAXVALUE_curr2 = "88"
 PWRONMON_curr2 = "ON"
+
+LABEL_temp1= "vddio_efgh"
+WARNLO_temp1= "0"
+WARNHI_temp1= "125000"
+CRITHI_temp1 = "125000"
+CRITLO_temp1 = "0"
+MINVALUE_temp1 = "-128"
+MAXVALUE_temp1 = "127"
+PWRONMON_temp1 = "ON"
diff --git a/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@3/vrm@45.conf b/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@3/vrm@45.conf
index 5c484c5..2ae8f21 100644
--- a/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@3/vrm@45.conf
+++ b/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@3/vrm@45.conf
@@ -35,3 +35,12 @@
 MINVALUE_curr2 = "0"
 MAXVALUE_curr2 = "88"
 PWRONMON_curr2 = "ON"
+
+LABEL_temp1= "vddio_abcd"
+WARNLO_temp1= "0"
+WARNHI_temp1= "125000"
+CRITHI_temp1 = "125000"
+CRITLO_temp1 = "0"
+MINVALUE_temp1 = "-128"
+MAXVALUE_temp1 = "127"
+PWRONMON_temp1 = "ON"
diff --git a/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@8c000/vrm@5d.conf b/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@8c000/vrm@5d.conf
index 2cd0ad6..0ef7d60 100644
--- a/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@8c000/vrm@5d.conf
+++ b/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@8c000/vrm@5d.conf
@@ -39,3 +39,12 @@
 MINVALUE_curr2 = "0"
 MAXVALUE_curr2 = "150"
 PWRONMON_curr2 = "ON"
+
+LABEL_temp1= "p12v_fan"
+WARNLO_temp1= "0"
+WARNHI_temp1= "125000"
+CRITHI_temp1 = "125000"
+CRITLO_temp1 = "0"
+MINVALUE_temp1 = "-128"
+MAXVALUE_temp1 = "127"
+PWRONMON_temp1 = "ON"
diff --git a/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@8c000/vrm@5e.conf b/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@8c000/vrm@5e.conf
index 81d056d..a795a74 100644
--- a/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@8c000/vrm@5e.conf
+++ b/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@8c000/vrm@5e.conf
@@ -39,3 +39,12 @@
 MINVALUE_curr2 = "0"
 MAXVALUE_curr2 = "150"
 PWRONMON_curr2 = "ON"
+
+LABEL_temp1= "p12v_mobo"
+WARNLO_temp1= "0"
+WARNHI_temp1= "125000"
+CRITHI_temp1 = "125000"
+CRITLO_temp1 = "0"
+MINVALUE_temp1 = "-128"
+MAXVALUE_temp1 = "127"
+PWRONMON_temp1 = "ON"