mirror of
https://github.com/LineageOS/android_kernel_fxtec_sm6115.git
synced 2026-08-19 00:41:08 +00:00
soc: qcom: ssr: Add dependency hooks for subsystem power operations
The subsystems might depend on other subsystem's state to be powered-on or powered-off. Hence, add flexibility via 'pon-depends-on' and 'poff-depends-on' device-tree properties. This way, first the dependent subsystem's power operation would be fulfilled and then this subsystem's. Change-Id: I9764178ff9cc3957389f25cb5b0882c75c0d7db0 Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
This commit is contained in:
committed by
Rishabh Bhatnagar
parent
79f92d5aea
commit
f36bc9cda1
@ -631,7 +631,7 @@ static int spcom_handle_restart_sp_command(void *cmd_buf, int cmd_size)
|
||||
}
|
||||
|
||||
pr_debug("restart - Name: %s FW name: %s Depends on: %s\n",
|
||||
desc_p->name, desc_p->fw_name, desc_p->depends_on);
|
||||
desc_p->name, desc_p->fw_name, desc_p->pon_depends_on);
|
||||
desc_powerup = desc_p->powerup;
|
||||
/**
|
||||
* Overwrite the subsys PIL powerup function with an spcom
|
||||
|
||||
@ -956,7 +956,7 @@ void *__subsystem_get(const char *name, const char *fw_name)
|
||||
goto err_module;
|
||||
}
|
||||
|
||||
subsys_d = subsystem_get(subsys->desc->depends_on);
|
||||
subsys_d = subsystem_get(subsys->desc->pon_depends_on);
|
||||
if (IS_ERR(subsys_d)) {
|
||||
retval = subsys_d;
|
||||
goto err_depends;
|
||||
@ -1035,6 +1035,10 @@ void subsystem_put(void *subsystem)
|
||||
if (IS_ERR_OR_NULL(subsys))
|
||||
return;
|
||||
|
||||
subsys_d = find_subsys_device(subsys->desc->poff_depends_on);
|
||||
if (subsys_d)
|
||||
subsystem_put(subsys_d);
|
||||
|
||||
track = subsys_get_track(subsys);
|
||||
mutex_lock(&track->lock);
|
||||
if (WARN(!subsys->count, "%s: %s: Reference count mismatch\n",
|
||||
@ -1048,11 +1052,6 @@ void subsystem_put(void *subsystem)
|
||||
}
|
||||
mutex_unlock(&track->lock);
|
||||
|
||||
subsys_d = find_subsys_device(subsys->desc->depends_on);
|
||||
if (subsys_d) {
|
||||
subsystem_put(subsys_d);
|
||||
put_device(&subsys_d->dev);
|
||||
}
|
||||
module_put(subsys->owner);
|
||||
put_device(&subsys->dev);
|
||||
return;
|
||||
@ -1654,6 +1653,14 @@ static int subsys_parse_devicetree(struct subsys_desc *desc)
|
||||
return PTR_ERR(order);
|
||||
}
|
||||
|
||||
if (of_property_read_string(pdev->dev.of_node, "qcom,pon-depends-on",
|
||||
&desc->pon_depends_on))
|
||||
pr_debug("pon-depends-on not set for %s\n", desc->name);
|
||||
|
||||
if (of_property_read_string(pdev->dev.of_node, "qcom,poff-depends-on",
|
||||
&desc->poff_depends_on))
|
||||
pr_debug("poff-depends-on not set for %s\n", desc->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -55,7 +55,12 @@ struct subsys_notif_timeout {
|
||||
* struct subsys_desc - subsystem descriptor
|
||||
* @name: name of subsystem
|
||||
* @fw_name: firmware name
|
||||
* @depends_on: subsystem this subsystem depends on to operate
|
||||
* @pon_depends_on: subsystem this subsystem wants to power-on first. If the
|
||||
* dependednt subsystem is already powered-on, the framework won't try to power
|
||||
* it back up again.
|
||||
* @poff_depends_on: subsystem this subsystem wants to power-off first. If the
|
||||
* dependednt subsystem is already powered-off, the framework won't try to power
|
||||
* it off again.
|
||||
* @dev: parent device
|
||||
* @owner: module the descriptor belongs to
|
||||
* @shutdown: Stop a subsystem
|
||||
@ -79,7 +84,8 @@ struct subsys_notif_timeout {
|
||||
struct subsys_desc {
|
||||
const char *name;
|
||||
char fw_name[256];
|
||||
const char *depends_on;
|
||||
const char *pon_depends_on;
|
||||
const char *poff_depends_on;
|
||||
struct device *dev;
|
||||
struct module *owner;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user