msm: kgsl: Fix direct references to HZ

Make the various timeout values HZ agnostic by using the proper
macros and values instead.

Change-Id: I6b75b3f7795e6670220b1eec3df9a03b75b8c8f9
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
diff --git a/Documentation/devicetree/bindings/gpu/adreno.txt b/Documentation/devicetree/bindings/gpu/adreno.txt
index 47bbbf8..1100969 100644
--- a/Documentation/devicetree/bindings/gpu/adreno.txt
+++ b/Documentation/devicetree/bindings/gpu/adreno.txt
@@ -84,7 +84,7 @@
 - qcom,bus-control:	   Boolean. Enables an independent bus vote from the gpu frequency
 - qcom,gpubw-dev:	   a phandle to a device representing bus bandwidth requirements
 			   (see devdw.txt)
-- qcom,idle-timeout:	   This property represents the time in microseconds for idle timeout.
+- qcom,idle-timeout:	   This property represents the time in milliseconds for idle timeout.
 - qcom,chipid:		   If it exists this property is used to replace
 			   the chip identification read from the GPU hardware.
 			   This is used to override faulty hardware readings.
diff --git a/arch/arm/boot/dts/qcom/msm8916-gpu.dtsi b/arch/arm/boot/dts/qcom/msm8916-gpu.dtsi
index e4690c6..3c6c7dd 100644
--- a/arch/arm/boot/dts/qcom/msm8916-gpu.dtsi
+++ b/arch/arm/boot/dts/qcom/msm8916-gpu.dtsi
@@ -25,8 +25,7 @@
 
 		qcom,initial-pwrlevel = <1>;
 
-		/* Idle Timeout = HZ/12 */
-		qcom,idle-timeout = <8>;
+		qcom,idle-timeout = <80>; //msec
 		qcom,strtstp-sleepwake;
 
 		/*
diff --git a/arch/arm/boot/dts/qcom/msm8992-gpu.dtsi b/arch/arm/boot/dts/qcom/msm8992-gpu.dtsi
index 85804aa..fc1522a 100644
--- a/arch/arm/boot/dts/qcom/msm8992-gpu.dtsi
+++ b/arch/arm/boot/dts/qcom/msm8992-gpu.dtsi
@@ -24,7 +24,7 @@
 
 		qcom,initial-pwrlevel = <2>;
 
-		qcom,idle-timeout = <8>; //<HZ/12>
+		qcom,idle-timeout = <80>; //msec
 		qcom,strtstp-sleepwake;
 
 		/*
diff --git a/arch/arm/boot/dts/qcom/msm8994-gpu.dtsi b/arch/arm/boot/dts/qcom/msm8994-gpu.dtsi
index 28e683f..116a942 100644
--- a/arch/arm/boot/dts/qcom/msm8994-gpu.dtsi
+++ b/arch/arm/boot/dts/qcom/msm8994-gpu.dtsi
@@ -57,7 +57,7 @@
 
 		qcom,initial-pwrlevel = <2>;
 
-		qcom,idle-timeout = <8>; //<HZ/12>
+		qcom,idle-timeout = <80>; //msec
 		qcom,strtstp-sleepwake;
 
 		qcom,pm-qos-active-latency = <501>;
diff --git a/drivers/gpu/msm/adreno.c b/drivers/gpu/msm/adreno.c
index 94b90d2..9b5538d 100644
--- a/drivers/gpu/msm/adreno.c
+++ b/drivers/gpu/msm/adreno.c
@@ -757,7 +757,7 @@
 
 	if (of_property_read_u32(pdev->dev.of_node, "qcom,idle-timeout",
 		&pdata->idle_timeout))
-		pdata->idle_timeout = HZ/12;
+		pdata->idle_timeout = 80;
 
 	pdata->strtstp_sleepwake = of_property_read_bool(pdev->dev.of_node,
 						"qcom,strtstp-sleepwake");
diff --git a/drivers/gpu/msm/adreno_dispatch.c b/drivers/gpu/msm/adreno_dispatch.c
index 4dc76e7..9e526fb 100644
--- a/drivers/gpu/msm/adreno_dispatch.c
+++ b/drivers/gpu/msm/adreno_dispatch.c
@@ -363,7 +363,7 @@
 		 * it hasn't already been started
 		 */
 		if (!timer_pending(&cmdbatch->timer))
-			mod_timer(&cmdbatch->timer, jiffies + (5 * HZ));
+			mod_timer(&cmdbatch->timer, jiffies + msecs_to_jiffies(5000));
 
 		return ERR_PTR(-EAGAIN);
 	}
diff --git a/drivers/gpu/msm/adreno_profile.c b/drivers/gpu/msm/adreno_profile.c
index 538e902..46fa820 100644
--- a/drivers/gpu/msm/adreno_profile.c
+++ b/drivers/gpu/msm/adreno_profile.c
@@ -934,7 +934,7 @@
 
 		mutex_unlock(&device->mutex);
 		set_current_state(TASK_INTERRUPTIBLE);
-		schedule_timeout(HZ / 10);
+		schedule_timeout(msecs_to_jiffies(100));
 		mutex_lock(&device->mutex);
 
 		if (signal_pending(current)) {
diff --git a/drivers/gpu/msm/kgsl_device.h b/drivers/gpu/msm/kgsl_device.h
index 896d6ab..18d18e1 100644
--- a/drivers/gpu/msm/kgsl_device.h
+++ b/drivers/gpu/msm/kgsl_device.h
@@ -32,8 +32,6 @@
 #define KGSL_TIMEOUT_DEFAULT        0xFFFFFFFF
 #define KGSL_TIMEOUT_PART           50 /* 50 msec */
 
-#define FIRST_TIMEOUT (HZ / 2)
-
 #define KGSL_IOCTL_FUNC(_cmd, _func) \
 	[_IOC_NR((_cmd))] = \
 		{ .cmd = (_cmd), .func = (_func) }
diff --git a/drivers/gpu/msm/kgsl_pwrctrl.c b/drivers/gpu/msm/kgsl_pwrctrl.c
index 1304329..6340a4f 100644
--- a/drivers/gpu/msm/kgsl_pwrctrl.c
+++ b/drivers/gpu/msm/kgsl_pwrctrl.c
@@ -46,7 +46,7 @@
 #define MAX_UDELAY		2000
 
 /* Number of jiffies for a full thermal cycle */
-#define TH_HZ			20
+#define TH_HZ			(HZ/5)
 
 #define KGSL_MAX_BUSLEVELS	20
 
@@ -1326,7 +1326,7 @@
 
 	pwr->power_flags = 0;
 
-	pwr->interval_timeout = pdata->idle_timeout;
+	pwr->interval_timeout = msecs_to_jiffies(pdata->idle_timeout);
 	pwr->strtstp_sleepwake = pdata->strtstp_sleepwake;
 
 	if (kgsl_property_read_u32(device, "qcom,pm-qos-active-latency",