Change how hwmon.pl is invoked for MRW systems

This minor tweak removes the need for MRW using systems
to append the phosphor-hwmon recipe in their layer.

Change-Id: I3d9dcfff452e26d191df37ae7d759c6c2c3f2cd4
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/meta-phosphor/classes/phosphor-hwmon-mrw.bbclass b/meta-phosphor/common/recipes-phosphor/sensors/phosphor-hwmon-config-mrw.bb
similarity index 84%
rename from meta-phosphor/classes/phosphor-hwmon-mrw.bbclass
rename to meta-phosphor/common/recipes-phosphor/sensors/phosphor-hwmon-config-mrw.bb
index 0821a22..d72d503 100644
--- a/meta-phosphor/classes/phosphor-hwmon-mrw.bbclass
+++ b/meta-phosphor/common/recipes-phosphor/sensors/phosphor-hwmon-config-mrw.bb
@@ -1,5 +1,9 @@
-#Common code to generate the hwmon conf files from the MRW.
-#Can be pulled in on a per system basis.
+SUMMARY = "Phosphor hwmon configuration generator"
+DESCRIPTION = "Generate phosphor-hwmon configuration from an MRW."
+PR = "r1"
+
+inherit obmc-phosphor-license
+inherit allarch
 
 DEPENDS += "mrw-perl-tools-native mrw-native"
 
diff --git a/meta-phosphor/common/recipes-phosphor/sensors/phosphor-hwmon.bb b/meta-phosphor/common/recipes-phosphor/sensors/phosphor-hwmon.bb
index d7a2d6d..11e968f 100644
--- a/meta-phosphor/common/recipes-phosphor/sensors/phosphor-hwmon.bb
+++ b/meta-phosphor/common/recipes-phosphor/sensors/phosphor-hwmon.bb
@@ -23,6 +23,8 @@
         phosphor-logging \
         "
 
+RRECOMMENDS_${PN} += "${VIRTUAL-RUNTIME_phosphor-hwmon-config}"
+
 SRC_URI += "git://github.com/openbmc/phosphor-hwmon"
 SRC_URI += "file://70-hwmon.rules"
 
diff --git a/meta-phosphor/conf/distro/include/phosphor-defaults.inc b/meta-phosphor/conf/distro/include/phosphor-defaults.inc
index 64309d1..28e04ef 100644
--- a/meta-phosphor/conf/distro/include/phosphor-defaults.inc
+++ b/meta-phosphor/conf/distro/include/phosphor-defaults.inc
@@ -54,6 +54,13 @@
 PREFERRED_PROVIDER_virtual/obmc-user-mgmt ?= "obmc-phosphor-user"
 PREFERRED_PROVIDER_virtual/obmc-wsgihost ?= "phosphor-gevent"
 
+# phosphor-hwmon-config
+#
+# The phosphor-hwmon package can have its configuration generated
+# automatically if the MRW feature is enabled.
+VIRTUAL-RUNTIME_phosphor-hwmon-config ?= \
+    "${@cf_enabled(d, 'obmc-mrw', 'phosphor-hwmon-config-mrw')}"
+
 # virtual/phosphor-ipmi-fru-hostfw-config
 #
 # The phosphor-ipmi-fru application is data-driven and requires an input