Lines Matching refs:pfdevfreq
13 static void panfrost_devfreq_update_utilization(struct panfrost_devfreq *pfdevfreq) in panfrost_devfreq_update_utilization() argument
18 last = pfdevfreq->time_last_update; in panfrost_devfreq_update_utilization()
20 if (pfdevfreq->busy_count > 0) in panfrost_devfreq_update_utilization()
21 pfdevfreq->busy_time += ktime_sub(now, last); in panfrost_devfreq_update_utilization()
23 pfdevfreq->idle_time += ktime_sub(now, last); in panfrost_devfreq_update_utilization()
25 pfdevfreq->time_last_update = now; in panfrost_devfreq_update_utilization()
41 static void panfrost_devfreq_reset(struct panfrost_devfreq *pfdevfreq) in panfrost_devfreq_reset() argument
43 pfdevfreq->busy_time = 0; in panfrost_devfreq_reset()
44 pfdevfreq->idle_time = 0; in panfrost_devfreq_reset()
45 pfdevfreq->time_last_update = ktime_get(); in panfrost_devfreq_reset()
52 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_get_dev_status() local
57 spin_lock_irqsave(&pfdevfreq->lock, irqflags); in panfrost_devfreq_get_dev_status()
59 panfrost_devfreq_update_utilization(pfdevfreq); in panfrost_devfreq_get_dev_status()
61 status->total_time = ktime_to_ns(ktime_add(pfdevfreq->busy_time, in panfrost_devfreq_get_dev_status()
62 pfdevfreq->idle_time)); in panfrost_devfreq_get_dev_status()
64 status->busy_time = ktime_to_ns(pfdevfreq->busy_time); in panfrost_devfreq_get_dev_status()
66 panfrost_devfreq_reset(pfdevfreq); in panfrost_devfreq_get_dev_status()
68 spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); in panfrost_devfreq_get_dev_status()
93 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_init() local
121 pfdevfreq->opp_of_table_added = true; in panfrost_devfreq_init()
123 spin_lock_init(&pfdevfreq->lock); in panfrost_devfreq_init()
125 panfrost_devfreq_reset(pfdevfreq); in panfrost_devfreq_init()
151 pfdevfreq->gov_data.upthreshold = 45; in panfrost_devfreq_init()
152 pfdevfreq->gov_data.downdifferential = 5; in panfrost_devfreq_init()
156 &pfdevfreq->gov_data); in panfrost_devfreq_init()
161 pfdevfreq->devfreq = devfreq; in panfrost_devfreq_init()
167 pfdevfreq->cooling = cooling; in panfrost_devfreq_init()
174 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_fini() local
176 if (pfdevfreq->cooling) { in panfrost_devfreq_fini()
177 devfreq_cooling_unregister(pfdevfreq->cooling); in panfrost_devfreq_fini()
178 pfdevfreq->cooling = NULL; in panfrost_devfreq_fini()
184 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_resume() local
186 if (!pfdevfreq->devfreq) in panfrost_devfreq_resume()
189 panfrost_devfreq_reset(pfdevfreq); in panfrost_devfreq_resume()
191 devfreq_resume_device(pfdevfreq->devfreq); in panfrost_devfreq_resume()
196 struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; in panfrost_devfreq_suspend() local
198 if (!pfdevfreq->devfreq) in panfrost_devfreq_suspend()
201 devfreq_suspend_device(pfdevfreq->devfreq); in panfrost_devfreq_suspend()
204 void panfrost_devfreq_record_busy(struct panfrost_devfreq *pfdevfreq) in panfrost_devfreq_record_busy() argument
208 if (!pfdevfreq->devfreq) in panfrost_devfreq_record_busy()
211 spin_lock_irqsave(&pfdevfreq->lock, irqflags); in panfrost_devfreq_record_busy()
213 panfrost_devfreq_update_utilization(pfdevfreq); in panfrost_devfreq_record_busy()
215 pfdevfreq->busy_count++; in panfrost_devfreq_record_busy()
217 spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); in panfrost_devfreq_record_busy()
220 void panfrost_devfreq_record_idle(struct panfrost_devfreq *pfdevfreq) in panfrost_devfreq_record_idle() argument
224 if (!pfdevfreq->devfreq) in panfrost_devfreq_record_idle()
227 spin_lock_irqsave(&pfdevfreq->lock, irqflags); in panfrost_devfreq_record_idle()
229 panfrost_devfreq_update_utilization(pfdevfreq); in panfrost_devfreq_record_idle()
231 WARN_ON(--pfdevfreq->busy_count < 0); in panfrost_devfreq_record_idle()
233 spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); in panfrost_devfreq_record_idle()