diff options
author | Jonny Svärd <jonny.svaerd@arm.com> | 2022-04-26 18:31:24 +0200 |
---|---|---|
committer | Kristofer Jonsson <kristofer.jonsson@arm.com> | 2022-05-05 12:56:33 +0000 |
commit | 301399d9e0b619fb2e229c9a9223aaf31ec6bcfa (patch) | |
tree | 5dbbfa41d5186add0e28b6d6b3e07b2267856c4f /include/ethosu_driver.h | |
parent | c6505f3f8df8a5f00197f0eee5cc502e4e59c6a4 (diff) | |
download | ethos-u-core-driver-301399d9e0b619fb2e229c9a9223aaf31ec6bcfa.tar.gz |
Refactor power handling22.05-rc1
Add reference counted ethosu_request_power(),
ethosu_release_power() functions. While there are
active requests, disable the Q-channel power gating
of the Ethos-U device, leaving the device powered on.
Note that clock gating is implemented to follow the
state of the power gating.
Add ethosu_soft_reset() function. Restore power-
and clock gating state after reset.
Refactor and simplify driver code to use the new
functions.
Change-Id: I9756572c5c3e51b2be244bcea856d88e890e2d40
Diffstat (limited to 'include/ethosu_driver.h')
-rw-r--r-- | include/ethosu_driver.h | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/include/ethosu_driver.h b/include/ethosu_driver.h index 053b529..c48a3f2 100644 --- a/include/ethosu_driver.h +++ b/include/ethosu_driver.h @@ -74,11 +74,9 @@ struct ethosu_driver void *semaphore; uint64_t fast_memory; size_t fast_memory_size; + uint32_t power_request_counter; bool status_error; - bool dev_power_always_on; bool reserved; - uint8_t clock_request; - uint8_t power_request; }; struct ethosu_driver_version @@ -158,6 +156,24 @@ int ethosu_init(struct ethosu_driver *drv, void ethosu_deinit(struct ethosu_driver *drv); /** + * Soft resets the Ethos-U device. + */ +bool ethosu_soft_reset(struct ethosu_driver *drv); + +/** + * Request to disable Q-channel power gating of the Ethos-U device. + * Power requests are ref.counted. Increases count. + * (Note: clock gating is made to follow power gating) + */ +bool ethosu_request_power(struct ethosu_driver *drv); + +/** + * Release disable request for Q-channel power gating of the Ethos-U device. + * Power requests are ref.counted. Decreases count. + */ +void ethosu_release_power(struct ethosu_driver *drv); + +/** * Get Ethos-U driver version. */ void ethosu_get_driver_version(struct ethosu_driver_version *ver); @@ -209,11 +225,6 @@ int ethosu_invoke_async(struct ethosu_driver *drv, int ethosu_wait(struct ethosu_driver *drv, bool block); /** - * Set Ethos-U power mode. - */ -void ethosu_set_power_mode(struct ethosu_driver *drv, bool always_on); - -/** * Reserves a driver to execute inference with */ struct ethosu_driver *ethosu_reserve_driver(void); @@ -224,14 +235,6 @@ struct ethosu_driver *ethosu_reserve_driver(void); void ethosu_release_driver(struct ethosu_driver *drv); /** - * Set clock and power request bits - */ -enum ethosu_error_codes set_clock_and_power_request(struct ethosu_driver *drv, - enum ethosu_request_clients client, - enum ethosu_clock_q_request clock_request, - enum ethosu_power_q_request power_request); - -/** * Static inline for backwards-compatibility */ static inline int ethosu_invoke_v2(const void *custom_data_ptr, |