CHROMIUM: MALI: Freeze temperature polling while suspended

We don't need to run temperature polling while the system is
suspending / resuming.  We'll mark ourselves freezable.  Without this
suspend/resume freezes on rk3288-veyron devices.

BUG=chromium:970685
TEST=suspend / resume

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1644069
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
(cherry picked from commit abb47ccba91ff211b3fef3c58ba8d8c6c1e5eadb)
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>

Change-Id: Ibd5f1f10c86373d96d32feb6069a9dd31b5e8059
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
diff --git a/drivers/gpu/arm/midgard/ipa/mali_kbase_ipa_simple.c b/drivers/gpu/arm/midgard/ipa/mali_kbase_ipa_simple.c
index 852559e..91dcf6c 100644
--- a/drivers/gpu/arm/midgard/ipa/mali_kbase_ipa_simple.c
+++ b/drivers/gpu/arm/midgard/ipa/mali_kbase_ipa_simple.c
@@ -27,6 +27,7 @@
 #endif
 #include <linux/of.h>
 #include <linux/delay.h>
+#include <linux/freezer.h>
 #include <linux/kthread.h>
 
 #include "mali_kbase.h"
@@ -154,6 +155,8 @@
 	int temp;
 #endif
 
+	set_freezable();
+
 	while (!kthread_should_stop()) {
 		struct thermal_zone_device *tz = READ_ONCE(model_data->gpu_tz);
 
@@ -173,6 +176,7 @@
 		WRITE_ONCE(model_data->current_temperature, temp);
 
 		msleep_interruptible(READ_ONCE(model_data->temperature_poll_interval_ms));
+		try_to_freeze();
 	}
 
 	return 0;