Lines Matching full:qos

3  * Devices PM QoS constraints management
8 * per-device PM QoS dependencies. It provides infrastructure for registration
11 * Dependents on a QoS value : register requests
12 * Watchers of QoS value : get notified when target QoS value changes
14 * This QoS design is best effort based. Dependents register their QoS needs.
15 * Watchers register to keep track of the current QoS needs of the system.
46 * __dev_pm_qos_flags - Check PM QoS flags for a given device.
47 * @dev: Device to check the PM QoS flags for.
54 struct dev_pm_qos *qos = dev->power.qos; in __dev_pm_qos_flags() local
60 if (IS_ERR_OR_NULL(qos)) in __dev_pm_qos_flags()
63 pqf = &qos->flags; in __dev_pm_qos_flags()
75 * dev_pm_qos_flags - Check PM QoS flags for a given device (locked).
76 * @dev: Device to check the PM QoS flags for.
94 * @dev: Device to get the PM QoS constraint value for.
106 * dev_pm_qos_read_value - Get PM QoS constraint for a given device (locked).
107 * @dev: Device to get the PM QoS constraint value for.
108 * @type: QoS request type.
112 struct dev_pm_qos *qos = dev->power.qos; in dev_pm_qos_read_value() local
120 ret = IS_ERR_OR_NULL(qos) ? PM_QOS_RESUME_LATENCY_NO_CONSTRAINT in dev_pm_qos_read_value()
121 : pm_qos_read_value(&qos->resume_latency); in dev_pm_qos_read_value()
124 ret = IS_ERR_OR_NULL(qos) ? PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE in dev_pm_qos_read_value()
125 : freq_qos_read_value(&qos->freq, FREQ_QOS_MIN); in dev_pm_qos_read_value()
128 ret = IS_ERR_OR_NULL(qos) ? PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE in dev_pm_qos_read_value()
129 : freq_qos_read_value(&qos->freq, FREQ_QOS_MAX); in dev_pm_qos_read_value()
142 * apply_constraint - Add/modify/remove device PM QoS request.
145 * @value: Value to assign to the QoS request.
147 * Internal function to update the constraints list using the PM QoS core
153 struct dev_pm_qos *qos = req->dev->power.qos; in apply_constraint() local
161 ret = pm_qos_update_target(&qos->resume_latency, in apply_constraint()
165 ret = pm_qos_update_target(&qos->latency_tolerance, in apply_constraint()
168 value = pm_qos_read_value(&qos->latency_tolerance); in apply_constraint()
177 ret = pm_qos_update_flags(&qos->flags, &req->data.flr, in apply_constraint()
196 struct dev_pm_qos *qos; in dev_pm_qos_constraints_allocate() local
200 qos = kzalloc(sizeof(*qos), GFP_KERNEL); in dev_pm_qos_constraints_allocate()
201 if (!qos) in dev_pm_qos_constraints_allocate()
206 kfree(qos); in dev_pm_qos_constraints_allocate()
210 c = &qos->resume_latency; in dev_pm_qos_constraints_allocate()
219 c = &qos->latency_tolerance; in dev_pm_qos_constraints_allocate()
226 freq_constraints_init(&qos->freq); in dev_pm_qos_constraints_allocate()
228 INIT_LIST_HEAD(&qos->flags.list); in dev_pm_qos_constraints_allocate()
231 dev->power.qos = qos; in dev_pm_qos_constraints_allocate()
248 struct dev_pm_qos *qos; in dev_pm_qos_constraints_destroy() local
256 * If the device's PM QoS resume latency limit or PM QoS flags have been in dev_pm_qos_constraints_destroy()
267 qos = dev->power.qos; in dev_pm_qos_constraints_destroy()
268 if (!qos) in dev_pm_qos_constraints_destroy()
272 c = &qos->resume_latency; in dev_pm_qos_constraints_destroy()
282 c = &qos->latency_tolerance; in dev_pm_qos_constraints_destroy()
288 c = &qos->freq.min_freq; in dev_pm_qos_constraints_destroy()
295 c = &qos->freq.max_freq; in dev_pm_qos_constraints_destroy()
302 f = &qos->flags; in dev_pm_qos_constraints_destroy()
309 dev->power.qos = ERR_PTR(-ENODEV); in dev_pm_qos_constraints_destroy()
312 kfree(qos->resume_latency.notifiers); in dev_pm_qos_constraints_destroy()
313 kfree(qos); in dev_pm_qos_constraints_destroy()
341 if (IS_ERR(dev->power.qos)) in __dev_pm_qos_add_request()
343 else if (!dev->power.qos) in __dev_pm_qos_add_request()
353 ret = freq_qos_add_request(&dev->power.qos->freq, in __dev_pm_qos_add_request()
357 ret = freq_qos_add_request(&dev->power.qos->freq, in __dev_pm_qos_add_request()
367 * dev_pm_qos_add_request - inserts new qos request into the list
371 * @value: defines the qos request
374 * requested qos performance characteristics. It recomputes the aggregate
375 * QoS expectations of parameters and initializes the dev_pm_qos_request
401 * __dev_pm_qos_update_request - Modify an existing device PM QoS request.
402 * @req : PM QoS request to modify.
418 if (IS_ERR_OR_NULL(req->dev->power.qos)) in __dev_pm_qos_update_request()
446 * dev_pm_qos_update_request - modifies an existing qos request
448 * @new_value: defines the qos request
450 * Updates an existing dev PM qos request along with updating the
485 if (IS_ERR_OR_NULL(req->dev->power.qos)) in __dev_pm_qos_remove_request()
496 * dev_pm_qos_remove_request - modifies an existing qos request
499 * Will remove pm qos request from the list of constraints and
523 * of per-device PM QoS constraints
542 if (IS_ERR(dev->power.qos)) in dev_pm_qos_add_notifier()
544 else if (!dev->power.qos) in dev_pm_qos_add_notifier()
552 ret = blocking_notifier_chain_register(dev->power.qos->resume_latency.notifiers, in dev_pm_qos_add_notifier()
556 ret = freq_qos_add_notifier(&dev->power.qos->freq, in dev_pm_qos_add_notifier()
560 ret = freq_qos_add_notifier(&dev->power.qos->freq, in dev_pm_qos_add_notifier()
576 * of per-device PM QoS constraints
594 if (IS_ERR_OR_NULL(dev->power.qos)) in dev_pm_qos_remove_notifier()
599 ret = blocking_notifier_chain_unregister(dev->power.qos->resume_latency.notifiers, in dev_pm_qos_remove_notifier()
603 ret = freq_qos_remove_notifier(&dev->power.qos->freq, in dev_pm_qos_remove_notifier()
607 ret = freq_qos_remove_notifier(&dev->power.qos->freq, in dev_pm_qos_remove_notifier()
622 * dev_pm_qos_add_ancestor_request - Add PM QoS request for device's ancestor.
666 req = dev->power.qos->resume_latency_req; in __dev_pm_qos_drop_user_request()
667 dev->power.qos->resume_latency_req = NULL; in __dev_pm_qos_drop_user_request()
670 req = dev->power.qos->latency_tolerance_req; in __dev_pm_qos_drop_user_request()
671 dev->power.qos->latency_tolerance_req = NULL; in __dev_pm_qos_drop_user_request()
674 req = dev->power.qos->flags_req; in __dev_pm_qos_drop_user_request()
675 dev->power.qos->flags_req = NULL; in __dev_pm_qos_drop_user_request()
694 * dev_pm_qos_expose_latency_limit - Expose PM QoS latency limit to user space.
695 * @dev: Device whose PM QoS latency limit is to be exposed to user space.
720 if (IS_ERR_OR_NULL(dev->power.qos)) in dev_pm_qos_expose_latency_limit()
722 else if (dev->power.qos->resume_latency_req) in dev_pm_qos_expose_latency_limit()
731 dev->power.qos->resume_latency_req = req; in dev_pm_qos_expose_latency_limit()
747 if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->resume_latency_req) in __dev_pm_qos_hide_latency_limit()
752 * dev_pm_qos_hide_latency_limit - Hide PM QoS latency limit from user space.
753 * @dev: Device whose PM QoS latency limit is to be hidden from user space.
770 * dev_pm_qos_expose_flags - Expose PM QoS flags of a device to user space.
771 * @dev: Device whose PM QoS flags are to be exposed to user space.
797 if (IS_ERR_OR_NULL(dev->power.qos)) in dev_pm_qos_expose_flags()
799 else if (dev->power.qos->flags_req) in dev_pm_qos_expose_flags()
808 dev->power.qos->flags_req = req; in dev_pm_qos_expose_flags()
825 if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->flags_req) in __dev_pm_qos_hide_flags()
830 * dev_pm_qos_hide_flags - Hide PM QoS flags of a device from user space.
831 * @dev: Device whose PM QoS flags are to be hidden from user space.
850 * dev_pm_qos_update_flags - Update PM QoS flags request owned by user space.
851 * @dev: Device to update the PM QoS flags request for.
863 if (IS_ERR_OR_NULL(dev->power.qos) || !dev->power.qos->flags_req) { in dev_pm_qos_update_flags()
874 ret = __dev_pm_qos_update_request(dev->power.qos->flags_req, value); in dev_pm_qos_update_flags()
891 ret = IS_ERR_OR_NULL(dev->power.qos) in dev_pm_qos_get_user_latency_tolerance()
892 || !dev->power.qos->latency_tolerance_req ? in dev_pm_qos_get_user_latency_tolerance()
894 dev->power.qos->latency_tolerance_req->data.pnode.prio; in dev_pm_qos_get_user_latency_tolerance()
910 if (IS_ERR_OR_NULL(dev->power.qos) in dev_pm_qos_update_user_latency_tolerance()
911 || !dev->power.qos->latency_tolerance_req) { in dev_pm_qos_update_user_latency_tolerance()
931 dev->power.qos->latency_tolerance_req = req; in dev_pm_qos_update_user_latency_tolerance()
937 ret = __dev_pm_qos_update_request(dev->power.qos->latency_tolerance_req, val); in dev_pm_qos_update_user_latency_tolerance()