/** * * @brief scheduler_lpr_init * * Init function for the Scheduler LPR. * * Initialize the Scheduler LPR and then enables itself. * */ void npa_scheduler_lpr_init( void ) { if (npa_sleep_lpr_supported) { /* feature has not been turned off */ CORE_VERIFY_PTR( npa_scheduler.sleep.lpr_client = npa_create_sync_client( NPA_SCHEDULER_SLEEP_LPR_RESOURCE_NAME, "/npa/scheduler/lpr", NPA_CLIENT_REQUIRED ) ); /* register with sleep */ sleep_define_lpr_str("npa_scheduler", npa_scheduler.sleep.lpr_client); /* create CPU Wakeup Client for getting info to determine soft wakeup time */ CORE_VERIFY_PTR( npa_scheduler.sleep.cpu_wakeup_query_handle = npa_create_query_handle( NPA_SCHEDULER_SLEEP_CORE_CPU_WAKEUP_RESOURCE_NAME ) ); /* Set up a callback to create a query handle if Sleep's max_duration resource is available */ npa_resource_available_cb( NPA_SCHEDULER_SLEEP_MAX_DURATION_RESOURCE_NAME, npa_scheduler_max_duration_available_callback, NULL ); } }
static void npa_res_available_cb(void *u_data, unsigned t, void *d, unsigned n) { struct npa_client_info *client_info = (struct npa_client_info *)u_data; struct npa_client *npa_client; /* Create NPA 'required' client. */ npa_client = npa_create_sync_client(client_info->resource_name, client_info->request_name, NPA_CLIENT_REQUIRED); if (IS_ERR(npa_client)) { pr_crit("npa_pm_qos: Failed to create NPA client '%s' " "for resource '%s'. (Error %ld)\n", client_info->request_name, client_info->resource_name, PTR_ERR(npa_client)); BUG(); } *(client_info->npa_client) = npa_client; /* Issue default resource requirement. */ npa_issue_required_request(npa_client, client_info->value); kfree(client_info); return; }