#include <trace/events/power.h>
#include "power.h"
+//#ifndef CONFIG_ARM64
+#if 1
+int wakeup_debug = 0;
+#define _TAG_WAKEUP "WAKEUP"
+#define wakeup_log(fmt, ...) do { if (wakeup_debug) pr_info("[%s][%s]" fmt, _TAG_WAKEUP, __func__, ##__VA_ARGS__); } while (0)
+#define wakeup_warn(fmt, ...) do { if (wakeup_debug) pr_warn("[%s][%s]" fmt, _TAG_WAKEUP, __func__, ##__VA_ARGS__); } while (0)
/*
* If set, the suspend/hibernate code will abort transitions to a sleep state
* if wakeup events are registered during or immediately before the transition.
*/
bool events_check_enabled __read_mostly;
+EXPORT_SYMBOL_GPL(events_check_enabled);
/*
* Combined counters of registered wakeup events and wakeup events in progress.
ws->active_count++;
ws->last_time = ktime_get();
if (ws->autosleep_enabled)
+ {
+ //<20130327> <marc.huang> add wakeup source dubug log
+ wakeup_warn("ws->name: %s\n", ws->name);
ws->start_prevent_time = ws->last_time;
+ }
/* Increment the counter of events in progress. */
cec = atomic_inc_return(&combined_event_count);
if (!ws)
return;
+ //<20130327> <marc.huang> add wakeup source dubug log
+ wakeup_log("ws->name: %s\n", ws->name);
+
spin_lock_irqsave(&ws->lock, flags);
wakeup_source_report_event(ws);
ws->timer_expires = 0;
if (ws->autosleep_enabled)
+ {
+ //<20130327> <marc.huang> add wakeup source dubug log
+ wakeup_warn("ws->name: %s\n", ws->name);
update_prevent_sleep_time(ws, now);
+ }
/*
* Increment the counter of registered wakeup events and decrement the
* couter of wakeup events in progress simultaneously.
*/
+ // FIXME: CHECK BUG here ??? if combined_event_count = 0x????0000, then atomic_add_return(...) --> 0x????ffff
+ // , which is not the expected result !!!
cec = atomic_add_return(MAX_IN_PROGRESS, &combined_event_count);
trace_wakeup_source_deactivate(ws->name, cec);
if (!ws)
return;
+ //<20130327> <marc.huang> add wakeup source dubug log
+ wakeup_log("ws->name: %s\n", ws->name);
+
spin_lock_irqsave(&ws->lock, flags);
if (ws->active)
wakeup_source_deactivate(ws);
if (!ws)
return;
+ //<20130327> <marc.huang> add wakeup source dubug log
+ wakeup_log("ws->name: %s\n", ws->name);
+
spin_lock_irqsave(&ws->lock, flags);
wakeup_source_report_event(ws);
split_counters(&cnt, &inpr);
ret = (cnt != saved_count || inpr > 0);
events_check_enabled = !ret;
+
+ //<20130327> <marc.huang> add wakeup source dubug log
+ if (ret)
+ wakeup_warn("cnt: %d, saved_count: %d, inpr: %d\n", cnt, saved_count, inpr);
}
spin_unlock_irqrestore(&events_lock, flags);
return ret;
}
+EXPORT_SYMBOL_GPL(pm_wakeup_pending);
/**
* pm_get_wakeup_count - Read the number of registered wakeup events.
if (inpr == 0 || signal_pending(current))
break;
+ //<20130327> <marc.huang> add wakeup source dubug log
+ print_active_wakeup_sources();
schedule();
}
finish_wait(&wakeup_count_wait_queue, &wait);
return ret;
}
-
+#endif
+//#ifdef CONFIG_ARM64
+#if 1
+static struct dentry *wakeup_sources_stats_dentry;
+#endif
/**
* wakeup_sources_stats_show - Print wakeup sources statistics information.
* @m: seq_file to print the statistics into.
"last_change\tprevent_suspend_time\n");
rcu_read_lock();
+//#ifndef CONFIG_ARM64
+#if 1
list_for_each_entry_rcu(ws, &wakeup_sources, entry)
print_wakeup_source_stats(m, ws);
+#endif
rcu_read_unlock();
return 0;