mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-25 22:23:14 -04:00
Merge "Merge remote-tracking branch 'remotes/origin/tmp-aefd2d632eb0' into msm-lahaina"
This commit is contained in:
commit
71c01ac3f6
1257 changed files with 13728 additions and 39772 deletions
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/cpufreq.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/fwnode.h>
|
||||
|
|
@ -130,6 +131,9 @@ static int device_is_dependent(struct device *dev, void *target)
|
|||
return ret;
|
||||
|
||||
list_for_each_entry(link, &dev->links.consumers, s_node) {
|
||||
if (link->flags == (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED))
|
||||
continue;
|
||||
|
||||
if (link->consumer == target)
|
||||
return 1;
|
||||
|
||||
|
|
@ -199,8 +203,11 @@ static int device_reorder_to_tail(struct device *dev, void *not_used)
|
|||
device_pm_move_last(dev);
|
||||
|
||||
device_for_each_child(dev, NULL, device_reorder_to_tail);
|
||||
list_for_each_entry(link, &dev->links.consumers, s_node)
|
||||
list_for_each_entry(link, &dev->links.consumers, s_node) {
|
||||
if (link->flags == (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED))
|
||||
continue;
|
||||
device_reorder_to_tail(link->consumer, NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -227,7 +234,8 @@ void device_pm_move_to_tail(struct device *dev)
|
|||
|
||||
#define DL_MANAGED_LINK_FLAGS (DL_FLAG_AUTOREMOVE_CONSUMER | \
|
||||
DL_FLAG_AUTOREMOVE_SUPPLIER | \
|
||||
DL_FLAG_AUTOPROBE_CONSUMER)
|
||||
DL_FLAG_AUTOPROBE_CONSUMER | \
|
||||
DL_FLAG_SYNC_STATE_ONLY)
|
||||
|
||||
#define DL_ADD_VALID_FLAGS (DL_MANAGED_LINK_FLAGS | DL_FLAG_STATELESS | \
|
||||
DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE)
|
||||
|
|
@ -295,6 +303,8 @@ struct device_link *device_link_add(struct device *consumer,
|
|||
|
||||
if (!consumer || !supplier || flags & ~DL_ADD_VALID_FLAGS ||
|
||||
(flags & DL_FLAG_STATELESS && flags & DL_MANAGED_LINK_FLAGS) ||
|
||||
(flags & DL_FLAG_SYNC_STATE_ONLY &&
|
||||
flags != DL_FLAG_SYNC_STATE_ONLY) ||
|
||||
(flags & DL_FLAG_AUTOPROBE_CONSUMER &&
|
||||
flags & (DL_FLAG_AUTOREMOVE_CONSUMER |
|
||||
DL_FLAG_AUTOREMOVE_SUPPLIER)))
|
||||
|
|
@ -315,11 +325,14 @@ struct device_link *device_link_add(struct device *consumer,
|
|||
|
||||
/*
|
||||
* If the supplier has not been fully registered yet or there is a
|
||||
* reverse dependency between the consumer and the supplier already in
|
||||
* the graph, return NULL.
|
||||
* reverse (non-SYNC_STATE_ONLY) dependency between the consumer and
|
||||
* the supplier already in the graph, return NULL. If the link is a
|
||||
* SYNC_STATE_ONLY link, we don't check for reverse dependencies
|
||||
* because it only affects sync_state() callbacks.
|
||||
*/
|
||||
if (!device_pm_initialized(supplier)
|
||||
|| device_is_dependent(consumer, supplier)) {
|
||||
|| (!(flags & DL_FLAG_SYNC_STATE_ONLY) &&
|
||||
device_is_dependent(consumer, supplier))) {
|
||||
link = NULL;
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -346,9 +359,14 @@ struct device_link *device_link_add(struct device *consumer,
|
|||
}
|
||||
|
||||
if (flags & DL_FLAG_STATELESS) {
|
||||
link->flags |= DL_FLAG_STATELESS;
|
||||
kref_get(&link->kref);
|
||||
goto out;
|
||||
if (link->flags & DL_FLAG_SYNC_STATE_ONLY &&
|
||||
!(link->flags & DL_FLAG_STATELESS)) {
|
||||
link->flags |= DL_FLAG_STATELESS;
|
||||
goto reorder;
|
||||
} else {
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -370,6 +388,12 @@ struct device_link *device_link_add(struct device *consumer,
|
|||
link->flags |= DL_FLAG_MANAGED;
|
||||
device_link_init_status(link, consumer, supplier);
|
||||
}
|
||||
if (link->flags & DL_FLAG_SYNC_STATE_ONLY &&
|
||||
!(flags & DL_FLAG_SYNC_STATE_ONLY)) {
|
||||
link->flags &= ~DL_FLAG_SYNC_STATE_ONLY;
|
||||
goto reorder;
|
||||
}
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
@ -409,6 +433,13 @@ struct device_link *device_link_add(struct device *consumer,
|
|||
flags & DL_FLAG_PM_RUNTIME)
|
||||
pm_runtime_resume(supplier);
|
||||
|
||||
if (flags & DL_FLAG_SYNC_STATE_ONLY) {
|
||||
dev_dbg(consumer,
|
||||
"Linked as a sync state only consumer to %s\n",
|
||||
dev_name(supplier));
|
||||
goto out;
|
||||
}
|
||||
reorder:
|
||||
/*
|
||||
* Move the consumer and all of the devices depending on it to the end
|
||||
* of dpm_list and the devices_kset list.
|
||||
|
|
@ -449,13 +480,25 @@ EXPORT_SYMBOL_GPL(device_link_add);
|
|||
* This function is NOT meant to be called from the probe function of the
|
||||
* consumer but rather from code that creates/adds the consumer device.
|
||||
*/
|
||||
static void device_link_wait_for_supplier(struct device *consumer)
|
||||
static void device_link_wait_for_supplier(struct device *consumer,
|
||||
bool need_for_probe)
|
||||
{
|
||||
mutex_lock(&wfs_lock);
|
||||
list_add_tail(&consumer->links.needs_suppliers, &wait_for_suppliers);
|
||||
consumer->links.need_for_probe = need_for_probe;
|
||||
mutex_unlock(&wfs_lock);
|
||||
}
|
||||
|
||||
static void device_link_wait_for_mandatory_supplier(struct device *consumer)
|
||||
{
|
||||
device_link_wait_for_supplier(consumer, true);
|
||||
}
|
||||
|
||||
static void device_link_wait_for_optional_supplier(struct device *consumer)
|
||||
{
|
||||
device_link_wait_for_supplier(consumer, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* device_link_add_missing_supplier_links - Add links from consumer devices to
|
||||
* supplier devices, leaving any
|
||||
|
|
@ -625,7 +668,8 @@ int device_links_check_suppliers(struct device *dev)
|
|||
* probe.
|
||||
*/
|
||||
mutex_lock(&wfs_lock);
|
||||
if (!list_empty(&dev->links.needs_suppliers)) {
|
||||
if (!list_empty(&dev->links.needs_suppliers) &&
|
||||
dev->links.need_for_probe) {
|
||||
mutex_unlock(&wfs_lock);
|
||||
return -EPROBE_DEFER;
|
||||
}
|
||||
|
|
@ -634,7 +678,8 @@ int device_links_check_suppliers(struct device *dev)
|
|||
device_links_write_lock();
|
||||
|
||||
list_for_each_entry(link, &dev->links.suppliers, c_node) {
|
||||
if (!(link->flags & DL_FLAG_MANAGED))
|
||||
if (!(link->flags & DL_FLAG_MANAGED) ||
|
||||
link->flags & DL_FLAG_SYNC_STATE_ONLY)
|
||||
continue;
|
||||
|
||||
if (link->status != DL_STATE_AVAILABLE) {
|
||||
|
|
@ -728,6 +773,15 @@ void device_links_driver_bound(struct device *dev)
|
|||
{
|
||||
struct device_link *link;
|
||||
|
||||
/*
|
||||
* If a device probes successfully, it's expected to have created all
|
||||
* the device links it needs to or make new device links as it needs
|
||||
* them. So, it no longer needs to wait on any suppliers.
|
||||
*/
|
||||
mutex_lock(&wfs_lock);
|
||||
list_del_init(&dev->links.needs_suppliers);
|
||||
mutex_unlock(&wfs_lock);
|
||||
|
||||
device_links_write_lock();
|
||||
|
||||
list_for_each_entry(link, &dev->links.consumers, s_node) {
|
||||
|
|
@ -948,7 +1002,8 @@ void device_links_unbind_consumers(struct device *dev)
|
|||
list_for_each_entry(link, &dev->links.consumers, s_node) {
|
||||
enum device_link_state status;
|
||||
|
||||
if (!(link->flags & DL_FLAG_MANAGED))
|
||||
if (!(link->flags & DL_FLAG_MANAGED) ||
|
||||
link->flags & DL_FLAG_SYNC_STATE_ONLY)
|
||||
continue;
|
||||
|
||||
status = link->status;
|
||||
|
|
@ -2242,7 +2297,7 @@ int device_add(struct device *dev)
|
|||
struct device *parent;
|
||||
struct kobject *kobj;
|
||||
struct class_interface *class_intf;
|
||||
int error = -EINVAL;
|
||||
int error = -EINVAL, fw_ret;
|
||||
struct kobject *glue_dir = NULL;
|
||||
|
||||
dev = get_device(dev);
|
||||
|
|
@ -2358,9 +2413,13 @@ int device_add(struct device *dev)
|
|||
*/
|
||||
device_link_add_missing_supplier_links();
|
||||
|
||||
if (fwnode_has_op(dev->fwnode, add_links)
|
||||
&& fwnode_call_int_op(dev->fwnode, add_links, dev))
|
||||
device_link_wait_for_supplier(dev);
|
||||
if (fwnode_has_op(dev->fwnode, add_links)) {
|
||||
fw_ret = fwnode_call_int_op(dev->fwnode, add_links, dev);
|
||||
if (fw_ret == -ENODEV)
|
||||
device_link_wait_for_mandatory_supplier(dev);
|
||||
else if (fw_ret)
|
||||
device_link_wait_for_optional_supplier(dev);
|
||||
}
|
||||
|
||||
bus_probe_device(dev);
|
||||
if (parent)
|
||||
|
|
@ -3346,6 +3405,8 @@ void device_shutdown(void)
|
|||
wait_for_device_probe();
|
||||
device_block_probing();
|
||||
|
||||
cpufreq_suspend();
|
||||
|
||||
spin_lock(&devices_kset->list_lock);
|
||||
/*
|
||||
* Walk the devices list backward, shutting down each in turn.
|
||||
|
|
|
|||
|
|
@ -540,6 +540,9 @@ static ssize_t soft_offline_page_store(struct device *dev,
|
|||
pfn >>= PAGE_SHIFT;
|
||||
if (!pfn_valid(pfn))
|
||||
return -ENXIO;
|
||||
/* Only online pages can be soft-offlined (esp., not ZONE_DEVICE). */
|
||||
if (!pfn_to_online_page(pfn))
|
||||
return -EIO;
|
||||
ret = soft_offline_page(pfn_to_page(pfn), 0);
|
||||
return ret == 0 ? count : ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,20 +115,10 @@ s32 dev_pm_qos_read_value(struct device *dev, enum dev_pm_qos_req_type type)
|
|||
|
||||
spin_lock_irqsave(&dev->power.lock, flags);
|
||||
|
||||
switch (type) {
|
||||
case DEV_PM_QOS_RESUME_LATENCY:
|
||||
if (type == DEV_PM_QOS_RESUME_LATENCY) {
|
||||
ret = IS_ERR_OR_NULL(qos) ? PM_QOS_RESUME_LATENCY_NO_CONSTRAINT
|
||||
: pm_qos_read_value(&qos->resume_latency);
|
||||
break;
|
||||
case DEV_PM_QOS_MIN_FREQUENCY:
|
||||
ret = IS_ERR_OR_NULL(qos) ? PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE
|
||||
: pm_qos_read_value(&qos->min_frequency);
|
||||
break;
|
||||
case DEV_PM_QOS_MAX_FREQUENCY:
|
||||
ret = IS_ERR_OR_NULL(qos) ? PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE
|
||||
: pm_qos_read_value(&qos->max_frequency);
|
||||
break;
|
||||
default:
|
||||
} else {
|
||||
WARN_ON(1);
|
||||
ret = 0;
|
||||
}
|
||||
|
|
@ -169,14 +159,6 @@ static int apply_constraint(struct dev_pm_qos_request *req,
|
|||
req->dev->power.set_latency_tolerance(req->dev, value);
|
||||
}
|
||||
break;
|
||||
case DEV_PM_QOS_MIN_FREQUENCY:
|
||||
ret = pm_qos_update_target(&qos->min_frequency,
|
||||
&req->data.pnode, action, value);
|
||||
break;
|
||||
case DEV_PM_QOS_MAX_FREQUENCY:
|
||||
ret = pm_qos_update_target(&qos->max_frequency,
|
||||
&req->data.pnode, action, value);
|
||||
break;
|
||||
case DEV_PM_QOS_FLAGS:
|
||||
ret = pm_qos_update_flags(&qos->flags, &req->data.flr,
|
||||
action, value);
|
||||
|
|
@ -227,24 +209,6 @@ static int dev_pm_qos_constraints_allocate(struct device *dev)
|
|||
c->no_constraint_value = PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT;
|
||||
c->type = PM_QOS_MIN;
|
||||
|
||||
c = &qos->min_frequency;
|
||||
plist_head_init(&c->list);
|
||||
c->target_value = PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE;
|
||||
c->default_value = PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE;
|
||||
c->no_constraint_value = PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE;
|
||||
c->type = PM_QOS_MAX;
|
||||
c->notifiers = ++n;
|
||||
BLOCKING_INIT_NOTIFIER_HEAD(n);
|
||||
|
||||
c = &qos->max_frequency;
|
||||
plist_head_init(&c->list);
|
||||
c->target_value = PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE;
|
||||
c->default_value = PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE;
|
||||
c->no_constraint_value = PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE;
|
||||
c->type = PM_QOS_MIN;
|
||||
c->notifiers = ++n;
|
||||
BLOCKING_INIT_NOTIFIER_HEAD(n);
|
||||
|
||||
INIT_LIST_HEAD(&qos->flags.list);
|
||||
|
||||
spin_lock_irq(&dev->power.lock);
|
||||
|
|
@ -305,18 +269,6 @@ void dev_pm_qos_constraints_destroy(struct device *dev)
|
|||
memset(req, 0, sizeof(*req));
|
||||
}
|
||||
|
||||
c = &qos->min_frequency;
|
||||
plist_for_each_entry_safe(req, tmp, &c->list, data.pnode) {
|
||||
apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE);
|
||||
memset(req, 0, sizeof(*req));
|
||||
}
|
||||
|
||||
c = &qos->max_frequency;
|
||||
plist_for_each_entry_safe(req, tmp, &c->list, data.pnode) {
|
||||
apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE);
|
||||
memset(req, 0, sizeof(*req));
|
||||
}
|
||||
|
||||
f = &qos->flags;
|
||||
list_for_each_entry_safe(req, tmp, &f->list, data.flr.node) {
|
||||
apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE);
|
||||
|
|
@ -428,8 +380,6 @@ static int __dev_pm_qos_update_request(struct dev_pm_qos_request *req,
|
|||
switch(req->type) {
|
||||
case DEV_PM_QOS_RESUME_LATENCY:
|
||||
case DEV_PM_QOS_LATENCY_TOLERANCE:
|
||||
case DEV_PM_QOS_MIN_FREQUENCY:
|
||||
case DEV_PM_QOS_MAX_FREQUENCY:
|
||||
curr_value = req->data.pnode.prio;
|
||||
break;
|
||||
case DEV_PM_QOS_FLAGS:
|
||||
|
|
@ -557,14 +507,6 @@ int dev_pm_qos_add_notifier(struct device *dev, struct notifier_block *notifier,
|
|||
ret = blocking_notifier_chain_register(dev->power.qos->resume_latency.notifiers,
|
||||
notifier);
|
||||
break;
|
||||
case DEV_PM_QOS_MIN_FREQUENCY:
|
||||
ret = blocking_notifier_chain_register(dev->power.qos->min_frequency.notifiers,
|
||||
notifier);
|
||||
break;
|
||||
case DEV_PM_QOS_MAX_FREQUENCY:
|
||||
ret = blocking_notifier_chain_register(dev->power.qos->max_frequency.notifiers,
|
||||
notifier);
|
||||
break;
|
||||
default:
|
||||
WARN_ON(1);
|
||||
ret = -EINVAL;
|
||||
|
|
@ -604,14 +546,6 @@ int dev_pm_qos_remove_notifier(struct device *dev,
|
|||
ret = blocking_notifier_chain_unregister(dev->power.qos->resume_latency.notifiers,
|
||||
notifier);
|
||||
break;
|
||||
case DEV_PM_QOS_MIN_FREQUENCY:
|
||||
ret = blocking_notifier_chain_unregister(dev->power.qos->min_frequency.notifiers,
|
||||
notifier);
|
||||
break;
|
||||
case DEV_PM_QOS_MAX_FREQUENCY:
|
||||
ret = blocking_notifier_chain_unregister(dev->power.qos->max_frequency.notifiers,
|
||||
notifier);
|
||||
break;
|
||||
default:
|
||||
WARN_ON(1);
|
||||
ret = -EINVAL;
|
||||
|
|
|
|||
Loading…
Reference in a new issue