[PATCH umr] Add --update demo

Tom St Denis tom.stdenis at amd.com
Tue Jun 20 18:32:55 UTC 2017


In this commit we add a demo that reads the NB voltage
sensor on a Carrizo in shell script.

Signed-off-by: Tom St Denis <tom.stdenis at amd.com>
---
 demo/update/carrizo.update |  4 ++++
 demo/update/read_sensor.sh | 17 +++++++++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 demo/update/carrizo.update
 create mode 100755 demo/update/read_sensor.sh

diff --git a/demo/update/carrizo.update b/demo/update/carrizo.update
new file mode 100644
index 000000000000..0ec40e074c9f
--- /dev/null
+++ b/demo/update/carrizo.update
@@ -0,0 +1,4 @@
+add reg carrizo.smu80.ixSMUSVI_NB_CURRENTVID smc 0xD8230044
+add bit carrizo.smu80.ixSMUSVI_NB_CURRENTVID.CURRENT_NB_VID 24 31
+add reg carrizo.smu80.ixSMUSVI_GFX_CURRENTVID smc 0xD8230048
+add bit carrizo.smu80.ixSMUSVI_GFX_CURRENTVID.CURRENT_GFX_VID 24 31
diff --git a/demo/update/read_sensor.sh b/demo/update/read_sensor.sh
new file mode 100755
index 000000000000..94267f45492f
--- /dev/null
+++ b/demo/update/read_sensor.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# Example script that uses umr + update scripts to read sensors that are not
+# part of the kernel headers.
+#
+# In this case we're reading the NB voltage sensor from Carrizo
+
+# capture value in hex
+NB_VID=`umr -O risky,risky,read_smc -u carrizo.update -r carrizo.smu80.ixSMUSVI_NB_CURRENTVID | cut -b1-4`
+
+# convert to decimal
+NB_VID_DEC=`printf "%d" ${NB_VID}`
+
+# voltage is 6200mV - (25mV * sensor_data)
+NB_VID_V=`expr ${NB_VID_DEC} \* 25`
+NB_VID_V=`expr 6200 - ${NB_VID_V}`
+printf "Northbridge voltage is %dmV\n" ${NB_VID_V}
-- 
2.12.0



More information about the amd-gfx mailing list