HAP_dcvs APIs
DSP Power & Performance Management
DCVS Helper APIs

DCVS Duty Cycle Helper APIs with usage examples.

DCVS Duty Cycle Helper APIs

Header file: HAP_dcvs.h

Usage examples

HAP_set_dcvs_v3_duty_cycle

This is the most straightforward and therefore the recommended simplified API to enable DCVS Duty Cycle.

User has to pass the context (power client identifier to be used in a HAP_power_set call) to this API. The function calls into HAP_power_set API with the provided context and selects DCVS duty cycle mode via HAP_power_set_DCVS_v3 request type. User optionally can provide max_active_time and periodicity. The DCVS algorithm selects appropriate operating levels to keep the activity time within the provided maximum allowed time and uses periodicity as a hint while predicting activity.

User does not need to specify any clock corners, the DCVS algorithm will select appropriate clock corners based on performance power tradeoff and max_active_time, periodicity if provided by user.

Below example shows usage of HAP_set_dcvs_v3_duty_cycle API.

/*
* Enabling DCVS Duty Cycle with 10ms max_active_time and 33ms periodicity
*/
HAP_set_dcvs_v3_duty_cycle(context, 10, 33);

Here DCVS Duty cycle starts with NOM as active corner and LOW SVS (SVS2) corner for idle cycle. After observing active time more than user defined max active time (10ms), the DCVS algorithm increases the clock to next level NOM PLUS to attain active time <=10ms.

screenshot

HAP_set_dcvs_v3_duty_cycle_params

This API is useful in setting the max_active_time and periodicity in an existing DCVS request structure.

User can set the DCVS params as per application requirement in DCVS request structure with request type set to HAP_power_set_DCVS_v3 and pass it as an argument to this function.

This API sets the user given max_active_time and periodicity in the given request structure. After invoking this function, user will have to call HAP_power_set() using the same request structure.

HAP_power_request_t request;
request.type = HAP_power_set_DCVS_v3;
/*
* Selecting Duty Cycle mode with DCVS enabled
*/
request.dcvs_v3.set_dcvs_enable = TRUE;
request.dcvs_v3.dcvs_enable = TRUE;
request.dcvs_v3.dcvs_option = HAP_DCVS_V2_DUTY_CYCLE_MODE;
/*
* Setting TURBO PLUS as Max corner, NOM PLUS as Target corner
* and LOW SVS as Min corner
*/
request.dcvs_v3.set_core_params = TRUE;
request.dcvs_v3.core_params.min_corner = HAP_DCVS_VCORNER_SVS2;
request.dcvs_v3.core_params.max_corner = HAP_DCVS_VCORNER_TURBO_PLUS;
request.dcvs_v3.core_params.target_corner = HAP_DCVS_VCORNER_NOM_PLUS;
request.dcvs_v3.set_bus_params = TRUE;
request.dcvs_v3.bus_params.min_corner = HAP_DCVS_VCORNER_SVS2;
request.dcvs_v3.bus_params.max_corner = HAP_DCVS_VCORNER_TURBO_PLUS;
request.dcvs_v3.bus_params.target_corner = HAP_DCVS_VCORNER_NOM_PLUS;
/*
* Setting 20ms max_active_time and 33ms periodicity
*/
HAP_set_dcvs_v3_duty_cycle_params(&request, 20, 33);
HAP_power_set(context, &request);

Here DCVS duty cycle apply LOW SVS (SVS2) for idle cycle and active cycle corner in the range of Max to Target (TURBO PLUS to NOM PLUS) to maintain the user given max_active_time (20ms).

screenshot

HAP_set_dcvs_v3_core_perf_mode

This API helps to select core clock frequency level within target voltage corner.

By default, the highest core clock frequency available at the requested target corner is selected. Using this API, user can select either the highest (HAP_DCVS_CLK_PERF_HIGH) or the lowest (HAP_DCVS_CLK_PERF_LOW) core clock frequency at any given target corner. If there is only one core clock frequency available at the requested target corner, both the high and low settings will select the same.

User can set the DCVS params as per application requirement in DCVS request structure with request type set to HAP_power_set_DCVS_v3 and pass the same as an arguement to this function along with perf_mode arguement which specifies the core clock frequency level (HAP_DCVS_CLK_PERF_HIGH/HAP_DCVS_CLK_PERF_LOW).

This API sets the user provided perf_mode for core clock in the given request structure. After invoking this function, user will have to call HAP_power_set() using the same request structure.

HAP_power_request_t request;
request.type = HAP_power_set_DCVS_v3;
/*
* Setting TURBO as Max corner, NOM as Target corner
* and LOW SVS as Min corner for core clock
*/
request.dcvs_v3.set_core_params = TRUE;
request.dcvs_v3.core_params.min_corner = HAP_DCVS_VCORNER_SVS2;
request.dcvs_v3.core_params.max_corner = HAP_DCVS_VCORNER_TURBO;
request.dcvs_v3.core_params.target_corner = HAP_DCVS_VCORNER_NOM;
/*
* Setting perf_mode as HAP_DCVS_CLK_PERF_LOW
*/
HAP_set_dcvs_v3_core_perf_mode(&request, HAP_DCVS_CLK_PERF_LOW);
HAP_power_set(context, &request);

Here DCVS will vote for minimum available core clock frequency at NOM target corner.

HAP_set_dcvs_v3_bus_perf_mode

This API helps to select bus clock frequency level within target voltage corner.

By default, the highest bus clock frequency available at the requested target corner is selected. Using this API, user can select either the highest (HAP_DCVS_CLK_PERF_HIGH) or the lowest (HAP_DCVS_CLK_PERF_LOW) bus clock frequency at any given target corner. If there is only one bus clock frequency available at the requested target corner, both the high and low settings will select the same.

User can set the DCVS params as per application requirement in DCVS request structure with request type set to HAP_power_set_DCVS_v3 and pass the same as an arguement to this function along with perf_mode arguement which specifies the bus clock frequency level (HAP_DCVS_CLK_PERF_HIGH/HAP_DCVS_CLK_PERF_LOW).

This API sets the user provided perf_mode for bus clock in the given request structure. After invoking this function, user will have to call HAP_power_set() using the same request structure.

HAP_power_request_t request;
request.type = HAP_power_set_DCVS_v3;
/*
* Setting TURBO PLUS as Max corner, TURBO as Target corner
* and LOW SVS as Min corner for bus clock
*/
request.dcvs_v3.set_bus_params = TRUE;
request.dcvs_v3.bus_params.min_corner = HAP_DCVS_VCORNER_SVS2;
request.dcvs_v3.bus_params.max_corner = HAP_DCVS_VCORNER_TURBO_PLUS;
request.dcvs_v3.bus_params.target_corner = HAP_DCVS_VCORNER_TURBO;
/*
* Setting perf_mode as HAP_DCVS_CLK_PERF_LOW
*/
HAP_set_dcvs_v3_bus_perf_mode(&request, HAP_DCVS_CLK_PERF_LOW);
HAP_power_set(context, &request);

Here DCVS will vote for minimum available bus clock frequency at TURBO target corner.