Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2010, Code Aurora Forum. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | #ifndef __ARCH_ARM_MACH_MSM_IDLE_STATS_H |
| 15 | #define __ARCH_ARM_MACH_MSM_IDLE_STATS_H |
| 16 | |
| 17 | #include <linux/types.h> |
| 18 | #include <linux/ioctl.h> |
| 19 | |
| 20 | enum msm_idle_stats_event { |
| 21 | MSM_IDLE_STATS_EVENT_BUSY_TIMER_EXPIRED = 1, |
| 22 | MSM_IDLE_STATS_EVENT_COLLECTION_TIMER_EXPIRED = 2, |
| 23 | MSM_IDLE_STATS_EVENT_COLLECTION_FULL = 3, |
| 24 | MSM_IDLE_STATS_EVENT_TIMER_MIGRATED = 4, |
| 25 | }; |
| 26 | |
| 27 | /* |
| 28 | * All time, timer, and time interval values are in units of |
| 29 | * microseconds unless stated otherwise. |
| 30 | */ |
| 31 | #define MSM_IDLE_STATS_NR_MAX_INTERVALS 100 |
| 32 | #define MSM_IDLE_STATS_MAX_TIMER 1000000 |
| 33 | |
| 34 | struct msm_idle_stats { |
| 35 | __u32 busy_timer; |
| 36 | __u32 collection_timer; |
| 37 | |
| 38 | __u32 busy_intervals[MSM_IDLE_STATS_NR_MAX_INTERVALS]; |
| 39 | __u32 idle_intervals[MSM_IDLE_STATS_NR_MAX_INTERVALS]; |
| 40 | __u32 nr_collected; |
| 41 | __s64 last_busy_start; |
| 42 | __s64 last_idle_start; |
| 43 | |
| 44 | enum msm_idle_stats_event event; |
| 45 | __s64 return_timestamp; |
| 46 | }; |
| 47 | |
| 48 | #define MSM_IDLE_STATS_IOC_MAGIC 0xD8 |
| 49 | #define MSM_IDLE_STATS_IOC_COLLECT \ |
| 50 | _IOWR(MSM_IDLE_STATS_IOC_MAGIC, 1, struct msm_idle_stats) |
| 51 | |
| 52 | #endif /* __ARCH_ARM_MACH_MSM_IDLE_STATS_H */ |