Lines Matching refs:last_idx
71 int last_idx = dev->last_state_idx; in ladder_select_state() local
78 ladder_do_selection(dev, ldev, last_idx, 0); in ladder_select_state()
82 last_state = &ldev->states[last_idx]; in ladder_select_state()
84 last_residency = dev->last_residency_ns - drv->states[last_idx].exit_latency_ns; in ladder_select_state()
87 if (last_idx < drv->state_count - 1 && in ladder_select_state()
88 !dev->states_usage[last_idx + 1].disable && in ladder_select_state()
90 drv->states[last_idx + 1].exit_latency_ns <= latency_req) { in ladder_select_state()
94 ladder_do_selection(dev, ldev, last_idx, last_idx + 1); in ladder_select_state()
95 return last_idx + 1; in ladder_select_state()
100 if (last_idx > first_idx && in ladder_select_state()
101 (dev->states_usage[last_idx].disable || in ladder_select_state()
102 drv->states[last_idx].exit_latency_ns > latency_req)) { in ladder_select_state()
105 for (i = last_idx - 1; i > first_idx; i--) { in ladder_select_state()
109 ladder_do_selection(dev, ldev, last_idx, i); in ladder_select_state()
113 if (last_idx > first_idx && in ladder_select_state()
118 ladder_do_selection(dev, ldev, last_idx, last_idx - 1); in ladder_select_state()
119 return last_idx - 1; in ladder_select_state()
124 return last_idx; in ladder_select_state()