summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMahesh Sivasubramanian <msivasub@codeaurora.org>2016-02-01 10:40:26 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 11:07:18 -0700
commitc184ee865f4dd565b25e814517bb63477f27b15a (patch)
treedd014ec04147641dcefc79a1281f1ae20b2de118 /include
parenta3b546e50972ed14a930b3a47a0ea599e0350548 (diff)
soc: qcom: idle: Snapshot of idle/sleep driver as of msm-3.18
This is a snapshot of the Sleep driver and realted functionality as of e70ad0cd5efdd9dc91a77dcdac31d6132e1315c1 on msm-3.18 branch Change-Id: I98fec26849898c5c66abbb1b094439780c23964d
Diffstat (limited to 'include')
-rw-r--r--include/linux/coresight-cti.h93
-rw-r--r--include/linux/msm-core-interface.h13
-rw-r--r--include/soc/qcom/event_timer.h80
-rw-r--r--include/soc/qcom/jtag.h54
-rw-r--r--include/soc/qcom/lpm-stats.h71
-rw-r--r--include/soc/qcom/msm-core.h24
-rw-r--r--include/soc/qcom/pm.h172
-rw-r--r--include/trace/events/trace_msm_core.h103
-rw-r--r--include/trace/events/trace_msm_low_power.h167
-rw-r--r--include/uapi/linux/msm-core-interface.h29
10 files changed, 806 insertions, 0 deletions
diff --git a/include/linux/coresight-cti.h b/include/linux/coresight-cti.h
new file mode 100644
index 000000000000..73f56b76cc18
--- /dev/null
+++ b/include/linux/coresight-cti.h
@@ -0,0 +1,93 @@
+/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _LINUX_CORESIGHT_CTI_H
+#define _LINUX_CORESIGHT_CTI_H
+
+#include <linux/list.h>
+
+struct coresight_cti_data {
+ int nr_ctis;
+ const char **names;
+};
+
+struct coresight_cti {
+ const char *name;
+ struct list_head link;
+};
+
+#ifdef CONFIG_CORESIGHT_CTI
+extern struct coresight_cti *coresight_cti_get(const char *name);
+extern void coresight_cti_put(struct coresight_cti *cti);
+extern int coresight_cti_map_trigin(
+ struct coresight_cti *cti, int trig, int ch);
+extern int coresight_cti_map_trigout(
+ struct coresight_cti *cti, int trig, int ch);
+extern void coresight_cti_unmap_trigin(
+ struct coresight_cti *cti, int trig, int ch);
+extern void coresight_cti_unmap_trigout(
+ struct coresight_cti *cti, int trig, int ch);
+extern void coresight_cti_reset(struct coresight_cti *cti);
+extern int coresight_cti_set_trig(struct coresight_cti *cti, int ch);
+extern void coresight_cti_clear_trig(struct coresight_cti *cti, int ch);
+extern int coresight_cti_pulse_trig(struct coresight_cti *cti, int ch);
+extern int coresight_cti_enable_gate(struct coresight_cti *cti, int ch);
+extern void coresight_cti_disable_gate(struct coresight_cti *cti, int ch);
+extern void coresight_cti_ctx_save(void);
+extern void coresight_cti_ctx_restore(void);
+extern int coresight_cti_ack_trig(struct coresight_cti *cti, int trig);
+#else
+static inline struct coresight_cti *coresight_cti_get(const char *name)
+{
+ return NULL;
+}
+static inline void coresight_cti_put(struct coresight_cti *cti) {}
+static inline int coresight_cti_map_trigin(
+ struct coresight_cti *cti, int trig, int ch)
+{
+ return -ENOSYS;
+}
+static inline int coresight_cti_map_trigout(
+ struct coresight_cti *cti, int trig, int ch)
+{
+ return -ENOSYS;
+}
+static inline void coresight_cti_unmap_trigin(
+ struct coresight_cti *cti, int trig, int ch) {}
+static inline void coresight_cti_unmap_trigout(
+ struct coresight_cti *cti, int trig, int ch) {}
+static inline void coresight_cti_reset(struct coresight_cti *cti) {}
+static inline int coresight_cti_set_trig(struct coresight_cti *cti, int ch)
+{
+ return -ENOSYS;
+}
+static inline void coresight_cti_clear_trig(struct coresight_cti *cti, int ch)
+{}
+static inline int coresight_cti_pulse_trig(struct coresight_cti *cti, int ch)
+{
+ return -ENOSYS;
+}
+static inline int coresight_cti_enable_gate(struct coresight_cti *cti, int ch)
+{
+ return -ENOSYS;
+}
+static inline void coresight_cti_disable_gate(struct coresight_cti *cti, int ch)
+{}
+static inline void coresight_cti_ctx_save(void){}
+static inline void coresight_cti_ctx_restore(void){}
+static inline int coresight_cti_ack_trig(struct coresight_cti *cti, int trig)
+{
+ return -ENOSYS;
+}
+#endif
+
+#endif
diff --git a/include/linux/msm-core-interface.h b/include/linux/msm-core-interface.h
new file mode 100644
index 000000000000..33bb40829dd7
--- /dev/null
+++ b/include/linux/msm-core-interface.h
@@ -0,0 +1,13 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <uapi/linux/msm-core-interface.h>
diff --git a/include/soc/qcom/event_timer.h b/include/soc/qcom/event_timer.h
new file mode 100644
index 000000000000..6f2a1aa2f9b1
--- /dev/null
+++ b/include/soc/qcom/event_timer.h
@@ -0,0 +1,80 @@
+/* Copyright (c) 2012, 2014, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __ARCH_ARM_MACH_MSM_EVENT_TIMER_H
+#define __ARCH_ARM_MACH_MSM_EVENT_TIMER_H
+
+#include <linux/hrtimer.h>
+
+struct event_timer_info;
+
+#ifdef CONFIG_MSM_EVENT_TIMER
+/**
+ * add_event_timer() : Add a wakeup event. Intended to be called
+ * by clients once. Returns a handle to be used
+ * for future transactions.
+ * @irq : Interrupt number to track affinity.
+ * @function : The callback function will be called when event
+ * timer expires.
+ * @data : Callback data provided by client.
+ */
+struct event_timer_info *add_event_timer(uint32_t irq,
+ void (*function)(void *), void *data);
+
+/** activate_event_timer() : Set the expiration time for an event in absolute
+ * ktime. This is a oneshot event timer, clients
+ * should call this again to set another expiration.
+ * @event : Event handle.
+ * @event_time : Event time in absolute ktime.
+ */
+void activate_event_timer(struct event_timer_info *event, ktime_t event_time);
+
+/**
+ * deactivate_event_timer() : Deactivate an event timer.
+ * @event: event handle.
+ */
+void deactivate_event_timer(struct event_timer_info *event);
+
+/**
+ * destroy_event_timer() : Free the event info data structure allocated during
+ * add_event_timer().
+ * @event: event handle.
+ */
+void destroy_event_timer(struct event_timer_info *event);
+
+/**
+ * get_next_event_timer() : Get the next wakeup event.
+ * returns a ktime value of the next
+ * expiring event.
+ */
+ktime_t get_next_event_time(int cpu);
+#else
+static inline void *add_event_timer(uint32_t irq, void (*function)(void *),
+ void *data)
+{
+ return NULL;
+}
+
+static inline void activate_event_timer(void *event, ktime_t event_time) {}
+
+static inline void deactivate_event_timer(void *event) {}
+
+static inline void destroy_event_timer(void *event) {}
+
+static inline ktime_t get_next_event_time(int cpu)
+{
+ return ns_to_ktime(0);
+}
+
+#endif /* CONFIG_MSM_EVENT_TIMER_MANAGER */
+#endif /* __ARCH_ARM_MACH_MSM_EVENT_TIMER_H */
diff --git a/include/soc/qcom/jtag.h b/include/soc/qcom/jtag.h
new file mode 100644
index 000000000000..a5de362cdb8c
--- /dev/null
+++ b/include/soc/qcom/jtag.h
@@ -0,0 +1,54 @@
+/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __MACH_JTAG_H
+#define __MACH_JTAG_H
+
+#if defined(CONFIG_MSM_JTAG) || defined(CONFIG_MSM_JTAG_MM) || \
+ defined(CONFIG_MSM_JTAGV8)
+extern void msm_jtag_save_state(void);
+extern void msm_jtag_restore_state(void);
+extern void msm_jtag_etm_save_state(void);
+extern void msm_jtag_etm_restore_state(void);
+extern bool msm_jtag_fuse_apps_access_disabled(void);
+#else
+static inline void msm_jtag_save_state(void) {}
+static inline void msm_jtag_restore_state(void) {}
+static inline void msm_jtag_etm_save_state(void) {}
+static inline void msm_jtag_etm_restore_state(void){}
+static inline bool msm_jtag_fuse_apps_access_disabled(void) { return false; }
+#endif
+#ifdef CONFIG_MSM_JTAGV8
+extern int msm_jtag_save_register(struct notifier_block *nb);
+extern int msm_jtag_save_unregister(struct notifier_block *nb);
+extern int msm_jtag_restore_register(struct notifier_block *nb);
+extern int msm_jtag_restore_unregister(struct notifier_block *nb);
+#else
+static inline int msm_jtag_save_register(struct notifier_block *nb)
+{
+ return 0;
+}
+static inline int msm_jtag_save_unregister(struct notifier_block *nb)
+{
+ return 0;
+}
+static inline int msm_jtag_restore_register(struct notifier_block *nb)
+{
+ return 0;
+}
+static inline int msm_jtag_restore_unregister(struct notifier_block *nb)
+{
+ return 0;
+}
+#endif
+
+#endif
diff --git a/include/soc/qcom/lpm-stats.h b/include/soc/qcom/lpm-stats.h
new file mode 100644
index 000000000000..05f5516f4177
--- /dev/null
+++ b/include/soc/qcom/lpm-stats.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __ARCH_ARM_MACH_MSM_LPM_STATS_H
+#define __ARCH_ARM_MACH_MSM_LPM_STATS_H
+
+struct lpm_stats;
+
+#ifdef CONFIG_MSM_IDLE_STATS
+struct lpm_stats *lpm_stats_config_level(const char *name,
+ const char **levels, int num_levels, struct lpm_stats *parent,
+ struct cpumask *mask);
+void lpm_stats_cluster_enter(struct lpm_stats *stats, uint32_t index);
+void lpm_stats_cluster_exit(struct lpm_stats *stats, uint32_t index,
+ bool success);
+void lpm_stats_cpu_enter(uint32_t index);
+void lpm_stats_cpu_exit(uint32_t index, bool success);
+void lpm_stats_suspend_enter(void);
+void lpm_stats_suspend_exit(void);
+#else
+static inline struct lpm_stats *lpm_stats_config_level(const char *name,
+ const char **levels, int num_levels, struct lpm_stats *parent,
+ struct cpumask *mask)
+{
+ return ERR_PTR(-ENODEV);
+}
+
+static inline void lpm_stats_cluster_enter(struct lpm_stats *stats,
+ uint32_t index)
+{
+ return;
+}
+
+static inline void lpm_stats_cluster_exit(struct lpm_stats *stats,
+ uint32_t index, bool success)
+{
+ return;
+}
+
+static inline void lpm_stats_cpu_enter(uint32_t index)
+{
+ return;
+}
+
+static inline void lpm_stats_cpu_exit(uint32_t index, bool success)
+{
+ return;
+}
+
+static inline void lpm_stats_suspend_enter(void)
+{
+ return;
+}
+
+static inline void lpm_stats_suspend_exit(void)
+{
+ return;
+}
+#endif
+#endif /* __ARCH_ARM_MACH_MSM_LPM_STATS_H */
diff --git a/include/soc/qcom/msm-core.h b/include/soc/qcom/msm-core.h
new file mode 100644
index 000000000000..5e187183f07b
--- /dev/null
+++ b/include/soc/qcom/msm-core.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __ARCH_ARM_MACH_MSM_CORE_H
+#define __ARCH_ARM_MACH_MSM_CORE_H
+#ifdef CONFIG_APSS_CORE_EA
+void set_cpu_throttled(struct cpumask *mask, bool throttling);
+struct blocking_notifier_head *get_power_update_notifier(void);
+#else
+static inline void set_cpu_throttled(struct cpumask *mask, bool throttling) {}
+struct blocking_notifier_head *get_power_update_notifier(void) {return NULL; }
+#endif
+#endif
+
diff --git a/include/soc/qcom/pm.h b/include/soc/qcom/pm.h
new file mode 100644
index 000000000000..b7ad2e5e6c2c
--- /dev/null
+++ b/include/soc/qcom/pm.h
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2007 Google, Inc.
+ * Copyright (c) 2009-2015, The Linux Foundation. All rights reserved.
+ * Author: San Mehat <san@android.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __ARCH_ARM_MACH_MSM_PM_H
+#define __ARCH_ARM_MACH_MSM_PM_H
+
+#include <linux/types.h>
+#include <linux/cpuidle.h>
+#include <asm/smp_plat.h>
+#include <asm/barrier.h>
+
+#if !defined(CONFIG_SMP)
+#define msm_secondary_startup NULL
+#elif defined(CONFIG_CPU_V7)
+#define msm_secondary_startup secondary_startup
+#else
+#define msm_secondary_startup secondary_holding_pen
+#endif
+
+enum msm_pm_sleep_mode {
+ MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
+ MSM_PM_SLEEP_MODE_RETENTION,
+ MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
+ MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+ MSM_PM_SLEEP_MODE_FASTPC,
+ MSM_PM_SLEEP_MODE_POWER_COLLAPSE_SUSPEND,
+ MSM_PM_SLEEP_MODE_NR,
+ MSM_PM_SLEEP_MODE_NOT_SELECTED,
+};
+
+enum msm_pm_l2_scm_flag {
+ MSM_SCM_L2_ON = 0,
+ MSM_SCM_L2_OFF = 1,
+ MSM_SCM_L2_GDHS = 2,
+ MSM_SCM_L3_PC_OFF = 4,
+};
+
+#define MSM_PM_MODE(cpu, mode_nr) ((cpu) * MSM_PM_SLEEP_MODE_NR + (mode_nr))
+
+struct msm_pm_time_params {
+ uint32_t latency_us;
+ uint32_t sleep_us;
+ uint32_t next_event_us;
+ uint32_t modified_time_us;
+};
+
+struct msm_pm_sleep_status_data {
+ void *base_addr;
+ uint32_t mask;
+};
+
+/**
+ * lpm_cpu_pre_pc_cb(): API to get the L2 flag to pass to TZ
+ *
+ * @cpu: cpuid of the CPU going down.
+ *
+ * Returns the l2 flush flag enum that is passed down to TZ during power
+ * collaps
+ */
+enum msm_pm_l2_scm_flag lpm_cpu_pre_pc_cb(unsigned int cpu);
+
+/**
+ * msm_pm_sleep_mode_allow() - API to determine if sleep mode is allowed.
+ * @cpu: CPU on which to check for the sleep mode.
+ * @mode: Sleep Mode to check for.
+ * @idle: Idle or Suspend Sleep Mode.
+ *
+ * Helper function to determine if a Idle or Suspend
+ * Sleep mode is allowed for a specific CPU.
+ *
+ * Return: 1 for allowed; 0 if not allowed.
+ */
+int msm_pm_sleep_mode_allow(unsigned int, unsigned int, bool);
+
+/**
+ * msm_pm_sleep_mode_supported() - API to determine if sleep mode is
+ * supported.
+ * @cpu: CPU on which to check for the sleep mode.
+ * @mode: Sleep Mode to check for.
+ * @idle: Idle or Suspend Sleep Mode.
+ *
+ * Helper function to determine if a Idle or Suspend
+ * Sleep mode is allowed and enabled for a specific CPU.
+ *
+ * Return: 1 for supported; 0 if not supported.
+ */
+int msm_pm_sleep_mode_supported(unsigned int, unsigned int, bool);
+
+struct msm_pm_cpr_ops {
+ void (*cpr_suspend)(void);
+ void (*cpr_resume)(void);
+};
+
+void __init msm_pm_set_tz_retention_flag(unsigned int flag);
+void msm_pm_enable_retention(bool enable);
+bool msm_pm_retention_enabled(void);
+bool msm_cpu_pm_enter_sleep(enum msm_pm_sleep_mode mode, bool from_idle);
+static inline void msm_arch_idle(void)
+{
+ mb();
+ wfi();
+}
+
+#ifdef CONFIG_MSM_PM
+void msm_pm_set_rpm_wakeup_irq(unsigned int irq);
+int msm_pm_wait_cpu_shutdown(unsigned int cpu);
+int __init msm_pm_sleep_status_init(void);
+void lpm_cpu_hotplug_enter(unsigned int cpu);
+s32 msm_cpuidle_get_deep_idle_latency(void);
+int msm_pm_collapse(unsigned long unused);
+#else
+static inline void msm_pm_set_rpm_wakeup_irq(unsigned int irq) {}
+static inline int msm_pm_wait_cpu_shutdown(unsigned int cpu) { return 0; }
+static inline int msm_pm_sleep_status_init(void) { return 0; };
+
+static inline void lpm_cpu_hotplug_enter(unsigned int cpu)
+{
+ msm_arch_idle();
+};
+
+static inline s32 msm_cpuidle_get_deep_idle_latency(void) { return 0; }
+#define msm_pm_collapse NULL
+#endif
+
+#ifdef CONFIG_HOTPLUG_CPU
+int msm_platform_secondary_init(unsigned int cpu);
+#else
+static inline int msm_platform_secondary_init(unsigned int cpu) { return 0; }
+#endif
+
+enum msm_pm_time_stats_id {
+ MSM_PM_STAT_REQUESTED_IDLE = 0,
+ MSM_PM_STAT_IDLE_SPIN,
+ MSM_PM_STAT_IDLE_WFI,
+ MSM_PM_STAT_RETENTION,
+ MSM_PM_STAT_IDLE_STANDALONE_POWER_COLLAPSE,
+ MSM_PM_STAT_IDLE_FAILED_STANDALONE_POWER_COLLAPSE,
+ MSM_PM_STAT_IDLE_POWER_COLLAPSE,
+ MSM_PM_STAT_IDLE_FAILED_POWER_COLLAPSE,
+ MSM_PM_STAT_SUSPEND,
+ MSM_PM_STAT_FAILED_SUSPEND,
+ MSM_PM_STAT_NOT_IDLE,
+ MSM_PM_STAT_COUNT
+};
+
+#ifdef CONFIG_MSM_IDLE_STATS
+void msm_pm_add_stats(enum msm_pm_time_stats_id *enable_stats, int size);
+void msm_pm_add_stat(enum msm_pm_time_stats_id id, int64_t t);
+void msm_pm_l2_add_stat(uint32_t id, int64_t t);
+#else
+static inline void msm_pm_add_stats(enum msm_pm_time_stats_id *enable_stats,
+ int size) {}
+static inline void msm_pm_add_stat(enum msm_pm_time_stats_id id, int64_t t) {}
+static inline void msm_pm_l2_add_stat(uint32_t id, int64_t t) {}
+#endif
+
+void msm_pm_set_cpr_ops(struct msm_pm_cpr_ops *ops);
+extern dma_addr_t msm_pc_debug_counters_phys;
+#endif /* __ARCH_ARM_MACH_MSM_PM_H */
diff --git a/include/trace/events/trace_msm_core.h b/include/trace/events/trace_msm_core.h
new file mode 100644
index 000000000000..d99b72ca63fa
--- /dev/null
+++ b/include/trace/events/trace_msm_core.h
@@ -0,0 +1,103 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM msm_core
+
+#if !defined(_TRACE_MSM_CORE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_MSM_CORE_H
+
+#include <linux/tracepoint.h>
+#include <linux/thermal.h>
+
+TRACE_EVENT(cpu_stats,
+
+ TP_PROTO(unsigned int cpu, long temp,
+ uint64_t min_power, uint64_t max_power),
+
+ TP_ARGS(cpu, temp, min_power, max_power),
+
+ TP_STRUCT__entry(
+ __field(unsigned int, cpu)
+ __field(long, temp)
+ __field(uint64_t, min_power)
+ __field(uint64_t, max_power)
+ ),
+
+ TP_fast_assign(
+ __entry->cpu = cpu;
+ __entry->temp = temp;
+ __entry->min_power = min_power;
+ __entry->max_power = max_power;
+ ),
+
+ TP_printk("Cpu%d: temp:%ld power@minfreq:%llu power@maxfreq:%llu",
+ __entry->cpu, __entry->temp, __entry->min_power,
+ __entry->max_power)
+);
+
+TRACE_EVENT(temp_threshold,
+
+ TP_PROTO(unsigned int cpu, long temp,
+ long hi_thresh, long low_thresh),
+
+ TP_ARGS(cpu, temp, hi_thresh, low_thresh),
+
+ TP_STRUCT__entry(
+ __field(unsigned int, cpu)
+ __field(long, temp)
+ __field(long, hi_thresh)
+ __field(long, low_thresh)
+ ),
+
+ TP_fast_assign(
+ __entry->cpu = cpu;
+ __entry->temp = temp;
+ __entry->hi_thresh = hi_thresh;
+ __entry->low_thresh = low_thresh;
+ ),
+
+ TP_printk("Cpu%d: temp:%ld hi_thresh:%ld low_thresh:%ld",
+ __entry->cpu, __entry->temp, __entry->hi_thresh,
+ __entry->low_thresh)
+);
+
+TRACE_EVENT(temp_notification,
+
+ TP_PROTO(unsigned int sensor_id, enum thermal_trip_type type,
+ int temp, int prev_temp),
+
+ TP_ARGS(sensor_id, type, temp, prev_temp),
+
+ TP_STRUCT__entry(
+ __field(unsigned int, sensor_id)
+ __field(enum thermal_trip_type, type)
+ __field(int, temp)
+ __field(int, prev_temp)
+ ),
+
+ TP_fast_assign(
+ __entry->sensor_id = sensor_id;
+ __entry->type = type;
+ __entry->temp = temp;
+ __entry->prev_temp = prev_temp;
+ ),
+
+ TP_printk("Sensor_id%d: %s threshold triggered temp:%d(previous:%d)",
+ __entry->sensor_id,
+ __entry->type == THERMAL_TRIP_CONFIGURABLE_HI ? "High" : "Low",
+ __entry->temp, __entry->prev_temp)
+);
+
+#endif
+#define TRACE_INCLUDE_FILE trace_msm_core
+#include <trace/define_trace.h>
diff --git a/include/trace/events/trace_msm_low_power.h b/include/trace/events/trace_msm_low_power.h
new file mode 100644
index 000000000000..691df1b2689b
--- /dev/null
+++ b/include/trace/events/trace_msm_low_power.h
@@ -0,0 +1,167 @@
+/* Copyright (c) 2012, 2014-2015, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM msm_low_power
+
+#if !defined(_TRACE_MSM_LOW_POWER_H_) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_MSM_LOW_POWER_H_
+
+#include <linux/tracepoint.h>
+
+TRACE_EVENT(cpu_power_select,
+
+ TP_PROTO(int index, u32 sleep_us, u32 latency, u32 next_event_us),
+
+ TP_ARGS(index, sleep_us, latency, next_event_us),
+
+ TP_STRUCT__entry(
+ __field(int, index)
+ __field(u32, sleep_us)
+ __field(u32, latency)
+ __field(u32, next_event_us)
+ ),
+
+ TP_fast_assign(
+ __entry->index = index;
+ __entry->sleep_us = sleep_us;
+ __entry->latency = latency;
+ __entry->next_event_us = next_event_us;
+ ),
+
+ TP_printk("idx:%d sleep_time:%u latency:%u next_event:%u",
+ __entry->index, __entry->sleep_us, __entry->latency,
+ __entry->next_event_us)
+);
+
+TRACE_EVENT(cpu_idle_enter,
+
+ TP_PROTO(int index),
+
+ TP_ARGS(index),
+
+ TP_STRUCT__entry(
+ __field(int, index)
+ ),
+
+ TP_fast_assign(
+ __entry->index = index;
+ ),
+
+ TP_printk("idx:%d",
+ __entry->index)
+);
+
+TRACE_EVENT(cpu_idle_exit,
+
+ TP_PROTO(int index, bool success),
+
+ TP_ARGS(index, success),
+
+ TP_STRUCT__entry(
+ __field(int, index)
+ __field(bool, success)
+ ),
+
+ TP_fast_assign(
+ __entry->index = index;
+ __entry->success = success;
+ ),
+
+ TP_printk("idx:%d success:%d",
+ __entry->index,
+ __entry->success)
+);
+
+TRACE_EVENT(cluster_enter,
+
+ TP_PROTO(const char *name, int index, unsigned long sync_cpus,
+ unsigned long child_cpus, bool from_idle),
+
+ TP_ARGS(name, index, sync_cpus, child_cpus, from_idle),
+
+ TP_STRUCT__entry(
+ __field(const char *, name)
+ __field(int, index)
+ __field(unsigned long, sync_cpus)
+ __field(unsigned long, child_cpus)
+ __field(bool, from_idle)
+ ),
+
+ TP_fast_assign(
+ __entry->name = name;
+ __entry->index = index;
+ __entry->sync_cpus = sync_cpus;
+ __entry->child_cpus = child_cpus;
+ __entry->from_idle = from_idle;
+ ),
+
+ TP_printk("cluster_name:%s idx:%d sync:0x%lx child:0x%lx idle:%d",
+ __entry->name,
+ __entry->index,
+ __entry->sync_cpus,
+ __entry->child_cpus,
+ __entry->from_idle)
+);
+
+TRACE_EVENT(cluster_exit,
+
+ TP_PROTO(const char *name, int index, unsigned long sync_cpus,
+ unsigned long child_cpus, bool from_idle),
+
+ TP_ARGS(name, index, sync_cpus, child_cpus, from_idle),
+
+ TP_STRUCT__entry(
+ __field(const char *, name)
+ __field(int, index)
+ __field(unsigned long, sync_cpus)
+ __field(unsigned long, child_cpus)
+ __field(bool, from_idle)
+ ),
+
+ TP_fast_assign(
+ __entry->name = name;
+ __entry->index = index;
+ __entry->sync_cpus = sync_cpus;
+ __entry->child_cpus = child_cpus;
+ __entry->from_idle = from_idle;
+ ),
+
+ TP_printk("cluster_name:%s idx:%d sync:0x%lx child:0x%lx idle:%d",
+ __entry->name,
+ __entry->index,
+ __entry->sync_cpus,
+ __entry->child_cpus,
+ __entry->from_idle)
+);
+
+TRACE_EVENT(pre_pc_cb,
+
+ TP_PROTO(int tzflag),
+
+ TP_ARGS(tzflag),
+
+ TP_STRUCT__entry(
+ __field(int, tzflag)
+ ),
+
+ TP_fast_assign(
+ __entry->tzflag = tzflag;
+ ),
+
+ TP_printk("tzflag:%d",
+ __entry->tzflag
+ )
+);
+#endif
+#define TRACE_INCLUDE_FILE trace_msm_low_power
+#include <trace/define_trace.h>
diff --git a/include/uapi/linux/msm-core-interface.h b/include/uapi/linux/msm-core-interface.h
new file mode 100644
index 000000000000..6c0dae46ab57
--- /dev/null
+++ b/include/uapi/linux/msm-core-interface.h
@@ -0,0 +1,29 @@
+#ifndef __MSM_CORE_LIB_H__
+#define __MSM_CORE_LIB_H__
+
+#include <linux/ioctl.h>
+
+#define TEMP_DATA_POINTS 13
+#define MAX_NUM_FREQ 200
+
+enum msm_core_ioctl_params {
+ MSM_CORE_LEAKAGE,
+ MSM_CORE_VOLTAGE,
+};
+
+#define MSM_CORE_MAGIC 0x9D
+
+struct sched_params {
+ uint32_t cpumask;
+ uint32_t cluster;
+ uint32_t power[TEMP_DATA_POINTS][MAX_NUM_FREQ];
+ uint32_t voltage[MAX_NUM_FREQ];
+ uint32_t freq[MAX_NUM_FREQ];
+};
+
+
+#define EA_LEAKAGE _IOWR(MSM_CORE_MAGIC, MSM_CORE_LEAKAGE,\
+ struct sched_params)
+#define EA_VOLT _IOWR(MSM_CORE_MAGIC, MSM_CORE_VOLTAGE,\
+ struct sched_params)
+#endif