Lines Matching refs:state

45  * struct _thermal_state - Represent the current thermal event state
56 * in throttled state for a single thermal
57 * threshold high to low state.
59 * in the throttled state.
77 * This structure is used to represent data related to thermal state for a CPU.
301 struct _thermal_state *state = container_of(to_delayed_work(work),
308 get_therm_status(state->level, &hot, &temp);
310 if (!hot && temp > state->baseline_temp) {
311 if (state->rate_control_active)
314 state->level == CORE_LEVEL ? "Core" : "Package",
315 state->count);
317 state->rate_control_active = false;
321 if (time_before64(now, state->next_check) &&
322 state->rate_control_active)
325 state->next_check = now + CHECK_INTERVAL;
327 if (state->count != state->last_count) {
329 state->last_count = state->count;
330 state->average = 0;
331 state->sample_count = 0;
332 state->sample_index = 0;
335 state->temp_samples[state->sample_index] = temp;
336 state->sample_count++;
337 state->sample_index = (state->sample_index + 1) % ARRAY_SIZE(state->temp_samples);
338 if (state->sample_count < ARRAY_SIZE(state->temp_samples))
342 for (i = 0; i < ARRAY_SIZE(state->temp_samples); ++i)
343 avg += state->temp_samples[i];
345 avg /= ARRAY_SIZE(state->temp_samples);
347 if (state->average > avg) {
350 state->level == CORE_LEVEL ? "Core" : "Package",
351 state->count);
352 state->rate_control_active = true;
355 state->average = avg;
358 thermal_clear_package_intr_status(state->level, THERM_STATUS_PROCHOT_LOG);
359 schedule_delayed_work_on(this_cpu, &state->therm_work, THERM_THROT_POLL_INTERVAL);
375 struct _thermal_state *state;
384 state = &pstate->core_throttle;
386 state = &pstate->core_power_limit;
391 state = &pstate->package_throttle;
393 state = &pstate->package_power_limit;
399 old_event = state->new_event;
400 state->new_event = new_event;
403 state->count++;
408 if (new_event && !state->last_interrupt_time) {
412 get_therm_status(state->level, &hot, &temp);
421 state->baseline_temp = temp;
422 state->last_interrupt_time = now;
423 schedule_delayed_work_on(this_cpu, &state->therm_work, THERM_THROT_POLL_INTERVAL);
424 } else if (old_event && state->last_interrupt_time) {
427 throttle_time = jiffies_delta_to_msecs(now - state->last_interrupt_time);
428 if (throttle_time > state->max_time_ms)
429 state->max_time_ms = throttle_time;
430 state->total_time_ms += throttle_time;
431 state->last_interrupt_time = 0;
437 struct _thermal_state *state;
443 state = (event == 0) ? &pstate->pkg_thresh0 :
446 state = (event == 0) ? &pstate->core_thresh0 :
449 if (time_before64(now, state->next_check))
452 state->next_check = now + CHECK_INTERVAL;
529 struct thermal_state *state = &per_cpu(thermal_state, cpu);
533 state->package_throttle.level = PACKAGE_LEVEL;
534 state->core_throttle.level = CORE_LEVEL;
536 INIT_DELAYED_WORK(&state->package_throttle.therm_work, throttle_active_work);
537 INIT_DELAYED_WORK(&state->core_throttle.therm_work, throttle_active_work);
555 struct thermal_state *state = &per_cpu(thermal_state, cpu);
565 cancel_delayed_work_sync(&state->package_throttle.therm_work);
566 cancel_delayed_work_sync(&state->core_throttle.therm_work);
568 state->package_throttle.rate_control_active = false;
569 state->core_throttle.rate_control_active = false;