Lines Matching +full:freq +full:- +full:domain

1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2018-2023 ARM Ltd.
8 #define pr_fmt(fmt) "SCMI Notifications PERF - " fmt
83 __le32 domain; member
88 __le32 domain; member
99 __le32 domain; member
104 __le32 domain; member
171 if (_opp->indicative_freq == f_) \
197 ret = ph->xops->xfer_get_init(ph, PROTOCOL_ATTRIBUTES, 0, in scmi_perf_attributes_get()
202 attr = t->rx.buf; in scmi_perf_attributes_get()
204 ret = ph->xops->do_xfer(ph, t); in scmi_perf_attributes_get()
206 u16 flags = le16_to_cpu(attr->flags); in scmi_perf_attributes_get()
208 pi->num_domains = le16_to_cpu(attr->num_domains); in scmi_perf_attributes_get()
211 pi->power_scale = SCMI_POWER_MILLIWATTS; in scmi_perf_attributes_get()
212 if (PROTOCOL_REV_MAJOR(pi->version) >= 0x3) in scmi_perf_attributes_get()
214 pi->power_scale = SCMI_POWER_MICROWATTS; in scmi_perf_attributes_get()
216 pi->stats_addr = le32_to_cpu(attr->stats_addr_low) | in scmi_perf_attributes_get()
217 (u64)le32_to_cpu(attr->stats_addr_high) << 32; in scmi_perf_attributes_get()
218 pi->stats_size = le32_to_cpu(attr->stats_size); in scmi_perf_attributes_get()
221 ph->xops->xfer_put(ph, t); in scmi_perf_attributes_get()
227 int domain; in scmi_perf_xa_destroy() local
230 for (domain = 0; domain < pinfo->num_domains; domain++) { in scmi_perf_xa_destroy()
231 xa_destroy(&((pinfo->dom_info + domain)->opps_by_idx)); in scmi_perf_xa_destroy()
232 xa_destroy(&((pinfo->dom_info + domain)->opps_by_lvl)); in scmi_perf_xa_destroy()
246 ret = ph->xops->xfer_get_init(ph, PERF_DOMAIN_ATTRIBUTES, in scmi_perf_domain_attributes_get()
247 sizeof(dom_info->id), sizeof(*attr), &t); in scmi_perf_domain_attributes_get()
251 put_unaligned_le32(dom_info->id, t->tx.buf); in scmi_perf_domain_attributes_get()
252 attr = t->rx.buf; in scmi_perf_domain_attributes_get()
254 ret = ph->xops->do_xfer(ph, t); in scmi_perf_domain_attributes_get()
256 flags = le32_to_cpu(attr->flags); in scmi_perf_domain_attributes_get()
258 dom_info->set_limits = SUPPORTS_SET_LIMITS(flags); in scmi_perf_domain_attributes_get()
259 dom_info->info.set_perf = SUPPORTS_SET_PERF_LVL(flags); in scmi_perf_domain_attributes_get()
260 dom_info->perf_limit_notify = SUPPORTS_PERF_LIMIT_NOTIFY(flags); in scmi_perf_domain_attributes_get()
261 dom_info->perf_level_notify = SUPPORTS_PERF_LEVEL_NOTIFY(flags); in scmi_perf_domain_attributes_get()
262 dom_info->perf_fastchannels = SUPPORTS_PERF_FASTCHANNELS(flags); in scmi_perf_domain_attributes_get()
264 dom_info->level_indexing_mode = in scmi_perf_domain_attributes_get()
266 dom_info->sustained_freq_khz = in scmi_perf_domain_attributes_get()
267 le32_to_cpu(attr->sustained_freq_khz); in scmi_perf_domain_attributes_get()
268 dom_info->sustained_perf_level = in scmi_perf_domain_attributes_get()
269 le32_to_cpu(attr->sustained_perf_level); in scmi_perf_domain_attributes_get()
270 if (!dom_info->sustained_freq_khz || in scmi_perf_domain_attributes_get()
271 !dom_info->sustained_perf_level || in scmi_perf_domain_attributes_get()
272 dom_info->level_indexing_mode) in scmi_perf_domain_attributes_get()
274 dom_info->mult_factor = 1000; in scmi_perf_domain_attributes_get()
276 dom_info->mult_factor = in scmi_perf_domain_attributes_get()
277 (dom_info->sustained_freq_khz * 1000UL) in scmi_perf_domain_attributes_get()
278 / dom_info->sustained_perf_level; in scmi_perf_domain_attributes_get()
279 strscpy(dom_info->info.name, attr->name, in scmi_perf_domain_attributes_get()
283 ph->xops->xfer_put(ph, t); in scmi_perf_domain_attributes_get()
291 ph->hops->extended_name_get(ph, PERF_DOMAIN_NAME_GET, in scmi_perf_domain_attributes_get()
292 dom_info->id, dom_info->info.name, in scmi_perf_domain_attributes_get()
295 if (dom_info->level_indexing_mode) { in scmi_perf_domain_attributes_get()
296 xa_init(&dom_info->opps_by_idx); in scmi_perf_domain_attributes_get()
297 xa_init(&dom_info->opps_by_lvl); in scmi_perf_domain_attributes_get()
298 hash_init(dom_info->opps_by_freq); in scmi_perf_domain_attributes_get()
308 return t1->perf - t2->perf; in opp_cmp_func()
323 msg->domain = cpu_to_le32(p->perf_dom->id); in iter_perf_levels_prepare_message()
325 msg->level_index = cpu_to_le32(desc_index); in iter_perf_levels_prepare_message()
333 st->num_returned = le16_to_cpu(r->num_returned); in iter_perf_levels_update_state()
334 st->num_remaining = le16_to_cpu(r->num_remaining); in iter_perf_levels_update_state()
343 opp->perf = le32_to_cpu(r->opp[loop_idx].perf_val); in process_response_opp()
344 opp->power = le32_to_cpu(r->opp[loop_idx].power); in process_response_opp()
345 opp->trans_latency_us = in process_response_opp()
346 le16_to_cpu(r->opp[loop_idx].transition_latency_us); in process_response_opp()
354 opp->perf = le32_to_cpu(r->opp[loop_idx].perf_val); in process_response_opp_v4()
355 opp->power = le32_to_cpu(r->opp[loop_idx].power); in process_response_opp_v4()
356 opp->trans_latency_us = in process_response_opp_v4()
357 le16_to_cpu(r->opp[loop_idx].transition_latency_us); in process_response_opp_v4()
359 /* Note that PERF v4 reports always five 32-bit words */ in process_response_opp_v4()
360 opp->indicative_freq = le32_to_cpu(r->opp[loop_idx].indicative_freq); in process_response_opp_v4()
361 if (dom->level_indexing_mode) { in process_response_opp_v4()
364 opp->level_index = le32_to_cpu(r->opp[loop_idx].level_index); in process_response_opp_v4()
366 ret = xa_insert(&dom->opps_by_idx, opp->level_index, opp, in process_response_opp_v4()
370 "Failed to add opps_by_idx at %d - ret:%d\n", in process_response_opp_v4()
371 opp->level_index, ret); in process_response_opp_v4()
373 ret = xa_insert(&dom->opps_by_lvl, opp->perf, opp, GFP_KERNEL); in process_response_opp_v4()
376 "Failed to add opps_by_lvl at %d - ret:%d\n", in process_response_opp_v4()
377 opp->perf, ret); in process_response_opp_v4()
379 hash_add(dom->opps_by_freq, &opp->hash, opp->indicative_freq); in process_response_opp_v4()
391 opp = &p->perf_dom->opp[st->desc_index + st->loop_idx]; in iter_perf_levels_process_response()
392 if (PROTOCOL_REV_MAJOR(p->version) <= 0x3) in iter_perf_levels_process_response()
393 process_response_opp(opp, st->loop_idx, response); in iter_perf_levels_process_response()
395 process_response_opp_v4(ph->dev, p->perf_dom, opp, st->loop_idx, in iter_perf_levels_process_response()
397 p->perf_dom->opp_count++; in iter_perf_levels_process_response()
399 dev_dbg(ph->dev, "Level %d Power %d Latency %dus Ifreq %d Index %d\n", in iter_perf_levels_process_response()
400 opp->perf, opp->power, opp->trans_latency_us, in iter_perf_levels_process_response()
401 opp->indicative_freq, opp->level_index); in iter_perf_levels_process_response()
422 iter = ph->hops->iter_response_init(ph, &ops, MAX_OPPS, in scmi_perf_describe_levels_get()
429 ret = ph->hops->iter_response_run(iter); in scmi_perf_describe_levels_get()
433 if (perf_dom->opp_count) in scmi_perf_describe_levels_get()
434 sort(perf_dom->opp, perf_dom->opp_count, in scmi_perf_describe_levels_get()
442 struct scmi_perf_info *pi = ph->get_priv(ph); in scmi_perf_num_domains_get()
444 return pi->num_domains; in scmi_perf_num_domains_get()
448 scmi_perf_domain_lookup(const struct scmi_protocol_handle *ph, u32 domain) in scmi_perf_domain_lookup() argument
450 struct scmi_perf_info *pi = ph->get_priv(ph); in scmi_perf_domain_lookup()
452 if (domain >= pi->num_domains) in scmi_perf_domain_lookup()
453 return ERR_PTR(-EINVAL); in scmi_perf_domain_lookup()
455 return pi->dom_info + domain; in scmi_perf_domain_lookup()
459 scmi_perf_info_get(const struct scmi_protocol_handle *ph, u32 domain) in scmi_perf_info_get() argument
463 dom = scmi_perf_domain_lookup(ph, domain); in scmi_perf_info_get()
465 return ERR_PTR(-EINVAL); in scmi_perf_info_get()
467 return &dom->info; in scmi_perf_info_get()
471 u32 domain, u32 max_perf, u32 min_perf) in scmi_perf_msg_limits_set() argument
477 ret = ph->xops->xfer_get_init(ph, PERF_LIMITS_SET, in scmi_perf_msg_limits_set()
482 limits = t->tx.buf; in scmi_perf_msg_limits_set()
483 limits->domain = cpu_to_le32(domain); in scmi_perf_msg_limits_set()
484 limits->max_level = cpu_to_le32(max_perf); in scmi_perf_msg_limits_set()
485 limits->min_level = cpu_to_le32(min_perf); in scmi_perf_msg_limits_set()
487 ret = ph->xops->do_xfer(ph, t); in scmi_perf_msg_limits_set()
489 ph->xops->xfer_put(ph, t); in scmi_perf_msg_limits_set()
497 if (dom->fc_info && dom->fc_info[PERF_FC_LIMIT].set_addr) { in __scmi_perf_limits_set()
498 struct scmi_fc_info *fci = &dom->fc_info[PERF_FC_LIMIT]; in __scmi_perf_limits_set()
501 dom->id, min_perf, max_perf); in __scmi_perf_limits_set()
502 iowrite32(max_perf, fci->set_addr); in __scmi_perf_limits_set()
503 iowrite32(min_perf, fci->set_addr + 4); in __scmi_perf_limits_set()
504 ph->hops->fastchannel_db_ring(fci->set_db); in __scmi_perf_limits_set()
508 return scmi_perf_msg_limits_set(ph, dom->id, max_perf, min_perf); in __scmi_perf_limits_set()
512 u32 domain, u32 max_perf, u32 min_perf) in scmi_perf_limits_set() argument
514 struct scmi_perf_info *pi = ph->get_priv(ph); in scmi_perf_limits_set()
517 dom = scmi_perf_domain_lookup(ph, domain); in scmi_perf_limits_set()
521 if (PROTOCOL_REV_MAJOR(pi->version) >= 0x3 && !max_perf && !min_perf) in scmi_perf_limits_set()
522 return -EINVAL; in scmi_perf_limits_set()
524 if (dom->level_indexing_mode) { in scmi_perf_limits_set()
528 opp = xa_load(&dom->opps_by_lvl, min_perf); in scmi_perf_limits_set()
530 return -EIO; in scmi_perf_limits_set()
532 min_perf = opp->level_index; in scmi_perf_limits_set()
536 opp = xa_load(&dom->opps_by_lvl, max_perf); in scmi_perf_limits_set()
538 return -EIO; in scmi_perf_limits_set()
540 max_perf = opp->level_index; in scmi_perf_limits_set()
548 u32 domain, u32 *max_perf, u32 *min_perf) in scmi_perf_msg_limits_get() argument
554 ret = ph->xops->xfer_get_init(ph, PERF_LIMITS_GET, in scmi_perf_msg_limits_get()
559 put_unaligned_le32(domain, t->tx.buf); in scmi_perf_msg_limits_get()
561 ret = ph->xops->do_xfer(ph, t); in scmi_perf_msg_limits_get()
563 limits = t->rx.buf; in scmi_perf_msg_limits_get()
565 *max_perf = le32_to_cpu(limits->max_level); in scmi_perf_msg_limits_get()
566 *min_perf = le32_to_cpu(limits->min_level); in scmi_perf_msg_limits_get()
569 ph->xops->xfer_put(ph, t); in scmi_perf_msg_limits_get()
577 if (dom->fc_info && dom->fc_info[PERF_FC_LIMIT].get_addr) { in __scmi_perf_limits_get()
578 struct scmi_fc_info *fci = &dom->fc_info[PERF_FC_LIMIT]; in __scmi_perf_limits_get()
580 *max_perf = ioread32(fci->get_addr); in __scmi_perf_limits_get()
581 *min_perf = ioread32(fci->get_addr + 4); in __scmi_perf_limits_get()
583 dom->id, *min_perf, *max_perf); in __scmi_perf_limits_get()
587 return scmi_perf_msg_limits_get(ph, dom->id, max_perf, min_perf); in __scmi_perf_limits_get()
591 u32 domain, u32 *max_perf, u32 *min_perf) in scmi_perf_limits_get() argument
596 dom = scmi_perf_domain_lookup(ph, domain); in scmi_perf_limits_get()
604 if (dom->level_indexing_mode) { in scmi_perf_limits_get()
607 opp = xa_load(&dom->opps_by_idx, *min_perf); in scmi_perf_limits_get()
609 return -EIO; in scmi_perf_limits_get()
611 *min_perf = opp->perf; in scmi_perf_limits_get()
613 opp = xa_load(&dom->opps_by_idx, *max_perf); in scmi_perf_limits_get()
615 return -EIO; in scmi_perf_limits_get()
617 *max_perf = opp->perf; in scmi_perf_limits_get()
624 u32 domain, u32 level, bool poll) in scmi_perf_msg_level_set() argument
630 ret = ph->xops->xfer_get_init(ph, PERF_LEVEL_SET, sizeof(*lvl), 0, &t); in scmi_perf_msg_level_set()
634 t->hdr.poll_completion = poll; in scmi_perf_msg_level_set()
635 lvl = t->tx.buf; in scmi_perf_msg_level_set()
636 lvl->domain = cpu_to_le32(domain); in scmi_perf_msg_level_set()
637 lvl->level = cpu_to_le32(level); in scmi_perf_msg_level_set()
639 ret = ph->xops->do_xfer(ph, t); in scmi_perf_msg_level_set()
641 ph->xops->xfer_put(ph, t); in scmi_perf_msg_level_set()
649 if (dom->fc_info && dom->fc_info[PERF_FC_LEVEL].set_addr) { in __scmi_perf_level_set()
650 struct scmi_fc_info *fci = &dom->fc_info[PERF_FC_LEVEL]; in __scmi_perf_level_set()
653 dom->id, level, 0); in __scmi_perf_level_set()
654 iowrite32(level, fci->set_addr); in __scmi_perf_level_set()
655 ph->hops->fastchannel_db_ring(fci->set_db); in __scmi_perf_level_set()
659 return scmi_perf_msg_level_set(ph, dom->id, level, poll); in __scmi_perf_level_set()
663 u32 domain, u32 level, bool poll) in scmi_perf_level_set() argument
667 dom = scmi_perf_domain_lookup(ph, domain); in scmi_perf_level_set()
671 if (dom->level_indexing_mode) { in scmi_perf_level_set()
674 opp = xa_load(&dom->opps_by_lvl, level); in scmi_perf_level_set()
676 return -EIO; in scmi_perf_level_set()
678 level = opp->level_index; in scmi_perf_level_set()
685 u32 domain, u32 *level, bool poll) in scmi_perf_msg_level_get() argument
690 ret = ph->xops->xfer_get_init(ph, PERF_LEVEL_GET, in scmi_perf_msg_level_get()
695 t->hdr.poll_completion = poll; in scmi_perf_msg_level_get()
696 put_unaligned_le32(domain, t->tx.buf); in scmi_perf_msg_level_get()
698 ret = ph->xops->do_xfer(ph, t); in scmi_perf_msg_level_get()
700 *level = get_unaligned_le32(t->rx.buf); in scmi_perf_msg_level_get()
702 ph->xops->xfer_put(ph, t); in scmi_perf_msg_level_get()
710 if (dom->fc_info && dom->fc_info[PERF_FC_LEVEL].get_addr) { in __scmi_perf_level_get()
711 *level = ioread32(dom->fc_info[PERF_FC_LEVEL].get_addr); in __scmi_perf_level_get()
713 dom->id, *level, 0); in __scmi_perf_level_get()
717 return scmi_perf_msg_level_get(ph, dom->id, level, poll); in __scmi_perf_level_get()
721 u32 domain, u32 *level, bool poll) in scmi_perf_level_get() argument
726 dom = scmi_perf_domain_lookup(ph, domain); in scmi_perf_level_get()
734 if (dom->level_indexing_mode) { in scmi_perf_level_get()
737 opp = xa_load(&dom->opps_by_idx, *level); in scmi_perf_level_get()
739 return -EIO; in scmi_perf_level_get()
741 *level = opp->perf; in scmi_perf_level_get()
748 u32 domain, int message_id, in scmi_perf_level_limits_notify() argument
755 ret = ph->xops->xfer_get_init(ph, message_id, sizeof(*notify), 0, &t); in scmi_perf_level_limits_notify()
759 notify = t->tx.buf; in scmi_perf_level_limits_notify()
760 notify->domain = cpu_to_le32(domain); in scmi_perf_level_limits_notify()
761 notify->notify_enable = enable ? cpu_to_le32(BIT(0)) : 0; in scmi_perf_level_limits_notify()
763 ret = ph->xops->do_xfer(ph, t); in scmi_perf_level_limits_notify()
765 ph->xops->xfer_put(ph, t); in scmi_perf_level_limits_notify()
770 u32 domain, struct scmi_fc_info **p_fc) in scmi_perf_domain_init_fc() argument
774 fc = devm_kcalloc(ph->dev, PERF_FC_MAX, sizeof(*fc), GFP_KERNEL); in scmi_perf_domain_init_fc()
778 ph->hops->fastchannel_init(ph, PERF_DESCRIBE_FASTCHANNEL, in scmi_perf_domain_init_fc()
779 PERF_LEVEL_SET, 4, domain, in scmi_perf_domain_init_fc()
783 ph->hops->fastchannel_init(ph, PERF_DESCRIBE_FASTCHANNEL, in scmi_perf_domain_init_fc()
784 PERF_LEVEL_GET, 4, domain, in scmi_perf_domain_init_fc()
787 ph->hops->fastchannel_init(ph, PERF_DESCRIBE_FASTCHANNEL, in scmi_perf_domain_init_fc()
788 PERF_LIMITS_SET, 8, domain, in scmi_perf_domain_init_fc()
792 ph->hops->fastchannel_init(ph, PERF_DESCRIBE_FASTCHANNEL, in scmi_perf_domain_init_fc()
793 PERF_LIMITS_GET, 8, domain, in scmi_perf_domain_init_fc()
804 if (of_parse_phandle_with_args(dev->of_node, "clocks", "#clock-cells", in scmi_dev_domain_id()
806 return -EINVAL; in scmi_dev_domain_id()
814 int idx, ret, domain; in scmi_dvfs_device_opps_add() local
815 unsigned long freq; in scmi_dvfs_device_opps_add() local
818 domain = scmi_dev_domain_id(dev); in scmi_dvfs_device_opps_add()
819 if (domain < 0) in scmi_dvfs_device_opps_add()
820 return -EINVAL; in scmi_dvfs_device_opps_add()
822 dom = scmi_perf_domain_lookup(ph, domain); in scmi_dvfs_device_opps_add()
826 for (idx = 0; idx < dom->opp_count; idx++) { in scmi_dvfs_device_opps_add()
827 if (!dom->level_indexing_mode) in scmi_dvfs_device_opps_add()
828 freq = dom->opp[idx].perf * dom->mult_factor; in scmi_dvfs_device_opps_add()
830 freq = dom->opp[idx].indicative_freq * dom->mult_factor; in scmi_dvfs_device_opps_add()
832 ret = dev_pm_opp_add(dev, freq, 0); in scmi_dvfs_device_opps_add()
834 dev_warn(dev, "failed to add opp %luHz\n", freq); in scmi_dvfs_device_opps_add()
840 domain, dom->info.name, idx, freq); in scmi_dvfs_device_opps_add()
849 int domain; in scmi_dvfs_transition_latency_get() local
852 domain = scmi_dev_domain_id(dev); in scmi_dvfs_transition_latency_get()
853 if (domain < 0) in scmi_dvfs_transition_latency_get()
854 return -EINVAL; in scmi_dvfs_transition_latency_get()
856 dom = scmi_perf_domain_lookup(ph, domain); in scmi_dvfs_transition_latency_get()
861 return dom->opp[dom->opp_count - 1].trans_latency_us * 1000; in scmi_dvfs_transition_latency_get()
864 static int scmi_dvfs_freq_set(const struct scmi_protocol_handle *ph, u32 domain, in scmi_dvfs_freq_set() argument
865 unsigned long freq, bool poll) in scmi_dvfs_freq_set() argument
870 dom = scmi_perf_domain_lookup(ph, domain); in scmi_dvfs_freq_set()
874 if (!dom->level_indexing_mode) { in scmi_dvfs_freq_set()
875 level = freq / dom->mult_factor; in scmi_dvfs_freq_set()
879 opp = LOOKUP_BY_FREQ(dom->opps_by_freq, in scmi_dvfs_freq_set()
880 freq / dom->mult_factor); in scmi_dvfs_freq_set()
882 return -EIO; in scmi_dvfs_freq_set()
884 level = opp->level_index; in scmi_dvfs_freq_set()
890 static int scmi_dvfs_freq_get(const struct scmi_protocol_handle *ph, u32 domain, in scmi_dvfs_freq_get() argument
891 unsigned long *freq, bool poll) in scmi_dvfs_freq_get() argument
897 dom = scmi_perf_domain_lookup(ph, domain); in scmi_dvfs_freq_get()
905 if (!dom->level_indexing_mode) { in scmi_dvfs_freq_get()
906 *freq = level * dom->mult_factor; in scmi_dvfs_freq_get()
910 opp = xa_load(&dom->opps_by_idx, level); in scmi_dvfs_freq_get()
912 return -EIO; in scmi_dvfs_freq_get()
914 *freq = opp->indicative_freq * dom->mult_factor; in scmi_dvfs_freq_get()
921 u32 domain, unsigned long *freq, in scmi_dvfs_est_power_get() argument
926 int idx, ret = -EINVAL; in scmi_dvfs_est_power_get()
929 dom = scmi_perf_domain_lookup(ph, domain); in scmi_dvfs_est_power_get()
933 for (opp = dom->opp, idx = 0; idx < dom->opp_count; idx++, opp++) { in scmi_dvfs_est_power_get()
934 if (!dom->level_indexing_mode) in scmi_dvfs_est_power_get()
935 opp_freq = opp->perf * dom->mult_factor; in scmi_dvfs_est_power_get()
937 opp_freq = opp->indicative_freq * dom->mult_factor; in scmi_dvfs_est_power_get()
939 if (opp_freq < *freq) in scmi_dvfs_est_power_get()
942 *freq = opp_freq; in scmi_dvfs_est_power_get()
943 *power = opp->power; in scmi_dvfs_est_power_get()
954 int domain; in scmi_fast_switch_possible() local
957 domain = scmi_dev_domain_id(dev); in scmi_fast_switch_possible()
958 if (domain < 0) in scmi_fast_switch_possible()
961 dom = scmi_perf_domain_lookup(ph, domain); in scmi_fast_switch_possible()
965 return dom->fc_info && dom->fc_info[PERF_FC_LEVEL].set_addr; in scmi_fast_switch_possible()
971 struct scmi_perf_info *pi = ph->get_priv(ph); in scmi_power_scale_get()
973 return pi->power_scale; in scmi_power_scale_get()
999 return -EINVAL; in scmi_perf_set_notify_enabled()
1004 pr_debug("FAIL_ENABLED - evt[%X] dom[%d] - ret:%d\n", in scmi_perf_set_notify_enabled()
1026 r->timestamp = timestamp; in scmi_perf_fill_custom_report()
1027 r->agent_id = le32_to_cpu(p->agent_id); in scmi_perf_fill_custom_report()
1028 r->domain_id = le32_to_cpu(p->domain_id); in scmi_perf_fill_custom_report()
1029 r->range_max = le32_to_cpu(p->range_max); in scmi_perf_fill_custom_report()
1030 r->range_min = le32_to_cpu(p->range_min); in scmi_perf_fill_custom_report()
1031 *src_id = r->domain_id; in scmi_perf_fill_custom_report()
1043 r->timestamp = timestamp; in scmi_perf_fill_custom_report()
1044 r->agent_id = le32_to_cpu(p->agent_id); in scmi_perf_fill_custom_report()
1045 r->domain_id = le32_to_cpu(p->domain_id); in scmi_perf_fill_custom_report()
1046 r->performance_level = le32_to_cpu(p->performance_level); in scmi_perf_fill_custom_report()
1047 *src_id = r->domain_id; in scmi_perf_fill_custom_report()
1060 struct scmi_perf_info *pi = ph->get_priv(ph); in scmi_perf_get_num_sources()
1063 return -EINVAL; in scmi_perf_get_num_sources()
1065 return pi->num_domains; in scmi_perf_get_num_sources()
1096 int domain, ret; in scmi_perf_protocol_init() local
1100 ret = ph->xops->version_get(ph, &version); in scmi_perf_protocol_init()
1104 dev_dbg(ph->dev, "Performance Version %d.%d\n", in scmi_perf_protocol_init()
1107 pinfo = devm_kzalloc(ph->dev, sizeof(*pinfo), GFP_KERNEL); in scmi_perf_protocol_init()
1109 return -ENOMEM; in scmi_perf_protocol_init()
1111 pinfo->version = version; in scmi_perf_protocol_init()
1117 pinfo->dom_info = devm_kcalloc(ph->dev, pinfo->num_domains, in scmi_perf_protocol_init()
1118 sizeof(*pinfo->dom_info), GFP_KERNEL); in scmi_perf_protocol_init()
1119 if (!pinfo->dom_info) in scmi_perf_protocol_init()
1120 return -ENOMEM; in scmi_perf_protocol_init()
1122 for (domain = 0; domain < pinfo->num_domains; domain++) { in scmi_perf_protocol_init()
1123 struct perf_dom_info *dom = pinfo->dom_info + domain; in scmi_perf_protocol_init()
1125 dom->id = domain; in scmi_perf_protocol_init()
1129 if (dom->perf_fastchannels) in scmi_perf_protocol_init()
1130 scmi_perf_domain_init_fc(ph, dom->id, &dom->fc_info); in scmi_perf_protocol_init()
1133 ret = devm_add_action_or_reset(ph->dev, scmi_perf_xa_destroy, pinfo); in scmi_perf_protocol_init()
1137 return ph->set_priv(ph, pinfo); in scmi_perf_protocol_init()