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()
42 static void panfrost_devfreq_reset(struct panfrost_devfreq *pfdevfreq) in panfrost_devfreq_reset() argument
44 pfdevfreq->busy_time = 0; in panfrost_devfreq_reset()
45 pfdevfreq->idle_time = 0; in panfrost_devfreq_reset()
46 pfdevfreq->time_last_update = ktime_get(); in panfrost_devfreq_reset()
53 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_get_dev_status() local
58 spin_lock_irqsave(&pfdevfreq->lock, irqflags); in panfrost_devfreq_get_dev_status()
60 panfrost_devfreq_update_utilization(pfdevfreq); in panfrost_devfreq_get_dev_status()
62 status->total_time = ktime_to_ns(ktime_add(pfdevfreq->busy_time, in panfrost_devfreq_get_dev_status()
63 pfdevfreq->idle_time)); in panfrost_devfreq_get_dev_status()
65 status->busy_time = ktime_to_ns(pfdevfreq->busy_time); in panfrost_devfreq_get_dev_status()
67 panfrost_devfreq_reset(pfdevfreq); in panfrost_devfreq_get_dev_status()
69 spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); in panfrost_devfreq_get_dev_status()
119 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_init() local
151 pfdevfreq->opp_of_table_added = true; in panfrost_devfreq_init()
153 spin_lock_init(&pfdevfreq->lock); in panfrost_devfreq_init()
155 panfrost_devfreq_reset(pfdevfreq); in panfrost_devfreq_init()
181 pfdevfreq->gov_data.upthreshold = 45; in panfrost_devfreq_init()
182 pfdevfreq->gov_data.downdifferential = 5; in panfrost_devfreq_init()
186 &pfdevfreq->gov_data); in panfrost_devfreq_init()
191 pfdevfreq->devfreq = devfreq; in panfrost_devfreq_init()
197 pfdevfreq->cooling = cooling; in panfrost_devfreq_init()
204 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_fini() local
206 if (pfdevfreq->cooling) { in panfrost_devfreq_fini()
207 devfreq_cooling_unregister(pfdevfreq->cooling); in panfrost_devfreq_fini()
208 pfdevfreq->cooling = NULL; in panfrost_devfreq_fini()
214 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_resume() local
216 if (!pfdevfreq->devfreq) in panfrost_devfreq_resume()
219 panfrost_devfreq_reset(pfdevfreq); in panfrost_devfreq_resume()
221 devfreq_resume_device(pfdevfreq->devfreq); in panfrost_devfreq_resume()
226 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_suspend() local
228 if (!pfdevfreq->devfreq) in panfrost_devfreq_suspend()
231 devfreq_suspend_device(pfdevfreq->devfreq); in panfrost_devfreq_suspend()
234 void panfrost_devfreq_record_busy(struct panfrost_devfreq *pfdevfreq) in panfrost_devfreq_record_busy() argument
238 if (!pfdevfreq->devfreq) in panfrost_devfreq_record_busy()
241 spin_lock_irqsave(&pfdevfreq->lock, irqflags); in panfrost_devfreq_record_busy()
243 panfrost_devfreq_update_utilization(pfdevfreq); in panfrost_devfreq_record_busy()
245 pfdevfreq->busy_count++; in panfrost_devfreq_record_busy()
247 spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); in panfrost_devfreq_record_busy()
250 void panfrost_devfreq_record_idle(struct panfrost_devfreq *pfdevfreq) in panfrost_devfreq_record_idle() argument
254 if (!pfdevfreq->devfreq) in panfrost_devfreq_record_idle()
257 spin_lock_irqsave(&pfdevfreq->lock, irqflags); in panfrost_devfreq_record_idle()
259 panfrost_devfreq_update_utilization(pfdevfreq); in panfrost_devfreq_record_idle()
261 WARN_ON(--pfdevfreq->busy_count < 0); in panfrost_devfreq_record_idle()
263 spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); in panfrost_devfreq_record_idle()