Lines Matching refs:ii_dev
102 static void idle_inject_wakeup(struct idle_inject_device *ii_dev) in idle_inject_wakeup() argument
107 for_each_cpu_and(cpu, to_cpumask(ii_dev->cpumask), cpu_online_mask) { in idle_inject_wakeup()
127 struct idle_inject_device *ii_dev = in idle_inject_timer_fn() local
130 if (!ii_dev->update || (ii_dev->update && ii_dev->update())) in idle_inject_timer_fn()
131 idle_inject_wakeup(ii_dev); in idle_inject_timer_fn()
133 duration_us = READ_ONCE(ii_dev->run_duration_us); in idle_inject_timer_fn()
134 duration_us += READ_ONCE(ii_dev->idle_duration_us); in idle_inject_timer_fn()
150 struct idle_inject_device *ii_dev; in idle_inject_fn() local
153 ii_dev = per_cpu(idle_inject_device, cpu); in idle_inject_fn()
161 play_idle_precise(READ_ONCE(ii_dev->idle_duration_us) * NSEC_PER_USEC, in idle_inject_fn()
162 READ_ONCE(ii_dev->latency_us) * NSEC_PER_USEC); in idle_inject_fn()
171 void idle_inject_set_duration(struct idle_inject_device *ii_dev, in idle_inject_set_duration() argument
176 WRITE_ONCE(ii_dev->run_duration_us, run_duration_us); in idle_inject_set_duration()
177 WRITE_ONCE(ii_dev->idle_duration_us, idle_duration_us); in idle_inject_set_duration()
190 void idle_inject_get_duration(struct idle_inject_device *ii_dev, in idle_inject_get_duration() argument
194 *run_duration_us = READ_ONCE(ii_dev->run_duration_us); in idle_inject_get_duration()
195 *idle_duration_us = READ_ONCE(ii_dev->idle_duration_us); in idle_inject_get_duration()
204 void idle_inject_set_latency(struct idle_inject_device *ii_dev, in idle_inject_set_latency() argument
207 WRITE_ONCE(ii_dev->latency_us, latency_us); in idle_inject_set_latency()
221 int idle_inject_start(struct idle_inject_device *ii_dev) in idle_inject_start() argument
223 unsigned int idle_duration_us = READ_ONCE(ii_dev->idle_duration_us); in idle_inject_start()
224 unsigned int run_duration_us = READ_ONCE(ii_dev->run_duration_us); in idle_inject_start()
230 cpumask_pr_args(to_cpumask(ii_dev->cpumask))); in idle_inject_start()
232 idle_inject_wakeup(ii_dev); in idle_inject_start()
234 hrtimer_start(&ii_dev->timer, in idle_inject_start()
254 void idle_inject_stop(struct idle_inject_device *ii_dev) in idle_inject_stop() argument
260 cpumask_pr_args(to_cpumask(ii_dev->cpumask))); in idle_inject_stop()
262 hrtimer_cancel(&ii_dev->timer); in idle_inject_stop()
279 for_each_cpu(cpu, to_cpumask(ii_dev->cpumask)) { in idle_inject_stop()
334 struct idle_inject_device *ii_dev; in idle_inject_register_full() local
337 ii_dev = kzalloc(sizeof(*ii_dev) + cpumask_size(), GFP_KERNEL); in idle_inject_register_full()
338 if (!ii_dev) in idle_inject_register_full()
341 cpumask_copy(to_cpumask(ii_dev->cpumask), cpumask); in idle_inject_register_full()
342 hrtimer_init(&ii_dev->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in idle_inject_register_full()
343 ii_dev->timer.function = idle_inject_timer_fn; in idle_inject_register_full()
344 ii_dev->latency_us = UINT_MAX; in idle_inject_register_full()
345 ii_dev->update = update; in idle_inject_register_full()
347 for_each_cpu(cpu, to_cpumask(ii_dev->cpumask)) { in idle_inject_register_full()
354 per_cpu(idle_inject_device, cpu) = ii_dev; in idle_inject_register_full()
357 return ii_dev; in idle_inject_register_full()
360 for_each_cpu(cpu_rb, to_cpumask(ii_dev->cpumask)) { in idle_inject_register_full()
366 kfree(ii_dev); in idle_inject_register_full()
397 void idle_inject_unregister(struct idle_inject_device *ii_dev) in idle_inject_unregister() argument
401 idle_inject_stop(ii_dev); in idle_inject_unregister()
403 for_each_cpu(cpu, to_cpumask(ii_dev->cpumask)) in idle_inject_unregister()
406 kfree(ii_dev); in idle_inject_unregister()