diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 6b904fbbf488..f00d048aa583 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -1130,7 +1130,7 @@ source drivers/hwmon/pmbus/Kconfig
 
 config SENSORS_PWM_FAN
 	tristate "PWM fan"
-	depends on PWM
+	depends on (PWM && OF) || COMPILE_TEST
 	help
 	  If you say yes here you get support for fans connected to PWM lines.
 	  The driver uses the generic PWM interface, thus it will work on a