BZ: 23525
Read Interrupt Request Register form apic to track
wakeups that are not from GPIO. This helps us log
wakeups from sources like power button, alarm, and
headset plug.
Change-Id: I4e9ea82541e2e56e39d5de1d761fa9b89656ea7b
Signed-off-by: Axel Haslam <axelx.haslam@intel.com>
Reviewed-on: http://android.intel.com:8080/36068
Reviewed-by: Mansoor, Illyas <illyas.mansoor@intel.com>
Reviewed-by: Fiat, Christophe <christophe.fiat@intel.com>
Tested-by: Cuesta, FernandX <fernandx.cuesta@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
return 0;
}
+static void log_wakeup_irq(void)
+{
+ unsigned int irr = 0, vector = 0;
+ int offset = 0, irq = 0;
+ for (offset = (FIRST_EXTERNAL_VECTOR/32);
+ offset < (NR_VECTORS/32); offset++) {
+ irr = apic_read(APIC_IRR + (offset * 0x10));
+ while (irr) {
+ vector = __ffs(irr);
+ irr &= ~(1 << vector);
+
+ irq = __this_cpu_read(
+ vector_irq[vector + (offset * 32)]);
+ if (irq < 0)
+ continue;
+
+ pr_info("wakeup from IRQ %d\n", irq);
+ }
+ }
+ return;
+}
+
/* return the last wake source id, and make statistics about wake sources */
static int pmu_get_wake_source(void)
{
pr_info("wakeup from HSI.\n");
break;
default:
- pr_info("wakeup from OTHER.\n");
+ log_wakeup_irq();
}
return source;