diff --git a/drivers/soc/qcom/spcom.c b/drivers/soc/qcom/spcom.c index ac9e5bda249b..dda069c322b1 100644 --- a/drivers/soc/qcom/spcom.c +++ b/drivers/soc/qcom/spcom.c @@ -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 diff --git a/drivers/soc/qcom/subsystem_restart.c b/drivers/soc/qcom/subsystem_restart.c index f9ac0a7538c6..2d0c3b8b35e0 100644 --- a/drivers/soc/qcom/subsystem_restart.c +++ b/drivers/soc/qcom/subsystem_restart.c @@ -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; } diff --git a/include/soc/qcom/subsystem_restart.h b/include/soc/qcom/subsystem_restart.h index 81716f35b6b3..989112764cb3 100644 --- a/include/soc/qcom/subsystem_restart.h +++ b/include/soc/qcom/subsystem_restart.h @@ -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;