• Home
  • Raw
  • Download

Lines Matching refs:dev

26 static bool _is_cpu_device(struct device *dev)  in _is_cpu_device()  argument
28 return (dev->bus == &cpu_subsys); in _is_cpu_device()
67 static void em_debug_create_pd(struct device *dev) in em_debug_create_pd() argument
73 d = debugfs_create_dir(dev_name(dev), rootdir); in em_debug_create_pd()
75 if (_is_cpu_device(dev)) in em_debug_create_pd()
76 debugfs_create_file("cpus", 0444, d, dev->em_pd->cpus, in em_debug_create_pd()
79 debugfs_create_file("flags", 0444, d, dev->em_pd, in em_debug_create_pd()
83 for (i = 0; i < dev->em_pd->nr_perf_states; i++) in em_debug_create_pd()
84 em_debug_create_ps(&dev->em_pd->table[i], d); in em_debug_create_pd()
88 static void em_debug_remove_pd(struct device *dev) in em_debug_remove_pd() argument
90 debugfs_lookup_and_remove(dev_name(dev), rootdir); in em_debug_remove_pd()
102 static void em_debug_create_pd(struct device *dev) {} in em_debug_create_pd() argument
103 static void em_debug_remove_pd(struct device *dev) {} in em_debug_remove_pd() argument
106 static int em_create_perf_table(struct device *dev, struct em_perf_domain *pd, in em_create_perf_table() argument
126 ret = cb->active_power(dev, &power, &freq); in em_create_perf_table()
128 dev_err(dev, "EM: invalid perf. state: %d\n", in em_create_perf_table()
138 dev_err(dev, "EM: non-increasing freq: %lu\n", in em_create_perf_table()
148 dev_err(dev, "EM: invalid power: %lu\n", in em_create_perf_table()
163 ret = cb->get_cost(dev, table[i].frequency, &cost); in em_create_perf_table()
165 dev_err(dev, "EM: invalid cost %lu %d\n", in em_create_perf_table()
178 dev_dbg(dev, "EM: OPP:%lu is inefficient\n", in em_create_perf_table()
195 static int em_create_pd(struct device *dev, int nr_states, in em_create_pd() argument
203 if (_is_cpu_device(dev)) { in em_create_pd()
208 dev_err(dev, "EM: too many CPUs, overflow possible\n"); in em_create_pd()
223 ret = em_create_perf_table(dev, pd, nr_states, cb, flags); in em_create_pd()
229 if (_is_cpu_device(dev)) in em_create_pd()
235 dev->em_pd = pd; in em_create_pd()
240 static void em_cpufreq_update_efficiencies(struct device *dev) in em_cpufreq_update_efficiencies() argument
242 struct em_perf_domain *pd = dev->em_pd; in em_cpufreq_update_efficiencies()
248 if (!_is_cpu_device(dev) || !pd) in em_cpufreq_update_efficiencies()
253 dev_warn(dev, "EM: Access to CPUFreq policy failed"); in em_cpufreq_update_efficiencies()
286 struct em_perf_domain *em_pd_get(struct device *dev) in em_pd_get() argument
288 if (IS_ERR_OR_NULL(dev)) in em_pd_get()
291 return dev->em_pd; in em_pd_get()
337 int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states, in em_dev_register_perf_domain() argument
345 if (!dev || !nr_states || !cb) in em_dev_register_perf_domain()
354 if (dev->em_pd) { in em_dev_register_perf_domain()
359 if (_is_cpu_device(dev)) { in em_dev_register_perf_domain()
361 dev_err(dev, "EM: invalid CPU mask\n"); in em_dev_register_perf_domain()
368 dev_err(dev, "EM: exists for CPU%d\n", cpu); in em_dev_register_perf_domain()
379 dev_err(dev, "EM: CPUs of %*pbl must have the same capacity\n", in em_dev_register_perf_domain()
394 ret = em_create_pd(dev, nr_states, cb, cpus, flags); in em_dev_register_perf_domain()
398 dev->em_pd->flags |= flags; in em_dev_register_perf_domain()
400 em_cpufreq_update_efficiencies(dev); in em_dev_register_perf_domain()
402 em_debug_create_pd(dev); in em_dev_register_perf_domain()
403 dev_info(dev, "EM: created perf domain\n"); in em_dev_register_perf_domain()
417 void em_dev_unregister_perf_domain(struct device *dev) in em_dev_unregister_perf_domain() argument
419 if (IS_ERR_OR_NULL(dev) || !dev->em_pd) in em_dev_unregister_perf_domain()
422 if (_is_cpu_device(dev)) in em_dev_unregister_perf_domain()
431 em_debug_remove_pd(dev); in em_dev_unregister_perf_domain()
433 kfree(dev->em_pd->table); in em_dev_unregister_perf_domain()
434 kfree(dev->em_pd); in em_dev_unregister_perf_domain()
435 dev->em_pd = NULL; in em_dev_unregister_perf_domain()