James Carr | ad3c02f | 2016-07-29 19:02:16 -0700 | [diff] [blame] | 1 | /* include/linux/memory-state-time.h |
| 2 | * |
| 3 | * Copyright (C) 2016 Google, Inc. |
| 4 | * |
| 5 | * This software is licensed under the terms of the GNU General Public |
| 6 | * License version 2, as published by the Free Software Foundation, and |
| 7 | * may be copied, distributed, and modified under those terms. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | */ |
| 15 | |
| 16 | #include <linux/workqueue.h> |
| 17 | |
| 18 | #define UPDATE_MEMORY_STATE(BLOCK, VALUE) BLOCK->update_call(BLOCK, VALUE) |
| 19 | |
| 20 | struct memory_state_update_block; |
| 21 | |
| 22 | typedef void (*memory_state_update_fn_t)(struct memory_state_update_block *ub, |
| 23 | int value); |
| 24 | |
| 25 | /* This struct is populated when you pass it to a memory_state_register* |
| 26 | * function. The update_call function is used for an update and defined in the |
| 27 | * typedef memory_state_update_fn_t |
| 28 | */ |
| 29 | struct memory_state_update_block { |
| 30 | memory_state_update_fn_t update_call; |
| 31 | int id; |
| 32 | }; |
| 33 | |
| 34 | /* Register a frequency struct memory_state_update_block to provide updates to |
| 35 | * memory_state_time about frequency changes using its update_call function. |
| 36 | */ |
| 37 | struct memory_state_update_block *memory_state_register_frequency_source(void); |
| 38 | |
| 39 | /* Register a bandwidth struct memory_state_update_block to provide updates to |
| 40 | * memory_state_time about bandwidth changes using its update_call function. |
| 41 | */ |
| 42 | struct memory_state_update_block *memory_state_register_bandwidth_source(void); |