Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 1 | /* |
Rajan Vaja | 8368761 | 2018-01-17 02:39:20 -0800 | [diff] [blame] | 2 | * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved. |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef _PM_API_SYS_H_ |
| 8 | #define _PM_API_SYS_H_ |
| 9 | |
| 10 | #include <stdint.h> |
| 11 | #include "pm_defs.h" |
| 12 | |
Rajan Vaja | 3511613 | 2018-01-17 02:39:25 -0800 | [diff] [blame] | 13 | enum pm_query_id { |
| 14 | PM_QID_INVALID, |
| 15 | PM_QID_CLOCK_GET_NAME, |
| 16 | PM_QID_CLOCK_GET_TOPOLOGY, |
| 17 | PM_QID_CLOCK_GET_FIXEDFACTOR_PARAMS, |
| 18 | PM_QID_CLOCK_GET_PARENTS, |
| 19 | PM_QID_CLOCK_GET_ATTRIBUTES, |
Rajan Vaja | d5dd836 | 2018-01-30 04:16:31 -0800 | [diff] [blame] | 20 | PM_QID_PINCTRL_GET_NUM_PINS, |
| 21 | PM_QID_PINCTRL_GET_NUM_FUNCTIONS, |
| 22 | PM_QID_PINCTRL_GET_NUM_FUNCTION_GROUPS, |
| 23 | PM_QID_PINCTRL_GET_FUNCTION_NAME, |
| 24 | PM_QID_PINCTRL_GET_FUNCTION_GROUPS, |
| 25 | PM_QID_PINCTRL_GET_PIN_GROUPS, |
Rajan Vaja | 3511613 | 2018-01-17 02:39:25 -0800 | [diff] [blame] | 26 | }; |
| 27 | |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 28 | /********************************************************** |
| 29 | * System-level API function declarations |
| 30 | **********************************************************/ |
| 31 | enum pm_ret_status pm_req_suspend(enum pm_node_id nid, |
| 32 | enum pm_request_ack ack, |
| 33 | unsigned int latency, |
| 34 | unsigned int state); |
| 35 | |
| 36 | enum pm_ret_status pm_self_suspend(enum pm_node_id nid, |
| 37 | unsigned int latency, |
| 38 | unsigned int state, |
| 39 | uintptr_t address); |
| 40 | |
| 41 | enum pm_ret_status pm_force_powerdown(enum pm_node_id nid, |
| 42 | enum pm_request_ack ack); |
| 43 | |
| 44 | enum pm_ret_status pm_abort_suspend(enum pm_abort_reason reason); |
| 45 | |
| 46 | enum pm_ret_status pm_req_wakeup(enum pm_node_id nid, |
| 47 | unsigned int set_address, |
| 48 | uintptr_t address, |
| 49 | enum pm_request_ack ack); |
| 50 | |
| 51 | enum pm_ret_status pm_set_wakeup_source(enum pm_node_id target, |
| 52 | enum pm_node_id wkup_node, |
| 53 | unsigned int enable); |
| 54 | |
Soren Brinkmann | 58fbb9b | 2016-09-02 09:50:54 -0700 | [diff] [blame] | 55 | enum pm_ret_status pm_system_shutdown(unsigned int type, unsigned int subtype); |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 56 | |
| 57 | enum pm_ret_status pm_init_suspend_cb(enum pm_suspend_reason reason, |
| 58 | unsigned int latency, |
| 59 | unsigned int state, |
| 60 | unsigned int timeout); |
| 61 | |
| 62 | /* API functions for managing PM Slaves */ |
| 63 | enum pm_ret_status pm_req_node(enum pm_node_id nid, |
| 64 | unsigned int capabilities, |
| 65 | unsigned int qos, |
| 66 | enum pm_request_ack ack); |
| 67 | enum pm_ret_status pm_release_node(enum pm_node_id nid); |
| 68 | |
| 69 | enum pm_ret_status pm_set_requirement(enum pm_node_id nid, |
| 70 | unsigned int capabilities, |
| 71 | unsigned int qos, |
| 72 | enum pm_request_ack ack); |
| 73 | enum pm_ret_status pm_set_max_latency(enum pm_node_id nid, |
| 74 | unsigned int latency); |
| 75 | |
| 76 | /* Miscellaneous API functions */ |
| 77 | enum pm_ret_status pm_get_api_version(unsigned int *version); |
| 78 | enum pm_ret_status pm_set_configuration(unsigned int phys_addr); |
| 79 | enum pm_ret_status pm_get_node_status(enum pm_node_id node); |
| 80 | enum pm_ret_status pm_register_notifier(enum pm_node_id nid, |
| 81 | unsigned int event, |
| 82 | unsigned int wake, |
| 83 | unsigned int enable); |
| 84 | enum pm_ret_status pm_get_op_characteristic(enum pm_node_id nid, |
Anes Hadziahmetagic | 92aee01 | 2016-05-12 16:17:30 +0200 | [diff] [blame] | 85 | enum pm_opchar_type type, |
| 86 | uint32_t *result); |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 87 | enum pm_ret_status pm_acknowledge_cb(enum pm_node_id nid, |
| 88 | enum pm_ret_status status, |
| 89 | unsigned int oppoint); |
| 90 | enum pm_ret_status pm_notify_cb(enum pm_node_id nid, |
| 91 | unsigned int event, |
| 92 | unsigned int oppoint); |
| 93 | |
| 94 | /* Direct-Control API functions */ |
| 95 | enum pm_ret_status pm_reset_assert(unsigned int reset_id, |
| 96 | unsigned int assert); |
| 97 | enum pm_ret_status pm_reset_get_status(unsigned int reset_id, |
| 98 | unsigned int *reset_status); |
| 99 | enum pm_ret_status pm_mmio_write(uintptr_t address, |
| 100 | unsigned int mask, |
| 101 | unsigned int value); |
| 102 | enum pm_ret_status pm_mmio_read(uintptr_t address, unsigned int *value); |
Soren Brinkmann | 881788d | 2017-09-18 09:13:17 -0700 | [diff] [blame] | 103 | enum pm_ret_status pm_fpga_load(uint32_t address_low, |
| 104 | uint32_t address_high, |
Nava kishore Manne | 68d460c | 2016-08-20 23:18:09 +0530 | [diff] [blame] | 105 | uint32_t size, |
| 106 | uint32_t flags); |
| 107 | enum pm_ret_status pm_fpga_get_status(unsigned int *value); |
| 108 | |
Soren Brinkmann | cb36681 | 2016-09-22 12:21:11 -0700 | [diff] [blame] | 109 | enum pm_ret_status pm_get_chipid(uint32_t *value); |
Soren Brinkmann | 84f0af4 | 2016-09-30 14:24:25 -0700 | [diff] [blame] | 110 | void pm_get_callbackdata(uint32_t *data, size_t count); |
Rajan Vaja | 8368761 | 2018-01-17 02:39:20 -0800 | [diff] [blame] | 111 | enum pm_ret_status pm_pinctrl_request(unsigned int pin); |
| 112 | enum pm_ret_status pm_pinctrl_release(unsigned int pin); |
| 113 | enum pm_ret_status pm_pinctrl_get_function(unsigned int pin, |
Jolly Shah | 69fb5bf | 2018-02-07 16:25:41 -0800 | [diff] [blame] | 114 | enum pm_node_id *nid); |
Rajan Vaja | 8368761 | 2018-01-17 02:39:20 -0800 | [diff] [blame] | 115 | enum pm_ret_status pm_pinctrl_set_function(unsigned int pin, |
Jolly Shah | 69fb5bf | 2018-02-07 16:25:41 -0800 | [diff] [blame] | 116 | enum pm_node_id nid); |
Rajan Vaja | 8368761 | 2018-01-17 02:39:20 -0800 | [diff] [blame] | 117 | enum pm_ret_status pm_pinctrl_get_config(unsigned int pin, |
| 118 | unsigned int param, |
| 119 | unsigned int *value); |
| 120 | enum pm_ret_status pm_pinctrl_set_config(unsigned int pin, |
| 121 | unsigned int param, |
| 122 | unsigned int value); |
Rajan Vaja | 5529a01 | 2018-01-17 02:39:23 -0800 | [diff] [blame] | 123 | enum pm_ret_status pm_ioctl(enum pm_node_id nid, |
| 124 | unsigned int ioctl_id, |
| 125 | unsigned int arg1, |
| 126 | unsigned int arg2, |
| 127 | unsigned int *value); |
Rajan Vaja | 3511613 | 2018-01-17 02:39:25 -0800 | [diff] [blame] | 128 | enum pm_ret_status pm_clock_enable(unsigned int clock_id); |
| 129 | enum pm_ret_status pm_clock_disable(unsigned int clock_id); |
| 130 | enum pm_ret_status pm_clock_getstate(unsigned int clock_id, |
| 131 | unsigned int *state); |
| 132 | enum pm_ret_status pm_clock_setdivider(unsigned int clock_id, |
| 133 | unsigned int divider); |
| 134 | enum pm_ret_status pm_clock_getdivider(unsigned int clock_id, |
| 135 | unsigned int *divider); |
| 136 | enum pm_ret_status pm_clock_setrate(unsigned int clock_id, |
| 137 | uint64_t rate); |
| 138 | enum pm_ret_status pm_clock_getrate(unsigned int clock_id, |
| 139 | uint64_t *rate); |
| 140 | enum pm_ret_status pm_clock_setparent(unsigned int clock_id, |
| 141 | unsigned int parent_id); |
| 142 | enum pm_ret_status pm_clock_getparent(unsigned int clock_id, |
| 143 | unsigned int *parent_id); |
| 144 | enum pm_ret_status pm_query_data(enum pm_query_id qid, |
| 145 | unsigned int arg1, |
| 146 | unsigned int arg2, |
| 147 | unsigned int arg3, |
| 148 | unsigned int *data); |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 149 | #endif /* _PM_API_SYS_H_ */ |