Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 613321ec authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "soc: qcom: ssr: Add dependency hooks for subsystem power operations"

parents fb414f0b f36bc9cd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+13 −6
Original line number Diff line number Diff line
@@ -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;
}

+8 −2
Original line number Diff line number Diff line
@@ -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;