Lines Matching refs:pfdevfreq

14 static void panfrost_devfreq_update_utilization(struct panfrost_devfreq *pfdevfreq)  in panfrost_devfreq_update_utilization()  argument
19 last = pfdevfreq->time_last_update; in panfrost_devfreq_update_utilization()
21 if (pfdevfreq->busy_count > 0) in panfrost_devfreq_update_utilization()
22 pfdevfreq->busy_time += ktime_sub(now, last); in panfrost_devfreq_update_utilization()
24 pfdevfreq->idle_time += ktime_sub(now, last); in panfrost_devfreq_update_utilization()
26 pfdevfreq->time_last_update = now; in panfrost_devfreq_update_utilization()
43 ptdev->pfdevfreq.current_frequency = *freq; in panfrost_devfreq_target()
48 static void panfrost_devfreq_reset(struct panfrost_devfreq *pfdevfreq) in panfrost_devfreq_reset() argument
50 pfdevfreq->busy_time = 0; in panfrost_devfreq_reset()
51 pfdevfreq->idle_time = 0; in panfrost_devfreq_reset()
52 pfdevfreq->time_last_update = ktime_get(); in panfrost_devfreq_reset()
59 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_get_dev_status() local
64 spin_lock_irqsave(&pfdevfreq->lock, irqflags); in panfrost_devfreq_get_dev_status()
66 panfrost_devfreq_update_utilization(pfdevfreq); in panfrost_devfreq_get_dev_status()
68 status->total_time = ktime_to_ns(ktime_add(pfdevfreq->busy_time, in panfrost_devfreq_get_dev_status()
69 pfdevfreq->idle_time)); in panfrost_devfreq_get_dev_status()
71 status->busy_time = ktime_to_ns(pfdevfreq->busy_time); in panfrost_devfreq_get_dev_status()
73 panfrost_devfreq_reset(pfdevfreq); in panfrost_devfreq_get_dev_status()
75 spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); in panfrost_devfreq_get_dev_status()
125 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_init() local
158 pfdevfreq->opp_of_table_added = true; in panfrost_devfreq_init()
160 spin_lock_init(&pfdevfreq->lock); in panfrost_devfreq_init()
162 panfrost_devfreq_reset(pfdevfreq); in panfrost_devfreq_init()
178 pfdevfreq->current_frequency = cur_freq; in panfrost_devfreq_init()
195 pfdevfreq->fast_rate = freq; in panfrost_devfreq_init()
203 pfdevfreq->gov_data.upthreshold = 45; in panfrost_devfreq_init()
204 pfdevfreq->gov_data.downdifferential = 5; in panfrost_devfreq_init()
208 &pfdevfreq->gov_data); in panfrost_devfreq_init()
213 pfdevfreq->devfreq = devfreq; in panfrost_devfreq_init()
219 pfdevfreq->cooling = cooling; in panfrost_devfreq_init()
226 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_fini() local
228 if (pfdevfreq->cooling) { in panfrost_devfreq_fini()
229 devfreq_cooling_unregister(pfdevfreq->cooling); in panfrost_devfreq_fini()
230 pfdevfreq->cooling = NULL; in panfrost_devfreq_fini()
236 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_resume() local
238 if (!pfdevfreq->devfreq) in panfrost_devfreq_resume()
241 panfrost_devfreq_reset(pfdevfreq); in panfrost_devfreq_resume()
243 devfreq_resume_device(pfdevfreq->devfreq); in panfrost_devfreq_resume()
248 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_suspend() local
250 if (!pfdevfreq->devfreq) in panfrost_devfreq_suspend()
253 devfreq_suspend_device(pfdevfreq->devfreq); in panfrost_devfreq_suspend()
256 void panfrost_devfreq_record_busy(struct panfrost_devfreq *pfdevfreq) in panfrost_devfreq_record_busy() argument
260 if (!pfdevfreq->devfreq) in panfrost_devfreq_record_busy()
263 spin_lock_irqsave(&pfdevfreq->lock, irqflags); in panfrost_devfreq_record_busy()
265 panfrost_devfreq_update_utilization(pfdevfreq); in panfrost_devfreq_record_busy()
267 pfdevfreq->busy_count++; in panfrost_devfreq_record_busy()
269 spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); in panfrost_devfreq_record_busy()
272 void panfrost_devfreq_record_idle(struct panfrost_devfreq *pfdevfreq) in panfrost_devfreq_record_idle() argument
276 if (!pfdevfreq->devfreq) in panfrost_devfreq_record_idle()
279 spin_lock_irqsave(&pfdevfreq->lock, irqflags); in panfrost_devfreq_record_idle()
281 panfrost_devfreq_update_utilization(pfdevfreq); in panfrost_devfreq_record_idle()
283 WARN_ON(--pfdevfreq->busy_count < 0); in panfrost_devfreq_record_idle()
285 spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); in panfrost_devfreq_record_idle()