Searched refs:power_zone (Results 1 - 3 of 3) sorted by relevance

/linux-4.1.27/drivers/powercap/
H A Dpowercap_sys.c37 struct powercap_zone *power_zone = to_powercap_zone(dev); \
39 if (power_zone->ops->get_##_attr) { \
40 if (!power_zone->ops->get_##_attr(power_zone, &value)) \
54 struct powercap_zone *power_zone = to_powercap_zone(dev); \
62 if (power_zone->ops->reset_##_attr) { \
63 if (!power_zone->ops->reset_##_attr(power_zone)) \
78 struct powercap_zone *power_zone = to_powercap_zone(dev); \
84 if (id >= power_zone->const_id_cnt) \
86 pconst = &power_zone->constraints[id]; \
88 if (!pconst->ops->get_##_attr(power_zone, id, &value)) \
103 struct powercap_zone *power_zone = to_powercap_zone(dev); \
109 if (id >= power_zone->const_id_cnt) \
111 pconst = &power_zone->constraints[id]; \
116 if (!pconst->ops->set_##_attr(power_zone, id, value)) \
171 struct powercap_zone *power_zone = to_powercap_zone(dev); show_constraint_name() local
178 if (id >= power_zone->const_id_cnt) show_constraint_name()
180 pconst = &power_zone->constraints[id]; show_constraint_name()
183 name = pconst->ops->get_name(power_zone, id); show_constraint_name()
295 static int create_constraints(struct powercap_zone *power_zone, create_constraints() argument
304 if (!power_zone || !const_ops || !const_ops->get_power_limit_uw || create_constraints()
310 count = power_zone->zone_attr_count; create_constraints()
312 pconst = &power_zone->constraints[i]; create_constraints()
314 pconst->id = power_zone->const_id_cnt; create_constraints()
315 power_zone->const_id_cnt++; create_constraints()
316 power_zone->zone_dev_attrs[count++] = create_constraints()
318 power_zone->zone_dev_attrs[count++] = create_constraints()
321 power_zone->zone_dev_attrs[count++] = create_constraints()
324 power_zone->zone_dev_attrs[count++] = create_constraints()
327 power_zone->zone_dev_attrs[count++] = create_constraints()
330 power_zone->zone_dev_attrs[count++] = create_constraints()
333 power_zone->zone_dev_attrs[count++] = create_constraints()
336 power_zone->zone_attr_count = count; create_constraints()
363 struct powercap_zone *power_zone = to_powercap_zone(dev); name_show() local
365 return sprintf(buf, "%s\n", power_zone->name); name_show()
372 struct powercap_zone *power_zone) create_power_zone_common_attributes()
376 power_zone->zone_dev_attrs[count++] = &dev_attr_name.attr; create_power_zone_common_attributes()
377 if (power_zone->ops->get_max_energy_range_uj) create_power_zone_common_attributes()
378 power_zone->zone_dev_attrs[count++] = create_power_zone_common_attributes()
380 if (power_zone->ops->get_energy_uj) { create_power_zone_common_attributes()
381 if (power_zone->ops->reset_energy_uj) create_power_zone_common_attributes()
385 power_zone->zone_dev_attrs[count++] = create_power_zone_common_attributes()
388 if (power_zone->ops->get_power_uw) create_power_zone_common_attributes()
389 power_zone->zone_dev_attrs[count++] = create_power_zone_common_attributes()
391 if (power_zone->ops->get_max_power_range_uw) create_power_zone_common_attributes()
392 power_zone->zone_dev_attrs[count++] = create_power_zone_common_attributes()
394 power_zone->zone_dev_attrs[count] = NULL; create_power_zone_common_attributes()
395 power_zone->zone_attr_count = count; create_power_zone_common_attributes()
403 struct powercap_zone *power_zone = to_powercap_zone(dev); powercap_release() local
406 allocated = power_zone->allocated; powercap_release()
408 idr_remove(power_zone->parent_idr, power_zone->id); powercap_release()
410 idr_destroy(&power_zone->idr); powercap_release()
411 kfree(power_zone->name); powercap_release()
412 kfree(power_zone->zone_dev_attrs); powercap_release()
413 kfree(power_zone->constraints); powercap_release()
414 if (power_zone->ops->release) powercap_release()
415 power_zone->ops->release(power_zone); powercap_release()
417 kfree(power_zone); powercap_release()
441 struct powercap_zone *power_zone = to_powercap_zone(dev); enabled_show() local
442 if (power_zone->ops->get_enable) enabled_show()
443 if (power_zone->ops->get_enable(power_zone, &mode)) enabled_show()
465 struct powercap_zone *power_zone = to_powercap_zone(dev); enabled_store() local
466 if (power_zone->ops->set_enable) enabled_store()
467 if (!power_zone->ops->set_enable(power_zone, mode)) enabled_store()
495 struct powercap_zone *power_zone, powercap_register_zone()
512 if (power_zone) { powercap_register_zone()
515 memset(power_zone, 0, sizeof(*power_zone)); powercap_register_zone()
517 power_zone = kzalloc(sizeof(*power_zone), GFP_KERNEL); powercap_register_zone()
518 if (!power_zone) powercap_register_zone()
520 power_zone->allocated = true; powercap_register_zone()
522 power_zone->ops = ops; powercap_register_zone()
523 power_zone->control_type_inst = control_type; powercap_register_zone()
525 power_zone->dev.parent = &control_type->dev; powercap_register_zone()
526 power_zone->parent_idr = &control_type->idr; powercap_register_zone()
528 power_zone->dev.parent = &parent->dev; powercap_register_zone()
529 power_zone->parent_idr = &parent->idr; powercap_register_zone()
531 power_zone->dev.class = &powercap_class; powercap_register_zone()
535 result = idr_alloc(power_zone->parent_idr, NULL, 0, 0, GFP_KERNEL); powercap_register_zone()
539 power_zone->id = result; powercap_register_zone()
540 idr_init(&power_zone->idr); powercap_register_zone()
541 power_zone->name = kstrdup(name, GFP_KERNEL); powercap_register_zone()
542 if (!power_zone->name) powercap_register_zone()
544 dev_set_name(&power_zone->dev, "%s:%x", powercap_register_zone()
545 dev_name(power_zone->dev.parent), powercap_register_zone()
546 power_zone->id); powercap_register_zone()
547 power_zone->constraints = kzalloc(sizeof(*power_zone->constraints) * powercap_register_zone()
549 if (!power_zone->constraints) powercap_register_zone()
554 power_zone->zone_dev_attrs = kzalloc(sizeof(void *) * powercap_register_zone()
556 if (!power_zone->zone_dev_attrs) powercap_register_zone()
558 create_power_zone_common_attributes(power_zone); powercap_register_zone()
559 result = create_constraints(power_zone, nr_constraints, const_ops); powercap_register_zone()
563 power_zone->zone_dev_attrs[power_zone->zone_attr_count] = NULL; powercap_register_zone()
564 power_zone->dev_zone_attr_group.attrs = power_zone->zone_dev_attrs; powercap_register_zone()
565 power_zone->dev_attr_groups[0] = &power_zone->dev_zone_attr_group; powercap_register_zone()
566 power_zone->dev_attr_groups[1] = NULL; powercap_register_zone()
567 power_zone->dev.groups = power_zone->dev_attr_groups; powercap_register_zone()
568 result = device_register(&power_zone->dev); powercap_register_zone()
575 return power_zone; powercap_register_zone()
578 kfree(power_zone->zone_dev_attrs); powercap_register_zone()
580 kfree(power_zone->constraints); powercap_register_zone()
582 kfree(power_zone->name); powercap_register_zone()
584 idr_remove(power_zone->parent_idr, power_zone->id); powercap_register_zone()
586 if (power_zone->allocated) powercap_register_zone()
587 kfree(power_zone); powercap_register_zone()
595 struct powercap_zone *power_zone) powercap_unregister_zone()
597 if (!power_zone || !control_type) powercap_unregister_zone()
604 device_unregister(&power_zone->dev); powercap_unregister_zone()
371 create_power_zone_common_attributes( struct powercap_zone *power_zone) create_power_zone_common_attributes() argument
494 powercap_register_zone( struct powercap_zone *power_zone, struct powercap_control_type *control_type, const char *name, struct powercap_zone *parent, const struct powercap_zone_ops *ops, int nr_constraints, struct powercap_zone_constraint_ops *const_ops) powercap_register_zone() argument
594 powercap_unregister_zone(struct powercap_control_type *control_type, struct powercap_zone *power_zone) powercap_unregister_zone() argument
H A Dintel_rapl.c156 struct powercap_zone power_zone; member in struct:rapl_domain
165 container_of(_zone, struct rapl_domain, power_zone)
179 struct powercap_zone *power_zone; /* keep track of parent zone */ member in struct:rapl_package
287 static int get_energy_counter(struct powercap_zone *power_zone, u64 *energy_raw) get_energy_counter() argument
296 rd = power_zone_to_rapl_domain(power_zone); get_energy_counter()
317 static int release_zone(struct powercap_zone *power_zone) release_zone() argument
319 struct rapl_domain *rd = power_zone_to_rapl_domain(power_zone); release_zone()
328 dev_warn(&power_zone->dev, "no package id %s\n", release_zone()
352 static int set_domain_enable(struct powercap_zone *power_zone, bool mode) set_domain_enable() argument
354 struct rapl_domain *rd = power_zone_to_rapl_domain(power_zone); set_domain_enable()
367 static int get_domain_enable(struct powercap_zone *power_zone, bool *mode) get_domain_enable() argument
369 struct rapl_domain *rd = power_zone_to_rapl_domain(power_zone); get_domain_enable()
423 static int set_power_limit(struct powercap_zone *power_zone, int id, set_power_limit() argument
431 rd = power_zone_to_rapl_domain(power_zone); set_power_limit()
439 dev_warn(&power_zone->dev, "%s locked by BIOS, monitoring only\n", set_power_limit()
462 static int get_current_power_limit(struct powercap_zone *power_zone, int id, get_current_power_limit() argument
471 rd = power_zone_to_rapl_domain(power_zone); get_current_power_limit()
493 static int set_time_window(struct powercap_zone *power_zone, int id, set_time_window() argument
500 rd = power_zone_to_rapl_domain(power_zone); set_time_window()
515 static int get_time_window(struct powercap_zone *power_zone, int id, u64 *data) get_time_window() argument
522 rd = power_zone_to_rapl_domain(power_zone); get_time_window()
541 static const char *get_constraint_name(struct powercap_zone *power_zone, int id) get_constraint_name() argument
546 rd = power_zone_to_rapl_domain(power_zone); get_constraint_name()
553 static int get_max_power(struct powercap_zone *power_zone, int id, get_max_power() argument
562 rd = power_zone_to_rapl_domain(power_zone); get_max_power()
815 dev_dbg(&rd->power_zone.dev, rapl_write_data_raw()
823 dev_dbg(&rd->power_zone.dev, rapl_write_data_raw()
1122 powercap_unregister_zone(control_type, &rd->power_zone); rapl_unregister_powercap()
1127 &rd_package->power_zone); rapl_unregister_powercap()
1139 struct powercap_zone *power_zone = NULL; rapl_package_register_powercap() local
1151 power_zone = powercap_register_zone(&rd->power_zone, rapl_package_register_powercap()
1157 if (IS_ERR(power_zone)) { rapl_package_register_powercap()
1160 ret = PTR_ERR(power_zone); rapl_package_register_powercap()
1164 rp->power_zone = power_zone; rapl_package_register_powercap()
1169 if (!power_zone) { rapl_package_register_powercap()
1180 power_zone = powercap_register_zone(&rd->power_zone, rapl_package_register_powercap()
1182 rp->power_zone, rapl_package_register_powercap()
1186 if (IS_ERR(power_zone)) { rapl_package_register_powercap()
1187 pr_debug("failed to register power_zone, %d:%s:%s\n", rapl_package_register_powercap()
1189 ret = PTR_ERR(power_zone); rapl_package_register_powercap()
1202 powercap_unregister_zone(control_type, &rd->power_zone); rapl_package_register_powercap()
1233 powercap_unregister_zone(control_type, &rd->power_zone); rapl_register_powercap()
1387 powercap_unregister_zone(control_type, &rd->power_zone); rapl_remove_package()
1390 powercap_unregister_zone(control_type, &rd_package->power_zone); rapl_remove_package()
/linux-4.1.27/include/linux/
H A Dpowercap.h103 * the power_zone memory.
203 * @power_zone: Pointer to the power zone for this constraint.
210 struct powercap_zone *power_zone; member in struct:powercap_zone_constraint
216 #define POWERCAP_GET_DEV(power_zone) (&power_zone->dev)
220 * @power_zone: A pointer to the valid zone instance.
225 static inline void powercap_set_zone_data(struct powercap_zone *power_zone, powercap_set_zone_data() argument
228 if (power_zone) powercap_set_zone_data()
229 power_zone->private_data = pdata; powercap_set_zone_data()
234 * @power_zone: A pointer to the valid zone instance.
239 static inline void *powercap_get_zone_data(struct powercap_zone *power_zone) powercap_get_zone_data() argument
241 if (power_zone) powercap_get_zone_data()
242 return power_zone->private_data; powercap_get_zone_data()
284 * @power_zone: Pointer to client allocated memory for the power zone structure
303 * Returns pointer to the power_zone on success.
306 struct powercap_zone *power_zone,
317 * @power_zone: A pointer to the valid zone instance for a control_type
323 struct powercap_zone *power_zone);

Completed in 114 milliseconds