Lines Matching refs:pfdevfreq
16 static void panfrost_devfreq_update_utilization(struct panfrost_devfreq *pfdevfreq) in panfrost_devfreq_update_utilization() argument
21 last = pfdevfreq->time_last_update; in panfrost_devfreq_update_utilization()
23 if (pfdevfreq->busy_count > 0) in panfrost_devfreq_update_utilization()
24 pfdevfreq->busy_time += ktime_sub(now, last); in panfrost_devfreq_update_utilization()
26 pfdevfreq->idle_time += ktime_sub(now, last); in panfrost_devfreq_update_utilization()
28 pfdevfreq->time_last_update = now; in panfrost_devfreq_update_utilization()
45 pfdev->pfdevfreq.current_frequency = *freq; in panfrost_devfreq_target()
50 static void panfrost_devfreq_reset(struct panfrost_devfreq *pfdevfreq) in panfrost_devfreq_reset() argument
52 pfdevfreq->busy_time = 0; in panfrost_devfreq_reset()
53 pfdevfreq->idle_time = 0; in panfrost_devfreq_reset()
54 pfdevfreq->time_last_update = ktime_get(); in panfrost_devfreq_reset()
61 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_get_dev_status() local
66 spin_lock_irqsave(&pfdevfreq->lock, irqflags); in panfrost_devfreq_get_dev_status()
68 panfrost_devfreq_update_utilization(pfdevfreq); in panfrost_devfreq_get_dev_status()
70 status->total_time = ktime_to_ns(ktime_add(pfdevfreq->busy_time, in panfrost_devfreq_get_dev_status()
71 pfdevfreq->idle_time)); in panfrost_devfreq_get_dev_status()
73 status->busy_time = ktime_to_ns(pfdevfreq->busy_time); in panfrost_devfreq_get_dev_status()
75 panfrost_devfreq_reset(pfdevfreq); in panfrost_devfreq_get_dev_status()
77 spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); in panfrost_devfreq_get_dev_status()
127 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_init() local
160 pfdevfreq->opp_of_table_added = true; in panfrost_devfreq_init()
162 spin_lock_init(&pfdevfreq->lock); in panfrost_devfreq_init()
164 panfrost_devfreq_reset(pfdevfreq); in panfrost_devfreq_init()
180 pfdevfreq->current_frequency = cur_freq; in panfrost_devfreq_init()
197 pfdevfreq->fast_rate = freq; in panfrost_devfreq_init()
205 pfdevfreq->gov_data.upthreshold = 45; in panfrost_devfreq_init()
206 pfdevfreq->gov_data.downdifferential = 5; in panfrost_devfreq_init()
210 &pfdevfreq->gov_data); in panfrost_devfreq_init()
215 pfdevfreq->devfreq = devfreq; in panfrost_devfreq_init()
221 pfdevfreq->cooling = cooling; in panfrost_devfreq_init()
228 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_fini() local
230 if (pfdevfreq->cooling) { in panfrost_devfreq_fini()
231 devfreq_cooling_unregister(pfdevfreq->cooling); in panfrost_devfreq_fini()
232 pfdevfreq->cooling = NULL; in panfrost_devfreq_fini()
238 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_resume() local
240 if (!pfdevfreq->devfreq) in panfrost_devfreq_resume()
243 panfrost_devfreq_reset(pfdevfreq); in panfrost_devfreq_resume()
245 devfreq_resume_device(pfdevfreq->devfreq); in panfrost_devfreq_resume()
250 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_suspend() local
252 if (!pfdevfreq->devfreq) in panfrost_devfreq_suspend()
255 devfreq_suspend_device(pfdevfreq->devfreq); in panfrost_devfreq_suspend()
258 void panfrost_devfreq_record_busy(struct panfrost_devfreq *pfdevfreq) in panfrost_devfreq_record_busy() argument
262 if (!pfdevfreq->devfreq) in panfrost_devfreq_record_busy()
265 spin_lock_irqsave(&pfdevfreq->lock, irqflags); in panfrost_devfreq_record_busy()
267 panfrost_devfreq_update_utilization(pfdevfreq); in panfrost_devfreq_record_busy()
269 pfdevfreq->busy_count++; in panfrost_devfreq_record_busy()
271 spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); in panfrost_devfreq_record_busy()
274 void panfrost_devfreq_record_idle(struct panfrost_devfreq *pfdevfreq) in panfrost_devfreq_record_idle() argument
278 if (!pfdevfreq->devfreq) in panfrost_devfreq_record_idle()
281 spin_lock_irqsave(&pfdevfreq->lock, irqflags); in panfrost_devfreq_record_idle()
283 panfrost_devfreq_update_utilization(pfdevfreq); in panfrost_devfreq_record_idle()
285 WARN_ON(--pfdevfreq->busy_count < 0); in panfrost_devfreq_record_idle()
287 spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); in panfrost_devfreq_record_idle()