static struct kobject *wakeup_reason;
static DEFINE_SPINLOCK(resume_reason_lock);
+#define MAX_WAKEUP_SRCS 32
+static const char* wakeup_src_list[MAX_WAKEUP_SRCS];
+static int wakeup_src_cnt;
+static bool wakeup_src_by_name;
+
static ktime_t last_monotime; /* monotonic time before last suspend */
static ktime_t curr_monotime; /* monotonic time after last suspend */
static ktime_t last_stime; /* monotonic boottime offset before last suspend */
irq_list[irq_no]);
}
}
+
+ if (!suspend_abort && wakeup_src_by_name) {
+ int i;
+ for (i = 0; i < wakeup_src_cnt; i++) {
+ /* XXX: 999 is dummy irq number for batterystats*/
+ buf_offset += sprintf(buf + buf_offset, "999 %s\n",
+ wakeup_src_list[i]);
+ }
+ }
+
spin_unlock(&resume_reason_lock);
return buf_offset;
}
spin_unlock(&resume_reason_lock);
}
+void log_wakeup_reason_name(const char *name)
+{
+ printk(KERN_INFO "Resume caused by wakeup source: %s\n", name);
+
+ spin_lock(&resume_reason_lock);
+ if (wakeup_src_cnt == MAX_WAKEUP_SRCS) {
+ spin_unlock(&resume_reason_lock);
+ printk(KERN_WARNING
+ "Resume caused by more than %d wakeup sources\n",
+ MAX_WAKEUP_REASON_IRQS);
+ return;
+ }
+
+ wakeup_src_list[wakeup_src_cnt++] = name;
+ wakeup_src_by_name = true;
+ spin_unlock(&resume_reason_lock);
+}
+
int check_wakeup_reason(int irq)
{
int irq_no;
spin_lock(&resume_reason_lock);
irqcount = 0;
suspend_abort = false;
+ wakeup_src_cnt = 0;
+ wakeup_src_by_name = false;
spin_unlock(&resume_reason_lock);
/* monotonic time since boot */
last_monotime = ktime_get();