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()
194 pfdevfreq->fast_rate = freq; in panfrost_devfreq_init()
202 pfdevfreq->gov_data.upthreshold = 45; in panfrost_devfreq_init()
203 pfdevfreq->gov_data.downdifferential = 5; in panfrost_devfreq_init()
207 &pfdevfreq->gov_data); in panfrost_devfreq_init()
212 pfdevfreq->devfreq = devfreq; in panfrost_devfreq_init()
218 pfdevfreq->cooling = cooling; in panfrost_devfreq_init()
225 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_fini() local
227 if (pfdevfreq->cooling) { in panfrost_devfreq_fini()
228 devfreq_cooling_unregister(pfdevfreq->cooling); in panfrost_devfreq_fini()
229 pfdevfreq->cooling = NULL; in panfrost_devfreq_fini()
235 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_resume() local
237 if (!pfdevfreq->devfreq) in panfrost_devfreq_resume()
240 panfrost_devfreq_reset(pfdevfreq); in panfrost_devfreq_resume()
242 devfreq_resume_device(pfdevfreq->devfreq); in panfrost_devfreq_resume()
247 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_suspend() local
249 if (!pfdevfreq->devfreq) in panfrost_devfreq_suspend()
252 devfreq_suspend_device(pfdevfreq->devfreq); in panfrost_devfreq_suspend()
255 void panfrost_devfreq_record_busy(struct panfrost_devfreq *pfdevfreq) in panfrost_devfreq_record_busy() argument
259 if (!pfdevfreq->devfreq) in panfrost_devfreq_record_busy()
262 spin_lock_irqsave(&pfdevfreq->lock, irqflags); in panfrost_devfreq_record_busy()
264 panfrost_devfreq_update_utilization(pfdevfreq); in panfrost_devfreq_record_busy()
266 pfdevfreq->busy_count++; in panfrost_devfreq_record_busy()
268 spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); in panfrost_devfreq_record_busy()
271 void panfrost_devfreq_record_idle(struct panfrost_devfreq *pfdevfreq) in panfrost_devfreq_record_idle() argument
275 if (!pfdevfreq->devfreq) in panfrost_devfreq_record_idle()
278 spin_lock_irqsave(&pfdevfreq->lock, irqflags); in panfrost_devfreq_record_idle()
280 panfrost_devfreq_update_utilization(pfdevfreq); in panfrost_devfreq_record_idle()
282 WARN_ON(--pfdevfreq->busy_count < 0); in panfrost_devfreq_record_idle()
284 spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); in panfrost_devfreq_record_idle()