Advertisement
Guest User

Untitled

a guest
Jul 21st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.21 KB | None | 0 0
  1. /* Create display state boolean */
  2.     const bool display_on = is_display_on();
  3.     s64 delta_ns;
  4.  
  5.     delta_ns = time - sg_policy->last_freq_update_time;
  6.  
  7.     if (!display_on) {
  8.         if (sg_policy->up_rate_delay_ns != sg_policy->up_rate_delay_prev_ns)
  9.             sg_policy->up_rate_delay_ns = sg_policy->up_rate_delay_prev_ns;
  10.         if (sg_policy->down_rate_delay_ns != sg_policy->down_rate_delay_prev_ns)
  11.             sg_policy->down_rate_delay_ns = sg_policy->down_rate_delay_prev_ns;
  12.     } else if (display_on) {
  13.         if (sg_policy->up_rate_delay_ns != DEFAULT_RATE_LIMIT_SUSP_NS) {
  14.             sg_policy->up_rate_delay_prev_ns = sg_policy->up_rate_delay_ns;
  15.             sg_policy->up_rate_delay_ns
  16.                 = max(sg_policy->up_rate_delay_ns,
  17.                     DEFAULT_RATE_LIMIT_SUSP_NS);
  18.         }
  19.         if (sg_policy->down_rate_delay_ns != DEFAULT_RATE_LIMIT_SUSP_NS) {
  20.             sg_policy->down_rate_delay_prev_ns = sg_policy->down_rate_delay_ns;
  21.             sg_policy->down_rate_delay_ns
  22.                 = max(sg_policy->down_rate_delay_ns,
  23.                     DEFAULT_RATE_LIMIT_SUSP_NS);
  24.         }
  25.     }
  26.  
  27.     if (next_freq > sg_policy->next_freq &&
  28.         delta_ns < sg_policy->up_rate_delay_ns)
  29.             return true;
  30.  
  31.     if (next_freq < sg_policy->next_freq &&
  32.         delta_ns < sg_policy->down_rate_delay_ns)
  33.             return true;
  34.  
  35.     return false;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement