--- a/nouveau-pm/monitor_downclocking.c
+++ b/nouveau-pm/monitor_downclocking.c
@@ -22,11 +22,13 @@
  */
 
 #include <stdio.h>
+#include <linux/time.h>
 #include <X11/Xlib.h>
 
 #include "NVCtrl.h"
 #include "NVCtrlLib.h"
 
+#define	NOUVEAU_TIME_WAIT 180
 
 inline void
 read_card_specific_registers(void)
@@ -50,19 +52,19 @@
 read_bus_rate(Display *dpy)
 {
 	static int bus_rate;
-	
+
 	XNVCTRLQueryTargetAttribute (dpy, NV_CTRL_TARGET_TYPE_X_SCREEN, 0,
                                          0, NV_CTRL_BUS_RATE, &bus_rate);
-	fprintf(stderr, "NV_CTRL_BUS_RATE = %d\n", bus_rate);      
+	fprintf(stderr, "NV_CTRL_BUS_RATE = %d\n", bus_rate);
 }
 inline void
 check_bus_type(Display *dpy)
 {
 	static int bus_type;
-	
+
 	XNVCTRLQueryTargetAttribute (dpy, NV_CTRL_TARGET_TYPE_X_SCREEN, 0,
                                          0, NV_CTRL_BUS_TYPE, &bus_type);
-//	fprintf(stderr, "NV_CTRL_BUS_TYPE = %d\n", bus_type);      
+//	fprintf(stderr, "NV_CTRL_BUS_TYPE = %d\n", bus_type);
 	fprintf(stderr, "NV_CTRL_BUS_TYPE = ");
 	switch(bus_type)
 	{
@@ -116,11 +118,16 @@
 }
 int main(void)
 {
+	unsigned long start_time, get_time;
+	struct timeval tv;
 	Display *dpy;
 	int old_hz, new_hz, old_mode, new_mode, def_2d;
 	int i;
 	char *str;
 	int *pData = 0, len = 0;
+
+	do_gettimeofday(&tv);
+	start_time = tv.tv_sec;
 
 	dpy = XOpenDisplay(NULL);
 
@@ -175,6 +182,14 @@
 //	def_2d = 0;
 	do
 	{
+		do_gettimeofday(&tv);
+		get_time = tv.tv_sec;
+		if ((start_time + NOUVEAU_TIME_WAIT) < get_time ) {
+			printf("ERROR - Timeout\n");
+			XCloseDisplay(dpy);
+			return 4;
+		}
+
 		XNVCTRLQueryTargetAttribute (dpy, NV_CTRL_TARGET_TYPE_X_SCREEN, 0,
 									 0, NV_CTRL_GPU_CURRENT_CLOCK_FREQS, &new_hz);
 		if (new_hz != old_hz) {